aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/clojurecomplete.vim8
-rw-r--r--runtime/autoload/dist/ft.vim241
-rw-r--r--runtime/autoload/freebasic.vim40
-rw-r--r--runtime/autoload/health.vim16
-rw-r--r--runtime/autoload/health/nvim.vim28
-rw-r--r--runtime/autoload/health/provider.vim61
-rw-r--r--runtime/autoload/man.vim23
-rw-r--r--runtime/autoload/provider/python.vim45
-rw-r--r--runtime/autoload/provider/pythonx.vim20
-rw-r--r--runtime/autoload/python3complete.vim5
-rw-r--r--runtime/colors/README.txt94
-rw-r--r--runtime/colors/blue.vim607
-rw-r--r--runtime/colors/darkblue.vim511
-rw-r--r--runtime/colors/delek.vim453
-rw-r--r--runtime/colors/desert.vim484
-rw-r--r--runtime/colors/elflord.vim489
-rw-r--r--runtime/colors/evening.vim551
-rw-r--r--runtime/colors/industry.vim434
-rw-r--r--runtime/colors/koehler.vim491
-rw-r--r--runtime/colors/morning.vim438
-rw-r--r--runtime/colors/murphy.vim428
-rw-r--r--runtime/colors/pablo.vim453
-rw-r--r--runtime/colors/peachpuff.vim449
-rw-r--r--runtime/colors/ron.vim479
-rw-r--r--runtime/colors/shine.vim455
-rw-r--r--runtime/colors/slate.vim463
-rw-r--r--runtime/colors/torte.vim457
-rw-r--r--runtime/colors/zellner.vim453
-rw-r--r--runtime/compiler/icon.vim33
-rw-r--r--runtime/compiler/jest.vim8
-rw-r--r--runtime/compiler/perl.vim18
-rw-r--r--runtime/compiler/perlcritic.vim27
-rw-r--r--runtime/compiler/podchecker.vim28
-rw-r--r--runtime/compiler/scdoc.vim3
-rw-r--r--runtime/compiler/sml.vim8
-rw-r--r--runtime/delmenu.vim1
-rw-r--r--runtime/doc/api.txt1260
-rw-r--r--runtime/doc/arabic.txt2
-rw-r--r--runtime/doc/autocmd.txt128
-rw-r--r--runtime/doc/builtin.txt9087
-rw-r--r--runtime/doc/change.txt49
-rw-r--r--runtime/doc/channel.txt4
-rw-r--r--runtime/doc/cmdline.txt25
-rw-r--r--runtime/doc/deprecated.txt21
-rw-r--r--runtime/doc/dev_style.txt144
-rw-r--r--runtime/doc/develop.txt15
-rw-r--r--runtime/doc/diagnostic.txt127
-rw-r--r--runtime/doc/diff.txt19
-rw-r--r--runtime/doc/digraph.txt3
-rw-r--r--runtime/doc/editing.txt29
-rw-r--r--runtime/doc/eval.txt8956
-rw-r--r--runtime/doc/filetype.txt88
-rw-r--r--runtime/doc/fold.txt6
-rw-r--r--runtime/doc/ft_ada.txt24
-rw-r--r--runtime/doc/ft_raku.txt24
-rw-r--r--runtime/doc/ft_rust.txt4
-rw-r--r--runtime/doc/ft_sql.txt20
-rw-r--r--runtime/doc/gui.txt47
-rw-r--r--runtime/doc/help.txt1
-rw-r--r--runtime/doc/helphelp.txt2
-rw-r--r--runtime/doc/if_pyth.txt71
-rw-r--r--runtime/doc/indent.txt17
-rw-r--r--runtime/doc/index.txt43
-rw-r--r--runtime/doc/insert.txt66
-rw-r--r--runtime/doc/intro.txt27
-rw-r--r--runtime/doc/lsp.txt676
-rw-r--r--runtime/doc/lua.txt1076
-rw-r--r--runtime/doc/map.txt180
-rw-r--r--runtime/doc/message.txt5
-rw-r--r--runtime/doc/motion.txt10
-rw-r--r--runtime/doc/nvim_terminal_emulator.txt137
-rw-r--r--runtime/doc/options.txt501
-rw-r--r--runtime/doc/pattern.txt94
-rw-r--r--runtime/doc/pi_health.txt24
-rw-r--r--runtime/doc/pi_msgpack.txt2
-rw-r--r--runtime/doc/pi_netrw.txt14
-rw-r--r--runtime/doc/print.txt6
-rw-r--r--runtime/doc/provider.txt26
-rw-r--r--runtime/doc/quickfix.txt83
-rw-r--r--runtime/doc/quickref.txt8
-rw-r--r--runtime/doc/recover.txt2
-rw-r--r--runtime/doc/remote.txt131
-rw-r--r--runtime/doc/repeat.txt29
-rw-r--r--runtime/doc/scroll.txt18
-rw-r--r--runtime/doc/sign.txt2
-rw-r--r--runtime/doc/spell.txt4
-rw-r--r--runtime/doc/starting.txt369
-rw-r--r--runtime/doc/syntax.txt259
-rw-r--r--runtime/doc/tabpage.txt37
-rw-r--r--runtime/doc/tagsrch.txt5
-rw-r--r--runtime/doc/term.txt54
-rw-r--r--runtime/doc/testing.txt2
-rw-r--r--runtime/doc/tips.txt28
-rw-r--r--runtime/doc/treesitter.txt212
-rw-r--r--runtime/doc/uganda.txt11
-rw-r--r--runtime/doc/ui.txt60
-rw-r--r--runtime/doc/undo.txt18
-rw-r--r--runtime/doc/usr_04.txt8
-rw-r--r--runtime/doc/usr_05.txt12
-rw-r--r--runtime/doc/usr_06.txt24
-rw-r--r--runtime/doc/usr_07.txt4
-rw-r--r--runtime/doc/usr_08.txt2
-rw-r--r--runtime/doc/usr_10.txt4
-rw-r--r--runtime/doc/usr_21.txt4
-rw-r--r--runtime/doc/usr_29.txt19
-rw-r--r--runtime/doc/usr_40.txt11
-rw-r--r--runtime/doc/usr_41.txt61
-rw-r--r--runtime/doc/usr_42.txt3
-rw-r--r--runtime/doc/various.txt47
-rw-r--r--runtime/doc/vim_diff.txt117
-rw-r--r--runtime/doc/visual.txt12
-rw-r--r--runtime/doc/windows.txt18
-rw-r--r--runtime/filetype.lua57
-rw-r--r--runtime/filetype.vim292
-rw-r--r--runtime/ftplugin/abaqus.vim8
-rw-r--r--runtime/ftplugin/ant.vim6
-rw-r--r--runtime/ftplugin/aspvbs.vim6
-rw-r--r--runtime/ftplugin/basic.vim46
-rw-r--r--runtime/ftplugin/c.vim5
-rw-r--r--runtime/ftplugin/clojure.vim12
-rw-r--r--runtime/ftplugin/config.vim6
-rw-r--r--runtime/ftplugin/confini.vim10
-rw-r--r--runtime/ftplugin/cpp.vim1
-rw-r--r--runtime/ftplugin/cs.vim44
-rw-r--r--runtime/ftplugin/csc.vim6
-rw-r--r--runtime/ftplugin/csh.vim2
-rw-r--r--runtime/ftplugin/dtd.vim6
-rw-r--r--runtime/ftplugin/elixir.vim11
-rw-r--r--runtime/ftplugin/elm.vim4
-rw-r--r--runtime/ftplugin/fennel.vim18
-rw-r--r--runtime/ftplugin/fetchmail.vim15
-rw-r--r--runtime/ftplugin/fortran.vim8
-rw-r--r--runtime/ftplugin/freebasic.vim76
-rw-r--r--runtime/ftplugin/html.vim6
-rw-r--r--runtime/ftplugin/icon.vim36
-rw-r--r--runtime/ftplugin/java.vim6
-rw-r--r--runtime/ftplugin/jsp.vim6
-rw-r--r--runtime/ftplugin/liquid.vim4
-rw-r--r--runtime/ftplugin/m3build.vim9
-rw-r--r--runtime/ftplugin/m3quake.vim10
-rw-r--r--runtime/ftplugin/man.vim6
-rw-r--r--runtime/ftplugin/masm.vim15
-rw-r--r--runtime/ftplugin/modula3.vim18
-rw-r--r--runtime/ftplugin/pascal.vim2
-rw-r--r--runtime/ftplugin/perl.vim60
-rw-r--r--runtime/ftplugin/php.vim9
-rw-r--r--runtime/ftplugin/pod.vim71
-rw-r--r--runtime/ftplugin/qb64.vim26
-rw-r--r--runtime/ftplugin/query.lua6
-rw-r--r--runtime/ftplugin/reva.vim4
-rw-r--r--runtime/ftplugin/ruby.vim44
-rw-r--r--runtime/ftplugin/scdoc.vim10
-rw-r--r--runtime/ftplugin/sgml.vim6
-rw-r--r--runtime/ftplugin/sh.vim6
-rw-r--r--runtime/ftplugin/spec.vim5
-rw-r--r--runtime/ftplugin/svg.vim6
-rw-r--r--runtime/ftplugin/tap.vim27
-rw-r--r--runtime/ftplugin/tcsh.vim2
-rw-r--r--runtime/ftplugin/tt2html.vim8
-rw-r--r--runtime/ftplugin/vue.vim24
-rw-r--r--runtime/ftplugin/wget.vim29
-rw-r--r--runtime/ftplugin/wget2.vim29
-rw-r--r--runtime/ftplugin/xhtml.vim6
-rw-r--r--runtime/ftplugin/xml.vim2
-rw-r--r--runtime/ftplugin/xs.vim7
-rw-r--r--runtime/ftplugin/xsd.vim6
-rw-r--r--runtime/ftplugin/xslt.vim16
-rw-r--r--runtime/indent/README.txt2
-rw-r--r--runtime/indent/ada.vim3
-rw-r--r--runtime/indent/awk.vim3
-rw-r--r--runtime/indent/basic.vim11
-rw-r--r--runtime/indent/bst.vim6
-rw-r--r--runtime/indent/cdl.vim4
-rw-r--r--runtime/indent/chaiscript.vim3
-rw-r--r--runtime/indent/clojure.vim2
-rw-r--r--runtime/indent/cmake.vim4
-rw-r--r--runtime/indent/cs.vim22
-rw-r--r--runtime/indent/d.vim4
-rw-r--r--runtime/indent/dictconf.vim4
-rw-r--r--runtime/indent/dictdconf.vim2
-rw-r--r--runtime/indent/dtd.vim6
-rw-r--r--runtime/indent/dylan.vim5
-rw-r--r--runtime/indent/falcon.vim3
-rw-r--r--runtime/indent/fennel.vim12
-rw-r--r--runtime/indent/fortran.vim7
-rw-r--r--runtime/indent/freebasic.vim11
-rw-r--r--runtime/indent/gitolite.vim4
-rw-r--r--runtime/indent/haml.vim4
-rw-r--r--runtime/indent/html.vim15
-rw-r--r--runtime/indent/idlang.vim4
-rw-r--r--runtime/indent/julia.vim8
-rw-r--r--runtime/indent/krl.vim130
-rw-r--r--runtime/indent/liquid.vim23
-rw-r--r--runtime/indent/make.vim4
-rw-r--r--runtime/indent/mma.vim3
-rw-r--r--runtime/indent/nginx.vim4
-rw-r--r--runtime/indent/objc.vim6
-rw-r--r--runtime/indent/occam.vim4
-rw-r--r--runtime/indent/perl.vim7
-rw-r--r--runtime/indent/postscr.vim8
-rw-r--r--runtime/indent/pov.vim3
-rw-r--r--runtime/indent/prolog.vim3
-rw-r--r--runtime/indent/qb64.vim (renamed from runtime/indent/systemd.vim)7
-rw-r--r--runtime/indent/query.lua6
-rw-r--r--runtime/indent/ruby.vim48
-rw-r--r--runtime/indent/sas.vim4
-rw-r--r--runtime/indent/sass.vim4
-rw-r--r--runtime/indent/sml.vim5
-rw-r--r--runtime/indent/systemverilog.vim3
-rw-r--r--runtime/indent/testdir/html.in13
-rw-r--r--runtime/indent/testdir/html.ok13
-rw-r--r--runtime/indent/testdir/krl.in148
-rw-r--r--runtime/indent/testdir/krl.ok148
-rw-r--r--runtime/indent/testdir/vim.in6
-rw-r--r--runtime/indent/testdir/vim.ok6
-rw-r--r--runtime/indent/testdir/yaml.in5
-rw-r--r--runtime/indent/testdir/yaml.ok5
-rw-r--r--runtime/indent/tf.vim4
-rw-r--r--runtime/indent/tilde.vim5
-rw-r--r--runtime/indent/treetop.vim9
-rw-r--r--runtime/indent/vim.vim31
-rw-r--r--runtime/indent/xf86conf.vim9
-rw-r--r--runtime/indent/xinetd.vim9
-rw-r--r--runtime/indent/yacc.vim9
-rw-r--r--runtime/indent/yaml.vim40
-rw-r--r--runtime/lua/health.lua29
-rw-r--r--runtime/lua/man.lua28
-rw-r--r--runtime/lua/vim/F.lua10
-rw-r--r--runtime/lua/vim/_editor.lua854
-rw-r--r--runtime/lua/vim/_init_packages.lua83
-rw-r--r--runtime/lua/vim/_meta.lua297
-rw-r--r--runtime/lua/vim/compat.lua4
-rw-r--r--runtime/lua/vim/diagnostic.lua571
-rw-r--r--runtime/lua/vim/filetype.lua3671
-rw-r--r--runtime/lua/vim/filetype/detect.lua1630
-rw-r--r--runtime/lua/vim/fs.lua209
-rw-r--r--runtime/lua/vim/health.lua49
-rw-r--r--runtime/lua/vim/highlight.lua134
-rw-r--r--runtime/lua/vim/inspect.lua383
-rw-r--r--runtime/lua/vim/keymap.lua57
-rw-r--r--runtime/lua/vim/lsp.lua985
-rw-r--r--runtime/lua/vim/lsp/_snippet.lua247
-rw-r--r--runtime/lua/vim/lsp/buf.lua545
-rw-r--r--runtime/lua/vim/lsp/codelens.lua66
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua503
-rw-r--r--runtime/lua/vim/lsp/handlers.lua263
-rw-r--r--runtime/lua/vim/lsp/health.lua17
-rw-r--r--runtime/lua/vim/lsp/log.lua118
-rw-r--r--runtime/lua/vim/lsp/protocol.lua584
-rw-r--r--runtime/lua/vim/lsp/rpc.lua272
-rw-r--r--runtime/lua/vim/lsp/sync.lua107
-rw-r--r--runtime/lua/vim/lsp/tagfunc.lua7
-rw-r--r--runtime/lua/vim/lsp/util.lua929
-rw-r--r--runtime/lua/vim/shared.lua323
-rw-r--r--runtime/lua/vim/treesitter.lua51
-rw-r--r--runtime/lua/vim/treesitter/health.lua14
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua195
-rw-r--r--runtime/lua/vim/treesitter/language.lua8
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua177
-rw-r--r--runtime/lua/vim/treesitter/query.lua195
-rw-r--r--runtime/lua/vim/ui.lua41
-rw-r--r--runtime/lua/vim/uri.lua36
-rw-r--r--runtime/menu.vim9
-rw-r--r--runtime/nvim.appdata.xml1
-rw-r--r--runtime/nvim.desktop3
-rw-r--r--runtime/optwin.vim10
-rw-r--r--runtime/pack/dist/opt/matchit/autoload/matchit.vim4
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim256
-rw-r--r--runtime/plugin/rplugin.vim4
-rw-r--r--runtime/scripts.vim18
-rw-r--r--runtime/spell/cleanadd.vim32
-rw-r--r--runtime/syntax/apache.vim3
-rw-r--r--runtime/syntax/basic.vim482
-rw-r--r--runtime/syntax/c.vim79
-rw-r--r--runtime/syntax/chordpro.vim170
-rw-r--r--runtime/syntax/clojure.vim42
-rw-r--r--runtime/syntax/coco.vim3
-rw-r--r--runtime/syntax/confini.vim12
-rw-r--r--runtime/syntax/cs.vim276
-rw-r--r--runtime/syntax/debchangelog.vim6
-rw-r--r--runtime/syntax/debcontrol.vim4
-rw-r--r--runtime/syntax/debsources.vim6
-rw-r--r--runtime/syntax/dep3patch.vim4
-rw-r--r--runtime/syntax/dirpager.vim2
-rw-r--r--runtime/syntax/doxygen.vim18
-rw-r--r--runtime/syntax/dts.vim3
-rw-r--r--runtime/syntax/eruby.vim12
-rw-r--r--runtime/syntax/fetchmail.vim110
-rw-r--r--runtime/syntax/freebasic.vim685
-rw-r--r--runtime/syntax/i3config.vim15
-rw-r--r--runtime/syntax/icon.vim336
-rw-r--r--runtime/syntax/initng.vim1
-rw-r--r--runtime/syntax/ipfilter.vim3
-rw-r--r--runtime/syntax/java.vim51
-rw-r--r--runtime/syntax/javascript.vim13
-rw-r--r--runtime/syntax/krl.vim458
-rw-r--r--runtime/syntax/liquid.vim24
-rw-r--r--runtime/syntax/lsp_markdown.vim27
-rw-r--r--runtime/syntax/lua.vim11
-rw-r--r--runtime/syntax/m4.vim6
-rw-r--r--runtime/syntax/man.vim2
-rw-r--r--runtime/syntax/masm.vim3
-rw-r--r--runtime/syntax/mason.vim16
-rw-r--r--runtime/syntax/mupad.vim1
-rw-r--r--runtime/syntax/neomuttrc.vim365
-rw-r--r--runtime/syntax/openscad.vim129
-rw-r--r--runtime/syntax/perl.vim420
-rw-r--r--runtime/syntax/plsql.vim940
-rw-r--r--runtime/syntax/pod.vim139
-rw-r--r--runtime/syntax/qb64.vim409
-rw-r--r--runtime/syntax/query.lua6
-rw-r--r--runtime/syntax/rc.vim21
-rw-r--r--runtime/syntax/ruby.vim16
-rw-r--r--runtime/syntax/sass.vim3
-rw-r--r--runtime/syntax/scala.vim110
-rw-r--r--runtime/syntax/scdoc.vim63
-rw-r--r--runtime/syntax/sendpr.vim4
-rw-r--r--runtime/syntax/sh.vim50
-rw-r--r--runtime/syntax/sml.vim7
-rw-r--r--runtime/syntax/strace.vim3
-rw-r--r--runtime/syntax/structurizr.vim9
-rw-r--r--runtime/syntax/synload.vim2
-rw-r--r--runtime/syntax/syntax.vim2
-rw-r--r--runtime/syntax/tap.vim23
-rw-r--r--runtime/syntax/tar.vim2
-rw-r--r--runtime/syntax/tex.vim106
-rw-r--r--runtime/syntax/tmux.vim127
-rw-r--r--runtime/syntax/trustees.vim4
-rw-r--r--runtime/syntax/tt2.vim17
-rw-r--r--runtime/syntax/tt2html.vim8
-rw-r--r--runtime/syntax/tt2js.vim8
-rw-r--r--runtime/syntax/vim.vim44
-rw-r--r--runtime/syntax/webmacro.vim6
-rw-r--r--runtime/syntax/wget.vim340
-rw-r--r--runtime/syntax/wget2.vim250
-rw-r--r--runtime/syntax/xs.vim13
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor165
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor.json50
338 files changed, 37430 insertions, 18931 deletions
diff --git a/runtime/autoload/clojurecomplete.vim b/runtime/autoload/clojurecomplete.vim
index 9f2c39081a..02262a6f91 100644
--- a/runtime/autoload/clojurecomplete.vim
+++ b/runtime/autoload/clojurecomplete.vim
@@ -4,12 +4,12 @@
" Former Maintainers: Sung Pae <self@sungpae.com>
" URL: https://github.com/clojure-vim/clojure.vim
" License: Vim (see :h license)
-" Last Change: 2021-10-26
+" Last Change: 2022-03-24
" -*- COMPLETION WORDS -*-
-" Generated from https://github.com/clojure-vim/clojure.vim/blob/62b215f079ce0f3834fd295c7a7f6bd8cc54bcc3/clj/src/vim_clojure_static/generate.clj
-" Clojure version 1.10.3
-let s:words = ["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Inst","PrintWriter-on","StackTraceElement->vec","Throwable->map","accessor","aclone","add-classpath","add-tap","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","any?","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc!","assoc","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","case","cast","cat","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj!","conj","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj!","disj","dissoc!","dissoc","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-cause","ex-data","ex-info","ex-message","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","if","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","indexed?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","new","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop!","pop","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","quote","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read+string","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-tap","remove-watch","repeat","repeatedly","replace","replicate","require","requiring-resolve","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seqable?","seque","sequence","sequential?","set!","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","tap>","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","uri?","use","uuid?","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"]
+" Generated from https://github.com/clojure-vim/clojure.vim/blob/fd280e33e84c88e97860930557dba3ff80b1a82d/clj/src/vim_clojure_static/generate.clj
+" Clojure version 1.11.0
+let s:words = ["&","*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Inst","NaN?","PrintWriter-on","StackTraceElement->vec","Throwable->map","abs","accessor","aclone","add-classpath","add-tap","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","any?","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","case","case*","cast","cat","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","deftype*","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-cause","ex-data","ex-info","ex-message","extend","extend-protocol","extend-type","extenders","extends?","false","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn*","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","if","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","indexed?","infinite?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iteration","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let*","letfn","letfn*","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop*","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","new","newline","next","nfirst","nil","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","parse-boolean","parse-double","parse-long","parse-uuid","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","quote","rand","rand-int","rand-nth","random-sample","random-uuid","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read+string","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","reify*","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-tap","remove-watch","repeat","repeatedly","replace","replicate","require","requiring-resolve","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq-to-map-for-destructuring","seq?","seqable?","seque","sequence","sequential?","set","set!","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","tap>","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-keys","update-proxy","update-vals","uri?","use","uuid?","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"]
" Simple word completion for special forms and public vars in clojure.core
function! clojurecomplete#Complete(findstart, base)
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 342731b272..9e30ae1f51 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -1,7 +1,7 @@
" Vim functions for file type detection
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Dec 17
+" Last Change: 2022 Apr 13
" These functions are moved here from runtime/filetype.vim to make startup
" faster.
@@ -67,14 +67,41 @@ func dist#ft#FTasmsyntax()
endif
endfunc
-" Check if one of the first five lines contains "VB_Name". In that case it is
-" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
-func dist#ft#FTVB(alt)
- if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
- setf vb
- else
- exe "setf " . a:alt
+let s:ft_visual_basic_content = '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
+
+" See FTfrm() for Visual Basic form file detection
+func dist#ft#FTbas()
+ if exists("g:filetype_bas")
+ exe "setf " . g:filetype_bas
+ return
endif
+
+ " most frequent FreeBASIC-specific keywords in distro files
+ let fb_keywords = '\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!'
+ let fb_preproc = '\c^\s*\%(' ..
+ \ '#\s*\a\+\|' ..
+ \ 'option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\|' ..
+ \ '\%(''\|rem\)\s*\$lang\>\|' ..
+ \ 'def\%(byte\|longint\|short\|ubyte\|uint\|ulongint\|ushort\)\>' ..
+ \ '\)'
+ let fb_comment = "^\\s*/'"
+ " OPTION EXPLICIT, without the leading underscore, is common to many dialects
+ let qb64_preproc = '\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)'
+
+ for lnum in range(1, min([line("$"), 100]))
+ let line = getline(lnum)
+ if line =~ s:ft_visual_basic_content
+ setf vb
+ return
+ elseif line =~ fb_preproc || line =~ fb_comment || line =~ fb_keywords
+ setf freebasic
+ return
+ elseif line =~ qb64_preproc
+ setf qb64
+ return
+ endif
+ endfor
+ setf basic
endfunc
func dist#ft#FTbtm()
@@ -93,6 +120,42 @@ func dist#ft#BindzoneCheck(default)
endif
endfunc
+" Returns true if file content looks like RAPID
+func IsRapid(sChkExt = "")
+ if a:sChkExt == "cfg"
+ return getline(1) =~? '\v^%(EIO|MMC|MOC|PROC|SIO|SYS):CFG'
+ endif
+ " called from FTmod, FTprg or FTsys
+ return getline(nextnonblank(1)) =~? '\v^\s*%(\%{3}|module\s+\k+\s*%(\(|$))'
+endfunc
+
+func dist#ft#FTcfg()
+ if exists("g:filetype_cfg")
+ exe "setf " .. g:filetype_cfg
+ elseif IsRapid("cfg")
+ setf rapid
+ else
+ setf cfg
+ endif
+endfunc
+
+func dist#ft#FTcls()
+ if exists("g:filetype_cls")
+ exe "setf " .. g:filetype_cls
+ return
+ endif
+
+ if getline(1) =~ '^%'
+ setf tex
+ elseif getline(1)[0] == '#' && getline(1) =~ 'rexx'
+ setf rexx
+ elseif getline(1) == 'VERSION 1.0 CLASS'
+ setf vb
+ else
+ setf st
+ endif
+endfunc
+
func dist#ft#FTlpc()
if exists("g:lpc_syntax_for_c")
let lnum = 1
@@ -154,7 +217,7 @@ endfunc
func dist#ft#FTent()
" This function checks for valid cl syntax in the first five lines.
- " Look for either an opening comment, '#', or a block start, '{".
+ " Look for either an opening comment, '#', or a block start, '{'.
" If not found, assume SGML.
let lnum = 1
while lnum < 6
@@ -192,6 +255,10 @@ func dist#ft#EuphoriaCheck()
endfunc
func dist#ft#DtraceCheck()
+ if did_filetype()
+ " Filetype was already detected
+ return
+ endif
let lines = getline(1, min([line("$"), 100]))
if match(lines, '^module\>\|^import\>') > -1
" D files often start with a module and/or import statement.
@@ -219,6 +286,21 @@ func dist#ft#FTe()
endif
endfunc
+func dist#ft#FTfrm()
+ if exists("g:filetype_frm")
+ exe "setf " . g:filetype_frm
+ return
+ endif
+
+ let lines = getline(1, min([line("$"), 5]))
+
+ if match(lines, s:ft_visual_basic_content) > -1
+ setf vb
+ else
+ setf form
+ endif
+endfunc
+
" Distinguish between Forth and F#.
" Provided by Doug Kearns.
func dist#ft#FTfs()
@@ -377,6 +459,36 @@ func dist#ft#FTmm()
setf nroff
endfunc
+" Returns true if file content looks like LambdaProlog module
+func IsLProlog()
+ " skip apparent comments and blank lines, what looks like
+ " LambdaProlog comment may be RAPID header
+ let l = nextnonblank(1)
+ while l > 0 && l < line('$') && getline(l) =~ '^\s*%' " LambdaProlog comment
+ let l = nextnonblank(l + 1)
+ endwhile
+ " this pattern must not catch a go.mod file
+ return getline(l) =~ '\<module\s\+\w\+\s*\.\s*\(%\|$\)'
+endfunc
+
+" Determine if *.mod is ABB RAPID, LambdaProlog, Modula-2, Modsim III or go.mod
+func dist#ft#FTmod()
+ if exists("g:filetype_mod")
+ exe "setf " .. g:filetype_mod
+ elseif IsLProlog()
+ setf lprolog
+ elseif getline(nextnonblank(1)) =~ '\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)'
+ setf modula2
+ elseif IsRapid()
+ setf rapid
+ elseif expand("<afile>") =~ '\<go.mod$'
+ setf gomod
+ else
+ " Nothing recognized, assume modsim3
+ setf modsim3
+ endif
+endfunc
+
func dist#ft#FTpl()
if exists("g:filetype_pl")
exe "setf " . g:filetype_pl
@@ -407,12 +519,14 @@ func dist#ft#FTinc()
" headers so assume POV-Ray
elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords
setf pascal
+ elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = '
+ setf bitbake
else
call dist#ft#FTasmsyntax()
if exists("b:asmsyntax")
- exe "setf " . fnameescape(b:asmsyntax)
+ exe "setf " . fnameescape(b:asmsyntax)
else
- setf pov
+ setf pov
endif
endif
endif
@@ -493,6 +607,18 @@ func dist#ft#FTpp()
endif
endfunc
+" Determine if *.prg is ABB RAPID. Can also be Clipper, FoxPro or eviews
+func dist#ft#FTprg()
+ if exists("g:filetype_prg")
+ exe "setf " .. g:filetype_prg
+ elseif IsRapid()
+ setf rapid
+ else
+ " Nothing recognized, assume Clipper
+ setf clipper
+ endif
+endfunc
+
func dist#ft#FTr()
let max = line("$") > 50 ? 50 : line("$")
@@ -674,6 +800,28 @@ func dist#ft#SQL()
endif
endfunc
+" This function checks the first 25 lines of file extension "sc" to resolve
+" detection between scala and SuperCollider
+func dist#ft#FTsc()
+ for lnum in range(1, min([line("$"), 25]))
+ if getline(lnum) =~# '[A-Za-z0-9]*\s:\s[A-Za-z0-9]\|var\s<\|classvar\s<\|\^this.*\||\w*|\|+\s\w*\s{\|\*ar\s'
+ setf supercollider
+ return
+ endif
+ endfor
+ setf scala
+endfunc
+
+" This function checks the first line of file extension "scd" to resolve
+" detection between scdoc and SuperCollider
+func dist#ft#FTscd()
+ if getline(1) =~# '\%^\S\+(\d[0-9A-Za-z]*)\%(\s\+\"[^"]*\"\%(\s\+\"[^"]*\"\)\=\)\=$'
+ setf scdoc
+ else
+ setf supercollider
+ endif
+endfunc
+
" If the file has an extension of 't' and is in a directory 't' or 'xt' then
" it is almost certainly a Perl test file.
" If the first line starts with '#' and contains 'perl' it's probably a Perl
@@ -692,7 +840,7 @@ func dist#ft#FTperl()
endif
let save_cursor = getpos('.')
call cursor(1,1)
- let has_use = search('^use\s\s*\k', 'c', 30)
+ let has_use = search('^use\s\s*\k', 'c', 30) > 0
call setpos('.', save_cursor)
if has_use
setf perl
@@ -701,6 +849,37 @@ func dist#ft#FTperl()
return 0
endfunc
+" LambdaProlog and Standard ML signature files
+func dist#ft#FTsig()
+ if exists("g:filetype_sig")
+ exe "setf " .. g:filetype_sig
+ return
+ endif
+
+ let lprolog_comment = '^\s*\%(/\*\|%\)'
+ let lprolog_keyword = '^\s*sig\s\+\a'
+ let sml_comment = '^\s*(\*'
+ let sml_keyword = '^\s*\%(signature\|structure\)\s\+\a'
+
+ let line = getline(nextnonblank(1))
+
+ if line =~ lprolog_comment || line =~# lprolog_keyword
+ setf lprolog
+ elseif line =~ sml_comment || line =~# sml_keyword
+ setf sml
+ endif
+endfunc
+
+func dist#ft#FTsys()
+ if exists("g:filetype_sys")
+ exe "setf " .. g:filetype_sys
+ elseif IsRapid()
+ setf rapid
+ else
+ setf bat
+ endif
+endfunc
+
" Choose context, plaintex, or tex (LaTeX) based on these rules:
" 1. Check the first line of the file for "%&<format>".
" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
@@ -724,7 +903,8 @@ func dist#ft#FTtex()
let save_cursor = getpos('.')
call cursor(1,1)
let firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
- if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword.
+ if firstNC > 0
+ " Check the next thousand lines for a LaTeX or ConTeXt keyword.
let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)',
@@ -846,6 +1026,41 @@ func dist#ft#FTfoam()
endwhile
endfunc
+" Determine if a *.tf file is TF mud client or terraform
+func dist#ft#FTtf()
+ let numberOfLines = line('$')
+ for i in range(1, numberOfLines)
+ let currentLine = trim(getline(i))
+ let firstCharacter = currentLine[0]
+ if firstCharacter !=? ";" && firstCharacter !=? "/" && firstCharacter !=? ""
+ setf terraform
+ return
+ endif
+ endfor
+ setf tf
+endfunc
+
+let s:ft_krl_header = '\&\w+'
+" Determine if a *.src file is Kuka Robot Language
+func dist#ft#FTsrc()
+ let ft_krl_def_or_deffct = '%(global\s+)?def%(fct)?>'
+ if exists("g:filetype_src")
+ exe "setf " .. g:filetype_src
+ elseif getline(nextnonblank(1)) =~? '\v^\s*%(' .. s:ft_krl_header .. '|' .. ft_krl_def_or_deffct .. ')'
+ setf krl
+ endif
+endfunc
+
+" Determine if a *.dat file is Kuka Robot Language
+func dist#ft#FTdat()
+ let ft_krl_defdat = 'defdat>'
+ if exists("g:filetype_dat")
+ exe "setf " .. g:filetype_dat
+ elseif getline(nextnonblank(1)) =~? '\v^\s*%(' .. s:ft_krl_header .. '|' .. ft_krl_defdat .. ')'
+ setf krl
+ endif
+endfunc
+
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/autoload/freebasic.vim b/runtime/autoload/freebasic.vim
new file mode 100644
index 0000000000..6c94cd34ea
--- /dev/null
+++ b/runtime/autoload/freebasic.vim
@@ -0,0 +1,40 @@
+" Vim filetype plugin file
+" Language: FreeBASIC
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 June 24
+
+" Dialects can be one of fb, qb, fblite, or deprecated
+" Precedence is forcelang > #lang > lang
+function! freebasic#GetDialect() abort
+ if exists("g:freebasic_forcelang")
+ return g:freebasic_forcelang
+ endif
+
+ if exists("g:freebasic_lang")
+ let dialect = g:freebasic_lang
+ else
+ let dialect = "fb"
+ endif
+
+ " override with #lang directive or metacommand
+
+ let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
+
+ let save_cursor = getcurpos()
+ call cursor(1, 1)
+ let lnum = search(pat, 'cn')
+ call setpos('.', save_cursor)
+
+ if lnum
+ let word = matchlist(getline(lnum), pat)[1]
+ if word =~? '\<\%(fb\|deprecated\|fblite\|qb\)\>'
+ let dialect = word
+ else
+ echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
+ endif
+ endif
+
+ return dialect
+endfunction
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim
index 1d462ad02c..a693868381 100644
--- a/runtime/autoload/health.vim
+++ b/runtime/autoload/health.vim
@@ -21,10 +21,17 @@ function! health#check(plugin_names) abort
throw 'healthcheck_not_found'
endif
eval type == 'v' ? call(func, []) : luaeval(func)
+ " in the event the healthcheck doesn't return anything
+ " (the plugin author should avoid this possibility)
+ if len(s:output) == 0
+ throw 'healthcheck_no_return_value'
+ endif
catch
let s:output = [] " Clear the output
if v:exception =~# 'healthcheck_not_found'
call health#report_error('No healthcheck found for "'.name.'" plugin.')
+ elseif v:exception =~# 'healthcheck_no_return_value'
+ call health#report_error('The healthcheck report for "'.name.'" plugin is empty.')
else
call health#report_error(printf(
\ "Failed to run healthcheck for \"%s\" plugin. Exception:\n%s\n%s",
@@ -127,7 +134,7 @@ endfunction " }}}
" From a path return a list [{name}, {func}, {type}] representing a healthcheck
function! s:filepath_to_healthcheck(path) abort
- if a:path =~# 'vim$'
+ if a:path =~# 'vim$'
let name = matchstr(a:path, '\zs[^\/]*\ze\.vim$')
let func = 'health#'.name.'#check'
let type = 'v'
@@ -164,6 +171,11 @@ function! s:get_healthcheck(plugin_names) abort
for v in values(healthchecks)
let output[v[0]] = v[1:]
endfor
+ try
+ " vim.health is not a healthcheck, skip it
+ call remove(output, 'vim')
+ catch
+ endtry
return output
endfunction
@@ -181,7 +193,7 @@ function! s:get_healthcheck_list(plugin_names) abort
\ + nvim_get_runtime_file('lua/**/'.p.'/health/init.lua', v:true)
\ + nvim_get_runtime_file('lua/**/'.p.'/health.lua', v:true)
if len(paths) == 0
- let healthchecks += [[p, '', '']] " healthchek not found
+ let healthchecks += [[p, '', '']] " healthcheck not found
else
let healthchecks += map(uniq(sort(paths)),
\'<SID>filepath_to_healthcheck(v:val)')
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 0bb343e198..9b387095ee 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -45,7 +45,7 @@ function! s:check_config() abort
let shadafile = empty(&shada) ? &shada : substitute(matchstr(
\ split(&shada, ',')[-1], '^n.\+'), '^n', '', '')
let shadafile = empty(&shadafile) ? empty(shadafile) ?
- \ stdpath('data').'/shada/main.shada' : expand(shadafile)
+ \ stdpath('state').'/shada/main.shada' : expand(shadafile)
\ : &shadafile ==# 'NONE' ? '' : &shadafile
if !empty(shadafile) && empty(glob(shadafile))
" Since this may be the first time neovim has been run, we will try to
@@ -104,8 +104,8 @@ function! s:check_rplugin_manifest() abort
if !has_key(existing_rplugins, script)
let msg = printf('"%s" is not registered.', fnamemodify(path, ':t'))
if python_version ==# 'pythonx'
- if !has('python2') && !has('python3')
- let msg .= ' (python2 and python3 not available)'
+ if !has('python3')
+ let msg .= ' (python3 not available)'
endif
elseif !has(python_version)
let msg .= printf(' (%s not available)', python_version)
@@ -144,18 +144,28 @@ function! s:check_performance() abort
\ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
\ s:suggest_faq])
endif
+
+ " check for slow shell invocation
+ let slow_cmd_time = 1.5
+ let start_time = reltime()
+ call system('echo')
+ let elapsed_time = reltimefloat(reltime(start_time))
+ if elapsed_time > slow_cmd_time
+ call health#report_warn(
+ \ 'Slow shell invocation (took '.printf('%.2f', elapsed_time).' seconds).')
+ endif
endfunction
function! s:get_tmux_option(option) abort
let cmd = 'tmux show-option -qvg '.a:option " try global scope
- let out = system(cmd)
+ let out = system(split(cmd))
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
return 'error'
elseif empty(val)
let cmd = 'tmux show-option -qvgs '.a:option " try session scope
- let out = system(cmd)
+ let out = system(split(cmd))
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
@@ -202,11 +212,11 @@ function! s:check_tmux() abort
" check default-terminal and $TERM
call health#report_info('$TERM: '.$TERM)
let cmd = 'tmux show-option -qvg default-terminal'
- let out = system(cmd)
+ let out = system(split(cmd))
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
if empty(tmux_default_term)
let cmd = 'tmux show-option -qvgs default-terminal'
- let out = system(cmd)
+ let out = system(split(cmd))
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
endif
@@ -225,7 +235,7 @@ function! s:check_tmux() abort
endif
" check for RGB capabilities
- let info = system('tmux server-info')
+ let info = system(['tmux', 'server-info'])
let has_tc = stridx(info, " Tc: (flag) true") != -1
let has_rgb = stridx(info, " RGB: (flag) true") != -1
if !has_tc && !has_rgb
@@ -242,7 +252,7 @@ function! s:check_terminal() abort
endif
call health#report_start('terminal')
let cmd = 'infocmp -L'
- let out = system(cmd)
+ let out = system(split(cmd))
let kbs_entry = matchstr(out, 'key_backspace=[^,[:space:]]*')
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index e6523aa215..5cda7cfd03 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -203,7 +203,7 @@ function! s:version_info(python) abort
let nvim_path = s:trim(s:system([
\ a:python, '-c',
\ 'import sys; ' .
- \ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
+ \ 'sys.path = [p for p in sys.path if p != ""]; ' .
\ 'import neovim; print(neovim.__file__)']))
if s:shell_error || empty(nvim_path)
return [python_version, 'unable to load neovim Python module', pypi_version,
@@ -282,10 +282,10 @@ function! s:disabled_via_loaded_var(provider) abort
return 0
endfunction
-function! s:check_python(version) abort
- call health#report_start('Python ' . a:version . ' provider (optional)')
+function! s:check_python() abort
+ call health#report_start('Python 3 provider (optional)')
- let pyname = 'python'.(a:version == 2 ? '' : '3')
+ let pyname = 'python3'
let python_exe = ''
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
let host_prog_var = pyname.'_host_prog'
@@ -301,7 +301,7 @@ function! s:check_python(version) abort
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
endif
- let [pyname, pythonx_errors] = provider#pythonx#Detect(a:version)
+ let [pyname, pythonx_warnings] = provider#pythonx#Detect(3)
if empty(pyname)
call health#report_warn('No Python executable found that can `import neovim`. '
@@ -311,8 +311,9 @@ function! s:check_python(version) abort
endif
" No Python executable could `import neovim`, or host_prog_var was used.
- if !empty(pythonx_errors)
- call health#report_error('Python provider error:', pythonx_errors)
+ if !empty(pythonx_warnings)
+ call health#report_warn(pythonx_warnings, ['See :help provider-python for more information.',
+ \ 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim'])
elseif !empty(pyname) && empty(python_exe)
if !exists('g:'.host_prog_var)
@@ -405,7 +406,7 @@ function! s:check_python(version) abort
" can import 'pynvim'. If so, that Python failed to import 'neovim' as
" well, which is most probably due to a failed pip upgrade:
" https://github.com/neovim/neovim/wiki/Following-HEAD#20181118
- let [pynvim_exe, errors] = provider#pythonx#DetectByModule('pynvim', a:version)
+ let [pynvim_exe, errors] = provider#pythonx#DetectByModule('pynvim', 3)
if !empty(pynvim_exe)
call health#report_error(
\ 'Detected pip upgrade failure: Python executable can import "pynvim" but '
@@ -416,14 +417,14 @@ function! s:check_python(version) abort
\ . pynvim_exe ." -m pip install neovim # only if needed by third-party software")
endif
else
- let [pyversion, current, latest, status] = s:version_info(python_exe)
+ let [majorpyversion, current, latest, status] = s:version_info(python_exe)
- if a:version != str2nr(pyversion)
+ if 3 != str2nr(majorpyversion)
call health#report_warn('Unexpected Python version.' .
\ ' This could lead to confusing error messages.')
endif
- call health#report_info('Python version: ' . pyversion)
+ call health#report_info('Python version: ' . majorpyversion)
if s:is_bad_response(status)
call health#report_info(printf('pynvim version: %s (%s)', current, status))
@@ -565,7 +566,7 @@ function! s:check_ruby() abort
\ ['Install Ruby and verify that `ruby` and `gem` commands work.'])
return
endif
- call health#report_info('Ruby: '. s:system('ruby -v'))
+ call health#report_info('Ruby: '. s:system(['ruby', '-v']))
let [host, err] = provider#ruby#Detect()
if empty(host)
@@ -573,7 +574,8 @@ function! s:check_ruby() abort
\ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
\ 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
\ 'If you are using rvm/rbenv/chruby, try "rehashing".',
- \ 'See :help g:ruby_host_prog for non-standard gem installations.'])
+ \ 'See :help g:ruby_host_prog for non-standard gem installations.',
+ \ 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim'])
return
endif
call health#report_info('Host: '. host)
@@ -588,11 +590,11 @@ function! s:check_ruby() abort
endif
let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 0, 'not found')
- let current_gem_cmd = host .' --version'
+ let current_gem_cmd = [host, '--version']
let current_gem = s:system(current_gem_cmd)
if s:shell_error
- call health#report_error('Failed to run: '. current_gem_cmd,
- \ ['Report this issue with the output of: ', current_gem_cmd])
+ call health#report_error('Failed to run: '. join(current_gem_cmd),
+ \ ['Report this issue with the output of: ', join(current_gem_cmd)])
return
endif
@@ -619,7 +621,7 @@ function! s:check_node() abort
\ ['Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.'])
return
endif
- let node_v = get(split(s:system('node -v'), "\n"), 0, '')
+ let node_v = get(split(s:system(['node', '-v']), "\n"), 0, '')
call health#report_info('Node.js: '. node_v)
if s:shell_error || s:version_cmp(node_v[1:], '6.0.0') < 0
call health#report_warn('Nvim node.js host does not support '.node_v)
@@ -634,7 +636,8 @@ function! s:check_node() abort
if empty(host)
call health#report_warn('Missing "neovim" npm (or yarn) package.',
\ ['Run in shell: npm install -g neovim',
- \ 'Run in shell (if you use yarn): yarn global add neovim'])
+ \ 'Run in shell (if you use yarn): yarn global add neovim',
+ \ 'You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim'])
return
endif
call health#report_info('Nvim node.js host: '. host)
@@ -660,8 +663,8 @@ function! s:check_node() abort
let current_npm_cmd = ['node', host, '--version']
let current_npm = s:system(current_npm_cmd)
if s:shell_error
- call health#report_error('Failed to run: '. string(current_npm_cmd),
- \ ['Report this issue with the output of: ', string(current_npm_cmd)])
+ call health#report_error('Failed to run: '. join(current_npm_cmd),
+ \ ['Report this issue with the output of: ', join(current_npm_cmd)])
return
endif
@@ -683,14 +686,15 @@ function! s:check_perl() abort
return
endif
- let [perl_exec, perl_errors] = provider#perl#Detect()
+ let [perl_exec, perl_warnings] = provider#perl#Detect()
if empty(perl_exec)
- if !empty(perl_errors)
- call health#report_error('perl provider error:', perl_errors)
- else
+ if !empty(perl_warnings)
+ call health#report_warn(perl_warnings, ['See :help provider-perl for more information.',
+ \ 'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim'])
+ else
call health#report_warn('No usable perl executable found')
endif
- return
+ return
endif
call health#report_info('perl executable: '. perl_exec)
@@ -734,8 +738,8 @@ function! s:check_perl() abort
let current_cpan_cmd = [perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
let current_cpan = s:system(current_cpan_cmd)
if s:shell_error
- call health#report_error('Failed to run: '. string(current_cpan_cmd),
- \ ['Report this issue with the output of: ', string(current_cpan_cmd)])
+ call health#report_error('Failed to run: '. join(current_cpan_cmd),
+ \ ['Report this issue with the output of: ', join(current_cpan_cmd)])
return
endif
@@ -751,8 +755,7 @@ endfunction
function! health#provider#check() abort
call s:check_clipboard()
- call s:check_python(2)
- call s:check_python(3)
+ call s:check_python()
call s:check_virtualenv()
call s:check_ruby()
call s:check_node()
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index a954e1b1a3..b8a73a64c9 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -123,12 +123,10 @@ function! s:system(cmd, ...) abort
endfunction
function! s:set_options(pager) abort
- setlocal filetype=man
setlocal noswapfile buftype=nofile bufhidden=hide
setlocal nomodified readonly nomodifiable
- if a:pager
- nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR>
- endif
+ let b:pager = a:pager
+ setlocal filetype=man
endfunction
function! s:get_page(path) abort
@@ -173,6 +171,12 @@ function! man#show_toc() abort
while lnum && lnum < last_line
let text = getline(lnum)
if text =~# '^\%( \{3\}\)\=\S.*$'
+ " if text is a section title
+ call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text})
+ elseif text =~# '^\s\+\%(+\|-\)\S\+'
+ " if text is a flag title. we strip whitespaces and prepend two
+ " spaces to have a consistent format in the loclist.
+ let text = ' ' .. substitute(text, '^\s*\(.\{-}\)\s*$', '\1', '')
call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text})
endif
let lnum = nextnonblank(lnum + 1)
@@ -232,7 +236,11 @@ function! s:get_path(sect, name) abort
"
" Finally, we can avoid relying on -S or -s here since they are very
" inconsistently supported. Instead, call -w with a section and a name.
- let results = split(s:system(['man', s:find_arg, a:sect, a:name]))
+ if empty(a:sect)
+ let results = split(s:system(['man', s:find_arg, a:name]))
+ else
+ let results = split(s:system(['man', s:find_arg, a:sect, a:name]))
+ endif
if empty(results)
return ''
@@ -469,10 +477,6 @@ endfunction
" Called when Nvim is invoked as $MANPAGER.
function! man#init_pager() abort
- " https://github.com/neovim/neovim/issues/6828
- let og_modifiable = &modifiable
- setlocal modifiable
-
if getline(1) =~# '^\s*$'
silent keepjumps 1delete _
else
@@ -492,7 +496,6 @@ function! man#init_pager() abort
endif
call s:set_options(v:true)
- let &l:modifiable = og_modifiable
endfunction
function! man#goto_tag(pattern, flags, info) abort
diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim
deleted file mode 100644
index 8a1d162784..0000000000
--- a/runtime/autoload/provider/python.vim
+++ /dev/null
@@ -1,45 +0,0 @@
-" The Python provider uses a Python host to emulate an environment for running
-" python-vim plugins. :help provider
-"
-" Associating the plugin with the Python host is the first step because plugins
-" will be passed as command-line arguments
-
-if exists('g:loaded_python_provider')
- finish
-endif
-let [s:prog, s:err] = provider#pythonx#Detect(2)
-let g:loaded_python_provider = empty(s:prog) ? 1 : 2
-
-function! provider#python#Prog() abort
- return s:prog
-endfunction
-
-function! provider#python#Error() abort
- return s:err
-endfunction
-
-" The Python provider plugin will run in a separate instance of the Python
-" host.
-call remote#host#RegisterClone('legacy-python-provider', 'python')
-call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', [])
-
-function! provider#python#Call(method, args) abort
- if s:err != ''
- return
- endif
- if !exists('s:host')
- let s:rpcrequest = function('rpcrequest')
-
- " Ensure that we can load the Python host before bootstrapping
- try
- let s:host = remote#host#Require('legacy-python-provider')
- catch
- let s:err = v:exception
- echohl WarningMsg
- echomsg v:exception
- echohl None
- return
- endtry
- endif
- return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host))
-endfunction
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 0eeb35cba8..6211b457d6 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -6,11 +6,9 @@ endif
let s:loaded_pythonx_provider = 1
function! provider#pythonx#Require(host) abort
- let ver = (a:host.orig_name ==# 'python') ? 2 : 3
-
" Python host arguments
- let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog())
- let args = [prog, '-c', 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; neovim.start_host()']
+ let prog = provider#python3#Prog()
+ let args = [prog, '-c', 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; neovim.start_host()']
" Collect registered Python plugins into args
@@ -23,14 +21,12 @@ function! provider#pythonx#Require(host) abort
endfunction
function! s:get_python_executable_from_host_var(major_version) abort
- return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : '').'_host_prog', ''), v:true)
+ return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : execute("throw 'unsupported'")).'_host_prog', ''), v:true)
endfunction
function! s:get_python_candidates(major_version) abort
return {
- \ 2: ['python2', 'python2.7', 'python2.6', 'python'],
- \ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7',
- \ 'python3.6', 'python']
+ \ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7', 'python']
\ }[a:major_version]
endfunction
@@ -60,14 +56,14 @@ function! provider#pythonx#DetectByModule(module, major_version) abort
endfor
" No suitable Python executable found.
- return ['', 'provider/pythonx: Could not load Python '.a:major_version.":\n".join(errors, "\n")]
+ return ['', 'Could not load Python '.a:major_version.":\n".join(errors, "\n")]
endfunction
" Returns array: [prog_exitcode, prog_version]
function! s:import_module(prog, module) abort
let prog_version = system([a:prog, '-c' , printf(
\ 'import sys; ' .
- \ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
+ \ 'sys.path = [p for p in sys.path if p != ""]; ' .
\ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' .
\ 'import pkgutil; ' .
\ 'exit(2*int(pkgutil.get_loader("%s") is None))',
@@ -82,7 +78,7 @@ function! provider#pythonx#CheckForModule(prog, module, major_version) abort
return [0, a:prog . ' not found in search path or not executable.']
endif
- let min_version = (a:major_version == 2) ? '2.6' : '3.3'
+ let min_version = '3.7'
" Try to load module, and output Python version.
" Exit codes:
@@ -103,7 +99,7 @@ function! provider#pythonx#CheckForModule(prog, module, major_version) abort
endif
if prog_exitcode == 2
- return [0, prog_path.' does not have the "' . a:module . '" module. :help provider-python']
+ return [0, prog_path.' does not have the "' . a:module . '" module.']
elseif prog_exitcode == 127
" This can happen with pyenv's shims.
return [0, prog_path . ' does not exist: ' . prog_version]
diff --git a/runtime/autoload/python3complete.vim b/runtime/autoload/python3complete.vim
index 192e9e6df8..b0781864c5 100644
--- a/runtime/autoload/python3complete.vim
+++ b/runtime/autoload/python3complete.vim
@@ -2,7 +2,7 @@
" Maintainer: <vacancy>
" Previous Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
" Version: 0.9
-" Last Updated: 2020 Oct 9
+" Last Updated: 2022 Mar 30
"
" Roland Puntaier: this file contains adaptations for python3 and is parallel to pythoncomplete.vim
"
@@ -91,6 +91,9 @@ endfunction
function! s:DefPython()
py3 << PYTHONEOF
+import warnings
+warnings.simplefilter(action='ignore', category=FutureWarning)
+
import sys, tokenize, io, types
from token import NAME, DEDENT, NEWLINE, STRING
diff --git a/runtime/colors/README.txt b/runtime/colors/README.txt
index 70aacb5384..4ea8e5e640 100644
--- a/runtime/colors/README.txt
+++ b/runtime/colors/README.txt
@@ -1,21 +1,27 @@
README.txt for color scheme files
-These files are used for the ":colorscheme" command. They appear in the
-Edit/Color Scheme menu in the GUI.
+These files are used for the `:colorscheme` command. They appear in the
+"Edit/Color Scheme" menu in the GUI.
+
+The colorschemes were updated for the Vim 9 release. If you don't like the
+changes you can find the old ones here:
+https://github.com/vim/colorschemes/tree/master/legacy_colors
Hints for writing a color scheme file:
There are two basic ways to define a color scheme:
-1. Define a new Normal color and set the 'background' option accordingly.
+1. Define a new Normal color and set the 'background' option accordingly. >
+
set background={light or dark}
highlight clear
highlight Normal ...
...
2. Use the default Normal color and automatically adjust to the value of
- 'background'.
+ 'background'. >
+
highlight clear Normal
set background&
highlight clear
@@ -27,25 +33,28 @@ There are two basic ways to define a color scheme:
...
endif
-You can use ":highlight clear" to reset everything to the defaults, and then
-change the groups that you want differently. This also will work for groups
+You can use `:highlight clear` to reset everything to the defaults, and then
+change the groups that you want differently. This will also work for groups
that are added in later versions of Vim.
-Note that ":highlight clear" uses the value of 'background', thus set it
+Note that `:highlight clear` uses the value of 'background', thus set it
before this command.
Some attributes (e.g., bold) might be set in the defaults that you want
removed in your color scheme. Use something like "gui=NONE" to remove the
attributes.
In case you want to set 'background' depending on the colorscheme selected,
-this autocmd might be useful:
+this autocmd might be useful: >
+
autocmd SourcePre */colors/blue_sky.vim set background=dark
+
Replace "blue_sky" with the name of the colorscheme.
In case you want to tweak a colorscheme after it was loaded, check out the
ColorScheme autocommand event.
To clean up just before loading another colorscheme, use the ColorSchemePre
-autocommand event. For example:
+autocommand event. For example: >
+
let g:term_ansi_colors = ...
augroup MyColorscheme
au!
@@ -54,36 +63,83 @@ autocommand event. For example:
augroup END
To customize a colorscheme use another name, e.g. "~/.vim/colors/mine.vim",
-and use `:runtime` to load the original colorscheme:
+and use ":runtime" to load the original colorscheme: >
+
" load the "evening" colorscheme
runtime colors/evening.vim
" change the color of statements
hi Statement ctermfg=Blue guifg=Blue
-To see which highlight group is used where, find the help for
-"highlight-groups" and "group-name".
+To see which highlight group is used where, see `:help highlight-groups` and
+`:help group-name` .
You can use ":highlight" to find out the current colors. Exception: the
ctermfg and ctermbg values are numbers, which are only valid for the current
-terminal. Use the color names instead. See ":help cterm-colors".
+terminal. Use the color names instead for better portability. See
+`:help cterm-colors` .
-The default color settings can be found in the source file src/highlight.c.
-Search for "highlight_init".
+The default color settings can be found in the source file
+"src/nvim/highlight_group.c". Search for "highlight_init".
If you think you have a color scheme that is good enough to be used by others,
please check the following items:
-- Source the $VIMRUNTIME/tools/check_colors.vim script to check for common mistakes.
-- Does it work in a color terminal as well as in the GUI?
+- Source the $VIMRUNTIME/colors/tools/check_colors.vim script to check for
+ common mistakes.
+
+- Does it work in a color terminal as well as in the GUI? Is it consistent?
+
- Is "g:colors_name" set to a meaningful value? In case of doubt you can do
- it this way:
+ it this way: >
+
let g:colors_name = expand('<sfile>:t:r')
+
- Is 'background' either used or appropriately set to "light" or "dark"?
+
- Try setting 'hlsearch' and searching for a pattern, is the match easy to
spot?
+
- Split a window with ":split" and ":vsplit". Are the status lines and
vertical separators clearly visible?
+
- In the GUI, is it easy to find the cursor, also in a file with lots of
syntax highlighting?
+
+- In general, test your color scheme against as many filetypes, Vim features,
+ environments, etc. as possible.
+
- Do not use hard coded escape sequences, these will not work in other
- terminals. Always use color names or #RRGGBB for the GUI.
+ terminals. Always use #RRGGBB for the GUI.
+
+- When targetting 8-16 colors terminals, don't count on "darkblue" to be blue
+ and dark, or on "2" to be even vaguely reddish. Names are more portable
+ than numbers, though.
+
+- When targetting 256 colors terminals, prefer colors 16-255 to colors 0-15
+ for the same reason.
+
+- Typographic attributes (bold, italic, underline, reverse, etc.) are not
+ universally supported. Don't count on any of them.
+
+- Is "g:terminal_ansi_colors" set to a list of 16 #RRGGBB values?
+
+- Try to keep your color scheme simple by avoiding unnecessary logic and
+ refraining from adding options. The best color scheme is one that only
+ requires: >
+
+ colorscheme foobar
+
+The color schemes distributed with Vim are built with lifepillar/colortemplate
+(https://github.com/lifepillar/vim-colortemplate). It is therefore highly
+recommended.
+
+If you would like your color scheme to be distributed with Vim, make sure
+that:
+
+- it satisfies the guidelines above,
+- it was made with colortemplate,
+
+and join us at vim/colorschemes: (https://github.com/vim/colorschemes).
+
+
+vim: set ft=help :
diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim
index 86de8a4dc4..d072ce6058 100644
--- a/runtime/colors/blue.vim
+++ b/runtime/colors/blue.vim
@@ -1,55 +1,562 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Steven Vertigan <steven@vertigan.wattle.id.au>
-" Last Change: 2006 Sep 23
-" Revision #5: Switch main text from white to yellow for easier contrast,
-" fixed some problems with terminal backgrounds.
+" Name: blue
+" Description: Colorscheme with a blue background
+" Author: Original author Steven Vertigan <steven@vertigan.wattle.id.au>
+" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sat 11 Jun 2022 11:16:14 MSK
+
+" Generated by Colortemplate v2.2.0
set background=dark
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'blue'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#870000', '#006400', '#878700', '#000087', '#870087', '#008787', '#bcbcbc', '#878787', '#d70000', '#00ff00', '#ffdf00', '#5fafff', '#d787d7', '#5fffff', '#ffffff']
+endif
+hi Normal guifg=#ffdf00 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 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 Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#005faf gui=NONE cterm=NONE
+hi CursorIM guifg=#000000 guibg=#ffdf00 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffdf00 guibg=#005faf gui=bold cterm=NONE
+hi EndOfBuffer guifg=#ffdf00 guibg=#000087 gui=NONE cterm=NONE
+hi Error guifg=#ff7f50 guibg=#000087 gui=reverse cterm=reverse
+hi ErrorMsg guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE
+hi FoldColumn guifg=#008787 guibg=NONE gui=NONE cterm=NONE
+hi Folded guifg=#000087 guibg=#878700 gui=NONE cterm=NONE
+hi IncSearch guifg=#d787d7 guibg=#000000 gui=standout cterm=reverse
+hi LineNr guifg=#5fffff guibg=NONE gui=NONE cterm=NONE
+hi MatchParen guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+hi ModeMsg guifg=#000087 guibg=#00ff00 gui=NONE cterm=NONE
+hi MoreMsg guifg=#5fffff guibg=NONE gui=NONE cterm=NONE
+hi NonText guifg=#d787d7 guibg=NONE gui=NONE cterm=NONE
+hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
+hi Question guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Search guifg=#ffdf00 guibg=#000000 gui=reverse cterm=reverse
+hi SignColumn guifg=#008787 guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#5fffff guibg=NONE gui=NONE cterm=NONE
+hi SpellBad guifg=#d70000 guibg=NONE guisp=#d70000 gui=undercurl cterm=underline
+hi SpellCap guifg=#00ff00 guibg=NONE guisp=#00ff00 gui=undercurl cterm=underline
+hi SpellLocal guifg=#ffffff guibg=NONE guisp=#ffffff gui=undercurl cterm=underline
+hi SpellRare guifg=#d787d7 guibg=NONE guisp=#d787d7 gui=undercurl cterm=underline
+hi StatusLine guifg=#000087 guibg=#5fffff gui=NONE cterm=NONE
+hi StatusLineNC guifg=#000087 guibg=#008787 gui=NONE cterm=NONE
+hi ToolbarButton guifg=#ffffff guibg=#005faf gui=NONE cterm=NONE
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi VertSplit guifg=#008787 guibg=NONE gui=NONE cterm=NONE
+hi Visual guifg=#ffffff guibg=#008787 gui=NONE cterm=NONE
+hi VisualNOS guifg=#008787 guibg=#ffffff gui=NONE cterm=NONE
+hi WarningMsg guifg=#d70000 guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#000087 guibg=#ffdf00 gui=NONE cterm=NONE
+hi debugBreakpoint guifg=#00ff00 guibg=#000087 gui=reverse cterm=reverse
+hi debugPC guifg=#5fffff guibg=#000087 gui=reverse cterm=reverse
+hi Directory guifg=#5fffff guibg=NONE gui=NONE cterm=NONE
+hi Title guifg=#d787d7 guibg=NONE gui=NONE cterm=NONE
+hi Comment guifg=#878787 guibg=NONE gui=bold cterm=NONE
+hi Constant guifg=#5fffff guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=#878787 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#d787d7 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffffff guibg=NONE gui=NONE cterm=NONE
+hi Todo guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+hi Type guifg=#ffa500 guibg=NONE gui=bold cterm=NONE
+hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
+hi Label guifg=#ffdf00 guibg=NONE gui=NONE cterm=NONE
+hi! link Terminal Normal
+hi! link Debug Special
+hi! link diffAdded String
+hi! link diffRemoved WarningMsg
+hi! link diffOnly WarningMsg
+hi! link diffNoEOL WarningMsg
+hi! link diffIsA WarningMsg
+hi! link diffIdentical WarningMsg
+hi! link diffDiffer WarningMsg
+hi! link diffCommon WarningMsg
+hi! link diffBDiffer WarningMsg
+hi! link lCursor Cursor
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineNr CursorLine
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link TabLine StatusLineNC
+hi! link TabLineFill StatusLineNC
+hi! link TabLineSel StatusLine
+hi! link Boolean Constant
+hi! link Character Constant
+hi! link Conditional Statement
+hi! link Define PreProc
+hi! link Delimiter Special
+hi! link Exception Statement
+hi! link Float Constant
+hi! link Function Identifier
+hi! link Include PreProc
+hi! link Keyword Statement
+hi! link Macro PreProc
+hi! link Number Constant
+hi! link Operator Type
+hi! link PreCondit PreProc
+hi! link Repeat Statement
+hi! link SpecialChar Special
+hi! link SpecialComment Special
+hi! link StorageClass Type
+hi! link String Constant
+hi! link Structure Type
+hi! link Tag Special
+hi! link Typedef Type
+hi! link Terminal Normal
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi Normal ctermfg=220 ctermbg=18 cterm=NONE
+ 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 QuickFixLine ctermfg=16 ctermbg=176 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=90 cterm=NONE
+ hi Conceal ctermfg=NONE 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
+ hi CursorLineNr ctermfg=220 ctermbg=25 cterm=NONE
+ hi EndOfBuffer ctermfg=220 ctermbg=18 cterm=NONE
+ hi Error ctermfg=209 ctermbg=18 cterm=reverse
+ hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE
+ hi FoldColumn ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=18 ctermbg=100 cterm=NONE
+ hi IncSearch ctermfg=176 ctermbg=16 cterm=reverse
+ hi LineNr ctermfg=87 ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ModeMsg ctermfg=18 ctermbg=46 cterm=NONE
+ hi MoreMsg ctermfg=87 ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=176 ctermbg=NONE cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE
+ hi Question ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Search ctermfg=220 ctermbg=16 cterm=reverse
+ hi SignColumn ctermfg=30 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=87 ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=160 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=46 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=231 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=176 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=18 ctermbg=87 cterm=NONE
+ hi StatusLineNC ctermfg=18 ctermbg=30 cterm=NONE
+ hi ToolbarButton ctermfg=231 ctermbg=25 cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=231 ctermbg=30 cterm=NONE
+ hi VisualNOS ctermfg=30 ctermbg=231 cterm=NONE
+ hi WarningMsg ctermfg=160 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=18 ctermbg=220 cterm=NONE
+ hi debugBreakpoint ctermfg=46 ctermbg=18 cterm=reverse
+ hi debugPC ctermfg=87 ctermbg=18 cterm=reverse
+ hi Directory ctermfg=87 ctermbg=NONE cterm=NONE
+ hi Title ctermfg=176 ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=102 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=87 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=250 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=102 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=176 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=231 ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Type ctermfg=214 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Label ctermfg=220 ctermbg=NONE cterm=NONE
+ hi! link Terminal Normal
+ hi! link Debug Special
+ hi! link diffAdded String
+ hi! link diffRemoved WarningMsg
+ hi! link diffOnly WarningMsg
+ hi! link diffNoEOL WarningMsg
+ hi! link diffIsA WarningMsg
+ hi! link diffIdentical WarningMsg
+ hi! link diffDiffer WarningMsg
+ hi! link diffCommon WarningMsg
+ hi! link diffBDiffer WarningMsg
+ hi! link lCursor Cursor
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineNr CursorLine
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine StatusLineNC
+ hi! link TabLineFill StatusLineNC
+ hi! link TabLineSel StatusLine
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi! link Conditional Statement
+ hi! link Define PreProc
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi! link Function Identifier
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Type
+ hi! link PreCondit PreProc
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi! link StorageClass Type
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi! link Typedef Type
+ hi! link Terminal Normal
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=yellow ctermbg=darkblue cterm=NONE
+ 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 QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=darkmagenta cterm=NONE
+ hi Conceal ctermfg=NONE 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
+ hi CursorLineNr ctermfg=yellow ctermbg=blue cterm=NONE
+ hi EndOfBuffer ctermfg=yellow ctermbg=darkblue cterm=NONE
+ hi Error ctermfg=red ctermbg=darkblue cterm=reverse
+ hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi IncSearch ctermfg=magenta ctermbg=black cterm=reverse
+ hi LineNr ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ModeMsg ctermfg=darkblue ctermbg=green cterm=NONE
+ hi MoreMsg ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi Question ctermfg=green ctermbg=NONE cterm=NONE
+ hi Search ctermfg=yellow ctermbg=black cterm=reverse
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=green ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=white ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=darkblue ctermbg=cyan cterm=NONE
+ hi StatusLineNC ctermfg=darkblue ctermbg=darkcyan cterm=NONE
+ hi ToolbarButton ctermfg=white ctermbg=blue cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=white ctermbg=darkcyan cterm=NONE
+ hi VisualNOS ctermfg=darkcyan ctermbg=white cterm=NONE
+ hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=darkblue ctermbg=yellow cterm=NONE
+ hi debugBreakpoint ctermfg=green ctermbg=darkblue cterm=reverse
+ hi debugPC ctermfg=cyan ctermbg=darkblue cterm=reverse
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=darkgray ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=gray ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=darkgray ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=green ctermbg=NONE cterm=NONE
+ hi Special ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=white ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Type ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Label ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi! link Terminal Normal
+ hi! link Debug Special
+ hi! link diffAdded String
+ hi! link diffRemoved WarningMsg
+ hi! link diffOnly WarningMsg
+ hi! link diffNoEOL WarningMsg
+ hi! link diffIsA WarningMsg
+ hi! link diffIdentical WarningMsg
+ hi! link diffDiffer WarningMsg
+ hi! link diffCommon WarningMsg
+ hi! link diffBDiffer WarningMsg
+ hi! link lCursor Cursor
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineNr CursorLine
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine StatusLineNC
+ hi! link TabLineFill StatusLineNC
+ hi! link TabLineSel StatusLine
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi! link Conditional Statement
+ hi! link Define PreProc
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi! link Function Identifier
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Type
+ hi! link PreCondit PreProc
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi! link StorageClass Type
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi! link Typedef Type
+ hi! link Terminal Normal
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=darkyellow ctermbg=blue cterm=NONE
+ 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 QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=magenta cterm=NONE
+ hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=black ctermbg=green cterm=NONE
+ hi CursorColumn ctermfg=blue ctermbg=yellow cterm=bold,reverse
+ hi CursorIM ctermfg=black ctermbg=yellow cterm=NONE
+ hi EndOfBuffer ctermfg=yellow ctermbg=blue cterm=NONE
+ hi Error ctermfg=red ctermbg=blue cterm=reverse
+ hi ErrorMsg ctermfg=gray ctermbg=red cterm=NONE
+ hi FoldColumn ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=blue ctermbg=yellow cterm=NONE
+ hi IncSearch ctermfg=magenta ctermbg=black cterm=reverse
+ hi LineNr ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ModeMsg ctermfg=blue ctermbg=green cterm=NONE
+ hi MoreMsg ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi Question ctermfg=green ctermbg=NONE cterm=NONE
+ hi Search ctermfg=yellow ctermbg=black cterm=reverse
+ hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=yellow cterm=reverse
+ hi SpellCap ctermfg=green ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=gray ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=magenta ctermbg=yellow cterm=reverse
+ hi StatusLine ctermfg=cyan ctermbg=blue cterm=bold,reverse
+ hi StatusLineNC ctermfg=blue ctermbg=cyan cterm=NONE
+ hi ToolbarButton ctermfg=blue ctermbg=gray cterm=bold,reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=black ctermbg=cyan cterm=NONE
+ hi VisualNOS ctermfg=cyan ctermbg=gray cterm=NONE
+ hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=blue ctermbg=yellow cterm=NONE
+ hi debugBreakpoint ctermfg=green ctermbg=blue cterm=reverse
+ hi debugPC ctermfg=cyan ctermbg=blue cterm=reverse
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=black ctermbg=NONE cterm=bold
+ hi Constant ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=gray ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=gray ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=green ctermbg=NONE cterm=NONE
+ hi Special ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=gray ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Type ctermfg=red ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Label ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi! link Terminal Normal
+ hi! link Debug Special
+ hi! link diffAdded String
+ hi! link diffRemoved WarningMsg
+ hi! link diffOnly WarningMsg
+ hi! link diffNoEOL WarningMsg
+ hi! link diffIsA WarningMsg
+ hi! link diffIdentical WarningMsg
+ hi! link diffDiffer WarningMsg
+ hi! link diffCommon WarningMsg
+ hi! link diffBDiffer WarningMsg
+ hi! link lCursor Cursor
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineNr CursorLine
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine StatusLineNC
+ hi! link TabLineFill StatusLineNC
+ hi! link TabLineSel StatusLine
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi! link Conditional Statement
+ hi! link Define PreProc
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi! link Function Identifier
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Type
+ hi! link PreCondit PreProc
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi! link StorageClass Type
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi! link Typedef Type
+ hi! link Terminal Normal
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
endif
-let g:colors_name = "blue"
-hi Normal guifg=yellow guibg=darkBlue ctermfg=yellow ctermbg=darkBlue
-hi NonText guifg=magenta ctermfg=lightMagenta
-hi comment guifg=gray ctermfg=gray ctermbg=darkBlue gui=bold
-hi constant guifg=cyan ctermfg=cyan
-hi identifier guifg=gray ctermfg=red
-hi statement guifg=white ctermfg=white ctermbg=darkBlue gui=none
-hi preproc guifg=green ctermfg=green
-hi type guifg=orange ctermfg=lightRed ctermbg=darkBlue
-hi special guifg=magenta ctermfg=lightMagenta ctermbg=darkBlue
-hi Underlined guifg=cyan ctermfg=cyan gui=underline cterm=underline
-hi label guifg=yellow ctermfg=yellow
-hi operator guifg=orange gui=bold ctermfg=lightRed ctermbg=darkBlue
-
-hi ErrorMsg guifg=orange guibg=darkBlue ctermfg=lightRed
-hi WarningMsg guifg=cyan guibg=darkBlue ctermfg=cyan gui=bold
-hi ModeMsg guifg=yellow gui=NONE ctermfg=yellow
-hi MoreMsg guifg=yellow gui=NONE ctermfg=yellow
-hi Error guifg=red guibg=darkBlue gui=underline ctermfg=red
-
-hi Todo guifg=black guibg=orange ctermfg=black ctermbg=darkYellow
-hi Cursor guifg=black guibg=white ctermfg=black ctermbg=white
-hi Search guifg=black guibg=orange ctermfg=black ctermbg=darkYellow
-hi IncSearch guifg=black guibg=yellow ctermfg=black ctermbg=darkYellow
-hi LineNr guifg=cyan ctermfg=cyan
-hi title guifg=white gui=bold cterm=bold
-
-hi StatusLineNC gui=NONE guifg=black guibg=blue ctermfg=black ctermbg=blue
-hi StatusLine gui=bold guifg=cyan guibg=blue ctermfg=cyan ctermbg=blue
-hi VertSplit gui=none guifg=blue guibg=blue ctermfg=blue ctermbg=blue
-
-hi Visual term=reverse ctermfg=black ctermbg=darkCyan guifg=black guibg=darkCyan
-
-hi DiffChange guibg=darkGreen guifg=black ctermbg=darkGreen ctermfg=black
-hi DiffText guibg=olivedrab guifg=black ctermbg=lightGreen ctermfg=black
-hi DiffAdd guibg=slateblue guifg=black ctermbg=blue ctermfg=black
-hi DiffDelete guibg=coral guifg=black ctermbg=cyan ctermfg=black
-
-hi Folded guibg=orange guifg=black ctermbg=yellow ctermfg=black
-hi FoldColumn guibg=gray30 guifg=black ctermbg=gray ctermfg=black
-hi cIf0 guifg=gray ctermfg=gray
+" Background: dark
+" Color: black #000000 16 black
+" Color: darkred #870000 88 darkred
+" Color: darkyellow #878700 100 darkyellow
+" Color: darkblue #000087 18 darkblue
+" Color: darkmagenta #870087 90 darkmagenta
+" Color: darkcyan #008787 30 darkcyan
+" Color: gray #bcbcbc 250 gray
+" Color: comment #878787 102 darkgray
+" Color: darkgray #878787 102 darkgray
+" Color: red #d70000 160 red
+" Color: green #00ff00 46 green
+" Color: yellow #ffdf00 220 yellow
+" Color: blue #005faf 25 blue
+" Color: magenta #d787d7 176 magenta
+" Color: cyan #5fffff 87 cyan
+" Color: white #ffffff 231 white
+" Color: xtermblue #5fafff 75 blue
+" Color: xtermdarkblue #0087af 31 darkblue
+" Color: orange #ffa500 214 darkyellow
+" Color: darkgreen #006400 22 darkgreen
+" Color: coral #ff7f50 209 red
+" Color: olivedrab #6b8e23 64 green
+" Color: slateblue #6a5acd 62 darkmagenta
+" Term colors: black darkred darkgreen darkyellow darkblue darkmagenta darkcyan gray
+" Term colors: darkgray red green yellow xtermblue magenta cyan white
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim
index 88f0bd73b9..970a8cb060 100644
--- a/runtime/colors/darkblue.vim
+++ b/runtime/colors/darkblue.vim
@@ -1,65 +1,466 @@
-" Vim color file
-" Maintainer: Bohdan Vlasyuk <bohdan@vstu.edu.ua>
-" Last Change: 2008 Jul 18
+" Name: darkblue
+" Description: For those who prefer dark background
+" Author: Original author Bohdan Vlasyuk <bohdan@vstu.edu.ua>
+" Maintainer: Original author Bohdan Vlasyuk <bohdan@vstu.edu.ua>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sat 11 Jun 2022 14:37:41 MSK
-" darkblue -- for those who prefer dark background
-" [note: looks bit uglier with come terminal palettes,
-" but is fine on default linux console palette.]
+" Generated by Colortemplate v2.2.0
-set bg=dark
-hi clear
-if exists("syntax_on")
- syntax reset
-endif
-
-let colors_name = "darkblue"
+set background=dark
-hi Normal guifg=#c0c0c0 guibg=#000040 ctermfg=gray ctermbg=black
-hi ErrorMsg guifg=#ffffff guibg=#287eff ctermfg=white ctermbg=lightblue
-hi Visual guifg=#8080ff guibg=fg gui=reverse ctermfg=lightblue ctermbg=fg cterm=reverse
-hi Todo guifg=#d14a14 guibg=#1248d1 ctermfg=red ctermbg=darkblue
-hi Search guifg=#90fff0 guibg=#2050d0 ctermfg=white ctermbg=darkblue cterm=underline term=underline
-hi IncSearch guifg=#b0ffff guibg=#2050d0 ctermfg=darkblue ctermbg=gray
-
-hi SpecialKey guifg=cyan ctermfg=darkcyan
-hi Directory guifg=cyan ctermfg=cyan
-hi Title guifg=magenta gui=none ctermfg=magenta cterm=bold
-hi WarningMsg guifg=red ctermfg=red
-hi WildMenu guifg=yellow guibg=black ctermfg=yellow ctermbg=black cterm=none term=none
-hi ModeMsg guifg=#22cce2 ctermfg=lightblue
-hi MoreMsg ctermfg=darkgreen ctermfg=darkgreen
-hi Question guifg=green gui=none ctermfg=green cterm=none
-hi NonText guifg=#0030ff ctermfg=darkblue
+hi clear
+let g:colors_name = 'darkblue'
-hi StatusLine guifg=blue guibg=darkgray gui=none ctermfg=blue ctermbg=gray term=none cterm=none
-hi StatusLineNC guifg=black guibg=darkgray gui=none ctermfg=black ctermbg=gray term=none cterm=none
-hi VertSplit guifg=black guibg=darkgray gui=none ctermfg=black ctermbg=gray term=none cterm=none
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
-hi Folded guifg=#808080 guibg=#000040 ctermfg=darkgrey ctermbg=black cterm=bold term=bold
-hi FoldColumn guifg=#808080 guibg=#000040 ctermfg=darkgrey ctermbg=black cterm=bold term=bold
-hi LineNr guifg=#90f020 ctermfg=green cterm=none
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#8b0000', '#90f020', '#ffa500', '#00008b', '#8b008b', '#008b8b', '#c0c0c0', '#808080', '#ffa0a0', '#90f020', '#ffff60', '#0030ff', '#ff00ff', '#90fff0', '#ffffff']
+endif
+hi! link Terminal Normal
+hi! link CursorColumn CursorLine
+hi! link CursorIM Cursor
+hi! link EndOfBuffer NonText
+hi! link ErrorMsg Error
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link TabLineFill TabLine
+hi! link Boolean Constant
+hi! link Character Constant
+hi! link Conditional Statement
+hi! link Define PreProc
+hi! link Delimiter Special
+hi! link Exception Statement
+hi! link Float Constant
+hi! link Function Identifier
+hi! link Include PreProc
+hi! link Keyword Statement
+hi! link Label Statement
+hi! link Macro PreProc
+hi! link Number Constant
+hi! link Operator Statement
+hi! link PreCondit PreProc
+hi! link Repeat Statement
+hi! link SpecialChar Special
+hi! link SpecialComment Special
+hi! link StorageClass Type
+hi! link String Constant
+hi! link Structure Type
+hi! link Tag Special
+hi! link Typedef Type
+hi! link Debug Special
+hi! link diffAdded String
+hi! link diffRemoved WarningMsg
+hi! link diffOnly WarningMsg
+hi! link diffNoEOL WarningMsg
+hi! link diffIsA WarningMsg
+hi! link diffIdentical WarningMsg
+hi! link diffDiffer WarningMsg
+hi! link diffCommon WarningMsg
+hi! link diffBDiffer WarningMsg
+hi! link lCursor Cursor
+hi! link CurSearch Search
+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 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
+hi Error guifg=#ffa0a0 guibg=NONE gui=reverse cterm=reverse
+hi FoldColumn guifg=#808080 guibg=NONE gui=bold cterm=NONE
+hi Folded guifg=#808080 guibg=NONE gui=bold cterm=NONE
+hi IncSearch guifg=#ffffff guibg=#0030ff gui=reverse cterm=reverse
+hi LineNr guifg=#90f020 guibg=NONE gui=NONE cterm=NONE
+hi MatchParen guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+hi ModeMsg guifg=#90fff0 guibg=NONE gui=NONE cterm=NONE
+hi MoreMsg guifg=#006400 guibg=NONE gui=NONE cterm=NONE
+hi NonText guifg=#0030ff guibg=NONE gui=NONE cterm=NONE
+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 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
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#90f020 guibg=NONE guisp=#90f020 gui=undercurl cterm=underline
+hi SpellLocal guifg=#90fff0 guibg=NONE guisp=#90fff0 gui=undercurl cterm=underline
+hi SpellRare guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi StatusLine guifg=#000040 guibg=#c0c0c0 gui=NONE cterm=NONE
+hi StatusLineNC guifg=#000000 guibg=#808080 gui=NONE cterm=NONE
+hi TabLine guifg=#000000 guibg=#808080 gui=NONE cterm=NONE
+hi ToolbarButton guifg=#ffffff guibg=#0030ff gui=NONE cterm=NONE
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi VertSplit guifg=#000000 guibg=#808080 gui=NONE cterm=NONE
+hi Visual guifg=#8080ff guibg=#ffffff gui=reverse cterm=reverse
+hi VisualNOS guifg=#8080ff guibg=#c0c0c0 gui=reverse,underline cterm=reverse,underline
+hi WarningMsg guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#ffff60 guibg=#000000 gui=NONE cterm=NONE
+hi debugBreakpoint guifg=#90f020 guibg=#00008b gui=reverse cterm=reverse
+hi debugPC guifg=#90fff0 guibg=#00008b gui=reverse cterm=reverse
+hi Directory guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
+hi Title guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE
+hi Comment guifg=#80a0ff guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ffa0a0 guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#90fff0 guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=#000040 guibg=#c0c0c0 gui=NONE cterm=NONE
+hi PreProc guifg=#ff80ff guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ffa500 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffff60 guibg=NONE gui=NONE cterm=NONE
+hi Todo guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+hi Type guifg=#90f020 guibg=NONE gui=NONE cterm=NONE
+hi Underlined guifg=#80a0ff guibg=NONE gui=underline cterm=underline
+hi TabLineSel guifg=#000040 guibg=#c0c0c0 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffff60 guibg=#666666 gui=NONE cterm=NONE
+hi Search guifg=#90fff0 guibg=#0030ff gui=NONE cterm=NONE
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
-hi DiffAdd guibg=darkblue ctermbg=darkblue term=none cterm=none
-hi DiffChange guibg=darkmagenta ctermbg=magenta cterm=none
-hi DiffDelete ctermfg=blue ctermbg=cyan gui=bold guifg=Blue guibg=DarkCyan
-hi DiffText cterm=bold ctermbg=red gui=bold guibg=Red
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link CursorColumn CursorLine
+ hi! link CursorIM Cursor
+ hi! link EndOfBuffer NonText
+ hi! link ErrorMsg Error
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link TabLineFill TabLine
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi! link Conditional Statement
+ hi! link Define PreProc
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi! link Function Identifier
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi! link StorageClass Type
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi! link Typedef Type
+ hi! link Debug Special
+ hi! link diffAdded String
+ hi! link diffRemoved WarningMsg
+ hi! link diffOnly WarningMsg
+ hi! link diffNoEOL WarningMsg
+ hi! link diffIsA WarningMsg
+ hi! link diffIdentical WarningMsg
+ hi! link diffDiffer WarningMsg
+ hi! link diffCommon WarningMsg
+ hi! link diffBDiffer WarningMsg
+ hi! link lCursor Cursor
+ hi! link CurSearch Search
+ hi Normal ctermfg=252 ctermbg=17 cterm=NONE
+ hi Conceal ctermfg=NONE 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
+ hi Error ctermfg=217 ctermbg=NONE cterm=reverse
+ hi FoldColumn ctermfg=102 ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=102 ctermbg=NONE cterm=NONE
+ hi IncSearch ctermfg=231 ctermbg=27 cterm=reverse
+ hi LineNr ctermfg=118 ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ModeMsg ctermfg=123 ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=22 ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=27 ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=231 ctermbg=27 cterm=NONE
+ 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 Question ctermfg=118 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=102 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=30 ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=118 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=123 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=201 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=17 ctermbg=252 cterm=NONE
+ hi StatusLineNC ctermfg=16 ctermbg=102 cterm=NONE
+ hi TabLine ctermfg=16 ctermbg=102 cterm=NONE
+ hi ToolbarButton ctermfg=231 ctermbg=27 cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=16 ctermbg=102 cterm=NONE
+ hi Visual ctermfg=105 ctermbg=231 cterm=reverse
+ hi VisualNOS ctermfg=105 ctermbg=252 cterm=reverse,underline
+ hi WarningMsg ctermfg=196 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=227 ctermbg=16 cterm=NONE
+ hi debugBreakpoint ctermfg=118 ctermbg=18 cterm=reverse
+ hi debugPC ctermfg=123 ctermbg=18 cterm=reverse
+ hi Directory ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Title ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=111 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=123 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=17 ctermbg=252 cterm=NONE
+ hi PreProc ctermfg=213 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=214 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=227 ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Type ctermfg=118 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi TabLineSel ctermfg=17 ctermbg=252 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=59 cterm=NONE
+ hi CursorLineNr ctermfg=227 ctermbg=59 cterm=NONE
+ hi Search ctermfg=123 ctermbg=27 cterm=NONE
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-hi Cursor guifg=black guibg=yellow ctermfg=black ctermbg=yellow
-hi lCursor guifg=black guibg=white ctermfg=black ctermbg=white
+if s:t_Co >= 16
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi Conceal ctermfg=NONE 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
+ hi Error ctermfg=red ctermbg=NONE cterm=reverse
+ hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi IncSearch ctermfg=white ctermbg=blue cterm=reverse
+ hi LineNr ctermfg=green ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ModeMsg ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=white ctermbg=blue cterm=NONE
+ 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 Question ctermfg=green ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=green ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=cyan ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkmagenta ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=black ctermbg=grey cterm=NONE
+ hi StatusLineNC ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi TabLine ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi ToolbarButton ctermfg=white ctermbg=blue cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi Visual ctermfg=blue ctermbg=white cterm=reverse
+ hi VisualNOS ctermfg=blue ctermbg=grey cterm=reverse,underline
+ hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=yellow ctermbg=black cterm=NONE
+ hi debugBreakpoint ctermfg=green ctermbg=darkblue cterm=reverse
+ hi debugPC ctermfg=cyan ctermbg=darkblue cterm=reverse
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=red ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=grey cterm=NONE
+ hi PreProc ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Type ctermfg=green ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi TabLineSel ctermfg=white ctermbg=black cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
+ hi Search ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+if s:t_Co >= 8
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=grey ctermbg=darkmagenta cterm=NONE
+ hi Error ctermfg=darkred ctermbg=grey cterm=reverse
+ hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=bold,reverse
+ hi IncSearch ctermfg=grey ctermbg=darkblue cterm=reverse
+ hi LineNr ctermfg=green ctermbg=NONE cterm=bold
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ModeMsg ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=grey ctermbg=blue cterm=NONE
+ 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 Question ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Search ctermfg=darkcyan ctermbg=blue cterm=NONE
+ hi SignColumn ctermfg=grey ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi StatusLine ctermfg=darkblue ctermbg=grey cterm=bold,reverse
+ hi StatusLineNC ctermfg=grey ctermbg=black cterm=reverse
+ hi VertSplit ctermfg=grey ctermbg=black cterm=reverse
+ hi TabLine ctermfg=grey ctermbg=black cterm=reverse
+ hi TabLineSel ctermfg=darkblue ctermbg=grey cterm=bold,reverse
+ hi ToolbarButton ctermfg=darkblue ctermbg=grey cterm=bold,reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=blue ctermbg=grey cterm=reverse
+ hi VisualNOS ctermfg=blue ctermbg=grey cterm=reverse,underline
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=yellow ctermbg=black cterm=NONE
+ hi debugBreakpoint ctermfg=darkgreen ctermbg=darkblue cterm=reverse
+ hi debugPC ctermfg=darkcyan ctermbg=darkblue cterm=reverse
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Todo ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-hi Comment guifg=#80a0ff ctermfg=darkred
-hi Constant ctermfg=magenta guifg=#ffa0a0 cterm=none
-hi Special ctermfg=brown guifg=Orange cterm=none gui=none
-hi Identifier ctermfg=cyan guifg=#40ffff cterm=none
-hi Statement ctermfg=yellow cterm=none guifg=#ffff60 gui=none
-hi PreProc ctermfg=magenta guifg=#ff80ff gui=none cterm=none
-hi type ctermfg=green guifg=#60ff60 gui=none cterm=none
-hi Underlined cterm=underline term=underline
-hi Ignore guifg=bg ctermfg=bg
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
-" suggested by tigmoid, 2008 Jul 18
-hi Pmenu guifg=#c0c0c0 guibg=#404080
-hi PmenuSel guifg=#c0c0c0 guibg=#2050d0
-hi PmenuSbar guifg=blue guibg=darkgray
-hi PmenuThumb guifg=#c0c0c0
+" Background: dark
+" Color: white #FFFFFF 231 white
+" Color: black #000000 16 black
+" Color: diffc #0087af 31 darkcyan
+" Color: difft #005f87 24 cyan
+" Color: cursorl #666666 59 darkgrey
+" Color: ogDeepBlue #000040 17 black
+" Color: ogDarkBlue #00008b 18 darkblue
+" Color: ogBlue #0030ff 27 blue
+" Color: ogLightBlue #287eff 33 blue
+" Color: ogDarkGrey #a9a9a9 248 grey
+" Color: ogGrey #808080 102 darkgrey
+" Color: ogLightGrey #c0c0c0 252 grey
+" Color: ogDarkViolet #404080 61 darkblue
+" Color: ogViolet #8080ff 105 blue
+" Color: ogLightViolet #80a0ff 111 blue
+" Color: ogDarkGreen #006400 22 darkgreen
+" Color: ogGreen #90f020 118 green
+" Color: ogDarkCyan #008b8b 30 darkcyan
+" Color: ogCyan #90fff0 123 cyan
+" Color: ogLightCyan #b0ffff 159 cyan
+" Color: ogDarkerRed #8b0000 88 darkred
+" Color: ogDarkRed #d14a14 166 darkred
+" Color: ogRed #ff0000 196 red
+" Color: ogLightRed #ffa0a0 217 red
+" Color: ogDarkMag #8b008b 90 darkmagenta
+" Color: ogMagenta #ff00ff 201 darkmagenta
+" Color: ogLightMag #ff80ff 213 magenta
+" Color: ogOrange #ffa500 214 darkyellow
+" Color: ogYellow #ffff60 227 yellow
+" Term colors: black ogDarkerRed ogGreen ogOrange ogDarkBlue ogDarkMag ogDarkCyan ogLightGrey
+" Term colors: ogGrey ogLightRed ogGreen ogYellow ogBlue ogMagenta ogCyan white
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim
index dd3a33a9e8..6bc1d1f699 100644
--- a/runtime/colors/delek.vim
+++ b/runtime/colors/delek.vim
@@ -1,54 +1,407 @@
-" Vim color file
-" Maintainer: David Schweikert <david@schweikert.ch>
-" Last Change: 2014 Mar 19
+" Name: delek
+" Description: Light background colorscheme.
+" Author: Original author David Schweikert <david@schweikert.ch>
+" Maintainer: Original maintainer David Schweikert <david@schweikert.ch>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:50:30 2022
+
+" Generated by Colortemplate v2.2.0
+
+set background=light
hi clear
+let g:colors_name = 'delek'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#ffffff', '#0000ff', '#00cd00', '#cd00cd', '#008b8b', '#0000ff', '#ff1493', '#bcbcbc', '#ee0000', '#0000ff', '#00cd00', '#cd00cd', '#008b8b', '#0000ff', '#ff1493', '#000000']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link ErrorMsg Error
+hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
+hi StatusLine guifg=#ffff00 guibg=#00008b gui=bold cterm=bold
+hi StatusLineNC guifg=#ffd700 guibg=#00008b gui=NONE cterm=NONE
+hi StatusLineTerm guifg=#ffff00 guibg=#0000ff gui=bold cterm=bold
+hi StatusLineTermNC guifg=#e4e4e4 guibg=#0000ff gui=NONE cterm=NONE
+hi VertSplit guifg=#e4e4e4 guibg=#00008b gui=NONE cterm=NONE
+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 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
+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 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
+hi LineNr guifg=#a52a2a guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#00008b guibg=NONE gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#a52a2a guibg=NONE gui=bold cterm=bold
+hi QuickFixLine guifg=#ffffff guibg=#008b8b gui=NONE cterm=NONE
+hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Underlined guifg=#6a5acd guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi WarningMsg guifg=#cd00cd guibg=#ffffff gui=NONE cterm=NONE
+hi MoreMsg guifg=#000000 guibg=#ffffff gui=bold cterm=bold
+hi ModeMsg guifg=#000000 guibg=#ffffff gui=bold cterm=bold
+hi Question guifg=#00cd00 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#ffffff guibg=#ff1493 gui=NONE cterm=NONE
+hi Search guifg=#ffffff guibg=#cd00cd gui=NONE cterm=NONE
+hi IncSearch guifg=#00cd00 guibg=NONE gui=reverse cterm=reverse
+hi WildMenu guifg=#00008b guibg=#ffd700 gui=bold cterm=bold
+hi ColorColumn guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE
+hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+hi lCursor guifg=#000000 guibg=#00cd00 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#008b8b guibg=NONE guisp=#008b8b gui=undercurl cterm=underline
+hi SpellLocal guifg=#0000ff guibg=NONE guisp=#0000ff gui=undercurl cterm=underline
+hi SpellRare guifg=#cd00cd guibg=NONE guisp=#cd00cd gui=undercurl cterm=underline
+hi debugBreakpoint guifg=#ffff00 guibg=#0000ff gui=NONE cterm=NONE
+hi debugPC guifg=#ff1493 guibg=#0000ff gui=NONE cterm=NONE
+hi Comment guifg=#ee0000 guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#00cd00 guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#0000ff guibg=NONE gui=bold cterm=bold
+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
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link ErrorMsg Error
+ hi Normal ctermfg=16 ctermbg=231 cterm=NONE
+ hi EndOfBuffer ctermfg=250 ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=226 ctermbg=18 cterm=bold
+ hi StatusLineNC ctermfg=220 ctermbg=18 cterm=NONE
+ hi StatusLineTerm ctermfg=226 ctermbg=21 cterm=bold
+ hi StatusLineTermNC ctermfg=254 ctermbg=21 cterm=NONE
+ hi VertSplit ctermfg=254 ctermbg=18 cterm=NONE
+ hi Pmenu ctermfg=16 ctermbg=152 cterm=NONE
+ 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 TabLine ctermfg=16 ctermbg=254 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=250 cterm=NONE
+ hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=254 cterm=NONE
+ 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 Folded ctermfg=18 ctermbg=254 cterm=NONE
+ hi Visual ctermfg=16 ctermbg=252 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=196 cterm=NONE
+ hi LineNr ctermfg=124 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=18 ctermbg=NONE cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=254 cterm=NONE
+ hi CursorLineNr ctermfg=124 ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=231 ctermbg=30 cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=62 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=231 cterm=reverse
+ hi WarningMsg ctermfg=164 ctermbg=231 cterm=NONE
+ hi MoreMsg ctermfg=16 ctermbg=231 cterm=bold
+ hi ModeMsg ctermfg=16 ctermbg=231 cterm=bold
+ hi Question ctermfg=40 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=16 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=231 ctermbg=198 cterm=NONE
+ hi Search ctermfg=231 ctermbg=164 cterm=NONE
+ hi IncSearch ctermfg=40 ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=18 ctermbg=220 cterm=bold
+ hi ColorColumn ctermfg=16 ctermbg=254 cterm=NONE
+ hi Cursor ctermfg=231 ctermbg=16 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=40 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=30 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=21 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=164 ctermbg=NONE cterm=underline
+ hi debugBreakpoint ctermfg=226 ctermbg=21 cterm=NONE
+ hi debugPC ctermfg=198 ctermbg=21 cterm=NONE
+ hi Comment ctermfg=196 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=40 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=21 ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=164 ctermbg=NONE cterm=NONE
+ 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
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=black ctermbg=white cterm=NONE
+ hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=yellow ctermbg=darkblue cterm=bold
+ hi StatusLineNC ctermfg=darkyellow ctermbg=darkblue cterm=NONE
+ hi StatusLineTerm ctermfg=yellow ctermbg=blue cterm=bold
+ hi StatusLineTermNC ctermfg=grey ctermbg=blue cterm=NONE
+ hi VertSplit ctermfg=grey ctermbg=darkblue cterm=NONE
+ hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ hi TabLineSel ctermfg=black ctermbg=white cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=grey cterm=NONE
+ 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 Folded ctermfg=darkblue ctermbg=grey cterm=NONE
+ hi Visual ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=darkred cterm=NONE
+ hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=grey cterm=NONE
+ hi CursorLineNr ctermfg=darkgrey ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=white ctermbg=darkcyan cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi Error ctermfg=red ctermbg=white cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=white cterm=NONE
+ hi MoreMsg ctermfg=black ctermbg=white cterm=bold
+ hi ModeMsg ctermfg=black ctermbg=white cterm=bold
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Todo ctermfg=black ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=white ctermbg=magenta cterm=NONE
+ hi Search ctermfg=white ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=darkblue ctermbg=darkyellow cterm=bold
+ hi ColorColumn ctermfg=black ctermbg=grey cterm=NONE
+ hi Cursor ctermfg=white ctermbg=black cterm=NONE
+ hi lCursor ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkmagenta ctermbg=NONE cterm=underline
+ hi debugBreakpoint ctermfg=yellow ctermbg=darkblue cterm=NONE
+ hi debugPC ctermfg=magenta ctermbg=darkblue cterm=NONE
+ hi Comment ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ 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
+ hi Visual ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-let g:colors_name = "delek"
-
-" Normal should come first
-hi Normal guifg=Black guibg=White
-hi Cursor guifg=bg guibg=fg
-hi lCursor guifg=NONE guibg=Cyan
-
-" Note: we never set 'term' because the defaults for B&W terminals are OK
-hi DiffAdd ctermbg=LightBlue guibg=LightBlue
-hi DiffChange ctermbg=LightMagenta guibg=LightMagenta
-hi DiffDelete ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan
-hi DiffText ctermbg=Red cterm=bold gui=bold guibg=Red
-hi Directory ctermfg=DarkBlue guifg=Blue
-hi ErrorMsg ctermfg=White ctermbg=DarkRed guibg=Red guifg=White
-hi FoldColumn ctermfg=DarkBlue ctermbg=Grey guibg=Grey guifg=DarkBlue
-hi Folded ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
-hi IncSearch cterm=reverse gui=reverse
-hi LineNr ctermfg=Brown guifg=Brown
-hi ModeMsg cterm=bold gui=bold
-hi MoreMsg ctermfg=DarkGreen gui=bold guifg=SeaGreen
-hi NonText ctermfg=Blue gui=bold guifg=gray guibg=white
-hi Pmenu guibg=LightBlue
-hi PmenuSel ctermfg=White ctermbg=DarkBlue guifg=White guibg=DarkBlue
-hi Question ctermfg=DarkGreen gui=bold guifg=SeaGreen
-if &background == "light"
- hi Search ctermfg=NONE ctermbg=Yellow guibg=Yellow guifg=NONE
-else
- hi Search ctermfg=Black ctermbg=Yellow guibg=Yellow guifg=Black
+if s:t_Co >= 8
+ hi Normal ctermfg=black ctermbg=gray cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=darkblue ctermbg=darkyellow cterm=bold,reverse
+ hi StatusLineNC ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi StatusLineTerm ctermfg=darkblue ctermbg=darkyellow cterm=bold,reverse
+ hi StatusLineTermNC ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi VertSplit ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ 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 TabLine ctermfg=gray ctermbg=black cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=black cterm=NONE
+ hi TabLineSel ctermfg=black ctermbg=gray cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ 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 Folded ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Error ctermfg=red ctermbg=gray cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkmagenta cterm=bold
+ hi Search ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi ColorColumn ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi SpellCap ctermfg=darkcyan ctermbg=black cterm=reverse
+ hi SpellLocal ctermfg=darkblue ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=NONE cterm=reverse
+ hi debugBreakpoint ctermfg=darkyellow ctermbg=darkblue cterm=NONE
+ hi debugPC ctermfg=darkmagenta ctermbg=darkblue cterm=NONE
+ hi Comment ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ 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
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
endif
-hi SpecialKey ctermfg=DarkBlue guifg=Blue
-hi StatusLine cterm=bold ctermbg=blue ctermfg=yellow guibg=gold guifg=blue
-hi StatusLineNC cterm=bold ctermbg=blue ctermfg=black guibg=gold guifg=blue
-hi Title ctermfg=DarkMagenta gui=bold guifg=Magenta
-hi VertSplit cterm=reverse gui=reverse
-hi Visual ctermbg=NONE cterm=reverse gui=reverse guifg=Grey guibg=fg
-hi WarningMsg ctermfg=DarkRed guifg=Red
-hi WildMenu ctermfg=Black ctermbg=Yellow guibg=Yellow guifg=Black
-
-" syntax highlighting
-hi Comment cterm=NONE ctermfg=DarkRed gui=NONE guifg=red2
-hi Constant cterm=NONE ctermfg=DarkGreen gui=NONE guifg=green3
-hi Identifier cterm=NONE ctermfg=DarkCyan gui=NONE guifg=cyan4
-hi PreProc cterm=NONE ctermfg=DarkMagenta gui=NONE guifg=magenta3
-hi Special cterm=NONE ctermfg=LightRed gui=NONE guifg=deeppink
-hi Statement cterm=bold ctermfg=Blue gui=bold guifg=blue
-hi Type cterm=NONE ctermfg=Blue gui=bold guifg=blue
-
-" vim: sw=2
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: light
+" Color: comment #ee0000 196 darkred
+" Color: constant #00cd00 40 darkgreen
+" Color: identifier #008b8b 30 darkcyan
+" Color: statement #0000ff 21 darkblue
+" Color: preproc #cd00cd 164 darkmagenta
+" Color: type #0000ff 21 blue
+" Color: special #ff1493 198 magenta
+" Color: fg0 #000000 16 black
+" Color: bg0 #ffffff 231 white
+" Color: bg1 #bcbcbc 250 darkgrey
+" Color: visual #d0d0d0 252 darkgrey
+" Color: folded #e4e4e4 254 grey
+" Color: pmenu #add8e6 152 grey
+" Color: wildmenu #00008b 18 darkblue
+" Color: error #ff0000 196 red
+" Color: status_fg #ffd700 220 darkyellow
+" Color: linenr #a52a2a 124 darkgrey
+" Color: Yellow #ffff00 226 yellow
+" Color: SlateBlue #6a5acd 62 blue
+" Color: black #000000 16 black
+" Color: darkred #870000 88 darkred
+" Color: darkgreen #008700 28 darkgreen
+" Color: darkyellow #878700 100 darkyellow
+" Color: darkblue #000087 18 darkblue
+" Color: darkmagenta #870087 18 darkmagenta
+" Color: darkcyan #008787 30 darkcyan
+" Color: gray #878787 102 gray
+" 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
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim
index 542e5ae015..6cc7c21ceb 100644
--- a/runtime/colors/desert.vim
+++ b/runtime/colors/desert.vim
@@ -1,106 +1,396 @@
-" Vim color file
-" Maintainer: Hans Fugal <hans@fugal.net>
-" Last Change: $Date: 2004/06/13 19:30:30 $
-" Last Change: $Date: 2004/06/13 19:30:30 $
-" URL: http://hans.fugal.net/vim/colors/desert.vim
-" Version: $Id: desert.vim,v 1.1 2004/06/13 19:30:30 vimboss Exp $
+" Name: desert
+" Description: Light background colorscheme.
+" Author: Original author Hans Fugal <hans@fugal.net>
+" Maintainer: Original maintainer Hans Fugal <hans@fugal.net>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:51:36 2022
-" cool help screens
-" :he group-name
-" :he highlight-groups
-" :he cterm-colors
+" Generated by Colortemplate v2.2.0
set background=dark
-if version > 580
- " no guarantees for version 5.8 and below, but this makes it stop
- " complaining
- hi clear
- if exists("syntax_on")
- syntax reset
- endif
-endif
-let g:colors_name="desert"
-hi Normal guifg=White guibg=grey20
+hi clear
+let g:colors_name = 'desert'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#7f7f8c', '#cd5c5c', '#9acd32', '#bdb76b', '#75a0ff', '#eeee00', '#cd853f', '#666666', '#8a7f7f', '#ff0000', '#89fb98', '#f0e68c', '#6dceeb', '#ffde9b', '#ffa0a0', '#c2bfa5']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link EndOfBuffer NonText
+hi Normal guifg=#ffffff guibg=#333333 gui=NONE cterm=NONE
+hi StatusLine guifg=#333333 guibg=#c2bfa5 gui=NONE cterm=NONE
+hi StatusLineNC guifg=#7f7f8c guibg=#c2bfa5 gui=NONE cterm=NONE
+hi StatusLineTerm guifg=#333333 guibg=#c2bfa5 gui=NONE cterm=NONE
+hi StatusLineTermNC guifg=#ffffff guibg=#c2bfa5 gui=NONE cterm=NONE
+hi VertSplit guifg=#7f7f8c guibg=#c2bfa5 gui=NONE cterm=NONE
+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 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
+hi ToolbarLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE
+hi ToolbarButton guifg=#333333 guibg=#ffde9b gui=bold cterm=bold
+hi NonText guifg=#6dceeb guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#9acd32 guibg=NONE gui=NONE cterm=NONE
+hi Folded guifg=#eeee00 guibg=#4d4d4d gui=NONE cterm=NONE
+hi Visual guifg=#f0e68c guibg=#6b8e24 gui=NONE cterm=NONE
+hi VisualNOS guifg=#f0e68c guibg=#6dceeb gui=NONE cterm=NONE
+hi LineNr guifg=#eeee00 guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#eeee00 guibg=#4d4d4d gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#666666 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#eeee00 guibg=NONE gui=bold cterm=bold
+hi QuickFixLine guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE
+hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Underlined guifg=#75a0ff guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi ErrorMsg guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi ModeMsg guifg=#ffde9b guibg=NONE gui=bold cterm=bold
+hi WarningMsg guifg=#cd5c5c guibg=NONE gui=bold cterm=bold
+hi MoreMsg guifg=#9acd32 guibg=NONE gui=bold cterm=bold
+hi Question guifg=#89fb98 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#ff0000 guibg=#eeee00 gui=NONE cterm=NONE
+hi MatchParen guifg=#7f7f8c guibg=#bdb76b gui=NONE cterm=NONE
+hi Search guifg=#f0e68c guibg=#7f7f8c gui=NONE cterm=NONE
+hi IncSearch guifg=#f0e68c guibg=#cd853f gui=NONE cterm=NONE
+hi WildMenu guifg=#333333 guibg=#eeee00 gui=NONE cterm=NONE
+hi ColorColumn guifg=#ffffff guibg=#cd5c5c gui=NONE cterm=NONE
+hi Cursor guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE
+hi lCursor guifg=#333333 guibg=#ff0000 gui=NONE cterm=NONE
+hi debugPC guifg=#666666 guibg=NONE gui=reverse cterm=reverse
+hi debugBreakpoint guifg=#ffa0a0 guibg=NONE gui=reverse cterm=reverse
+hi SpellBad guifg=#cd5c5c guibg=NONE guisp=#cd5c5c gui=undercurl cterm=underline
+hi SpellCap guifg=#75a0ff guibg=NONE guisp=#75a0ff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ffde9b guibg=NONE guisp=#ffde9b gui=undercurl cterm=underline
+hi SpellRare guifg=#9acd32 guibg=NONE guisp=#9acd32 gui=undercurl cterm=underline
+hi Comment guifg=#6dceeb guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#89fb98 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#f0e68c guibg=NONE gui=bold cterm=bold
+hi Constant guifg=#ffa0a0 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#cd5c5c guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#bdb76b guibg=NONE gui=bold cterm=bold
+hi Special guifg=#ffde9b guibg=NONE gui=NONE cterm=NONE
+hi Directory guifg=#6dceeb guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Title guifg=#cd5c5c 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
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
-" highlight groups
-hi Cursor guibg=khaki guifg=slategrey
-"hi CursorIM
-"hi Directory
-"hi DiffAdd
-"hi DiffChange
-"hi DiffDelete
-"hi DiffText
-"hi ErrorMsg
-hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none
-hi Folded guibg=grey30 guifg=gold
-hi FoldColumn guibg=grey30 guifg=tan
-hi IncSearch guifg=slategrey guibg=khaki
-"hi LineNr
-hi ModeMsg guifg=goldenrod
-hi MoreMsg guifg=SeaGreen
-hi NonText guifg=LightBlue guibg=grey30
-hi Question guifg=springgreen
-hi Search guibg=peru guifg=wheat
-hi SpecialKey guifg=yellowgreen
-hi StatusLine guibg=#c2bfa5 guifg=black gui=none
-hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none
-hi Title guifg=indianred
-hi Visual gui=none guifg=khaki guibg=olivedrab
-hi WarningMsg guifg=salmon
-"hi WildMenu
-"hi Menu
-"hi Scrollbar
-"hi Tooltip
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link EndOfBuffer NonText
+ hi Normal ctermfg=231 ctermbg=236 cterm=NONE
+ hi StatusLine ctermfg=236 ctermbg=144 cterm=NONE
+ hi StatusLineNC ctermfg=242 ctermbg=144 cterm=NONE
+ hi StatusLineTerm ctermfg=236 ctermbg=144 cterm=NONE
+ hi StatusLineTermNC ctermfg=231 ctermbg=144 cterm=NONE
+ hi VertSplit ctermfg=242 ctermbg=144 cterm=NONE
+ hi Pmenu ctermfg=231 ctermbg=241 cterm=NONE
+ 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 TabLine ctermfg=236 ctermbg=144 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=144 cterm=NONE
+ hi TabLineSel ctermfg=236 ctermbg=186 cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=241 cterm=NONE
+ hi ToolbarButton ctermfg=236 ctermbg=222 cterm=bold
+ hi NonText ctermfg=81 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=112 ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=226 ctermbg=239 cterm=NONE
+ hi Visual ctermfg=186 ctermbg=64 cterm=NONE
+ hi VisualNOS ctermfg=186 ctermbg=81 cterm=NONE
+ hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=226 ctermbg=239 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=241 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=241 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=236 ctermbg=186 cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=231 cterm=reverse
+ hi ErrorMsg ctermfg=196 ctermbg=231 cterm=reverse
+ hi ModeMsg ctermfg=222 ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=167 ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=112 ctermbg=NONE cterm=bold
+ hi Question ctermfg=120 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=196 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=242 ctermbg=143 cterm=NONE
+ hi Search ctermfg=186 ctermbg=242 cterm=NONE
+ hi IncSearch ctermfg=186 ctermbg=172 cterm=NONE
+ hi WildMenu ctermfg=236 ctermbg=226 cterm=NONE
+ hi ColorColumn ctermfg=231 ctermbg=167 cterm=NONE
+ hi debugPC ctermfg=241 ctermbg=NONE cterm=reverse
+ hi debugBreakpoint ctermfg=217 ctermbg=NONE cterm=reverse
+ hi SpellBad ctermfg=167 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=111 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=222 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=112 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=81 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=120 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=186 ctermbg=NONE cterm=bold
+ hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=167 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=143 ctermbg=NONE cterm=bold
+ hi Special ctermfg=222 ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=81 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=241 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=167 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-" syntax highlighting groups
-hi Comment guifg=SkyBlue
-hi Constant guifg=#ffa0a0
-hi Identifier guifg=palegreen
-hi Statement guifg=khaki
-hi PreProc guifg=indianred
-hi Type guifg=darkkhaki
-hi Special guifg=navajowhite
-"hi Underlined
-hi Ignore guifg=grey40
-"hi Error
-hi Todo guifg=orangered guibg=yellow2
+if s:t_Co >= 16
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi StatusLine ctermfg=black ctermbg=grey cterm=NONE
+ hi StatusLineNC ctermfg=darkgrey ctermbg=grey cterm=NONE
+ hi StatusLineTerm ctermfg=black ctermbg=grey cterm=NONE
+ hi StatusLineTermNC ctermfg=darkgrey ctermbg=grey cterm=NONE
+ hi VertSplit ctermfg=darkgrey ctermbg=grey cterm=NONE
+ hi Pmenu ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=white cterm=NONE
+ hi TabLineSel ctermfg=white ctermbg=black cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi NonText ctermfg=blue ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkyellow ctermbg=darkgrey cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=yellow cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Error ctermfg=red ctermbg=white cterm=reverse
+ hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse
+ hi ModeMsg ctermfg=magenta ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=green ctermbg=NONE cterm=bold
+ hi Todo ctermfg=red ctermbg=darkmagenta cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=yellow cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
+ hi debugPC ctermfg=grey ctermbg=NONE cterm=reverse
+ hi debugBreakpoint ctermfg=cyan ctermbg=NONE cterm=reverse
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=grey cterm=reverse
+ hi SpellLocal ctermfg=darkyellow ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=green ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=yellow ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Special ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE 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
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-" color terminal definitions
-hi SpecialKey ctermfg=darkgreen
-hi NonText cterm=bold ctermfg=darkblue
-hi Directory ctermfg=darkcyan
-hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1
-hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green
-hi Search cterm=NONE ctermfg=grey ctermbg=blue
-hi MoreMsg ctermfg=darkgreen
-hi ModeMsg cterm=NONE ctermfg=brown
-hi LineNr ctermfg=3
-hi Question ctermfg=green
-hi StatusLine cterm=bold,reverse
-hi StatusLineNC cterm=reverse
-hi VertSplit cterm=reverse
-hi Title ctermfg=5
-hi Visual cterm=reverse
-hi WarningMsg ctermfg=1
-hi WildMenu ctermfg=0 ctermbg=3
-hi Folded ctermfg=darkgrey ctermbg=NONE
-hi FoldColumn ctermfg=darkgrey ctermbg=NONE
-hi DiffAdd ctermbg=4
-hi DiffChange ctermbg=5
-hi DiffDelete cterm=bold ctermfg=4 ctermbg=6
-hi DiffText cterm=bold ctermbg=1
-hi Comment ctermfg=darkcyan
-hi Constant ctermfg=brown
-hi Special ctermfg=5
-hi Identifier ctermfg=6
-hi Statement ctermfg=3
-hi PreProc ctermfg=5
-hi Type ctermfg=2
-hi Underlined cterm=underline ctermfg=5
-hi Ignore cterm=bold ctermfg=7
-hi Ignore ctermfg=darkgrey
-hi Error cterm=bold ctermfg=7 ctermbg=1
+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=grey ctermbg=black cterm=reverse
+ 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 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=grey cterm=NONE
+ hi TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=grey cterm=reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=grey cterm=reverse
+ hi ModeMsg ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkred ctermbg=darkmagenta cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE
+ hi debugPC ctermfg=grey ctermbg=NONE cterm=reverse
+ hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=grey cterm=reverse
+ hi SpellLocal ctermfg=darkyellow ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Special ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE 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=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
-"vim: sw=4
+" Background: dark
+" Color: foreground #ffffff 231 white
+" Color: background #333333 236 black
+" Color: color00 #7f7f8c 242 black
+" Color: color08 #8a7f7f 244 darkgrey
+" Color: color01 #cd5c5c 167 darkred
+" Color: color09 #ff0000 196 red
+" Color: color02 #9acd32 112 darkgreen
+" Color: color10 #89fb98 120 green
+" Color: color03 #bdb76b 143 darkyellow
+" Color: color11 #f0e68c 186 yellow
+" Color: color04 #75a0ff 111 darkblue
+" Color: color12 #6dceeb 81 blue
+" Color: color05 #eeee00 226 darkmagenta
+" Color: color13 #ffde9b 222 magenta
+" Color: color06 #cd853f 172 darkcyan
+" Color: color14 #ffa0a0 217 cyan
+" Color: color07 #666666 241 grey
+" Color: color15 #c2bfa5 144 white
+" Color: color16 #6b8e24 64 darkgreen
+" Color: color17 #4d4d4d 239 grey
+" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
+" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim
index f74a828947..54a6afbd79 100644
--- a/runtime/colors/elflord.vim
+++ b/runtime/colors/elflord.vim
@@ -1,50 +1,447 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Ron Aaron <ron@ronware.org>
-" Last Change: 2003 May 02
+" Name: elflord
+" Author: original author Ron Aaron <ron@ronware.org>
+" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
+" Website: https://www.github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:48:00 2022
+
+" Generated by Colortemplate v2.2.0
set background=dark
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'elflord'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+hi! link Terminal Normal
+hi! link Boolean Constant
+hi! link Character Constant
+hi! link Conditional Repeat
+hi! link Debug Special
+hi! link Define PreProc
+hi! link Delimiter Special
+hi! link Exception Statement
+hi! link Float Number
+hi! link Include PreProc
+hi! link Keyword Statement
+hi! link Label Statement
+hi! link Macro PreProc
+hi! link Number Constant
+hi! link PopupSelected PmenuSel
+hi! link PreCondit PreProc
+hi! link SpecialChar Special
+hi! link SpecialComment Special
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link StorageClass Type
+hi! link String Constant
+hi! link Structure Type
+hi! link Tag Special
+hi! link Typedef Type
+hi! link lCursor Cursor
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi Normal guifg=#00ffff guibg=#000000 gui=NONE cterm=NONE
+hi QuickFixLine guifg=#ffffff guibg=#2e8b57 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#cd0000 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=bold
+hi Folded guifg=#00ffff guibg=#666666 gui=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
+hi Cursor guifg=#000000 guibg=#00ffff gui=NONE cterm=NONE
+hi Directory guifg=#00ffff guibg=#000000 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#0000ff guibg=#000000 gui=bold cterm=NONE
+hi ErrorMsg guifg=#ffffff guibg=#cd0000 gui=NONE cterm=NONE
+hi FoldColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi IncSearch guifg=NONE guibg=#000000 gui=reverse cterm=reverse
+hi LineNr guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi MatchParen guifg=NONE guibg=#008b8b gui=NONE cterm=NONE
+hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
+hi MoreMsg guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
+hi NonText guifg=#0000ff guibg=NONE gui=bold cterm=bold
+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 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
+hi SpecialKey guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#0000ff guibg=NONE guisp=#0000ff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ffff00 guibg=NONE guisp=#ffff00 gui=undercurl cterm=underline
+hi SpellRare guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi StatusLine guifg=#000000 guibg=#00ffff gui=bold cterm=bold
+hi StatusLineNC guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
+hi TabLine guifg=#000000 guibg=#008b8b gui=NONE cterm=NONE
+hi TabLineFill guifg=NONE guibg=#000000 gui=reverse cterm=reverse
+hi TabLineSel guifg=#00ffff guibg=#000000 gui=bold cterm=bold
+hi Terminal guifg=#00ffff guibg=#000000 gui=NONE cterm=NONE
+hi Title guifg=#ff00ff guibg=NONE gui=bold cterm=bold
+hi VertSplit guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
+hi Visual guifg=#000000 guibg=#a9a9a9 gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=#000000 gui=bold,underline cterm=underline
+hi WarningMsg guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi Comment guifg=#80a0ff guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE
+hi Error guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
+hi Function guifg=#ffffff guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#40ffff guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=#000000 guibg=#000000 gui=NONE cterm=NONE
+hi Operator guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#ff80ff guibg=NONE gui=NONE cterm=NONE
+hi Repeat guifg=#ffffff guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#aa4444 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#0000ff guibg=#ffff00 gui=NONE cterm=NONE
+hi Type guifg=#60ff60 guibg=NONE gui=bold cterm=bold
+hi Underlined guifg=#80a0ff guibg=NONE gui=underline cterm=underline
+hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=bold
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi Normal ctermfg=51 ctermbg=16 cterm=NONE
+ hi QuickFixLine ctermfg=231 ctermbg=29 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=160 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=bold
+ hi Folded ctermfg=51 ctermbg=59 cterm=NONE
+ hi Conceal ctermfg=59 ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=16 ctermbg=51 cterm=NONE
+ hi Directory ctermfg=51 ctermbg=16 cterm=NONE
+ hi EndOfBuffer ctermfg=21 ctermbg=16 cterm=NONE
+ hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE
+ hi FoldColumn ctermfg=51 ctermbg=NONE cterm=NONE
+ hi IncSearch ctermfg=NONE ctermbg=16 cterm=reverse
+ hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=30 cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=bold
+ hi NonText ctermfg=21 ctermbg=NONE cterm=bold
+ hi Pmenu ctermfg=231 ctermbg=238 cterm=NONE
+ 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 Question ctermfg=46 ctermbg=NONE cterm=bold
+ hi Search ctermfg=16 ctermbg=226 cterm=NONE
+ hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=51 ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=21 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=226 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=201 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=16 ctermbg=51 cterm=bold
+ hi StatusLineNC ctermfg=16 ctermbg=44 cterm=NONE
+ hi TabLine ctermfg=16 ctermbg=30 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=16 cterm=reverse
+ hi TabLineSel ctermfg=51 ctermbg=16 cterm=bold
+ hi Terminal ctermfg=51 ctermbg=16 cterm=NONE
+ hi Title ctermfg=201 ctermbg=NONE cterm=bold
+ hi VertSplit ctermfg=16 ctermbg=44 cterm=NONE
+ hi Visual ctermfg=16 ctermbg=145 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=16 cterm=underline
+ hi WarningMsg ctermfg=196 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi Comment ctermfg=111 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Error ctermfg=231 ctermbg=196 cterm=NONE
+ hi Function ctermfg=231 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=87 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=16 ctermbg=16 cterm=NONE
+ hi Operator ctermfg=196 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=213 ctermbg=NONE cterm=NONE
+ hi Repeat ctermfg=231 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=196 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=131 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=21 ctermbg=226 cterm=NONE
+ hi Type ctermfg=83 ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=16 ctermbg=254 cterm=bold
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let g:colors_name = "elflord"
-hi Normal guifg=cyan guibg=black
-hi Comment term=bold ctermfg=DarkCyan guifg=#80a0ff
-hi Constant term=underline ctermfg=Magenta guifg=Magenta
-hi Special term=bold ctermfg=DarkMagenta guifg=Red
-hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=#40ffff
-hi Statement term=bold ctermfg=Yellow gui=bold guifg=#aa4444
-hi PreProc term=underline ctermfg=LightBlue guifg=#ff80ff
-hi Type term=underline ctermfg=LightGreen guifg=#60ff60 gui=bold
-hi Function term=bold ctermfg=White guifg=White
-hi Repeat term=underline ctermfg=White guifg=white
-hi Operator ctermfg=Red guifg=Red
-hi Ignore ctermfg=black guifg=bg
-hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
-hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
-
-" Common groups that link to default highlighting.
-" You can specify other highlighting easily.
-hi link String Constant
-hi link Character Constant
-hi link Number Constant
-hi link Boolean Constant
-hi link Float Number
-hi link Conditional Repeat
-hi link Label Statement
-hi link Keyword Statement
-hi link Exception Statement
-hi link Include PreProc
-hi link Define PreProc
-hi link Macro PreProc
-hi link PreCondit PreProc
-hi link StorageClass Type
-hi link Structure Type
-hi link Typedef Type
-hi link Tag Special
-hi link SpecialChar Special
-hi link Delimiter Special
-hi link SpecialComment Special
-hi link Debug Special
+
+if s:t_Co >= 16
+ hi Normal ctermfg=cyan ctermbg=black cterm=NONE
+ hi QuickFixLine ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi ColorColumn ctermfg=cyan ctermbg=darkred cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=black ctermbg=cyan cterm=NONE
+ hi Directory ctermfg=cyan ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=black cterm=NONE
+ hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE
+ hi FoldColumn ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi IncSearch ctermfg=NONE ctermbg=black cterm=reverse
+ hi LineNr ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Pmenu ctermfg=white ctermbg=darkgrey cterm=NONE
+ 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 Question ctermfg=green ctermbg=NONE cterm=bold
+ hi Search ctermfg=black ctermbg=yellow cterm=NONE
+ hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=yellow ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=black ctermbg=cyan cterm=bold
+ hi StatusLineNC ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi TabLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=black cterm=reverse
+ hi TabLineSel ctermfg=cyan ctermbg=black cterm=bold
+ hi Terminal ctermfg=cyan ctermbg=black cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=bold
+ hi VertSplit ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi Visual ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi Comment ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Error ctermfg=white ctermbg=red cterm=NONE
+ hi Function ctermfg=white ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi Operator ctermfg=red ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Repeat ctermfg=white ctermbg=NONE cterm=NONE
+ hi Special ctermfg=red ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Todo ctermfg=blue ctermbg=yellow cterm=NONE
+ hi Type ctermfg=green ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=darkcyan ctermbg=black cterm=NONE
+ hi QuickFixLine ctermfg=grey ctermbg=darkgreen cterm=NONE
+ hi ColorColumn ctermfg=darkcyan ctermbg=darkred cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=underline
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi IncSearch ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=grey ctermbg=NONE cterm=NONE
+ 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 Question ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi SpellLocal ctermfg=darkyellow ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi StatusLine ctermfg=darkcyan ctermbg=NONE cterm=bold,reverse
+ hi StatusLineNC ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi TabLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Terminal ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi Visual ctermfg=black ctermbg=grey cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Comment ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Error ctermfg=grey ctermbg=darkred cterm=NONE
+ hi Function ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=NONE cterm=NONE
+ hi Operator ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Repeat ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=grey cterm=NONE
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: dark
+" Color: xterm0 #000000 16 black
+" Color: xterm1 #cd0000 160 darkred
+" Color: xterm2 #00cd00 40 darkgreen
+" Color: xterm3 #cdcd00 184 darkyellow
+" Color: xterm4 #0000ee 20 darkblue
+" Color: xterm5 #cd00cd 164 darkmagenta
+" Color: xterm6 #00cdcd 44 darkcyan
+" Color: xterm7 #e5e5e5 254 grey
+" Color: xterm8 #7f7f7f 102 darkgrey
+" Color: xterm9 #ff0000 196 red
+" Color: xterm10 #00ff00 46 green
+" Color: xterm11 #ffff00 226 yellow
+" Color: xterm12 #5c5cff 63 blue
+" Color: xterm13 #ff00ff 201 magenta
+" Color: xterm14 #00ffff 51 cyan
+" Color: xterm15 #ffffff 231 white
+" Color: Pmenu #444444 238 darkgrey
+" Color: CursorLine #3a3a3a 237 darkgrey
+" Color: rgbGrey40 #666666 59 darkgrey
+" Color: rgbDarkGrey #a9a9a9 145 darkgrey
+" Color: rgbBlue #0000ff 21 darkblue
+" Color: rgbDarkCyan #008b8b 30 darkcyan
+" Color: Directory #00ffff 51 cyan
+" Color: rgbSeaGreen #2e8b57 29 darkgreen
+" Color: rgbGrey #bebebe 250 grey
+" Color: Question #00ff00 46 green
+" Color: SignColumn #a9a9a9 248 grey
+" Color: SpecialKey #00ffff 51 cyan
+" Color: Title #ff00ff 201 magenta
+" Color: WarningMsg #ff0000 196 red
+" Color: ToolbarLine #7f7f7f 244 darkgrey
+" Color: Underlined #80a0ff 111 blue
+" Color: elfComment #80a0ff 111 blue
+" Color: elfIdentifier #40ffff 87 cyan
+" Color: elfStatement #aa4444 131 darkred
+" Color: elfPreProc #ff80ff 213 magenta
+" Color: elfType #60ff60 83 green
+" Color: elfBlue #0000ff 21 blue
+" Term colors: xterm0 xterm1 xterm2 xterm3 xterm4 xterm5 xterm6 xterm7
+" Term colors: xterm8 xterm9 xterm10 xterm11 xterm12 xterm13
+" Term colors: xterm14 xterm15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim
index 5257307593..777c37e3ae 100644
--- a/runtime/colors/evening.vim
+++ b/runtime/colors/evening.vim
@@ -1,55 +1,512 @@
-" Vim color file
-" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2016 Oct 10
+" Name: evening
+" Description: This color scheme uses a dark grey background.
+" Author: Original author Bram Moolenaar <Bram@vim.org>
+" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:52:56 2022
-" This color scheme uses a dark grey background.
+" Generated by Colortemplate v2.2.0
-" First remove all existing highlighting.
set background=dark
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'evening'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#ffa500', '#2e8b57', '#ffff00', '#006faf', '#8b008b', '#008b8b', '#bebebe', '#4d4d4d', '#ff5f5f', '#00ff00', '#ffff60', '#0087ff', '#ff80ff', '#00ffff', '#ffffff']
+endif
+hi! link VertSplit StatusLineNC
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link TabLineFill TabLine
+hi! link Terminal Normal
+hi! link CursorColumn CursorLine
+hi! link CursorIM Cursor
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link Debug Special
+hi! link diffAdded String
+hi! link diffRemoved WarningMsg
+hi! link diffOnly WarningMsg
+hi! link diffNoEOL WarningMsg
+hi! link diffIsA WarningMsg
+hi! link diffIdentical WarningMsg
+hi! link diffDiffer WarningMsg
+hi! link diffCommon WarningMsg
+hi! link diffBDiffer WarningMsg
+hi! link lCursor Cursor
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link Boolean Constant
+hi! link Character Constant
+hi! link Conditional Statement
+hi! link Define PreProc
+hi! link Delimiter Special
+hi! link Exception Statement
+hi! link Float Constant
+hi! link Function Identifier
+hi! link Include PreProc
+hi! link Keyword Statement
+hi! link Label Statement
+hi! link Macro PreProc
+hi! link Number Constant
+hi! link Operator Statement
+hi! link PreCondit PreProc
+hi! link Repeat Statement
+hi! link SpecialChar Special
+hi! link SpecialComment Special
+hi! link StorageClass Type
+hi! link String Constant
+hi! link Structure Type
+hi! link Tag Special
+hi! link Typedef Type
+hi Normal guifg=#ffffff guibg=#333333 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#8b0000 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffff00 guibg=#666666 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#add8e6 guibg=#4d4d4d gui=NONE cterm=NONE
+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 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
+hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
+hi QuickFixLine guifg=#ffffff guibg=#8b008b gui=NONE cterm=NONE
+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 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
+hi MatchParen guifg=NONE guibg=#008b8b gui=NONE cterm=NONE
+hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
+hi MoreMsg guifg=#2e8b57 guibg=NONE gui=NONE cterm=NONE
+hi NonText guifg=#add8e6 guibg=#4d4d4d gui=NONE cterm=NONE
+hi Question guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Search guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi SignColumn guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi ToolbarButton guifg=NONE guibg=#999999 gui=bold cterm=bold
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Visual guifg=#ffffff guibg=#999999 gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=NONE gui=bold,underline ctermfg=NONE ctermbg=NONE cterm=bold,underline
+hi WarningMsg guifg=#8b0000 guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=bold cterm=bold
+hi debugBreakpoint guifg=#00008b guibg=#ff0000 gui=NONE cterm=NONE
+hi debugPC guifg=#00008b guibg=#0000ff gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#00ff00 guibg=NONE guisp=#00ff00 gui=undercurl cterm=underline
+hi SpellLocal guifg=#00ffff guibg=NONE guisp=#00ffff gui=undercurl cterm=underline
+hi SpellRare guifg=#ff80ff guibg=NONE guisp=#ff80ff gui=undercurl cterm=underline
+hi Directory guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Title guifg=#ff80ff guibg=NONE gui=NONE cterm=NONE
+hi Comment guifg=#80a0ff guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ffa0a0 guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=#333333 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#ff80ff guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ffa500 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffff60 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#ffff00 guibg=#0000ff gui=reverse cterm=reverse
+hi Type guifg=#00ff00 guibg=NONE gui=bold cterm=bold
+hi Underlined guifg=#80a0ff guibg=NONE gui=underline cterm=underline
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link VertSplit StatusLineNC
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLineFill TabLine
+ hi! link Terminal Normal
+ hi! link CursorColumn CursorLine
+ hi! link CursorIM Cursor
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link Debug Special
+ hi! link diffAdded String
+ hi! link diffRemoved WarningMsg
+ hi! link diffOnly WarningMsg
+ hi! link diffNoEOL WarningMsg
+ hi! link diffIsA WarningMsg
+ hi! link diffIdentical WarningMsg
+ hi! link diffDiffer WarningMsg
+ hi! link diffCommon WarningMsg
+ hi! link diffBDiffer WarningMsg
+ hi! link lCursor Cursor
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi! link Conditional Statement
+ hi! link Define PreProc
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi! link Function Identifier
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi! link StorageClass Type
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi! link Typedef Type
+ hi Normal ctermfg=231 ctermbg=236 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=88 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=241 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=241 cterm=NONE
+ hi EndOfBuffer ctermfg=153 ctermbg=239 cterm=NONE
+ hi StatusLine ctermfg=236 ctermbg=231 cterm=bold
+ 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 Pmenu ctermfg=231 ctermbg=239 cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuSel ctermfg=16 ctermbg=250 cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE
+ hi QuickFixLine ctermfg=231 ctermbg=90 cterm=NONE
+ hi Cursor ctermfg=16 ctermbg=46 cterm=NONE
+ 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 FoldColumn ctermfg=153 ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=18 ctermbg=252 cterm=bold
+ hi IncSearch ctermfg=46 ctermbg=NONE cterm=reverse
+ hi MatchParen ctermfg=NONE ctermbg=30 cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=153 ctermbg=239 cterm=NONE
+ hi Question ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Search ctermfg=16 ctermbg=226 cterm=NONE
+ hi SignColumn ctermfg=30 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=51 ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=246 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=231 ctermbg=246 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=bold,underline
+ hi WarningMsg ctermfg=88 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=bold
+ hi debugBreakpoint ctermfg=18 ctermbg=196 cterm=NONE
+ hi debugPC ctermfg=18 ctermbg=21 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=46 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=51 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=201 ctermbg=NONE cterm=underline
+ hi Directory ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Title ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=111 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=236 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=214 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=227 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=226 ctermbg=21 cterm=reverse
+ hi Type ctermfg=46 ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi! link VertSplit StatusLineNC
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLineFill TabLine
+ hi! link Terminal Normal
+ hi! link CursorColumn CursorLine
+ hi! link CursorIM Cursor
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link Debug Special
+ hi! link diffAdded String
+ hi! link diffRemoved WarningMsg
+ hi! link diffOnly WarningMsg
+ hi! link diffNoEOL WarningMsg
+ hi! link diffIsA WarningMsg
+ hi! link diffIdentical WarningMsg
+ hi! link diffDiffer WarningMsg
+ hi! link diffCommon WarningMsg
+ hi! link diffBDiffer WarningMsg
+ hi! link lCursor Cursor
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi! link Conditional Statement
+ hi! link Define PreProc
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi! link Function Identifier
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi! link StorageClass Type
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi! link Typedef Type
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=underline
+ hi EndOfBuffer ctermfg=lightblue ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=black ctermbg=white cterm=NONE
+ 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 Pmenu ctermfg=white ctermbg=darkgray cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi QuickFixLine ctermfg=white ctermbg=darkmagenta cterm=NONE
+ hi Cursor ctermfg=black ctermbg=green cterm=NONE
+ 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 FoldColumn ctermfg=lightblue ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=gray cterm=bold
+ hi IncSearch ctermfg=green ctermbg=NONE cterm=reverse
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=lightblue ctermbg=darkgray cterm=NONE
+ hi Question ctermfg=green ctermbg=NONE cterm=NONE
+ hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=darkgray cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=white ctermbg=darkgray cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=bold,underline
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=bold
+ hi debugBreakpoint ctermfg=darkblue ctermbg=red cterm=NONE
+ hi debugPC ctermfg=darkblue ctermbg=blue cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=green ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=cyan ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkmagenta ctermbg=NONE cterm=underline
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=lightblue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=gray ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=yellow ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkyellow ctermbg=blue cterm=reverse
+ hi Type ctermfg=green ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=lightblue ctermbg=NONE cterm=underline
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=gray ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=gray ctermbg=darkred cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=blue ctermbg=NONE cterm=bold
+ hi StatusLine ctermfg=gray ctermbg=black cterm=bold,reverse
+ hi StatusLineNC ctermfg=gray ctermbg=black cterm=reverse
+ hi TabLineSel ctermfg=gray ctermbg=black cterm=bold,reverse
+ hi TabLine ctermfg=gray ctermbg=black cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ 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 QuickFixLine ctermfg=gray ctermbg=darkmagenta cterm=NONE
+ hi Error ctermfg=red ctermbg=gray cterm=reverse
+ hi ErrorMsg ctermfg=gray ctermbg=red cterm=NONE
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=gray cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=blue ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi debugBreakpoint ctermfg=darkblue ctermbg=darkred cterm=NONE
+ hi debugPC ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=gray ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Special ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkyellow ctermbg=blue cterm=reverse
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let colors_name = "evening"
-
-hi Normal ctermbg=DarkGrey ctermfg=White guifg=White guibg=grey20
-
-" Groups used in the 'highlight' and 'guicursor' options default value.
-hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
-hi IncSearch term=reverse cterm=reverse gui=reverse
-hi ModeMsg term=bold cterm=bold gui=bold
-hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
-hi StatusLineNC term=reverse cterm=reverse gui=reverse
-hi VertSplit term=reverse cterm=reverse gui=reverse
-hi Visual term=reverse ctermbg=black guibg=grey60
-hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
-hi Cursor guibg=Green guifg=Black
-hi lCursor guibg=Cyan guifg=Black
-hi Directory term=bold ctermfg=LightCyan guifg=Cyan
-hi LineNr term=underline ctermfg=Yellow guifg=Yellow
-hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen
-hi NonText term=bold ctermfg=LightBlue gui=bold guifg=LightBlue guibg=grey30
-hi Question term=standout ctermfg=LightGreen gui=bold guifg=Green
-hi Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
-hi SpecialKey term=bold ctermfg=LightBlue guifg=Cyan
-hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta
-hi WarningMsg term=standout ctermfg=LightRed guifg=Red
-hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
-hi Folded term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
-hi FoldColumn term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
-hi DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue
-hi DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta
-hi DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan
-hi CursorColumn term=reverse ctermbg=Black guibg=grey40
-hi CursorLine term=underline cterm=underline guibg=grey40
-
-" Groups for syntax highlighting
-hi Constant term=underline ctermfg=Magenta guifg=#ffa0a0
-hi Special term=bold ctermfg=LightRed guifg=Orange
-if &t_Co > 8
- hi Statement term=bold cterm=bold ctermfg=Yellow guifg=#ffff60 gui=bold
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
endif
-hi Ignore ctermfg=DarkGrey guifg=grey20
-" vim: sw=2
+" Background: dark
+" Color: lightmagenta #ffa0a0 217 magenta
+" Color: blue #0000ff 21 blue
+" Color: cyan #00ffff 51 cyan
+" Color: yellow #ffff00 226 darkyellow
+" Color: white #ffffff 231 white
+" Color: black #000000 16 black
+" Color: green #00ff00 46 green
+" Color: magenta #ff80ff 201 darkmagenta
+" Color: red #ff0000 196 red
+" Color: lightyellow #ffff60 227 yellow
+" Color: darkblue #00008b 18 darkblue
+" Color: darkcyan #008b8b 30 darkcyan
+" Color: darkmagenta #8b008b 90 darkmagenta
+" Color: lightblue #add8e6 153 lightblue
+" Color: orange #ffa500 214 darkred
+" Color: seagreen #2e8b57 29 darkgreen
+" Color: lightgrey #d3d3d3 252 gray
+" Color: grey #bebebe 250 gray
+" Color: grey20 #333333 236 gray
+" Color: grey30 #4d4d4d 239 darkgray
+" Color: grey40 #666666 241 darkgray
+" Color: grey60 #999999 246 darkgray
+" Color: xtermblue #0087ff 33 blue
+" Color: xtermdarkblue #006faf 25 darkblue
+" Color: xtermred #ff5f5f 203 red
+" Color: comment #80a0ff 111 lightblue
+" Color: darkred #8b0000 88 darkred
+" Term colors: black orange seagreen yellow xtermdarkblue darkmagenta darkcyan grey
+" Term colors: grey30 xtermred green lightyellow xtermblue magenta cyan white
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim
index ac9103b5c5..41bfe129e7 100644
--- a/runtime/colors/industry.vim
+++ b/runtime/colors/industry.vim
@@ -1,40 +1,406 @@
-" Vim color file
-" Maintainer: Shian Lee
-" Last Change: 2014 Mar 6 (for vim 7.4)
-" Remark: "industry" stands for 'industrial' color scheme. In industrial
-" HMI (Human-Machine-Interface) programming, using a standard color
-" scheme is mandatory in many cases (in traffic-lights for example):
-" LIGHT_RED is 'Warning'
-" LIGHT_YELLOW is 'Attention'
-" LIGHT_GREEN is 'Normal'
-" LIGHT_MAGENTA is 'Warning-Attention' (light RED-YELLOW)
-" LIGHT_CYAN is 'Attention-Normal' (light YELLOW-GREEN).
-" BLACK is Dark-High-Contrast Background for maximum safety.
-" BLUE is Shade of BLACK (not supposed to get attention).
-"
-" Industrial color scheme is by nature clear, safe and productive.
-" Yet, depends on the file type's syntax, it might appear incorrect.
-
-" Reset to dark background, then reset everything to defaults:
+" Name: industry
+" Description: "industry" stands for 'industrial' color scheme.
+" Author: Original author Shian Lee.
+" Maintainer: Original maintainer Shian Lee.
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:53:58 2022
+
+" Generated by Colortemplate v2.2.0
+
set background=dark
-highlight clear
-if exists("syntax_on")
- syntax reset
+
+hi clear
+let g:colors_name = 'industry'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#303030', '#870000', '#5fd75f', '#afaf00', '#87afff', '#af00af', '#00afaf', '#6c6c6c', '#444444', '#ff0000', '#00ff00', '#ffff00', '#005fff', '#ff00ff', '#00ffff', '#ffffff']
endif
+hi Normal guifg=#dadada guibg=#000000 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#444444 guibg=#000000 gui=NONE cterm=NONE
+hi StatusLine guifg=#000000 guibg=#dadada gui=bold cterm=bold
+hi StatusLineNC guifg=#000000 guibg=#6c6c6c gui=NONE cterm=NONE
+hi StatusLineTerm guifg=#000000 guibg=#00ff00 gui=bold cterm=bold
+hi StatusLineTermNC guifg=#000000 guibg=#5fd75f gui=NONE cterm=NONE
+hi VertSplit guifg=#000000 guibg=#6c6c6c gui=NONE cterm=NONE
+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 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
+hi ToolbarButton guifg=#dadada guibg=#6c6c6c gui=bold cterm=bold
+hi ToolbarLine guifg=NONE guibg=#303030 gui=NONE cterm=NONE
+hi NonText guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi Folded guifg=#00afaf guibg=#303030 gui=NONE cterm=NONE
+hi Visual guifg=#dadada guibg=#6c6c6c gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#6c6c6c gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#6c6c6c gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=bold
+hi ColorColumn guifg=NONE guibg=#444444 gui=NONE cterm=NONE
+hi QuickFixLine guifg=#000000 guibg=#ff00ff gui=NONE cterm=NONE
+hi VisualNOS guifg=#dadada guibg=#6c6c6c gui=NONE cterm=NONE
+hi LineNr guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi Underlined guifg=#87afff guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
+hi ErrorMsg guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
+hi ModeMsg guifg=#ffffff guibg=NONE gui=bold cterm=bold
+hi WarningMsg guifg=#870000 guibg=NONE gui=bold cterm=bold
+hi MoreMsg guifg=#5fd75f guibg=NONE gui=bold cterm=bold
+hi Question guifg=#00ff00 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#005fff guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#303030 guibg=#afaf00 gui=NONE cterm=NONE
+hi Search guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi IncSearch guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi Cursor guifg=#000000 guibg=#dadada gui=NONE cterm=NONE
+hi lCursor guifg=#000000 guibg=#ff0000 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#005fff guibg=NONE guisp=#005fff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi SpellRare guifg=#00ff00 guibg=NONE guisp=#00ff00 gui=undercurl cterm=underline
+hi Comment guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE
+hi Function guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffffff guibg=NONE gui=bold cterm=bold
+hi Constant guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#00ff00 guibg=NONE gui=bold cterm=bold
+hi Special guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi Delimiter guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi Directory guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#6c6c6c guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Title guifg=#ff00ff guibg=NONE gui=bold cterm=bold
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
-let colors_name = "industry"
+if s:t_Co >= 256
+ hi Normal ctermfg=253 ctermbg=16 cterm=NONE
+ hi EndOfBuffer ctermfg=238 ctermbg=16 cterm=NONE
+ hi StatusLine ctermfg=16 ctermbg=253 cterm=bold
+ hi StatusLineNC ctermfg=16 ctermbg=242 cterm=NONE
+ hi StatusLineTerm ctermfg=16 ctermbg=46 cterm=bold
+ hi StatusLineTermNC ctermfg=16 ctermbg=77 cterm=NONE
+ hi VertSplit ctermfg=16 ctermbg=242 cterm=NONE
+ hi Pmenu ctermfg=253 ctermbg=238 cterm=NONE
+ 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 TabLine ctermfg=253 ctermbg=238 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=242 cterm=NONE
+ hi TabLineSel ctermfg=231 ctermbg=16 cterm=bold
+ hi ToolbarButton ctermfg=253 ctermbg=242 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=236 cterm=NONE
+ hi NonText ctermfg=37 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=37 ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=37 ctermbg=236 cterm=NONE
+ hi Visual ctermfg=253 ctermbg=242 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=242 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=242 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=NONE ctermbg=238 cterm=NONE
+ hi QuickFixLine ctermfg=16 ctermbg=201 cterm=NONE
+ hi VisualNOS ctermfg=253 ctermbg=242 cterm=NONE
+ hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=37 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=37 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi Error ctermfg=231 ctermbg=196 cterm=NONE
+ hi ErrorMsg ctermfg=231 ctermbg=196 cterm=NONE
+ hi ModeMsg ctermfg=231 ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=88 ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=77 ctermbg=NONE cterm=bold
+ hi Question ctermfg=46 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=27 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=236 ctermbg=142 cterm=NONE
+ hi Search ctermfg=16 ctermbg=226 cterm=NONE
+ hi IncSearch ctermfg=16 ctermbg=46 cterm=NONE
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi Cursor ctermfg=16 ctermbg=253 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=196 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=27 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=201 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=46 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=37 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Function ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=231 ctermbg=NONE cterm=bold
+ hi Constant ctermfg=51 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=226 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=46 ctermbg=NONE cterm=bold
+ hi Special ctermfg=196 ctermbg=NONE cterm=NONE
+ hi Delimiter ctermfg=226 ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=242 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=201 ctermbg=NONE cterm=bold
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-" First set Normal to regular white on black text colors:
-hi Normal ctermfg=LightGray ctermbg=Black guifg=#dddddd guibg=Black
+if s:t_Co >= 16
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=darkgrey ctermbg=black cterm=NONE
+ hi StatusLine ctermfg=black ctermbg=white cterm=bold
+ hi StatusLineNC ctermfg=black ctermbg=grey cterm=NONE
+ hi StatusLineTerm ctermfg=black ctermbg=green cterm=bold
+ hi StatusLineTermNC ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=grey cterm=NONE
+ hi Pmenu ctermfg=white ctermbg=darkgrey cterm=NONE
+ 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 TabLine ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
+ hi TabLineSel ctermfg=white ctermbg=black cterm=bold
+ hi ToolbarButton ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
+ hi NonText ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=black ctermbg=grey cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
+ hi ColorColumn ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
+ hi VisualNOS ctermfg=white ctermbg=grey cterm=NONE
+ hi LineNr ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Error ctermfg=white ctermbg=red cterm=NONE
+ hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE
+ hi ModeMsg ctermfg=white ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=green ctermbg=NONE cterm=bold
+ hi Todo ctermfg=blue ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=black ctermbg=yellow cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=green cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi Cursor ctermfg=black ctermbg=white cterm=NONE
+ hi lCursor ctermfg=black ctermbg=red cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=magenta ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=green ctermbg=NONE cterm=underline
+ hi Comment ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Function ctermfg=green ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=white ctermbg=NONE cterm=bold
+ hi Constant ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Type ctermfg=green ctermbg=NONE cterm=bold
+ hi Special ctermfg=red ctermbg=NONE cterm=NONE
+ hi Delimiter ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=bold
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
-" Syntax highlighting (other color-groups using default, see :help group-name):
-hi Comment cterm=NONE ctermfg=DarkCyan gui=NONE guifg=#00aaaa
-hi Constant cterm=NONE ctermfg=LightCyan gui=NONE guifg=#00ffff
-hi Identifier cterm=NONE ctermfg=LightMagenta gui=NONE guifg=#ff00ff
-hi Function cterm=NONE ctermfg=LightGreen gui=NONE guifg=#00ff00
-hi Statement cterm=NONE ctermfg=White gui=bold guifg=#ffffff
-hi PreProc cterm=NONE ctermfg=Yellow gui=NONE guifg=#ffff00
-hi Type cterm=NONE ctermfg=LightGreen gui=bold guifg=#00ff00
-hi Special cterm=NONE ctermfg=LightRed gui=NONE guifg=#ff0000
-hi Delimiter cterm=NONE ctermfg=Yellow gui=NONE guifg=#ffff00
+if s:t_Co >= 8
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=grey ctermbg=black cterm=bold
+ hi StatusLine ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi StatusLineNC ctermfg=grey ctermbg=black cterm=reverse
+ hi StatusLineTerm ctermfg=darkgreen ctermbg=black cterm=bold,reverse
+ hi StatusLineTermNC ctermfg=darkgreen ctermbg=black cterm=reverse
+ hi VertSplit ctermfg=grey ctermbg=black cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
+ hi NonText ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi VisualNOS ctermfg=black ctermbg=grey cterm=NONE
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=grey ctermbg=darkred cterm=NONE
+ hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
+ hi ModeMsg ctermfg=grey ctermbg=NONE cterm=NONE
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi SpellRare ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Function ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=grey ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Special ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Delimiter ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkcyan 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
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+" Background: dark
+" Color: foreground #dadada 253 white
+" Color: background #000000 16 black
+" Color: color00 #303030 236 black
+" Color: color08 #444444 238 darkgrey
+" Color: color01 #870000 88 darkred
+" Color: color09 #FF0000 196 red
+" Color: color02 #5FD75F 77 darkgreen
+" Color: color10 #00FF00 46 green
+" Color: color03 #AFAF00 142 darkyellow
+" Color: color11 #FFFF00 226 yellow
+" Color: color04 #87AFFF 111 darkblue
+" Color: color12 #005FFF 27 blue
+" Color: color05 #AF00AF 127 darkmagenta
+" Color: color13 #FF00FF 201 magenta
+" Color: color06 #00AFAF 37 darkcyan
+" Color: color14 #00FFFF 51 cyan
+" Color: color07 #6C6C6C 242 grey
+" Color: color15 #FFFFFF 231 white
+" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
+" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim
index 250472a162..ecbc854030 100644
--- a/runtime/colors/koehler.vim
+++ b/runtime/colors/koehler.vim
@@ -1,73 +1,424 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Ron Aaron <ron@ronware.org>
-" Last Change: 2016 Sep 04
+" Name: koehler
+" Author: original author Ron Aaron <ron@ronware.org>
+" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
+" Website: https://www.github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sat 11 Jun 2022 11:24:58 MSK
+
+" Generated by Colortemplate v2.2.0
-hi clear
set background=dark
-if exists("syntax_on")
- syntax reset
+
+hi clear
+let g:colors_name = 'koehler'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+hi! link Terminal Normal
+hi! link Boolean Constant
+hi! link Character Constant
+hi! link Conditional Statement
+hi! link Debug Special
+hi! link Define PreProc
+hi! link Delimiter Special
+hi! link Exception Statement
+hi! link Float Number
+hi! link Function Identifier
+hi! link Include PreProc
+hi! link IncSearch Visual
+hi! link Keyword Statement
+hi! link Label Statement
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link Macro PreProc
+hi! link Number Constant
+hi! link Operator Statement
+hi! link PopupSelected PmenuSel
+hi! link PreCondit PreProc
+hi! link Repeat Statement
+hi! link SpecialChar Special
+hi! link SpecialComment Special
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link StorageClass Type
+hi! link String Constant
+hi! link Structure Type
+hi! link Tag Special
+hi! link Typedef Type
+hi! link lCursor Cursor
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi Normal guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#8b0000 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#555555 gui=NONE cterm=NONE
+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 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
+hi ErrorMsg guifg=#cd0000 guibg=#ffffff gui=reverse cterm=reverse
+hi FoldColumn guifg=#00cdcd guibg=NONE gui=NONE cterm=NONE
+hi LineNr guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi MatchParen guifg=NONE guibg=#0000ff gui=NONE cterm=NONE
+hi ModeMsg guifg=#ffffff guibg=#0000ff gui=bold cterm=bold
+hi MoreMsg guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
+hi NonText guifg=#cd0000 guibg=NONE gui=bold cterm=bold
+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 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
+hi SpecialKey guifg=#cd0000 guibg=NONE gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#60ff60 guibg=NONE guisp=#60ff60 gui=undercurl cterm=underline
+hi SpellLocal guifg=#00ffff guibg=NONE guisp=#00ffff gui=undercurl cterm=underline
+hi SpellRare guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi StatusLine guifg=#0000ff guibg=#ffffff gui=bold cterm=bold
+hi StatusLineNC guifg=#0000ff guibg=#e5e5e5 gui=NONE cterm=NONE
+hi TabLine guifg=#0000ff guibg=#ffffff gui=bold cterm=bold
+hi TabLineFill guifg=#0000ff guibg=#ffffff gui=bold cterm=bold
+hi TabLineSel guifg=#ffffff guibg=#0000ff gui=bold cterm=bold
+hi Title guifg=#ff00ff guibg=NONE gui=bold cterm=bold
+hi VertSplit guifg=#0000ff guibg=#e5e5e5 gui=NONE cterm=NONE
+hi Visual guifg=NONE guibg=#666666 gui=reverse cterm=reverse
+hi VisualNOS guifg=NONE guibg=#000000 gui=bold,underline cterm=underline
+hi WarningMsg guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi Comment guifg=#80a0ff guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ffa0a0 guibg=NONE gui=NONE cterm=NONE
+hi Error guifg=#cd0000 guibg=#ffffff gui=reverse cterm=reverse
+hi Identifier guifg=#40ffff guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=#000000 guibg=#000000 gui=NONE cterm=NONE
+hi PreProc guifg=#ff80ff guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ffa500 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffff60 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#0000ff guibg=#ffff00 gui=NONE cterm=NONE
+hi Type guifg=#60ff60 guibg=NONE gui=bold cterm=bold
+hi Underlined guifg=#add8e6 guibg=NONE gui=bold,underline cterm=underline
+hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=bold
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi Normal ctermfg=231 ctermbg=16 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=88 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=240 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=240 cterm=NONE
+ 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 Cursor ctermfg=16 ctermbg=46 cterm=NONE
+ hi Directory ctermfg=172 ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=160 ctermbg=NONE cterm=bold
+ hi ErrorMsg ctermfg=160 ctermbg=231 cterm=reverse
+ hi FoldColumn ctermfg=44 ctermbg=NONE cterm=NONE
+ hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=21 cterm=NONE
+ hi ModeMsg ctermfg=231 ctermbg=21 cterm=bold
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=bold
+ hi NonText ctermfg=160 ctermbg=NONE cterm=bold
+ hi Pmenu ctermfg=231 ctermbg=238 cterm=NONE
+ 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 Question ctermfg=63 ctermbg=NONE cterm=bold
+ hi Search ctermfg=231 ctermbg=196 cterm=NONE
+ hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=160 ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=83 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=51 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=201 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=21 ctermbg=231 cterm=bold
+ hi StatusLineNC ctermfg=21 ctermbg=254 cterm=NONE
+ hi TabLine ctermfg=21 ctermbg=231 cterm=bold
+ hi TabLineFill ctermfg=21 ctermbg=231 cterm=bold
+ hi TabLineSel ctermfg=231 ctermbg=21 cterm=bold
+ hi Title ctermfg=201 ctermbg=NONE cterm=bold
+ hi VertSplit ctermfg=21 ctermbg=254 cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=59 cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=16 cterm=underline
+ hi WarningMsg ctermfg=196 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi Comment ctermfg=111 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
+ hi Error ctermfg=160 ctermbg=231 cterm=reverse
+ hi Identifier ctermfg=87 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=16 ctermbg=16 cterm=NONE
+ hi PreProc ctermfg=213 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=214 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=227 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=21 ctermbg=226 cterm=NONE
+ hi Type ctermfg=83 ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=153 ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=16 ctermbg=254 cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ 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 Cursor ctermfg=black ctermbg=green cterm=NONE
+ hi Directory ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=darkred ctermbg=NONE cterm=bold
+ hi ErrorMsg ctermfg=darkred ctermbg=white cterm=reverse
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi LineNr ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=darkblue cterm=NONE
+ hi ModeMsg ctermfg=white ctermbg=darkblue cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi NonText ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Pmenu ctermfg=white ctermbg=darkgrey cterm=NONE
+ 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 Question ctermfg=blue ctermbg=NONE cterm=bold
+ hi Search ctermfg=white ctermbg=red cterm=NONE
+ hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=green ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=cyan ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=darkblue ctermbg=white cterm=bold
+ hi StatusLineNC ctermfg=darkblue ctermbg=grey cterm=NONE
+ hi TabLine ctermfg=darkblue ctermbg=white cterm=bold
+ hi TabLineFill ctermfg=darkblue ctermbg=white cterm=bold
+ hi TabLineSel ctermfg=white ctermbg=darkblue cterm=bold
+ hi Title ctermfg=magenta ctermbg=NONE cterm=bold
+ hi VertSplit ctermfg=darkblue ctermbg=grey cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=darkgrey cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi Comment ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Error ctermfg=darkred ctermbg=white cterm=reverse
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi PreProc ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=yellow ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkblue ctermbg=yellow cterm=NONE
+ hi Type ctermfg=green ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=darkred ctermbg=NONE cterm=bold
+ hi ErrorMsg ctermfg=darkred ctermbg=grey cterm=bold,reverse
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=darkblue cterm=NONE
+ hi ModeMsg ctermfg=white ctermbg=darkblue cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi NonText ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Pmenu ctermfg=grey ctermbg=darkgrey cterm=NONE
+ 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 Question ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Search ctermfg=grey ctermbg=darkred cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi StatusLine ctermfg=grey ctermbg=darkblue cterm=bold,reverse
+ hi StatusLineNC ctermfg=grey ctermbg=darkblue cterm=reverse
+ hi TabLine ctermfg=grey ctermbg=darkblue cterm=bold,reverse
+ hi TabLineFill ctermfg=darkblue ctermbg=grey cterm=bold
+ hi TabLineSel ctermfg=grey ctermbg=darkblue cterm=bold
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi VertSplit ctermfg=darkblue ctermbg=grey cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Comment ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Error ctermfg=darkred ctermbg=grey cterm=reverse
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
endif
-let g:colors_name = "koehler"
-hi Normal guifg=white guibg=black
-hi Scrollbar guifg=darkcyan guibg=cyan
-hi Menu guifg=black guibg=cyan
-hi SpecialKey term=bold cterm=bold ctermfg=darkred guifg=#cc0000
-hi NonText term=bold cterm=bold ctermfg=darkred gui=bold guifg=#cc0000
-hi Directory term=bold cterm=bold ctermfg=brown guifg=#cc8000
-hi ErrorMsg term=standout cterm=bold ctermfg=grey ctermbg=red guifg=White guibg=Red
-hi Search term=reverse ctermfg=white ctermbg=red guifg=white guibg=Red
-hi MoreMsg term=bold cterm=bold ctermfg=darkgreen gui=bold guifg=SeaGreen
-hi ModeMsg term=bold cterm=bold gui=bold guifg=White guibg=Blue
-hi LineNr term=underline cterm=bold ctermfg=darkcyan guifg=Yellow
-hi Question term=standout cterm=bold ctermfg=darkgreen gui=bold guifg=Green
-hi StatusLine term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
-hi StatusLineNC term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue
-hi Title term=bold cterm=bold ctermfg=darkmagenta gui=bold guifg=Magenta
-hi Visual term=reverse cterm=reverse gui=reverse
-hi WarningMsg term=standout cterm=bold ctermfg=darkred guifg=Red
-hi Cursor guifg=bg guibg=Green
-hi Comment term=bold cterm=bold ctermfg=cyan guifg=#80a0ff
-hi Constant term=underline cterm=bold ctermfg=magenta guifg=#ffa0a0
-hi Special term=bold cterm=bold ctermfg=red guifg=Orange
-hi Identifier term=underline ctermfg=brown guifg=#40ffff
-hi Statement term=bold cterm=bold ctermfg=yellow gui=bold guifg=#ffff60
-hi PreProc term=underline ctermfg=darkmagenta guifg=#ff80ff
-hi Type term=underline cterm=bold ctermfg=lightgreen gui=bold guifg=#60ff60
-hi Error term=reverse ctermfg=darkcyan ctermbg=black guifg=Red guibg=Black
-hi Todo term=standout ctermfg=black ctermbg=darkcyan guifg=Blue guibg=Yellow
-hi CursorLine term=underline guibg=#555555 cterm=underline
-hi CursorColumn term=underline guibg=#555555 cterm=underline
-hi MatchParen term=reverse ctermfg=blue guibg=Blue
-hi TabLine term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
-hi TabLineFill term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
-hi TabLineSel term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue
-hi Underlined term=underline cterm=bold,underline ctermfg=lightblue guifg=lightblue gui=bold,underline
-hi Ignore ctermfg=black ctermbg=black guifg=black guibg=black
-hi EndOfBuffer term=bold cterm=bold ctermfg=darkred guifg=#cc0000 gui=bold
-hi link IncSearch Visual
-hi link String Constant
-hi link Character Constant
-hi link Number Constant
-hi link Boolean Constant
-hi link Float Number
-hi link Function Identifier
-hi link Conditional Statement
-hi link Repeat Statement
-hi link Label Statement
-hi link Operator Statement
-hi link Keyword Statement
-hi link Exception Statement
-hi link Include PreProc
-hi link Define PreProc
-hi link Macro PreProc
-hi link PreCondit PreProc
-hi link StorageClass Type
-hi link Structure Type
-hi link Typedef Type
-hi link Tag Special
-hi link SpecialChar Special
-hi link Delimiter Special
-hi link SpecialComment Special
-hi link Debug Special
+
+" Background: dark
+" Color: xterm0 #000000 16 black
+" Color: xterm1 #cd0000 160 darkred
+" Color: xterm2 #00cd00 40 darkgreen
+" Color: xterm3 #cdcd00 184 darkyellow
+" Color: xterm4 #0000ee 20 darkblue
+" Color: xterm5 #cd00cd 164 darkmagenta
+" Color: xterm6 #00cdcd 44 darkcyan
+" Color: xterm7 #e5e5e5 254 grey
+" Color: xterm8 #7f7f7f 102 darkgrey
+" Color: xterm9 #ff0000 196 red
+" Color: xterm10 #00ff00 46 green
+" Color: xterm11 #ffff00 226 yellow
+" Color: xterm12 #5c5cff 63 blue
+" Color: xterm13 #ff00ff 201 magenta
+" Color: xterm14 #00ffff 51 cyan
+" Color: xterm15 #ffffff 231 white
+" Color: Pmenu #444444 238 darkgrey
+" Color: rgbGrey40 #666666 59 darkgrey
+" Color: rgbDarkGrey #a9a9a9 145 grey
+" Color: rgbDarkBlue #00008b 20 darkblue
+" Color: rgbDarkMagenta #8b008b 90 darkmagenta
+" Color: rgbBlue #0000ff 21 darkblue
+" Color: rgbDarkCyan #008b8b 44 darkcyan
+" Color: rgbSeaGreen #2e8b57 29 darkgreen
+" Color: rgbGrey #bebebe 250 grey
+" Color: StatusLineTerm #90ee90 120 darkgreen
+" Color: ToolbarLine #7f7f7f 244 darkgrey
+" Color: Comment #80a0ff 111 blue
+" Color: Constant #ffa0a0 217 darkred
+" Color: Special #ffa500 214 darkyellow
+" Color: Identifier #40ffff 87 cyan
+" Color: Statement #ffff60 227 yellow
+" Color: PreProc #ff80ff 213 magenta
+" Color: Type #60ff60 83 green
+" Color: koeDirectory #cc8000 172 darkyellow
+" Color: koeCursorLine #555555 240 black
+" Color: koeLightBlue #ADD8E6 153 blue
+" Color: koeDarkRed #8b0000 88 darkred
+" Term colors: xterm0 xterm1 xterm2 xterm3 xterm4 xterm5 xterm6 xterm7
+" Term colors: xterm8 xterm9 xterm10 xterm11 xterm12 xterm13
+" Term colors: xterm14 xterm15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim
index fca9c2a742..8a76fdf928 100644
--- a/runtime/colors/morning.vim
+++ b/runtime/colors/morning.vim
@@ -1,55 +1,399 @@
-" Vim color file
-" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2006 Apr 15
+" Name: morning
+" Description: Colorscheme with light grey background.
+" Author: Original author Bram Moolenaar <Bram@vim.org>
+" Maintainer: Original maintainer Bram Moolenaar <Bram@vim.org>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:55:30 2022
-" This color scheme uses a light grey background.
+" Generated by Colortemplate v2.2.0
-" First remove all existing highlighting.
set background=light
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'morning'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#e4e4e4', '#a52a2a', '#ff00ff', '#6a0dad', '#008787', '#2e8b57', '#6a5acd', '#bcbcbc', '#0000ff', '#a52a2a', '#ff00ff', '#6a0dad', '#008787', '#2e8b57', '#6a5acd', '#000000']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link StatuslineTerm Statusline
+hi! link StatuslineTermNC StatuslineNC
+hi Normal guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#0000ff guibg=#cccccc gui=bold cterm=bold
+hi Folded guifg=#00008b guibg=#d3d3d3 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#d3d3d3 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#d3d3d3 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#a52a2a guibg=NONE gui=bold cterm=bold
+hi QuickFixLine guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi StatusLine guifg=#eeeeee guibg=#000000 gui=bold cterm=bold
+hi StatusLineNC guifg=#bcbcbc guibg=#000000 gui=NONE cterm=NONE
+hi VertSplit guifg=#bcbcbc guibg=#000000 gui=NONE cterm=NONE
+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 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
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=NONE guibg=#bcbcbc gui=bold cterm=bold
+hi NonText guifg=#0000ff guibg=#bcbcbc gui=bold cterm=bold
+hi SpecialKey guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
+hi Visual guifg=NONE guibg=#d0d0d0 gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=#0000ff gui=NONE cterm=NONE
+hi LineNr guifg=#a52a2a guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#00008b guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=#00008b guibg=NONE gui=NONE cterm=NONE
+hi Underlined guifg=#6a5acd guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#e4e4e4 gui=reverse cterm=reverse
+hi ErrorMsg guifg=#ff0000 guibg=#e4e4e4 gui=reverse cterm=reverse
+hi WarningMsg guifg=#6a0dad guibg=NONE gui=bold cterm=bold
+hi MoreMsg guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
+hi ModeMsg guifg=#000000 guibg=NONE gui=bold cterm=bold
+hi Question guifg=#008787 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#e4e4e4 guibg=#6a5acd gui=NONE cterm=NONE
+hi Search guifg=#e4e4e4 guibg=#6a0dad gui=NONE cterm=NONE
+hi IncSearch guifg=#2e8b57 guibg=NONE gui=reverse cterm=reverse
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=bold cterm=bold
+hi ColorColumn guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi Cursor guifg=#e4e4e4 guibg=#2e8b57 gui=NONE cterm=NONE
+hi lCursor guifg=#e4e4e4 guibg=#a52a2a gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#00d700 guibg=NONE guisp=#00d700 gui=undercurl cterm=underline
+hi SpellLocal guifg=#a52a2a guibg=NONE guisp=#a52a2a gui=undercurl cterm=underline
+hi SpellRare guifg=#2e8b57 guibg=NONE guisp=#2e8b57 gui=undercurl cterm=underline
+hi Comment guifg=#0000ff guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ff00ff guibg=#eeeeee gui=NONE cterm=NONE
+hi Identifier guifg=#008787 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#a52a2a guibg=NONE gui=bold cterm=bold
+hi PreProc guifg=#6a0dad 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 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 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
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link StatuslineTerm Statusline
+ hi! link StatuslineTermNC StatuslineNC
+ hi Normal ctermfg=16 ctermbg=254 cterm=NONE
+ hi EndOfBuffer ctermfg=21 ctermbg=252 cterm=bold
+ hi Folded ctermfg=18 ctermbg=252 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=252 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=252 cterm=NONE
+ hi CursorLineNr ctermfg=124 ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=16 ctermbg=226 cterm=NONE
+ hi StatusLine ctermfg=255 ctermbg=16 cterm=bold
+ hi StatusLineNC ctermfg=250 ctermbg=16 cterm=NONE
+ hi VertSplit ctermfg=250 ctermbg=16 cterm=NONE
+ hi Pmenu ctermfg=16 ctermbg=249 cterm=NONE
+ 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 TabLine ctermfg=16 ctermbg=250 cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=16 ctermbg=254 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=250 cterm=bold
+ hi NonText ctermfg=21 ctermbg=250 cterm=bold
+ hi SpecialKey ctermfg=250 ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=252 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=21 cterm=NONE
+ hi LineNr ctermfg=124 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=18 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=18 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=62 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=254 cterm=reverse
+ hi ErrorMsg ctermfg=196 ctermbg=254 cterm=reverse
+ hi WarningMsg ctermfg=55 ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=bold
+ hi ModeMsg ctermfg=16 ctermbg=NONE cterm=bold
+ hi Question ctermfg=30 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=16 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=254 ctermbg=62 cterm=NONE
+ hi Search ctermfg=254 ctermbg=55 cterm=NONE
+ hi IncSearch ctermfg=29 ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=bold
+ hi ColorColumn ctermfg=16 ctermbg=231 cterm=NONE
+ hi Cursor ctermfg=254 ctermbg=29 cterm=NONE
+ hi lCursor ctermfg=254 ctermbg=124 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=40 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=124 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=29 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=21 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=201 ctermbg=255 cterm=NONE
+ hi Identifier ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=124 ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=55 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=29 ctermbg=NONE cterm=bold
+ 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 Title ctermfg=124 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=black ctermbg=grey cterm=NONE
+ hi EndOfBuffer ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkred ctermbg=NONE cterm=underline
+ hi QuickFixLine ctermfg=black ctermbg=yellow cterm=NONE
+ hi StatusLine ctermfg=white ctermbg=black cterm=bold
+ hi StatusLineNC ctermfg=darkgrey ctermbg=black cterm=NONE
+ hi VertSplit ctermfg=darkgrey ctermbg=black cterm=NONE
+ hi Pmenu ctermfg=black ctermbg=white cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=white cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=black ctermbg=grey cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=white cterm=bold
+ hi NonText ctermfg=blue ctermbg=white cterm=bold
+ hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=white cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=blue cterm=NONE
+ hi LineNr ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Error ctermfg=red ctermbg=grey cterm=reverse
+ hi ErrorMsg ctermfg=red ctermbg=grey cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi ModeMsg ctermfg=black ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Todo ctermfg=black ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=grey ctermbg=darkblue cterm=NONE
+ hi Search ctermfg=grey ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=bold
+ hi ColorColumn ctermfg=black ctermbg=white cterm=NONE
+ hi Cursor ctermfg=grey ctermbg=darkgreen cterm=NONE
+ hi lCursor ctermfg=grey ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=darkred ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkgreen ctermbg=NONE cterm=underline
+ hi Comment ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=magenta ctermbg=white cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ 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 Title ctermfg=darkred ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=black ctermbg=gray cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi StatusLine ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi StatusLineNC ctermfg=black ctermbg=gray cterm=reverse
+ hi VertSplit ctermfg=black ctermbg=gray cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ 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 TabLine ctermfg=gray ctermbg=black cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=black ctermbg=gray cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=gray cterm=reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=gray cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Question ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=gray ctermbg=darkblue cterm=NONE
+ hi Search ctermfg=gray ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi ColorColumn ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ 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=NONE 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=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let colors_name = "morning"
-
-hi Normal ctermfg=Black ctermbg=LightGrey guifg=Black guibg=grey90
-
-" Groups used in the 'highlight' and 'guicursor' options default value.
-hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
-hi IncSearch term=reverse cterm=reverse gui=reverse
-hi ModeMsg term=bold cterm=bold gui=bold
-hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
-hi StatusLineNC term=reverse cterm=reverse gui=reverse
-hi VertSplit term=reverse cterm=reverse gui=reverse
-hi Visual term=reverse ctermbg=grey guibg=grey80
-hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
-hi Cursor guibg=Green guifg=NONE
-hi lCursor guibg=Cyan guifg=NONE
-hi Directory term=bold ctermfg=DarkBlue guifg=Blue
-hi LineNr term=underline ctermfg=Brown guifg=Brown
-hi MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen
-hi NonText term=bold ctermfg=Blue gui=bold guifg=Blue guibg=grey80
-hi Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen
-hi Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE
-hi SpecialKey term=bold ctermfg=DarkBlue guifg=Blue
-hi Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta
-hi WarningMsg term=standout ctermfg=DarkRed guifg=Red
-hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
-hi Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
-hi FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
-hi DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue
-hi DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta
-hi DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan
-hi CursorLine term=underline cterm=underline guibg=grey80
-hi CursorColumn term=reverse ctermbg=grey guibg=grey80
-
-" Colors for syntax highlighting
-hi Constant term=underline ctermfg=DarkRed guifg=Magenta guibg=grey95
-hi Special term=bold ctermfg=DarkMagenta guifg=SlateBlue guibg=grey95
-if &t_Co > 8
- hi Statement term=bold cterm=bold ctermfg=Brown gui=bold guifg=Brown
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
endif
-hi Ignore ctermfg=LightGrey guifg=grey90
-" vim: sw=2
+" Background: light
+" Color: comment #0000ff 21 blue
+" Color: constant #ff00ff 201 magenta
+" Color: identifier #008787 30 darkcyan
+" Color: statement #a52a2a 124 darkred
+" Color: preproc #6a0dad 55 darkmagenta
+" Color: type #2e8b57 29 darkgreen
+" Color: special #6a5acd 62 darkblue
+" Color: fg0 #000000 16 black
+" Color: bg0 #e4e4e4 254 grey
+" Color: bg1 #bcbcbc 250 white
+" Color: status #bcbcbc 250 darkgrey
+" Color: bg2 #eeeeee 255 white
+" Color: endofbuffer #cccccc 252 darkgrey
+" Color: visual #d0d0d0 252 white
+" Color: folded #d3d3d3 252 darkgrey
+" Color: folded_fg #00008b 18 darkblue
+" Color: pmenu #b2b2b2 249 white
+" Color: wildmenu #ffff00 226 yellow
+" Color: error #ff0000 196 red
+" Color: colorcolumn #ffffff 231 white
+" Color: spellcap #00d700 40 green
+" Color: black #000000 16 black
+" Color: darkred #870000 88 darkred
+" Color: darkgreen #008700 28 darkgreen
+" Color: darkyellow #878700 100 darkyellow
+" Color: darkblue #000087 18 darkblue
+" Color: darkmagenta #870087 18 darkmagenta
+" Color: darkcyan #008787 30 darkcyan
+" Color: gray #878787 102 gray
+" 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
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim
index 1f439964ef..1ba096ecec 100644
--- a/runtime/colors/murphy.vim
+++ b/runtime/colors/murphy.vim
@@ -1,41 +1,393 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Ron Aaron <ron@ronware.org>
-" Last Change: 2003 May 02
+" Name: murphy
+" Description: Green foreground black background.
+" Author: Original author Ron Aaron <ron@ronware.org>.
+" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>.
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:56:21 2022
+
+" Generated by Colortemplate v2.2.0
-hi clear
set background=dark
-if exists("syntax_on")
- syntax reset
+
+hi clear
+let g:colors_name = 'murphy'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#303030', '#ffa700', '#005f00', '#ffd7af', '#87afff', '#ffafaf', '#00afaf', '#bcbcbc', '#444444', '#ff0000', '#00875f', '#ffff00', '#005fff', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi Normal guifg=#87ff87 guibg=#000000 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#0000ff guibg=#000000 gui=NONE cterm=NONE
+hi StatusLine guifg=#ffffff guibg=#00008b gui=NONE cterm=NONE
+hi StatusLineNC guifg=#ffffff guibg=#3a3a3a gui=NONE cterm=NONE
+hi VertSplit guifg=#ffffff guibg=#3a3a3a gui=NONE cterm=NONE
+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 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
+hi ToolbarLine guifg=NONE guibg=#303030 gui=NONE cterm=NONE
+hi ToolbarButton guifg=#ffffff guibg=#444444 gui=bold cterm=bold
+hi NonText guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi QuickFixLine guifg=#303030 guibg=#00afaf gui=NONE cterm=NONE
+hi Folded guifg=#00afaf guibg=#303030 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#444444 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#444444 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=bold
+hi ColorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE
+hi Visual guifg=#ffffff guibg=#005f00 gui=NONE cterm=NONE
+hi VisualNOS guifg=#ffffff guibg=#005f00 gui=NONE cterm=NONE
+hi LineNr guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=#00afaf guibg=NONE gui=NONE cterm=NONE
+hi Underlined guifg=#00afaf guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
+hi ErrorMsg guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
+hi ModeMsg guifg=#87ff87 guibg=NONE gui=bold cterm=bold
+hi WarningMsg guifg=#ffa700 guibg=NONE gui=bold cterm=bold
+hi MoreMsg guifg=#005f00 guibg=NONE gui=bold cterm=bold
+hi Question guifg=#00ffff guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#0000ff guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#303030 guibg=#ffd7af gui=NONE cterm=NONE
+hi Search guifg=#ffffff guibg=#0000ff gui=NONE cterm=NONE
+hi IncSearch guifg=#ffa700 guibg=NONE gui=reverse cterm=reverse
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi Cursor guifg=#000000 guibg=#87ff87 gui=NONE cterm=NONE
+hi lCursor guifg=#000000 guibg=#ff0000 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#00ffff guibg=NONE guisp=#00ffff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ffd7af guibg=NONE guisp=#ffd7af gui=undercurl cterm=underline
+hi SpellRare guifg=#ffff00 guibg=NONE guisp=#ffff00 gui=undercurl cterm=underline
+hi Comment guifg=#ffa700 guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ffffff guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#ffd7af guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE
+hi Directory guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Title guifg=#ff00ff 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
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi Normal ctermfg=120 ctermbg=16 cterm=NONE
+ hi EndOfBuffer ctermfg=21 ctermbg=16 cterm=NONE
+ hi StatusLine ctermfg=231 ctermbg=18 cterm=NONE
+ hi StatusLineNC ctermfg=231 ctermbg=237 cterm=NONE
+ hi VertSplit ctermfg=231 ctermbg=237 cterm=NONE
+ hi Pmenu ctermfg=231 ctermbg=238 cterm=NONE
+ 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 TabLineFill ctermfg=NONE ctermbg=236 cterm=NONE
+ hi TabLine ctermfg=120 ctermbg=238 cterm=NONE
+ hi TabLineSel ctermfg=231 ctermbg=16 cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=236 cterm=NONE
+ hi ToolbarButton ctermfg=231 ctermbg=238 cterm=bold
+ hi NonText ctermfg=37 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=37 ctermbg=NONE cterm=NONE
+ hi QuickFixLine ctermfg=236 ctermbg=37 cterm=NONE
+ hi Folded ctermfg=37 ctermbg=236 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=238 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=238 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=NONE ctermbg=235 cterm=NONE
+ hi Visual ctermfg=231 ctermbg=22 cterm=NONE
+ hi VisualNOS ctermfg=231 ctermbg=22 cterm=NONE
+ hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=37 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=37 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=37 ctermbg=NONE cterm=underline
+ hi Error ctermfg=231 ctermbg=196 cterm=NONE
+ hi ErrorMsg ctermfg=231 ctermbg=196 cterm=NONE
+ hi ModeMsg ctermfg=120 ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=214 ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=22 ctermbg=NONE cterm=bold
+ hi Question ctermfg=51 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=21 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=236 ctermbg=223 cterm=NONE
+ hi Search ctermfg=231 ctermbg=21 cterm=NONE
+ hi IncSearch ctermfg=214 ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi Cursor ctermfg=16 ctermbg=120 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=196 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=51 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=223 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=226 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=214 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=226 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=231 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=223 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=250 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=250 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=201 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let g:colors_name = "murphy"
-
-hi Normal ctermbg=Black ctermfg=lightgreen guibg=Black guifg=lightgreen
-hi Comment term=bold ctermfg=LightRed guifg=Orange
-hi Constant term=underline ctermfg=LightGreen guifg=White gui=NONE
-hi Identifier term=underline ctermfg=LightCyan guifg=#00ffff
-hi Ignore ctermfg=black guifg=bg
-hi PreProc term=underline ctermfg=LightBlue guifg=Wheat
-hi Search term=reverse guifg=white guibg=Blue
-hi Special term=bold ctermfg=LightRed guifg=magenta
-hi Statement term=bold ctermfg=Yellow guifg=#ffff00 gui=NONE
-hi Type ctermfg=LightGreen guifg=grey gui=none
-hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
-hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
-" From the source:
-hi Cursor guifg=Orchid guibg=fg
-hi Directory term=bold ctermfg=LightCyan guifg=Cyan
-hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
-hi IncSearch term=reverse cterm=reverse gui=reverse
-hi LineNr term=underline ctermfg=Yellow guifg=Yellow
-hi ModeMsg term=bold cterm=bold gui=bold
-hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen
-hi NonText term=bold ctermfg=Blue gui=bold guifg=Blue
-hi Question term=standout ctermfg=LightGreen gui=bold guifg=Cyan
-hi SpecialKey term=bold ctermfg=LightBlue guifg=Cyan
-hi StatusLine term=reverse,bold cterm=reverse gui=NONE guifg=White guibg=darkblue
-hi StatusLineNC term=reverse cterm=reverse gui=NONE guifg=white guibg=#333333
-hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Pink
-hi WarningMsg term=standout ctermfg=LightRed guifg=Red
-hi Visual term=reverse cterm=reverse gui=NONE guifg=white guibg=darkgreen
+
+if s:t_Co >= 16
+ hi Normal ctermfg=green ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=blue ctermbg=black cterm=NONE
+ hi StatusLine ctermfg=white ctermbg=darkblue cterm=NONE
+ hi StatusLineNC ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi VertSplit ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi Pmenu ctermfg=white ctermbg=darkgrey cterm=NONE
+ 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 TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
+ hi TabLine ctermfg=green ctermbg=darkgrey cterm=NONE
+ hi TabLineSel ctermfg=white ctermbg=black cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
+ hi ToolbarButton ctermfg=white ctermbg=darkgrey cterm=bold
+ hi NonText ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
+ hi ColorColumn ctermfg=green ctermbg=darkgrey cterm=NONE
+ hi Visual ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi VisualNOS ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi LineNr ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi Error ctermfg=white ctermbg=red cterm=NONE
+ hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE
+ hi ModeMsg ctermfg=green ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=cyan ctermbg=NONE cterm=bold
+ hi Todo ctermfg=blue ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=white ctermbg=blue cterm=NONE
+ hi IncSearch ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi Cursor ctermfg=black ctermbg=green cterm=NONE
+ hi lCursor ctermfg=black ctermbg=red cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=cyan ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=darkyellow ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=yellow ctermbg=NONE cterm=underline
+ hi Comment ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=white ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Special ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=darkgreen ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi StatusLine ctermfg=darkblue ctermbg=grey cterm=bold,reverse
+ hi StatusLineNC ctermfg=grey ctermbg=black cterm=reverse
+ hi VertSplit ctermfg=grey ctermbg=black cterm=reverse
+ 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=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
+ hi TabLine ctermfg=grey ctermbg=black cterm=reverse
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi NonText ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=reverse,underline
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=grey ctermbg=darkred cterm=NONE
+ hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
+ hi ModeMsg ctermfg=grey ctermbg=NONE cterm=bold
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=grey ctermbg=darkblue cterm=NONE
+ hi IncSearch ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkyellow ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi Comment ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=grey ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Type ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkcyan 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
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: dark
+" Color: foreground #87FF87 120 green
+" Color: background #000000 16 black
+" Color: color00 #303030 236 black
+" Color: color08 #444444 238 darkgrey
+" Color: color01 #FFA700 214 darkred
+" Color: color09 #FF0000 196 red
+" Color: color02 #005F00 22 darkgreen
+" Color: color10 #00875F 29 green
+" Color: color03 #FFD7AF 223 darkyellow
+" Color: color11 #FFFF00 226 yellow
+" Color: color04 #00008B 18 darkblue
+" Color: color12 #0000FF 21 blue
+" Color: color05 #FFAFAF 217 darkmagenta
+" Color: color13 #FF00FF 201 magenta
+" Color: color06 #00AFAF 37 darkcyan
+" Color: color14 #00FFFF 51 cyan
+" Color: color07 #BCBCBC 250 grey
+" Color: color15 #FFFFFF 231 white
+" Color: color16 #262626 235 black
+" Color: color17 #3A3A3A 237 darkgrey
+" Color: color04t #87AFFF 111 darkblue
+" Color: color12t #005FFF 27 blue
+" Term colors: color00 color01 color02 color03 color04t color05 color06 color07
+" Term colors: color08 color09 color10 color11 color12t color13 color14 color15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim
index e6bf737046..1dc086d820 100644
--- a/runtime/colors/pablo.vim
+++ b/runtime/colors/pablo.vim
@@ -1,26 +1,433 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Ron Aaron <ron@ronware.org>
-" Last Change: 2003 May 02
+" Name: pablo
+" Author: Ron Aaron <ron@ronware.org>
+" Maintainer: Original maintainerRon Aaron <ron@ronware.org>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 10:57:11 2022
+
+" Generated by Colortemplate v2.2.0
-hi clear
set background=dark
-if exists("syntax_on")
- syntax reset
+
+hi clear
+let g:colors_name = 'pablo'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi Normal guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+hi! link Terminal Normal
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi Comment guifg=#808080 guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#00c0c0 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#c0c000 guibg=NONE gui=bold cterm=bold
+hi PreProc guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#00c000 guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#0000ff guibg=NONE gui=NONE cterm=NONE
+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 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
+hi Title guifg=#ff00ff guibg=NONE gui=bold cterm=bold
+hi Directory guifg=#00c000 guibg=NONE gui=NONE cterm=NONE
+hi Search guifg=#000000 guibg=#c0c000 gui=NONE cterm=NONE
+hi IncSearch guifg=#ffffff guibg=NONE gui=reverse cterm=reverse
+hi NonText guifg=#0000ff guibg=NONE gui=bold cterm=bold
+hi EndOfBuffer guifg=#0000ff guibg=NONE gui=bold cterm=bold
+hi ErrorMsg guifg=#ffffff guibg=#cd0000 gui=NONE cterm=NONE
+hi WarningMsg guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=#00ffff guibg=#a9a9a9 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#4d4d4d gui=NONE cterm=NONE
+hi FoldColumn guifg=#7f7f7f guibg=#303030 gui=NONE cterm=NONE
+hi Folded guifg=#7f7f7f guibg=#303030 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE
+hi CursorLineNr guifg=#ffff00 guibg=#3a3a3a gui=bold cterm=bold
+hi Visual guifg=#00008b guibg=#a9a9a9 gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=#000000 gui=bold,underline cterm=underline
+hi LineNr guifg=#7f7f7f guibg=NONE gui=NONE cterm=NONE
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi MatchParen guifg=NONE guibg=#008b8b gui=NONE cterm=NONE
+hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
+hi MoreMsg guifg=#5c5cff guibg=NONE gui=bold cterm=bold
+hi Question guifg=#00ff00 guibg=NONE gui=bold cterm=bold
+hi SpecialKey guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi QuickFixLine guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#5c5cff guibg=NONE guisp=#5c5cff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi SpellRare guifg=#ffff00 guibg=NONE guisp=#ffff00 gui=undercurl cterm=underline
+hi StatusLine guifg=#ffff00 guibg=#0000ee gui=NONE cterm=NONE
+hi StatusLineNC guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi VertSplit guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi TabLine guifg=#ffffff guibg=#7f7f7f gui=NONE cterm=NONE
+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 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
+hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi Normal ctermfg=231 ctermbg=16 cterm=NONE
+ hi! link Terminal Normal
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi Comment ctermfg=244 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=37 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=142 ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=34 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=21 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ 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 Cursor ctermfg=16 ctermbg=231 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=231 cterm=NONE
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi Title ctermfg=225 ctermbg=NONE cterm=bold
+ hi Directory ctermfg=34 ctermbg=NONE cterm=NONE
+ hi Search ctermfg=16 ctermbg=142 cterm=NONE
+ hi IncSearch ctermfg=231 ctermbg=NONE cterm=reverse
+ hi NonText ctermfg=63 ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=63 ctermbg=NONE cterm=bold
+ hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE
+ hi WarningMsg ctermfg=224 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=51 ctermbg=248 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=239 cterm=NONE
+ hi FoldColumn ctermfg=102 ctermbg=236 cterm=NONE
+ hi Folded ctermfg=102 ctermbg=236 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=237 cterm=bold
+ hi Visual ctermfg=20 ctermbg=248 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=16 cterm=underline
+ hi LineNr ctermfg=102 ctermbg=NONE cterm=NONE
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi MatchParen ctermfg=NONE ctermbg=44 cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=63 ctermbg=NONE cterm=bold
+ hi Question ctermfg=121 ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=81 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi QuickFixLine ctermfg=16 ctermbg=44 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=63 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=201 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=226 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=226 ctermbg=20 cterm=NONE
+ hi StatusLineNC ctermfg=16 ctermbg=231 cterm=NONE
+ hi VertSplit ctermfg=16 ctermbg=231 cterm=NONE
+ hi TabLine ctermfg=231 ctermbg=102 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=16 cterm=reverse
+ 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 Pmenu ctermfg=fg ctermbg=236 cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuSel ctermfg=16 ctermbg=254 cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let g:colors_name = "pablo"
-
-highlight Comment ctermfg=8 guifg=#808080
-highlight Constant ctermfg=14 cterm=none guifg=#00ffff gui=none
-highlight Identifier ctermfg=6 guifg=#00c0c0
-highlight Statement ctermfg=3 cterm=bold guifg=#c0c000 gui=bold
-highlight PreProc ctermfg=10 guifg=#00ff00
-highlight Type ctermfg=2 guifg=#00c000
-highlight Special ctermfg=12 guifg=#0000ff
-highlight Error ctermbg=9 guibg=#ff0000
-highlight Todo ctermfg=4 ctermbg=3 guifg=#000080 guibg=#c0c000
-highlight Directory ctermfg=2 guifg=#00c000
-highlight StatusLine ctermfg=11 ctermbg=12 cterm=none guifg=#ffff00 guibg=#0000ff gui=none
-highlight Normal guifg=#ffffff guibg=#000000
-highlight Search ctermbg=3 guibg=#c0c000
+
+if s:t_Co >= 16
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi! link Terminal Normal
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=green ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Special ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkgreen ctermbg=NONE cterm=underline
+ 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 Cursor ctermfg=black ctermbg=white cterm=NONE
+ hi lCursor ctermfg=black ctermbg=white cterm=NONE
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=bold
+ hi Directory ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi IncSearch ctermfg=white ctermbg=NONE cterm=reverse
+ hi NonText ctermfg=blue ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=blue ctermbg=NONE cterm=bold
+ hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=cyan ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=blue ctermbg=NONE cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
+ hi Visual ctermfg=darkblue ctermbg=grey cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=blue ctermbg=NONE cterm=bold
+ hi Question ctermfg=green ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=magenta ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=yellow ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=yellow ctermbg=darkblue cterm=NONE
+ hi StatusLineNC ctermfg=black ctermbg=white cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=white cterm=NONE
+ hi TabLine ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=black cterm=reverse
+ 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 Pmenu ctermfg=fg ctermbg=darkgrey cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=grey cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=grey ctermbg=black cterm=bold
+ hi StatusLine ctermfg=darkblue ctermbg=grey cterm=reverse
+ hi StatusLineNC ctermfg=grey ctermbg=black cterm=reverse
+ hi StatusLineTerm ctermfg=darkblue ctermbg=grey cterm=reverse
+ hi StatusLineTermNC ctermfg=grey ctermbg=black cterm=reverse
+ hi VertSplit ctermfg=grey ctermbg=black cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
+ hi NonText ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi VisualNOS ctermfg=black ctermbg=grey cterm=NONE
+ hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=grey ctermbg=darkred cterm=NONE
+ hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
+ hi ModeMsg ctermfg=grey ctermbg=NONE cterm=NONE
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi SpellRare ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=grey ctermbg=NONE cterm=bold
+ hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Special ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Error ctermfg=grey ctermbg=darkred cterm=NONE
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Directory ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE 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
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: dark
+" Color: color00 #000000 16 black
+" Color: color08 #7f7f7f 102 darkgrey
+" Color: color01 #cd0000 160 darkred
+" Color: color09 #ff0000 196 red
+" Color: color02 #00cd00 40 darkgreen
+" Color: color10 #00ff00 46 green
+" Color: color03 #cdcd00 184 darkyellow
+" Color: color11 #ffff00 226 yellow
+" Color: color04 #0000ee 20 darkblue
+" Color: color12 #5c5cff 63 blue
+" Color: color05 #cd00cd 164 darkmagenta
+" Color: color13 #ff00ff 201 magenta
+" Color: color06 #00cdcd 44 darkcyan
+" Color: color14 #00ffff 51 cyan
+" Color: color07 #e5e5e5 254 grey
+" Color: color15 #ffffff 231 white
+" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
+" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
+" Color: rgbGrey30 #4d4d4d 239 darkgrey
+" Color: rgbGrey40 #666666 241 darkgrey
+" Color: rgbDarkGrey #a9a9a9 248 grey
+" Color: rgbDarkBlue #00008b 20 darkblue
+" Color: rgbDarkMagenta #8b008b 164 darkmagenta
+" Color: rgbBlue #0000ff 63 blue
+" Color: rgbDarkCyan #008b8b 44 darkcyan
+" Color: rgbSeaGreen #2e8b57 121 darkgreen
+" Color: rgbGrey #bebebe 248 grey
+" Color: Question #00ff00 121 green
+" Color: SignColumn #a9a9a9 248 black
+" Color: SpecialKey #00ffff 81 cyan
+" Color: StatusLineTerm #90ee90 121 darkgreen
+" Color: Title #ff00ff 225 magenta
+" Color: WarningMsg #ff0000 224 darkred
+" Color: ToolbarLine #7f7f7f 242 darkgrey
+" Color: ToolbarButton #d3d3d3 254 grey
+" Color: Underlined #80a0ff 111 darkgreen
+" Color: Comment #808080 244 darkgrey
+" Color: Constant #00ffff 51 cyan
+" Color: Special #0000ff 21 blue
+" Color: Identifier #00c0c0 37 darkcyan
+" Color: Search #c0c000 142 darkyellow
+" Color: Statement #c0c000 142 darkyellow
+" Color: Todo #c0c000 142 darkyellow
+" Color: PreProc #00ff00 46 green
+" Color: Type #00c000 34 darkgreen
+" Color: Directory #00c000 34 darkgreen
+" Color: Pmenu #303030 236 darkgrey
+" Color: Folded #303030 236 darkgrey
+" Color: Cursorline #3a3a3a 237 darkgrey
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim
index 1c0c2390f8..a540be2734 100644
--- a/runtime/colors/peachpuff.vim
+++ b/runtime/colors/peachpuff.vim
@@ -1,59 +1,404 @@
-" Vim color file
-" Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
-" Last Change: 2003-04-23
-" URL: http://trific.ath.cx/Ftp/vim/colors/peachpuff.vim
+" Name: peachpuff
+" Description: This color scheme uses a peachpuff background (what you've expected when it's " called peachpuff?).
+" Author: Original author David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
+" 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: Sun Jun 12 10:58:17 2022
-" This color scheme uses a peachpuff background (what you've expected when it's
-" called peachpuff?).
-"
-" Note: Only GUI colors differ from default, on terminal it's just `light'.
+" Generated by Colortemplate v2.2.0
-" First remove all existing highlighting.
set background=light
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'peachpuff'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#ffdab9', '#a52a2a', '#c00058', '#cd00cd', '#008b8b', '#2e8b57', '#6a5acd', '#737373', '#406090', '#a52a2a', '#c00058', '#cd00cd', '#008b8b', '#2e8b57', '#6a5acd', '#000000']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi Normal guifg=#000000 guibg=#ffdab9 gui=NONE cterm=NONE
+hi Folded guifg=#000000 guibg=#e3c1a5 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#f5c195 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#f5c195 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#cd0000 guibg=NONE gui=bold cterm=bold
+hi QuickFixLine guifg=#000000 guibg=#ffaf87 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#737373 guibg=NONE gui=NONE cterm=NONE
+hi StatusLine guifg=#ffffff guibg=#000000 gui=bold cterm=bold
+hi StatusLineNC guifg=#ffdab9 guibg=#737373 gui=bold cterm=bold
+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 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
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=#ffdab9 guibg=#737373 gui=bold cterm=bold
+hi NonText guifg=#737373 guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#737373 guibg=NONE gui=NONE cterm=NONE
+hi Visual guifg=#000000 guibg=#cccccc gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=#406090 gui=NONE cterm=NONE
+hi LineNr guifg=#cd0000 guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#406090 guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Underlined guifg=#6a5acd guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#ffffff gui=bold,reverse cterm=bold,reverse
+hi ErrorMsg guifg=#ff0000 guibg=#ffffff gui=bold,reverse cterm=bold,reverse
+hi WarningMsg guifg=#cd00cd guibg=#ffdab9 gui=bold cterm=bold
+hi MoreMsg guifg=#2e8b57 guibg=#ffdab9 gui=bold cterm=bold
+hi ModeMsg guifg=#000000 guibg=#ffdab9 gui=bold cterm=bold
+hi Question guifg=#c00058 guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#6a5acd guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#ffdab9 guibg=#6a5acd gui=NONE cterm=NONE
+hi Search guifg=#ffdab9 guibg=#cd00cd gui=NONE cterm=NONE
+hi IncSearch guifg=#2e8b57 guibg=NONE gui=reverse cterm=reverse
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=bold cterm=bold
+hi ColorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
+hi Cursor guifg=#ffdab9 guibg=#000000 gui=NONE cterm=NONE
+hi lCursor guifg=#000000 guibg=#c00058 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#008b8b guibg=NONE guisp=#008b8b gui=undercurl cterm=underline
+hi SpellLocal guifg=#cd00cd guibg=NONE guisp=#cd00cd gui=undercurl cterm=underline
+hi SpellRare guifg=#6a5acd guibg=NONE guisp=#6a5acd gui=undercurl cterm=underline
+hi Comment guifg=#406090 guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#c00058 guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#a52a2a guibg=NONE gui=bold cterm=bold
+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 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
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi Normal ctermfg=16 ctermbg=223 cterm=NONE
+ hi Folded ctermfg=16 ctermbg=252 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=180 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=180 cterm=NONE
+ hi CursorLineNr ctermfg=160 ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=16 ctermbg=216 cterm=NONE
+ hi EndOfBuffer ctermfg=243 ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=231 ctermbg=16 cterm=bold
+ hi StatusLineNC ctermfg=223 ctermbg=243 cterm=bold
+ hi StatusLineTerm ctermfg=231 ctermbg=29 cterm=bold
+ 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 TabLine ctermfg=223 ctermbg=243 cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=16 ctermbg=223 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=223 ctermbg=243 cterm=bold
+ hi NonText ctermfg=243 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=243 ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=16 ctermbg=252 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=25 cterm=NONE
+ hi LineNr ctermfg=160 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=25 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=62 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=231 cterm=bold,reverse
+ hi ErrorMsg ctermfg=196 ctermbg=231 cterm=bold,reverse
+ hi WarningMsg ctermfg=164 ctermbg=223 cterm=bold
+ hi MoreMsg ctermfg=29 ctermbg=223 cterm=bold
+ hi ModeMsg ctermfg=16 ctermbg=223 cterm=bold
+ hi Question ctermfg=161 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=62 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=223 ctermbg=62 cterm=NONE
+ hi Search ctermfg=223 ctermbg=164 cterm=NONE
+ hi IncSearch ctermfg=29 ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=bold
+ hi ColorColumn ctermfg=NONE ctermbg=255 cterm=NONE
+ hi Cursor ctermfg=223 ctermbg=16 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=161 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=30 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=164 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=62 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=25 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=161 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=124 ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=164 ctermbg=NONE cterm=NONE
+ 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 Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=164 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let colors_name = "peachpuff"
-
-hi Normal guibg=PeachPuff guifg=Black
-
-hi SpecialKey term=bold ctermfg=4 guifg=Blue
-hi NonText term=bold cterm=bold ctermfg=4 gui=bold guifg=Blue
-hi Directory term=bold ctermfg=4 guifg=Blue
-hi ErrorMsg term=standout cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=White guibg=Red
-hi IncSearch term=reverse cterm=reverse gui=reverse
-hi Search term=reverse ctermbg=3 guibg=Gold2
-hi MoreMsg term=bold ctermfg=2 gui=bold guifg=SeaGreen
-hi ModeMsg term=bold cterm=bold gui=bold
-hi LineNr term=underline ctermfg=3 guifg=Red3
-hi Question term=standout ctermfg=2 gui=bold guifg=SeaGreen
-hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold guifg=White guibg=Black
-hi StatusLineNC term=reverse cterm=reverse gui=bold guifg=PeachPuff guibg=Gray45
-hi VertSplit term=reverse cterm=reverse gui=bold guifg=White guibg=Gray45
-hi Title term=bold ctermfg=5 gui=bold guifg=DeepPink3
-hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey80 guibg=fg
-hi WarningMsg term=standout ctermfg=1 gui=bold guifg=Red
-hi WildMenu term=standout ctermfg=0 ctermbg=3 guifg=Black guibg=Yellow
-hi Folded term=standout ctermfg=4 ctermbg=7 guifg=Black guibg=#e3c1a5
-hi FoldColumn term=standout ctermfg=4 ctermbg=7 guifg=DarkBlue guibg=Gray80
-hi DiffAdd term=bold ctermbg=4 guibg=White
-hi DiffChange term=bold ctermbg=5 guibg=#edb5cd
-hi DiffDelete term=bold cterm=bold ctermfg=4 ctermbg=6 gui=bold guifg=LightBlue guibg=#f6e8d0
-hi DiffText term=reverse cterm=bold ctermbg=1 gui=bold guibg=#ff8060
-hi Cursor guifg=bg guibg=fg
-hi lCursor guifg=bg guibg=fg
-
-" Colors for syntax highlighting
-hi Comment term=bold ctermfg=4 guifg=#406090
-hi Constant term=underline ctermfg=1 guifg=#c00058
-hi Special term=bold ctermfg=5 guifg=SlateBlue
-hi Identifier term=underline ctermfg=6 guifg=DarkCyan
-hi Statement term=bold ctermfg=3 gui=bold guifg=Brown
-hi PreProc term=underline ctermfg=5 guifg=Magenta3
-hi Type term=underline ctermfg=2 gui=bold guifg=SeaGreen
-hi Ignore cterm=bold ctermfg=7 guifg=bg
-hi Error term=reverse cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=White guibg=Red
-hi Todo term=standout ctermfg=0 ctermbg=3 guifg=Blue guibg=Yellow
+if s:t_Co >= 16
+ hi Normal ctermfg=black ctermbg=white cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=underline
+ hi QuickFixLine ctermfg=black ctermbg=grey cterm=NONE
+ hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=white ctermbg=black cterm=bold
+ hi StatusLineNC ctermfg=white ctermbg=darkgrey cterm=bold
+ hi StatusLineTerm ctermfg=white ctermbg=darkgreen cterm=bold
+ 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 TabLine ctermfg=white ctermbg=darkgrey cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=black ctermbg=white cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ 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 Visual ctermfg=black ctermbg=grey cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ hi LineNr ctermfg=red ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=white cterm=bold,reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=white cterm=bold,reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=white cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=white cterm=bold
+ hi ModeMsg ctermfg=black ctermbg=white cterm=bold
+ hi Question ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkblue ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=white ctermbg=darkblue cterm=NONE
+ hi Search ctermfg=white ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=bold
+ hi ColorColumn ctermfg=NONE ctermbg=grey cterm=NONE
+ hi Cursor ctermfg=white ctermbg=black cterm=NONE
+ hi lCursor ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=darkmagenta ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Special ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=darkgrey 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
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=black ctermbg=gray cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=underline
+ hi QuickFixLine ctermfg=gray ctermbg=darkcyan cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi StatusLine ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi StatusLineNC ctermfg=black ctermbg=gray cterm=reverse
+ hi StatusLineTerm ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi StatusLineTermNC ctermfg=black ctermbg=gray cterm=reverse
+ hi VertSplit ctermfg=black ctermbg=gray cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ 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 TabLine ctermfg=gray ctermbg=black cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=black ctermbg=white cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=black ctermbg=NONE cterm=bold
+ hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=gray cterm=bold,reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=gray cterm=bold,reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi ModeMsg ctermfg=black ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Todo ctermfg=darkblue ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=gray ctermbg=darkblue cterm=NONE
+ hi Search ctermfg=gray ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi ColorColumn ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkblue ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=NONE ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkblue ctermbg=NONE cterm=NONE
+ 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
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+" Background: light
+" Color: comment #406090 25 darkgrey
+" Color: constant #c00058 161 darkred
+" Color: identifier #008b8b 30 darkcyan
+" Color: statement #a52a2a 124 darkred
+" Color: preproc #cd00cd 164 darkmagenta
+" Color: type #2e8b57 29 darkgreen
+" Color: special #6a5acd 62 darkblue
+" Color: fg0 #000000 16 black
+" Color: bg0 #ffdab9 223 white
+" Color: fg1 #ffffff 231 white
+" Color: bg1 #737373 243 darkgrey
+" Color: visual #cccccc 252 grey
+" Color: folded #e3c1a5 252 cyan
+" Color: folded_fg #000000 16 black
+" Color: cursorline #f5c195 180 yellow
+" Color: pmenu #ffaf87 216 grey
+" Color: wildmenu #ffff00 226 yellow
+" Color: error #ff0000 196 darkred
+" Color: linenr #cd0000 160 red
+" Color: blue #0000ff 21 darkblue
+" Color: red #ff0000 196 darkred
+" Color: colorcolumn #eeeeee 255 grey
+" Color: black #000000 16 black
+" Color: darkred #870000 88 darkred
+" Color: darkgreen #008700 28 darkgreen
+" Color: darkyellow #878700 100 darkyellow
+" Color: darkblue #000087 18 darkblue
+" Color: darkmagenta #870087 18 darkmagenta
+" Color: darkcyan #008787 30 darkcyan
+" Color: gray #878787 102 gray
+" 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
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim
index 1e9caa3150..6aa810e54e 100644
--- a/runtime/colors/ron.vim
+++ b/runtime/colors/ron.vim
@@ -1,45 +1,442 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Ron Aaron <ron@ronware.org>
-" Last Change: 2013 May 24
+" Name: ron
+" Author: original author Ron Aaron <ron@ronware.org>
+" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
+" Website: https://www.github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sat 11 Jun 2022 11:29:07 MSK
+
+" Generated by Colortemplate v2.2.0
set background=dark
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'ron'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+hi! link Terminal Normal
+hi! link Boolean Constant
+hi! link Character Constant
+hi! link Conditional Statement
+hi! link Debug Special
+hi! link Define PreProc
+hi! link Delimiter Special
+hi! link Exception Statement
+hi! link Float Constant
+hi! link Function Identifier
+hi! link Include PreProc
+hi! link Keyword Statement
+hi! link Macro PreProc
+hi! link Number Constant
+hi! link PopupSelected PmenuSel
+hi! link PreCondit PreProc
+hi! link Repeat Statement
+hi! link SpecialChar Special
+hi! link SpecialComment Special
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi! link StorageClass Type
+hi! link String Constant
+hi! link Structure Type
+hi! link Tag Special
+hi! link Typedef Type
+hi! link lCursor Cursor
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi Normal guifg=#00ffff guibg=#000000 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#cd0000 gui=NONE cterm=NONE
+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 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
+hi ErrorMsg guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi FoldColumn guifg=#ffffff guibg=NONE gui=NONE cterm=NONE
+hi Folded guifg=NONE guibg=#4d4d4d gui=NONE cterm=NONE
+hi IncSearch guifg=NONE guibg=#4682b4 gui=NONE cterm=NONE
+hi LineNr guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE
+hi MatchParen guifg=NONE guibg=#008b8b gui=NONE cterm=NONE
+hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE
+hi MoreMsg guifg=#2e8b57 guibg=NONE gui=bold cterm=NONE
+hi NonText guifg=#ffff00 guibg=#303030 gui=NONE cterm=NONE
+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 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
+hi SpecialKey guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi StatusLine guifg=#00ffff guibg=#0000ff gui=bold cterm=NONE
+hi StatusLineNC guifg=#add8e6 guibg=#00008b gui=NONE cterm=NONE
+hi VertSplit guifg=#add8e6 guibg=#00008b gui=NONE cterm=NONE
+hi TabLine guifg=#000000 guibg=#008b8b gui=NONE cterm=NONE
+hi TabLineFill guifg=#a9a9a9 guibg=#7f7f7f gui=NONE cterm=NONE
+hi TabLineSel guifg=#00ffff guibg=#000000 gui=bold cterm=NONE
+hi Terminal guifg=#00ffff guibg=#000000 gui=NONE cterm=NONE
+hi Title guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE
+hi Visual guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+hi VisualNOS guifg=NONE guibg=#000000 gui=bold,underline cterm=underline
+hi WarningMsg guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#ffffff guibg=NONE guisp=#ffffff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ffff00 guibg=NONE guisp=#ffff00 gui=undercurl cterm=underline
+hi SpellRare guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi Comment guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#00ffff guibg=NONE gui=bold cterm=NONE
+hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi Identifier guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=#000000 guibg=#000000 gui=NONE cterm=NONE
+hi Label guifg=#eec900 guibg=NONE gui=NONE cterm=NONE
+hi Operator guifg=#ffa500 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#eea9b8 guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#add8e6 guibg=NONE gui=NONE cterm=NONE
+hi Todo guifg=#000000 guibg=#ffa500 gui=NONE cterm=NONE
+hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=NONE
+hi Underlined guifg=#80a0ff guibg=NONE gui=underline cterm=underline
+hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=NONE
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi Normal ctermfg=51 ctermbg=16 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=160 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=59 cterm=NONE
+ 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 Cursor ctermfg=231 ctermbg=71 cterm=NONE
+ hi Directory ctermfg=51 ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=226 ctermbg=236 cterm=NONE
+ hi ErrorMsg ctermfg=196 ctermbg=231 cterm=reverse
+ hi FoldColumn ctermfg=231 ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=NONE ctermbg=239 cterm=NONE
+ hi IncSearch ctermfg=NONE ctermbg=67 cterm=NONE
+ hi LineNr ctermfg=145 ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=44 cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=226 ctermbg=236 cterm=NONE
+ hi Pmenu ctermfg=231 ctermbg=238 cterm=NONE
+ 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 Question ctermfg=46 ctermbg=16 cterm=NONE
+ hi Search ctermfg=16 ctermbg=145 cterm=NONE
+ hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=51 ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=51 ctermbg=21 cterm=NONE
+ hi StatusLineNC ctermfg=152 ctermbg=20 cterm=NONE
+ hi VertSplit ctermfg=152 ctermbg=20 cterm=NONE
+ hi TabLine ctermfg=16 ctermbg=44 cterm=NONE
+ hi TabLineFill ctermfg=145 ctermbg=102 cterm=NONE
+ hi TabLineSel ctermfg=51 ctermbg=16 cterm=NONE
+ hi Terminal ctermfg=51 ctermbg=16 cterm=NONE
+ hi Title ctermfg=145 ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=16 cterm=underline
+ hi WarningMsg ctermfg=226 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=231 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=226 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=201 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Error ctermfg=196 ctermbg=231 cterm=reverse
+ hi Identifier ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=16 ctermbg=16 cterm=NONE
+ hi Label ctermfg=220 ctermbg=NONE cterm=NONE
+ hi Operator ctermfg=214 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=217 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=226 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=152 ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=16 ctermbg=214 cterm=NONE
+ hi Type ctermfg=29 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=16 ctermbg=254 cterm=NONE
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let g:colors_name = "ron"
-hi Normal guifg=cyan guibg=black
-hi NonText guifg=yellow guibg=#303030
-hi comment guifg=green
-hi constant guifg=cyan gui=bold
-hi identifier guifg=cyan gui=NONE
-hi statement guifg=lightblue gui=NONE
-hi preproc guifg=Pink2
-hi type guifg=seagreen gui=bold
-hi special guifg=yellow
-hi ErrorMsg guifg=Black guibg=Red
-hi WarningMsg guifg=Black guibg=Green
-hi Error guibg=Red
-hi Todo guifg=Black guibg=orange
-hi Cursor guibg=#60a060 guifg=#00ff00
-hi Search guibg=darkgray guifg=black gui=bold
-hi IncSearch gui=NONE guibg=steelblue
-hi LineNr guifg=darkgrey
-hi title guifg=darkgrey
-hi ShowMarksHL ctermfg=cyan ctermbg=lightblue cterm=bold guifg=yellow guibg=black gui=bold
-hi StatusLineNC gui=NONE guifg=lightblue guibg=darkblue
-hi StatusLine gui=bold guifg=cyan guibg=blue
-hi label guifg=gold2
-hi operator guifg=orange
-hi clear Visual
-hi Visual term=reverse cterm=reverse gui=reverse
-hi DiffChange guibg=darkgreen
-hi DiffText guibg=olivedrab
-hi DiffAdd guibg=slateblue
-hi DiffDelete guibg=coral
-hi Folded guibg=gray30
-hi FoldColumn guibg=gray30 guifg=white
-hi cIf0 guifg=gray
-hi diffOnly guifg=red gui=bold
+
+if s:t_Co >= 16
+ hi Normal ctermfg=cyan ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=cyan ctermbg=darkred cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ 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 Cursor ctermfg=white ctermbg=green cterm=NONE
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=yellow ctermbg=darkgrey cterm=NONE
+ hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse
+ hi FoldColumn ctermfg=white ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ hi IncSearch ctermfg=NONE ctermbg=blue cterm=NONE
+ hi LineNr ctermfg=grey ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=yellow ctermbg=darkgrey cterm=NONE
+ hi Pmenu ctermfg=white ctermbg=darkgrey cterm=NONE
+ 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 Question ctermfg=green ctermbg=black cterm=NONE
+ hi Search ctermfg=black ctermbg=grey cterm=NONE
+ hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=cyan ctermbg=darkblue cterm=NONE
+ hi StatusLineNC ctermfg=darkcyan ctermbg=darkblue cterm=NONE
+ hi VertSplit ctermfg=darkcyan ctermbg=darkblue cterm=NONE
+ hi TabLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi TabLineFill ctermfg=grey ctermbg=darkgrey cterm=NONE
+ hi TabLineSel ctermfg=cyan ctermbg=black cterm=NONE
+ hi Terminal ctermfg=cyan ctermbg=black cterm=NONE
+ hi Title ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WarningMsg ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=white ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=yellow ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
+ hi Comment ctermfg=green ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Error ctermfg=red ctermbg=white cterm=reverse
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi Label ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Operator ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=darkcyan ctermbg=black cterm=NONE
+ hi ColorColumn ctermfg=darkcyan ctermbg=darkred cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=underline
+ hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=grey cterm=NONE
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi ErrorMsg ctermfg=darkred ctermbg=grey cterm=reverse
+ hi FoldColumn ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=black cterm=reverse
+ hi IncSearch ctermfg=darkyellow ctermbg=darkblue cterm=NONE
+ hi LineNr ctermfg=grey ctermbg=NONE cterm=bold
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=bold
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Pmenu ctermfg=grey ctermbg=darkgrey cterm=NONE
+ 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 Question ctermfg=darkgreen ctermbg=black cterm=bold
+ hi Search ctermfg=black ctermbg=grey cterm=NONE
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=darkblue ctermbg=grey cterm=bold,reverse
+ hi StatusLineNC ctermfg=darkblue ctermbg=grey cterm=reverse
+ hi VertSplit ctermfg=darkblue ctermbg=darkblue cterm=NONE
+ hi TabLine ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi TabLineFill ctermfg=darkblue ctermbg=darkblue cterm=NONE
+ hi TabLineSel ctermfg=darkcyan ctermbg=black cterm=bold
+ hi Terminal ctermfg=darkcyan ctermbg=black cterm=NONE
+ hi Title ctermfg=grey ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WarningMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkyellow ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi Comment ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Error ctermfg=darkred ctermbg=grey cterm=bold,reverse
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi Label ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Operator ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=bold
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: dark
+" Color: xterm0 #000000 16 black
+" Color: xterm1 #cd0000 160 darkred
+" Color: xterm2 #00cd00 40 darkgreen
+" Color: xterm3 #cdcd00 184 darkyellow
+" Color: xterm4 #0000ee 20 darkblue
+" Color: xterm5 #cd00cd 164 darkmagenta
+" Color: xterm6 #00cdcd 44 darkcyan
+" Color: xterm7 #e5e5e5 254 grey
+" Color: xterm8 #7f7f7f 102 darkgrey
+" Color: xterm9 #ff0000 196 red
+" Color: xterm10 #00ff00 46 green
+" Color: xterm11 #ffff00 226 yellow
+" Color: xterm12 #5c5cff 63 blue
+" Color: xterm13 #ff00ff 201 magenta
+" Color: xterm14 #00ffff 51 cyan
+" Color: xterm15 #ffffff 231 white
+" Color: rgbGrey40 #666666 59 darkgrey
+" Color: rgbDarkGrey #a9a9a9 145 grey
+" Color: rgbDarkBlue #00008b 20 darkblue
+" Color: rgbBlue #0000ff 21 darkblue
+" Color: rgbDarkCyan #008b8b 44 darkcyan
+" Color: Directory #00ffff 51 cyan
+" Color: rgbSeaGreen #2e8b57 29 darkgreen
+" Color: rgbGrey #bebebe 250 grey
+" Color: Question #00ff00 46 green
+" Color: SignColumn #a9a9a9 248 grey
+" Color: SpecialKey #00ffff 51 cyan
+" Color: StatusLineTerm #90ee90 120 darkgreen
+" Color: ToolbarLine #7f7f7f 244 darkgrey
+" Color: Underlined #80a0ff 111 blue
+" Color: Pmenu #444444 238 darkgrey
+" Color: ron303030 #303030 236 darkgrey
+" Color: ronLightBlue #add8e6 152 darkcyan
+" Color: ronPink2 #eea9b8 217 darkmagenta
+" Color: ronOrange #ffa500 214 darkyellow
+" Color: ronCursor #60a060 71 green
+" Color: ronSteelBlue #4682b4 67 blue
+" Color: ronGold2 #eec900 220 yellow
+" Color: ronDarkGreen #006400 22 darkgreen
+" Color: ronSlateBlue #6a5acd 62 blue
+" Color: ronOliveDrab #6b8e23 64 green
+" Color: ronCoral #ff7f50 209 red
+" Color: ronGray30 #4d4d4d 239 darkgrey
+" Term colors: xterm0 xterm1 xterm2 xterm3 xterm4 xterm5 xterm6 xterm7
+" Term colors: xterm8 xterm9 xterm10 xterm11 xterm12 xterm13
+" Term colors: xterm14 xterm15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim
index eedb9c9b25..5ae6d12111 100644
--- a/runtime/colors/shine.vim
+++ b/runtime/colors/shine.vim
@@ -1,59 +1,412 @@
-" Vim color file
-" Maintainer: Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
-" Last Change: 2001 May 25
+" Name: shine
+" Description: Light colorscheme inspired by normal text editors.
+" Author: Original author is Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
+" Maintainer: Original maintainer is Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 11:02:11 2022
-" This look like normal text editor.
-" This color scheme uses a light background.
+" Generated by Colortemplate v2.2.0
-" First remove all existing highlighting.
set background=light
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'shine'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#8b0000', '#006400', '#ffff00', '#00008b', '#6a0dad', '#008b8b', '#dadada', '#767676', '#ffafaf', '#90ee90', '#ffff60', '#add8e6', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link EndOfBuffer NonText
+hi! link ErrorMsg Error
+hi! link Tag Special
+hi! link Operator Statement
+hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi Folded guifg=#00008b guibg=#dadada gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#dadada gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#dadada gui=NONE cterm=NONE
+hi CursorLineNr guifg=NONE guibg=#dadada gui=NONE cterm=NONE
+hi QuickFixLine guifg=#000000 guibg=#ff8c00 gui=NONE cterm=NONE
+hi StatusLine guifg=#ffffff guibg=#000000 gui=bold cterm=bold
+hi StatusLineNC guifg=#ffffff guibg=#a8a8a8 gui=NONE cterm=NONE
+hi StatusLineTerm guifg=#000000 guibg=#90ee90 gui=bold cterm=bold
+hi StatusLineTermNC guifg=#dadada guibg=#006400 gui=NONE cterm=NONE
+hi VertSplit guifg=#a8a8a8 guibg=#a8a8a8 gui=NONE cterm=NONE
+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 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
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=NONE guibg=#a8a8a8 gui=bold cterm=bold
+hi NonText guifg=#add8e6 guibg=#ffffff gui=NONE cterm=NONE
+hi SpecialKey guifg=#add8e6 guibg=NONE gui=NONE cterm=NONE
+hi Visual guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=NONE gui=bold,underline ctermfg=NONE ctermbg=NONE cterm=underline
+hi LineNr guifg=#767676 guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#767676 guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Underlined guifg=#6a0dad guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi WarningMsg guifg=#6a0dad guibg=#ffffff gui=NONE cterm=NONE
+hi MoreMsg guifg=#006400 guibg=#ffffff gui=NONE cterm=NONE
+hi ModeMsg guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi Question guifg=#a07070 guibg=NONE gui=NONE cterm=NONE
+hi Todo guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#ffffff guibg=#ffafaf gui=NONE cterm=NONE
+hi Search guifg=#ffffff guibg=#6a0dad gui=NONE cterm=NONE
+hi IncSearch guifg=#008b8b guibg=#ffff00 gui=reverse cterm=reverse
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=bold cterm=bold
+hi ColorColumn guifg=#000000 guibg=#ffafaf gui=NONE cterm=NONE
+hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+hi lCursor guifg=#000000 guibg=#a07070 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#2e8b57 guibg=NONE guisp=#2e8b57 gui=undercurl cterm=underline
+hi SpellLocal guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi SpellRare guifg=#00008b guibg=NONE guisp=#00008b gui=undercurl cterm=underline
+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 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
+hi Float guifg=#a07070 guibg=NONE gui=bold cterm=bold
+hi PreProc guifg=#6a0dad guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ff8c00 guibg=NONE gui=NONE cterm=NONE
+hi SpecialChar guifg=#00008b guibg=NONE gui=NONE cterm=NONE
+hi Directory guifg=#008b8b guibg=NONE gui=bold cterm=bold
+hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Title guifg=#006400 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
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link EndOfBuffer NonText
+ hi! link ErrorMsg Error
+ hi! link Tag Special
+ hi! link Operator Statement
+ hi Normal ctermfg=16 ctermbg=231 cterm=NONE
+ hi Folded ctermfg=18 ctermbg=253 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=253 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=253 cterm=NONE
+ hi CursorLineNr ctermfg=NONE ctermbg=253 cterm=NONE
+ hi QuickFixLine ctermfg=16 ctermbg=208 cterm=NONE
+ hi StatusLine ctermfg=231 ctermbg=16 cterm=bold
+ hi StatusLineNC ctermfg=231 ctermbg=248 cterm=NONE
+ hi StatusLineTerm ctermfg=16 ctermbg=120 cterm=bold
+ hi StatusLineTermNC ctermfg=253 ctermbg=22 cterm=NONE
+ hi VertSplit ctermfg=248 ctermbg=248 cterm=NONE
+ hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE
+ 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 TabLine ctermfg=16 ctermbg=253 cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=248 cterm=bold
+ hi NonText ctermfg=153 ctermbg=231 cterm=NONE
+ hi SpecialKey ctermfg=153 ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=16 ctermbg=248 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=243 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=243 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=55 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=231 cterm=reverse
+ hi WarningMsg ctermfg=55 ctermbg=231 cterm=NONE
+ hi MoreMsg ctermfg=22 ctermbg=231 cterm=NONE
+ hi ModeMsg ctermfg=16 ctermbg=231 cterm=NONE
+ hi Question ctermfg=95 ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=16 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=231 ctermbg=217 cterm=NONE
+ hi Search ctermfg=231 ctermbg=55 cterm=NONE
+ hi IncSearch ctermfg=30 ctermbg=226 cterm=reverse
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=bold
+ hi ColorColumn ctermfg=16 ctermbg=217 cterm=NONE
+ hi Cursor ctermfg=231 ctermbg=16 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=95 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=29 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=201 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=18 ctermbg=NONE cterm=underline
+ hi Statement ctermfg=29 ctermbg=NONE cterm=bold
+ 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 Identifier ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=95 ctermbg=NONE cterm=NONE
+ hi Number ctermfg=95 ctermbg=NONE cterm=bold
+ hi Float ctermfg=95 ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=55 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=208 ctermbg=NONE cterm=NONE
+ hi SpecialChar ctermfg=18 ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=30 ctermbg=NONE cterm=bold
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=22 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=black ctermbg=white cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi StatusLine ctermfg=white ctermbg=black cterm=bold
+ hi StatusLineNC ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi StatusLineTerm ctermfg=black ctermbg=green cterm=bold
+ hi StatusLineTermNC ctermfg=grey ctermbg=darkgreen cterm=NONE
+ hi VertSplit ctermfg=darkgrey ctermbg=darkgrey cterm=NONE
+ hi Pmenu ctermfg=black ctermbg=darkgrey cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=black ctermbg=white cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=darkgrey cterm=bold
+ hi NonText ctermfg=blue ctermbg=white cterm=NONE
+ hi SpecialKey ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=darkmagenta ctermbg=NONE cterm=underline
+ hi Error ctermfg=red ctermbg=white cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=white cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=white cterm=NONE
+ hi ModeMsg ctermfg=black ctermbg=white cterm=NONE
+ hi Question ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=black ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=white ctermbg=red cterm=NONE
+ hi Search ctermfg=white ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkcyan ctermbg=yellow cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=bold
+ hi ColorColumn ctermfg=black ctermbg=red cterm=NONE
+ hi Cursor ctermfg=white ctermbg=black cterm=NONE
+ hi lCursor ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkgreen ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=magenta ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkblue ctermbg=NONE cterm=underline
+ hi Statement ctermfg=darkgreen ctermbg=NONE cterm=bold
+ 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 Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Number ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Float ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi SpecialChar ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=black ctermbg=grey cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi StatusLine ctermfg=black ctermbg=grey cterm=bold,reverse
+ hi StatusLineNC ctermfg=black ctermbg=grey cterm=reverse
+ hi StatusLineTerm ctermfg=black ctermbg=darkgreen cterm=bold,reverse
+ hi StatusLineTermNC ctermfg=grey ctermbg=darkgreen cterm=reverse
+ hi VertSplit ctermfg=black ctermbg=grey cterm=reverse
+ hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=reverse
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold,reverse
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=NONE ctermbg=NONE cterm=bold
+ hi FoldColumn ctermfg=grey ctermbg=NONE cterm=bold
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=NONE cterm=bold,reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi ModeMsg ctermfg=black ctermbg=NONE cterm=NONE
+ hi Question ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=grey ctermbg=darkred cterm=NONE
+ hi Search ctermfg=grey ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=darkcyan ctermbg=darkyellow cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=bold
+ hi ColorColumn ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi SpellCap ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=NONE cterm=reverse
+ hi SpellRare ctermfg=darkblue ctermbg=NONE cterm=reverse
+ hi Statement ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Comment ctermfg=black ctermbg=NONE cterm=bold
+ hi StorageClass ctermfg=darkred ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=NONE 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
+ hi Float ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi SpecialChar ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkgreen ctermbg=NONE 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
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
endif
-let colors_name = "shine"
-
-hi Normal ctermbg=White ctermfg=Black guifg=Black guibg=White
-
-" Groups used in the 'highlight' and 'guicursor' options default value.
-hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
-hi IncSearch term=reverse cterm=reverse gui=reverse
-hi ModeMsg term=bold cterm=bold gui=bold
-hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
-hi StatusLineNC term=reverse cterm=reverse gui=reverse
-hi VertSplit term=reverse cterm=reverse gui=reverse
-hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg
-hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
-hi Cursor ctermbg=Green guibg=Green guifg=Black
-hi lCursor guibg=Cyan guifg=Black
-hi Directory term=bold ctermfg=LightRed guifg=Red
-hi LineNr term=underline ctermfg=Yellow guifg=Yellow
-hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen
-hi NonText term=bold ctermfg=LightBlue gui=bold guifg=LightBlue guibg=grey90
-hi Question term=standout ctermfg=LightGreen gui=bold guifg=Green
-hi Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
-hi SpecialKey term=bold ctermfg=LightBlue guifg=Blue
-hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta
-hi WarningMsg term=standout ctermfg=LightRed guifg=Red
-hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
-hi Folded term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
-hi FoldColumn term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
-hi DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue
-hi DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta
-hi DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan
-
-hi Comment ctermfg=DarkGrey ctermbg=White guifg=DarkGrey gui=bold
-hi SpecialChar ctermfg=DarkGrey ctermbg=White guifg=DarkGrey gui=bold
-hi StorageClass ctermfg=Red ctermbg=White guifg=Red gui=bold
-hi Number ctermfg=LightRed ctermbg=White guifg=LightRed gui=bold
-
-" Groups for syntax highlighting
-hi Constant term=underline ctermfg=Magenta guifg=#a07070 guibg=grey80
-hi Special term=bold ctermfg=LightRed guifg=DarkOrange guibg=grey80
-if &t_Co > 8
- hi Statement term=bold cterm=bold ctermfg=DarkGreen ctermbg=White guifg=#ffff60 gui=bold
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
endif
-hi Ignore ctermfg=LightGrey guifg=grey90
-" vim: sw=2
+" Background: light
+" Color: Black #000000 16 black
+" Color: DarkGrey #767676 243 darkgrey
+" Color: MediumGrey #A8A8A8 248 darkgrey
+" Color: LightGrey #DADADA 253 grey
+" Color: White #ffffff 231 white
+" Color: Cyan #00ffff 51 cyan
+" Color: Magenta #ff00ff 201 magenta
+" Color: Red #ff0000 196 red
+" Color: Yellow #ffff00 226 yellow
+" Color: SeaGreen #2e8b57 29 darkgreen
+" Color: DarkBlue #00008b 18 darkblue
+" Color: DarkCyan #008b8b 30 darkcyan
+" Color: DarkGreen #006400 22 darkgreen
+" Color: DarkOrange #ff8c00 208 darkyellow
+" Color: DarkRed #8b0000 88 darkred
+" Color: LightBlue #add8e6 153 blue
+" Color: LightGreen #90ee90 120 green
+" Color: LightMagenta#ff83fa 213 magenta
+" Color: LightRed #ffafaf 217 red
+" Color: MutedRed #a07070 95 darkred
+" Color: MutedYellow #ffff60 228 yellow
+" Color: Purple #6a0dad 55 darkmagenta
+" Term colors: Black DarkRed DarkGreen Yellow DarkBlue Purple DarkCyan LightGrey
+" Term colors: DarkGrey LightRed LightGreen MutedYellow LightBlue Magenta Cyan White
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim
index ffc13b822a..192d4162ee 100644
--- a/runtime/colors/slate.vim
+++ b/runtime/colors/slate.vim
@@ -1,55 +1,410 @@
-"%% SiSU Vim color file
-" Slate Maintainer: Ralph Amissah <ralph@amissah.com>
-" (originally looked at desert Hans Fugal <hans@fugal.net> http://hans.fugal.net/vim/colors/desert.vim (2003/05/06)
-:set background=dark
-:highlight clear
-if version > 580
- hi clear
- if exists("syntax_on")
- syntax reset
- endif
+" Name: slate
+" Description: Remake of slate
+" Author: Original maintainer Ralph Amissah <ralph@amissah.com>
+" Maintainer: Original maintainer Ralph Amissah <ralph@amissah.com>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 11:03:10 2022
+
+" Generated by Colortemplate v2.2.0
+
+set background=dark
+
+hi clear
+let g:colors_name = 'slate'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#ff0000', '#5f8700', '#ffff00', '#87d7ff', '#d7d787', '#ffd7af', '#666666', '#333333', '#ffafaf', '#00875f', '#ffd700', '#5f87d7', '#afaf87', '#ff8787', '#ffffff']
endif
-let colors_name = "slate"
-:hi Normal guifg=White guibg=grey15
-:hi Cursor guibg=khaki guifg=slategrey
-:hi VertSplit guibg=#c2bfa5 guifg=grey40 gui=none cterm=reverse
-:hi Folded guibg=black guifg=grey40 ctermfg=grey ctermbg=darkgrey
-:hi FoldColumn guibg=black guifg=grey20 ctermfg=4 ctermbg=7
-:hi IncSearch guifg=green guibg=black cterm=none ctermfg=yellow ctermbg=green
-:hi ModeMsg guifg=goldenrod cterm=none ctermfg=brown
-:hi MoreMsg guifg=SeaGreen ctermfg=darkgreen
-:hi NonText guifg=RoyalBlue guibg=grey15 cterm=bold ctermfg=blue
-:hi Question guifg=springgreen ctermfg=green
-:hi Search guibg=peru guifg=wheat cterm=none ctermfg=grey ctermbg=blue
-:hi SpecialKey guifg=yellowgreen ctermfg=darkgreen
-:hi StatusLine guibg=#c2bfa5 guifg=black gui=none cterm=bold,reverse
-:hi StatusLineNC guibg=#c2bfa5 guifg=grey40 gui=none cterm=reverse
-:hi Title guifg=gold gui=bold cterm=bold ctermfg=yellow
-:hi Statement guifg=CornflowerBlue ctermfg=lightblue
-:hi Visual gui=none guifg=khaki guibg=olivedrab cterm=reverse
-:hi WarningMsg guifg=salmon ctermfg=1
-:hi String guifg=SkyBlue ctermfg=darkcyan
-:hi Comment term=bold ctermfg=11 guifg=grey40
-:hi Constant guifg=#ffa0a0 ctermfg=brown
-:hi Special guifg=darkkhaki ctermfg=brown
-:hi Identifier guifg=salmon ctermfg=red
-:hi Include guifg=red ctermfg=red
-:hi PreProc guifg=red guibg=white ctermfg=red
-:hi Operator guifg=Red ctermfg=Red
-:hi Define guifg=gold gui=bold ctermfg=yellow
-:hi Type guifg=CornflowerBlue ctermfg=2
-:hi Function guifg=navajowhite ctermfg=brown
-:hi Structure guifg=green ctermfg=green
-:hi LineNr guifg=grey50 ctermfg=3
-:hi Ignore guifg=grey40 cterm=bold ctermfg=7
-:hi Todo guifg=orangered guibg=yellow2
-:hi Directory ctermfg=darkcyan
-:hi ErrorMsg cterm=bold guifg=White guibg=Red cterm=bold ctermfg=7 ctermbg=1
-:hi WildMenu ctermfg=0 ctermbg=3
-:hi DiffAdd ctermbg=4
-:hi DiffChange ctermbg=5
-:hi DiffDelete cterm=bold ctermfg=4 ctermbg=6
-:hi DiffText cterm=bold ctermbg=1
-:hi Underlined cterm=underline ctermfg=5
-:hi Error guifg=White guibg=Red cterm=bold ctermfg=7 ctermbg=1
-:hi SpellErrors guifg=White guibg=Red cterm=bold ctermfg=7 ctermbg=1
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi Normal guifg=#ffffff guibg=#262626 gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#5f87d7 guibg=NONE gui=NONE cterm=NONE
+hi StatusLine guifg=#000000 guibg=#afaf87 gui=NONE cterm=NONE
+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 PmenuSbar guifg=NONE guibg=#262626 gui=NONE cterm=NONE
+hi PmenuThumb guifg=NONE guibg=#ffd700 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
+hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi ToolbarButton guifg=#262626 guibg=#d7d787 gui=NONE cterm=NONE
+hi NonText guifg=#5f87d7 guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#00875f guibg=NONE gui=NONE cterm=NONE
+hi QuickFixLine guifg=#000000 guibg=#5f87d7 gui=NONE cterm=NONE
+hi Folded guifg=#666666 guibg=#000000 gui=NONE cterm=NONE
+hi FoldColumn guifg=#5f87d7 guibg=#000000 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#333333 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#333333 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#000000 gui=NONE cterm=NONE
+hi CursorLineNr guifg=NONE guibg=#333333 gui=NONE cterm=NONE
+hi Visual guifg=#d7d787 guibg=#5f8700 gui=NONE cterm=NONE
+hi SignColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE
+hi VisualNOS guifg=#d7d787 guibg=#5f8700 gui=NONE cterm=NONE
+hi LineNr guifg=#666666 guibg=NONE gui=NONE cterm=NONE
+hi Underlined guifg=#5f87d7 guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi ErrorMsg guifg=#ff0000 guibg=#000000 gui=reverse cterm=reverse
+hi ModeMsg guifg=#262626 guibg=#ffd700 gui=NONE cterm=NONE
+hi WarningMsg guifg=#ff8787 guibg=NONE gui=NONE cterm=NONE
+hi MoreMsg guifg=#00875f guibg=NONE gui=NONE cterm=NONE
+hi Question guifg=#ffd700 guibg=NONE gui=NONE cterm=NONE
+hi Todo guifg=#ff0000 guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#000000 guibg=#ffd700 gui=NONE cterm=NONE
+hi Search guifg=#000000 guibg=#d7875f gui=NONE cterm=NONE
+hi IncSearch guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE
+hi WildMenu guifg=#262626 guibg=#d7d787 gui=NONE cterm=NONE
+hi Cursor guifg=#333333 guibg=#d7d787 gui=NONE cterm=NONE
+hi lCursor guifg=#262626 guibg=#ffafaf gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#ffff00 guibg=NONE guisp=#ffff00 gui=undercurl cterm=underline
+hi SpellLocal guifg=#ffafaf guibg=NONE guisp=#ffafaf gui=undercurl cterm=underline
+hi SpellRare guifg=#ffd7af guibg=NONE guisp=#ffd7af gui=undercurl cterm=underline
+hi Comment guifg=#666666 guibg=NONE gui=NONE cterm=NONE
+hi String guifg=#87d7ff guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#ff8787 guibg=NONE gui=NONE cterm=NONE
+hi Function guifg=#ffd7af guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#d7d787 guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#5f87d7 guibg=NONE gui=bold cterm=bold
+hi Constant guifg=#ffafaf guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#d7875f guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#5f87d7 guibg=NONE gui=bold cterm=bold
+hi Operator guifg=#d7875f guibg=NONE gui=NONE cterm=NONE
+hi Define guifg=#ffd700 guibg=NONE gui=bold cterm=bold
+hi Structure guifg=#00ff00 guibg=NONE gui=NONE cterm=NONE
+hi Directory guifg=#00875f guibg=NONE gui=bold cterm=bold
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
+hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Title guifg=#ffd700 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
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi Normal ctermfg=231 ctermbg=235 cterm=NONE
+ hi EndOfBuffer ctermfg=68 ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=16 ctermbg=144 cterm=NONE
+ hi StatusLineNC ctermfg=241 ctermbg=144 cterm=NONE
+ 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 PmenuSbar ctermfg=NONE ctermbg=235 cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=220 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
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=235 ctermbg=186 cterm=NONE
+ hi NonText ctermfg=68 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=29 ctermbg=NONE cterm=NONE
+ hi QuickFixLine ctermfg=16 ctermbg=68 cterm=NONE
+ hi Folded ctermfg=241 ctermbg=16 cterm=NONE
+ hi FoldColumn ctermfg=68 ctermbg=16 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=236 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=236 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=16 cterm=NONE
+ hi CursorLineNr ctermfg=NONE ctermbg=236 cterm=NONE
+ hi Visual ctermfg=186 ctermbg=64 cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=235 cterm=NONE
+ hi VisualNOS ctermfg=186 ctermbg=64 cterm=NONE
+ hi LineNr ctermfg=241 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=68 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=231 cterm=reverse
+ hi ErrorMsg ctermfg=196 ctermbg=16 cterm=reverse
+ hi ModeMsg ctermfg=235 ctermbg=220 cterm=NONE
+ hi WarningMsg ctermfg=210 ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=NONE
+ hi Question ctermfg=220 ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=196 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=16 ctermbg=220 cterm=NONE
+ hi Search ctermfg=16 ctermbg=173 cterm=NONE
+ hi IncSearch ctermfg=16 ctermbg=46 cterm=NONE
+ hi WildMenu ctermfg=235 ctermbg=186 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=226 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=217 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=223 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=241 ctermbg=NONE cterm=NONE
+ hi String ctermfg=117 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=210 ctermbg=NONE cterm=NONE
+ hi Function ctermfg=223 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=186 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=68 ctermbg=NONE cterm=bold
+ hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=173 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=68 ctermbg=NONE cterm=bold
+ hi Operator ctermfg=173 ctermbg=NONE cterm=NONE
+ hi Define ctermfg=220 ctermbg=NONE cterm=bold
+ hi Structure ctermfg=46 ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=29 ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=241 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=220 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=blue ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=black ctermbg=grey cterm=NONE
+ hi StatusLineNC ctermfg=darkgrey ctermbg=grey cterm=NONE
+ hi StatusLineTerm ctermfg=black ctermbg=grey cterm=NONE
+ hi StatusLineTermNC ctermfg=darkgrey 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 PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=yellow cterm=NONE
+ hi TabLineSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi TabLine ctermfg=grey ctermbg=darkgrey cterm=NONE
+ hi TabLineFill ctermfg=cyan ctermbg=darkgrey cterm=NONE
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi NonText ctermfg=blue ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=green ctermbg=NONE cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi Visual ctermfg=yellow ctermbg=darkgreen cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=black cterm=NONE
+ hi VisualNOS ctermfg=darkmagenta ctermbg=darkgreen cterm=NONE
+ hi LineNr ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=white cterm=reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=black cterm=reverse
+ hi ModeMsg ctermfg=black ctermbg=yellow cterm=NONE
+ hi WarningMsg ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=green ctermbg=NONE cterm=NONE
+ hi Question ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=darkred ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=yellow cterm=NONE
+ hi Search ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkyellow ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi String ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Function ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=blue ctermbg=NONE cterm=bold
+ hi Constant ctermfg=red ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=blue ctermbg=NONE cterm=bold
+ hi Operator ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Define ctermfg=yellow ctermbg=NONE cterm=bold
+ hi Structure ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=green ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=yellow ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi StatusLine ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi StatusLineNC ctermfg=grey ctermbg=black cterm=reverse
+ 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 PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=darkyellow cterm=NONE
+ hi TabLineSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi TabLine ctermfg=grey ctermbg=black cterm=reverse
+ hi TabLineFill ctermfg=grey ctermbg=black cterm=reverse
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=black ctermbg=darkblue cterm=NONE
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi VisualNOS ctermfg=darkmagenta ctermbg=darkgreen cterm=underline
+ hi LineNr ctermfg=grey ctermbg=NONE cterm=bold
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=grey cterm=reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=black cterm=reverse
+ hi ModeMsg ctermfg=NONE ctermbg=darkyellow cterm=NONE
+ hi WarningMsg ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=darkred ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi Search ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkyellow ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi SpellRare ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=grey ctermbg=NONE cterm=bold
+ hi String ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Function ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Operator ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Define ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Structure ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Directory ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkyellow ctermbg=NONE 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
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: dark
+" Color: foreground #FFFFFF 231 white
+" Color: background #262626 235 black
+" Color: color00 #000000 16 black
+" Color: color08 #333333 236 darkgrey
+" Color: color01 #FF0000 196 darkred
+" Color: color09 #FFAFAF 217 red
+" Color: color02 #5F8700 64 darkgreen
+" Color: color10 #00875F 29 green
+" Color: color03 #ffff00 226 darkyellow
+" Color: color11 #FFD700 220 yellow
+" Color: color04 #87d7FF 117 darkblue
+" Color: color12 #5F87D7 68 blue
+" Color: color05 #d7d787 186 darkmagenta
+" Color: color13 #AFAF87 144 magenta
+" Color: color06 #FFD7AF 223 darkcyan
+" Color: color14 #FF8787 210 cyan
+" Color: color07 #666666 241 grey
+" Color: color15 #FFFFFF 231 white
+" Color: color16 #D7875F 173 darkmagenta
+" Color: color17 #00FF00 46 darkgreen
+" Color: Pmenu #4A4A4A 239 darkgrey
+" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
+" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim
index 0e7a916a1c..bddd1c4e74 100644
--- a/runtime/colors/torte.vim
+++ b/runtime/colors/torte.vim
@@ -1,50 +1,419 @@
-" Vim color file
-" Maintainer: Thorsten Maerz <info@netztorte.de>
-" Last Change: 2006 Dec 07
-" grey on black
-" optimized for TFT panels
+" Name: torte
+" Description: Remake of torte (grey on black)
+" Author: Original maintainer Thorsten Maerz <info@netztorte.de>
+" Maintainer: Original maintainer Thorsten Maerz <info@netztorte.de>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 11:04:48 2022
+
+" Generated by Colortemplate v2.2.0
set background=dark
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'torte'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff']
+endif
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi! link StatusLineTerm StatusLine
+hi! link StatusLineTermNC StatusLineNC
+hi Normal guifg=#cccccc guibg=#000000 gui=NONE cterm=NONE
+hi Comment guifg=#80a0ff guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ffa0a0 guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#40ffff guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#ffff60 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#ff80ff guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#60ff60 guibg=NONE gui=NONE cterm=NONE
+hi Special guifg=#ffa500 guibg=NONE gui=NONE cterm=NONE
+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=#ffff00 guibg=#000000 gui=reverse cterm=reverse
+hi Folded guifg=#00cdcd guibg=#3a3a3a gui=NONE cterm=NONE
+hi Visual guifg=#000000 guibg=#a9a9a9 gui=bold cterm=NONE
+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=#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 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
+hi Title guifg=#ff00ff guibg=NONE gui=bold cterm=bold
+hi Directory guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi Search guifg=#ff0000 guibg=#000000 gui=reverse cterm=reverse
+hi IncSearch guifg=#00cd00 guibg=#000000 gui=reverse cterm=reverse
+hi NonText guifg=#0000ff guibg=NONE gui=bold cterm=NONE
+hi EndOfBuffer guifg=#0000ff guibg=NONE gui=bold cterm=NONE
+hi ErrorMsg guifg=#ffffff guibg=#cd0000 gui=NONE cterm=NONE
+hi WarningMsg guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi LineNr guifg=#7f7f7f guibg=NONE gui=NONE cterm=NONE
+hi MatchParen guifg=NONE guibg=#008b8b gui=NONE cterm=NONE
+hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
+hi MoreMsg guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
+hi Question guifg=#00ff00 guibg=NONE gui=bold cterm=bold
+hi SpecialKey guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=#000000 gui=bold,underline cterm=underline
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi QuickFixLine guifg=#000000 guibg=#cdcd00 gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#5c5cff guibg=NONE guisp=#5c5cff gui=undercurl cterm=underline
+hi SpellLocal guifg=#ff00ff guibg=NONE guisp=#ff00ff gui=undercurl cterm=underline
+hi SpellRare guifg=#00ffff guibg=NONE guisp=#00ffff gui=undercurl cterm=underline
+hi StatusLine guifg=#ffffff guibg=#0000ee gui=bold cterm=bold
+hi StatusLineNC guifg=#000000 guibg=#e5e5e5 gui=NONE cterm=NONE
+hi VertSplit guifg=#000000 guibg=#e5e5e5 gui=NONE cterm=NONE
+hi TabLine guifg=#ffffff guibg=#7f7f7f gui=NONE cterm=NONE
+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 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
+hi PmenuThumb guifg=NONE guibg=#bebebe gui=NONE cterm=NONE
+hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi Normal ctermfg=251 ctermbg=16 cterm=NONE
+ hi Comment ctermfg=111 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=87 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=227 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=213 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=83 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=214 ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
+ hi Ignore ctermfg=16 ctermbg=16 cterm=NONE
+ hi Error ctermfg=231 ctermbg=196 cterm=NONE
+ hi Todo ctermfg=226 ctermbg=16 cterm=reverse
+ hi Folded ctermfg=44 ctermbg=237 cterm=NONE
+ hi Visual ctermfg=16 ctermbg=248 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=242 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=242 cterm=NONE
+ hi CursorLineNr ctermfg=226 ctermbg=242 cterm=NONE
+ 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 Cursor ctermfg=16 ctermbg=46 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=254 cterm=NONE
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi Title ctermfg=201 ctermbg=NONE cterm=bold
+ hi Directory ctermfg=51 ctermbg=NONE cterm=NONE
+ hi Search ctermfg=196 ctermbg=16 cterm=reverse
+ hi IncSearch ctermfg=40 ctermbg=16 cterm=reverse
+ hi NonText ctermfg=21 ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=21 ctermbg=NONE cterm=NONE
+ hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE
+ hi WarningMsg ctermfg=196 ctermbg=NONE cterm=NONE
+ hi LineNr ctermfg=102 ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=30 cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=29 ctermbg=NONE cterm=bold
+ hi Question ctermfg=46 ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=51 ctermbg=NONE cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=16 cterm=underline
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi QuickFixLine ctermfg=16 ctermbg=184 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=63 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=201 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=51 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=231 ctermbg=20 cterm=bold
+ hi StatusLineNC ctermfg=16 ctermbg=254 cterm=NONE
+ hi VertSplit ctermfg=16 ctermbg=254 cterm=NONE
+ hi TabLine ctermfg=231 ctermbg=102 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=16 cterm=reverse
+ 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 Pmenu ctermfg=fg ctermbg=236 cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=250 cterm=NONE
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
endif
-"colorscheme default
-let g:colors_name = "torte"
-
-" hardcoded colors :
-" GUI Comment : #80a0ff = Light blue
-
-" GUI
-highlight Normal guifg=Grey80 guibg=Black
-highlight Search guifg=Black guibg=Red gui=bold
-highlight Visual guifg=#404040 gui=bold
-highlight Cursor guifg=Black guibg=Green gui=bold
-highlight Special guifg=Orange
-highlight Comment guifg=#80a0ff
-highlight StatusLine guifg=blue guibg=white
-highlight Statement guifg=Yellow gui=NONE
-highlight Type gui=NONE
-
-" Console
-highlight Normal ctermfg=LightGrey ctermbg=Black
-highlight Search ctermfg=Black ctermbg=Red cterm=NONE
-highlight Visual cterm=reverse
-highlight Cursor ctermfg=Black ctermbg=Green cterm=bold
-highlight Special ctermfg=Brown
-highlight Comment ctermfg=Blue
-highlight StatusLine ctermfg=blue ctermbg=white
-highlight Statement ctermfg=Yellow cterm=NONE
-highlight Type cterm=NONE
-
-" only for vim 5
-if has("unix")
- if v:version<600
- highlight Normal ctermfg=Grey ctermbg=Black cterm=NONE guifg=Grey80 guibg=Black gui=NONE
- highlight Search ctermfg=Black ctermbg=Red cterm=bold guifg=Black guibg=Red gui=bold
- highlight Visual ctermfg=Black ctermbg=yellow cterm=bold guifg=#404040 gui=bold
- highlight Special ctermfg=LightBlue cterm=NONE guifg=LightBlue gui=NONE
- highlight Comment ctermfg=Cyan cterm=NONE guifg=LightBlue gui=NONE
- endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=white ctermbg=black cterm=NONE
+ hi Comment ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Type ctermfg=green ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi Error ctermfg=white ctermbg=red cterm=NONE
+ hi Todo ctermfg=yellow ctermbg=black cterm=reverse
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=black ctermbg=grey cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=bold
+ 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 Cursor ctermfg=black ctermbg=green cterm=NONE
+ hi lCursor ctermfg=black ctermbg=grey cterm=NONE
+ hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
+ hi Title ctermfg=magenta ctermbg=NONE cterm=bold
+ hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi Search ctermfg=red ctermbg=black cterm=reverse
+ hi IncSearch ctermfg=darkgreen ctermbg=black cterm=reverse
+ hi NonText ctermfg=blue ctermbg=NONE cterm=NONE
+ hi EndOfBuffer ctermfg=blue ctermbg=NONE cterm=NONE
+ hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE
+ hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
+ hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=green ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=cyan ctermbg=NONE cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=magenta ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=cyan ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=white ctermbg=darkblue cterm=bold
+ hi StatusLineNC ctermfg=black ctermbg=grey cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLine ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=black cterm=reverse
+ 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 Pmenu ctermfg=fg ctermbg=darkgrey cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
+ hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=grey ctermbg=black cterm=NONE
+ hi Comment ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Type ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Ignore ctermfg=black ctermbg=black cterm=NONE
+ hi Error ctermfg=grey ctermbg=darkred cterm=NONE
+ hi Todo ctermfg=darkyellow ctermbg=black cterm=reverse
+ hi Folded ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold,underline
+ hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
+ hi Search ctermfg=darkred ctermbg=black cterm=bold,reverse
+ hi IncSearch ctermfg=darkgreen ctermbg=black cterm=reverse
+ hi NonText ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
+ hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi LineNr ctermfg=grey ctermbg=NONE cterm=bold
+ hi MatchParen ctermfg=grey ctermbg=darkcyan cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=black cterm=underline
+ hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=darkyellow cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=darkyellow cterm=reverse
+ hi SpellLocal ctermfg=darkmagenta ctermbg=darkyellow cterm=reverse
+ hi SpellRare ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi StatusLine ctermfg=grey ctermbg=darkblue cterm=bold
+ hi StatusLineNC ctermfg=black ctermbg=grey cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=black cterm=reverse
+ hi TabLineSel ctermfg=white ctermbg=black cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ 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 DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
endif
+" Background: dark
+" Color: foreground #CCCCCC 251 white
+" Color: background #000000 16 black
+" Color: color00 #000000 16 black
+" Color: color08 #7f7f7f 102 darkgrey
+" Color: color01 #cd0000 160 darkred
+" Color: color09 #ff0000 196 red
+" Color: color02 #00cd00 40 darkgreen
+" Color: color10 #00ff00 46 green
+" Color: color03 #cdcd00 184 darkyellow
+" Color: color11 #ffff00 226 yellow
+" Color: color04 #0000ee 20 darkblue
+" Color: color12 #5c5cff 63 blue
+" Color: color05 #cd00cd 164 darkmagenta
+" Color: color13 #ff00ff 201 magenta
+" Color: color06 #00cdcd 44 darkcyan
+" Color: color14 #00ffff 51 cyan
+" Color: color07 #e5e5e5 254 grey
+" Color: color15 #ffffff 231 white
+" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
+" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
+" Color: rgbGrey40 #666666 242 grey
+" Color: rgbDarkGrey #a9a9a9 248 grey
+" Color: rgbDarkBlue #00008b 18 darkblue
+" Color: rgbDarkMagenta #8b008b 90 darkmagenta
+" Color: rgbBlue #0000ff 21 blue
+" Color: rgbDarkCyan #008b8b 30 darkcyan
+" Color: Directory #00ffff 51 cyan
+" Color: rgbSeaGreen #2e8b57 29 darkgreen
+" Color: rgbGrey #bebebe 250 grey
+" Color: Question #00ff00 46 green
+" Color: SignColumn #a9a9a9 248 black
+" Color: SpecialKey #00ffff 51 cyan
+" Color: StatusLineTerm #90ee90 120 darkgreen
+" Color: Title #ff00ff 201 magenta
+" Color: WarningMsg #ff0000 196 red
+" Color: ToolbarLine #7f7f7f 243 black
+" Color: ToolbarButton #d3d3d3 252 darkgrey
+" Color: Comment #80a0ff 111 blue
+" Color: Constant #ffa0a0 217 darkmagenta
+" Color: Special #ffa500 214 darkred
+" Color: Identifier #40ffff 87 cyan
+" Color: Statement #ffff60 227 yellow
+" Color: PreProc #ff80ff 213 darkcyan
+" Color: Type #60ff60 83 green
+" Color: Underlined #80a0ff 111 blue
+" Color: FoldedBG #3a3a3a 237 darkgrey
+" Color: Pmenu #303030 236 darkgrey
+" Color: rgbDarkRed #8b0000 88 darkred
+" Color: bgDiffA #5F875F 65 darkgreen
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim
index ab875825c9..6133538885 100644
--- a/runtime/colors/zellner.vim
+++ b/runtime/colors/zellner.vim
@@ -1,54 +1,407 @@
-" local syntax file - set colors on a per-machine basis:
-" vim: tw=0 ts=4 sw=4
-" Vim color file
-" Maintainer: Ron Aaron <ron@ronware.org>
-" Last Change: 2003 May 02
+" Name: zellner
+" Description: Light background colorscheme.
+" Author: Original author Ron Aaron <ron@ronware.org>
+" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>
+" Website: https://github.com/vim/colorschemes
+" License: Same as Vim
+" Last Updated: Sun Jun 12 11:05:43 2022
+
+" Generated by Colortemplate v2.2.0
set background=light
+
hi clear
-if exists("syntax_on")
- syntax reset
+let g:colors_name = 'zellner'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ let g:terminal_ansi_colors = ['#ffffff', '#a52a2a', '#ff00ff', '#a020f0', '#0000ff', '#0000ff', '#ff00ff', '#a9a9a9', '#ff0000', '#a52a2a', '#ff00ff', '#a020f0', '#0000ff', '#0000ff', '#ff00ff', '#000000']
endif
-let g:colors_name = "zellner"
-
-hi Comment term=bold ctermfg=Red guifg=Red
-hi Normal guifg=black guibg=white
-hi Constant term=underline ctermfg=Magenta guifg=Magenta
-hi Special term=bold ctermfg=Magenta guifg=Magenta
-hi Identifier term=underline ctermfg=Blue guifg=Blue
-hi Statement term=bold ctermfg=DarkRed gui=NONE guifg=Brown
-hi PreProc term=underline ctermfg=Magenta guifg=Purple
-hi Type term=underline ctermfg=Blue gui=NONE guifg=Blue
-hi Visual term=reverse ctermfg=Yellow ctermbg=Red gui=NONE guifg=Black guibg=Yellow
-hi Search term=reverse ctermfg=Black ctermbg=Cyan gui=NONE guifg=Black guibg=Cyan
-hi Tag term=bold ctermfg=DarkGreen guifg=DarkGreen
-hi Error term=reverse ctermfg=15 ctermbg=9 guibg=Red guifg=White
-hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
-hi StatusLine term=bold,reverse cterm=NONE ctermfg=Yellow ctermbg=DarkGray gui=NONE guifg=Yellow guibg=DarkGray
-hi! link MoreMsg Comment
-hi! link ErrorMsg Visual
-hi! link WarningMsg ErrorMsg
-hi! link Question Comment
-hi link String Constant
-hi link Character Constant
-hi link Number Constant
-hi link Boolean Constant
-hi link Float Number
-hi link Function Identifier
-hi link Conditional Statement
-hi link Repeat Statement
-hi link Label Statement
-hi link Operator Statement
-hi link Keyword Statement
-hi link Exception Statement
-hi link Include PreProc
-hi link Define PreProc
-hi link Macro PreProc
-hi link PreCondit PreProc
-hi link StorageClass Type
-hi link Structure Type
-hi link Typedef Type
-hi link SpecialChar Special
-hi link Delimiter Special
-hi link SpecialComment Special
-hi link Debug Special
+hi! link Terminal Normal
+hi! link LineNrAbove LineNr
+hi! link LineNrBelow LineNr
+hi! link CurSearch Search
+hi! link CursorLineFold CursorLine
+hi! link CursorLineSign CursorLine
+hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+hi Folded guifg=#00008b guibg=#d3d3d3 gui=NONE cterm=NONE
+hi CursorLine guifg=NONE guibg=#e5e5e5 gui=NONE cterm=NONE
+hi CursorColumn guifg=NONE guibg=#e5e5e5 gui=NONE cterm=NONE
+hi CursorLineNr guifg=#a52a2a guibg=NONE gui=bold cterm=bold
+hi QuickFixLine guifg=#ffffff guibg=#6a5acd gui=NONE cterm=NONE
+hi EndOfBuffer guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE
+hi StatusLine guifg=#ffff00 guibg=#a9a9a9 gui=NONE cterm=NONE
+hi StatusLineNC guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+hi StatusLineTerm guifg=#ffffff guibg=#006400 gui=NONE cterm=NONE
+hi StatusLineTermNC guifg=#ffffff guibg=#0000ff gui=NONE cterm=NONE
+hi VertSplit guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+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 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
+hi ToolbarLine guifg=NONE guibg=#d3d3d3 gui=NONE cterm=NONE
+hi ToolbarButton guifg=NONE guibg=#a9a9a9 gui=bold cterm=bold
+hi NonText guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE
+hi SpecialKey guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE
+hi Visual guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi VisualNOS guifg=NONE guibg=#ff0000 gui=NONE cterm=NONE
+hi LineNr guifg=#a52a2a guibg=NONE gui=NONE cterm=NONE
+hi FoldColumn guifg=#00008b guibg=NONE gui=NONE cterm=NONE
+hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Underlined guifg=#6a5acd guibg=NONE gui=underline cterm=underline
+hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi ErrorMsg guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
+hi WarningMsg guifg=#a020f0 guibg=#ffffff gui=NONE cterm=NONE
+hi MoreMsg guifg=#000000 guibg=#ffffff gui=bold cterm=bold
+hi ModeMsg guifg=#000000 guibg=#ffffff gui=bold cterm=bold
+hi Question guifg=#ff00ff guibg=NONE gui=bold cterm=bold
+hi Todo guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi MatchParen guifg=#ffffff guibg=#ff00ff gui=NONE cterm=NONE
+hi Search guifg=#ffffff guibg=#a020f0 gui=NONE cterm=NONE
+hi IncSearch guifg=#000000 guibg=NONE gui=reverse cterm=reverse
+hi WildMenu guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
+hi ColorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
+hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+hi lCursor guifg=#000000 guibg=#ff00ff gui=NONE cterm=NONE
+hi SpellBad guifg=#ff0000 guibg=NONE guisp=#ff0000 gui=undercurl cterm=underline
+hi SpellCap guifg=#0000ff guibg=NONE guisp=#0000ff gui=undercurl cterm=underline
+hi SpellLocal guifg=#878700 guibg=NONE guisp=#878700 gui=undercurl cterm=underline
+hi SpellRare guifg=#008787 guibg=NONE guisp=#008787 gui=undercurl cterm=underline
+hi Comment guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE
+hi Identifier guifg=#0000ff guibg=NONE gui=NONE cterm=NONE
+hi Statement guifg=#a52a2a guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#a020f0 guibg=NONE gui=NONE cterm=NONE
+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 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
+hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
+hi DiffText guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
+hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE
+
+if s:t_Co >= 256
+ hi! link Terminal Normal
+ hi! link LineNrAbove LineNr
+ hi! link LineNrBelow LineNr
+ hi! link CurSearch Search
+ hi! link CursorLineFold CursorLine
+ hi! link CursorLineSign CursorLine
+ hi Normal ctermfg=16 ctermbg=231 cterm=NONE
+ hi Folded ctermfg=18 ctermbg=252 cterm=NONE
+ hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE
+ hi CursorColumn ctermfg=NONE ctermbg=254 cterm=NONE
+ hi CursorLineNr ctermfg=124 ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=231 ctermbg=62 cterm=NONE
+ hi EndOfBuffer ctermfg=248 ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=226 ctermbg=248 cterm=NONE
+ hi StatusLineNC ctermfg=231 ctermbg=16 cterm=NONE
+ hi StatusLineTerm ctermfg=231 ctermbg=22 cterm=NONE
+ hi StatusLineTermNC ctermfg=231 ctermbg=21 cterm=NONE
+ hi VertSplit ctermfg=231 ctermbg=16 cterm=NONE
+ hi Pmenu ctermfg=16 ctermbg=253 cterm=NONE
+ 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 TabLine ctermfg=16 ctermbg=248 cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=252 cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=248 cterm=bold
+ hi NonText ctermfg=248 ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=248 ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=16 ctermbg=226 cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=196 cterm=NONE
+ hi LineNr ctermfg=124 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=18 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=62 ctermbg=NONE cterm=underline
+ hi Error ctermfg=196 ctermbg=231 cterm=reverse
+ hi ErrorMsg ctermfg=196 ctermbg=231 cterm=reverse
+ hi WarningMsg ctermfg=129 ctermbg=231 cterm=NONE
+ hi MoreMsg ctermfg=16 ctermbg=231 cterm=bold
+ hi ModeMsg ctermfg=16 ctermbg=231 cterm=bold
+ hi Question ctermfg=201 ctermbg=NONE cterm=bold
+ hi Todo ctermfg=16 ctermbg=226 cterm=NONE
+ hi MatchParen ctermfg=231 ctermbg=201 cterm=NONE
+ hi Search ctermfg=231 ctermbg=129 cterm=NONE
+ hi IncSearch ctermfg=16 ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=16 ctermbg=226 cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=255 cterm=NONE
+ hi Cursor ctermfg=231 ctermbg=16 cterm=NONE
+ hi lCursor ctermfg=16 ctermbg=201 cterm=NONE
+ hi SpellBad ctermfg=196 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=21 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=100 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=30 ctermbg=NONE cterm=underline
+ hi Comment ctermfg=196 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=201 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=21 ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=124 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=129 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=21 ctermbg=NONE cterm=NONE
+ 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 Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=129 ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
+ hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
+ hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
+ hi DiffDelete ctermfg=231 ctermbg=133 cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 16
+ hi Normal ctermfg=black ctermbg=white cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorLineNr ctermfg=darkred ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=white ctermbg=blue cterm=NONE
+ hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi StatusLine ctermfg=yellow ctermbg=darkgrey cterm=NONE
+ hi StatusLineNC ctermfg=white ctermbg=black cterm=NONE
+ hi StatusLineTerm ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi StatusLineTermNC ctermfg=white ctermbg=blue cterm=NONE
+ hi VertSplit ctermfg=white ctermbg=black cterm=NONE
+ hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
+ 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 TabLine ctermfg=black ctermbg=grey cterm=underline
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi TabLineSel ctermfg=black ctermbg=white cterm=bold
+ hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
+ hi ToolbarButton ctermfg=NONE ctermbg=grey cterm=bold
+ hi NonText ctermfg=grey ctermbg=NONE cterm=NONE
+ hi SpecialKey ctermfg=grey ctermbg=NONE cterm=NONE
+ hi Visual ctermfg=black ctermbg=yellow cterm=NONE
+ hi VisualNOS ctermfg=NONE ctermbg=red cterm=NONE
+ hi LineNr ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=blue ctermbg=NONE cterm=underline
+ hi Error ctermfg=red ctermbg=white cterm=reverse
+ hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=white cterm=NONE
+ hi MoreMsg ctermfg=black ctermbg=white cterm=bold
+ hi ModeMsg ctermfg=black ctermbg=white cterm=bold
+ hi Question ctermfg=magenta ctermbg=NONE cterm=bold
+ hi Todo ctermfg=black ctermbg=yellow cterm=NONE
+ hi MatchParen ctermfg=white ctermbg=magenta cterm=NONE
+ hi Search ctermfg=white ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=black ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
+ hi ColorColumn ctermfg=NONE ctermbg=grey cterm=NONE
+ hi Cursor ctermfg=white ctermbg=black cterm=NONE
+ hi lCursor ctermfg=black ctermbg=magenta cterm=NONE
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=darkyellow ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi Comment ctermfg=red ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Type ctermfg=blue ctermbg=NONE cterm=NONE
+ 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 Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=grey cterm=NONE
+ hi DiffDelete ctermfg=white ctermbg=magenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 8
+ hi Normal ctermfg=black ctermbg=gray cterm=NONE
+ hi Folded ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=darkred ctermbg=NONE cterm=bold
+ hi QuickFixLine ctermfg=gray ctermbg=darkblue cterm=NONE
+ hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=bold
+ hi StatusLine ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi StatusLineNC ctermfg=black ctermbg=gray cterm=reverse
+ hi StatusLineTerm ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi StatusLineTermNC ctermfg=black ctermbg=gray cterm=reverse
+ hi VertSplit ctermfg=black ctermbg=gray cterm=reverse
+ 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=darkmagenta cterm=NONE
+ 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
+ hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=gray cterm=bold,reverse
+ hi NonText ctermfg=gray ctermbg=NONE cterm=bold
+ hi SpecialKey ctermfg=gray ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
+ hi LineNr ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi Error ctermfg=darkred ctermbg=black cterm=reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=black cterm=reverse
+ hi WarningMsg ctermfg=darkmagenta ctermbg=black cterm=NONE
+ hi MoreMsg ctermfg=gray ctermbg=black cterm=bold
+ hi ModeMsg ctermfg=gray ctermbg=black cterm=bold
+ hi Question ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi MatchParen ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi Search ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi IncSearch ctermfg=gray ctermbg=NONE cterm=reverse
+ hi WildMenu ctermfg=gray ctermbg=darkyellow cterm=NONE
+ hi ColorColumn ctermfg=black ctermbg=darkred cterm=NONE
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=NONE cterm=reverse
+ hi SpellLocal ctermfg=darkyellow ctermbg=darkblue cterm=reverse
+ hi SpellRare ctermfg=darkcyan ctermbg=NONE cterm=reverse
+ hi Comment ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkred ctermbg=NONE cterm=bold
+ hi PreProc ctermfg=darkmagenta ctermbg=NONE cterm=bold
+ 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 Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Title ctermfg=darkmagenta ctermbg=NONE 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
+ hi DiffDelete ctermfg=white ctermbg=darkmagenta cterm=NONE
+ unlet s:t_Co
+ finish
+endif
+
+if s:t_Co >= 0
+ hi Normal term=NONE
+ hi ColorColumn term=reverse
+ hi Conceal term=NONE
+ hi Cursor term=reverse
+ hi CursorColumn term=NONE
+ hi CursorLine term=underline
+ hi CursorLineNr term=bold
+ hi DiffAdd term=reverse
+ hi DiffChange term=NONE
+ hi DiffDelete term=reverse
+ hi DiffText term=reverse
+ hi Directory term=NONE
+ hi EndOfBuffer term=NONE
+ hi ErrorMsg term=bold,reverse
+ hi FoldColumn term=NONE
+ hi Folded term=NONE
+ hi IncSearch term=bold,reverse,underline
+ hi LineNr term=NONE
+ hi MatchParen term=bold,underline
+ hi ModeMsg term=bold
+ hi MoreMsg term=NONE
+ hi NonText term=NONE
+ hi Pmenu term=reverse
+ hi PmenuSbar term=reverse
+ hi PmenuSel term=bold
+ hi PmenuThumb term=NONE
+ hi Question term=standout
+ hi Search term=reverse
+ hi SignColumn term=reverse
+ hi SpecialKey term=bold
+ hi SpellBad term=underline
+ hi SpellCap term=underline
+ hi SpellLocal term=underline
+ hi SpellRare term=underline
+ hi StatusLine term=bold,reverse
+ hi StatusLineNC term=bold,underline
+ hi TabLine term=bold,underline
+ hi TabLineFill term=NONE
+ hi Terminal term=NONE
+ hi TabLineSel term=bold,reverse
+ hi Title term=NONE
+ hi VertSplit term=NONE
+ hi Visual term=reverse
+ hi VisualNOS term=NONE
+ hi WarningMsg term=standout
+ hi WildMenu term=bold
+ hi CursorIM term=NONE
+ hi ToolbarLine term=reverse
+ hi ToolbarButton term=bold,reverse
+ hi CurSearch term=reverse
+ hi CursorLineFold term=underline
+ hi CursorLineSign term=underline
+ hi Comment term=bold
+ hi Constant term=NONE
+ hi Error term=bold,reverse
+ hi Identifier term=NONE
+ hi Ignore term=NONE
+ hi PreProc term=NONE
+ hi Special term=NONE
+ hi Statement term=NONE
+ hi Todo term=bold,reverse
+ hi Type term=NONE
+ hi Underlined term=underline
+ unlet s:t_Co
+ finish
+endif
+
+" Background: light
+" Color: comment #ff0000 196 red
+" Color: constant #ff00ff 201 magenta
+" Color: identifier #0000ff 21 blue
+" Color: statement #a52a2a 124 darkred
+" Color: preproc #a020f0 129 darkmagenta
+" Color: type #0000ff 21 blue
+" Color: special #ff00ff 201 magenta
+" Color: tag #006400 22 darkgreen
+" Color: fg0 #000000 16 black
+" Color: bg0 #ffffff 231 white
+" Color: bg1 #a9a9a9 248 grey
+" Color: status #a9a9a9 248 darkgrey
+" Color: visual #ffff00 226 yellow
+" Color: folded #d3d3d3 252 black
+" Color: folded_fg #00008b 18 darkblue
+" Color: cursorline #e5e5e5 254 black
+" Color: pmenu #dadada 253 grey
+" Color: wildmenu #ffff00 226 yellow
+" Color: error #ff0000 196 red
+" Color: linenr #a52a2a 124 darkred
+" Color: colorcolumn #eeeeee 255 grey
+" Color: slateblue #6a5acd 62 blue
+" Color: black #000000 16 black
+" Color: darkred #870000 88 darkred
+" Color: darkgreen #008700 28 darkgreen
+" Color: darkyellow #878700 100 darkyellow
+" Color: darkblue #000087 18 darkblue
+" Color: darkmagenta #870087 18 darkmagenta
+" Color: darkcyan #008787 30 darkcyan
+" Color: gray #878787 102 gray
+" 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
+" Color: bgDiffC #5F87AF 67 blue
+" Color: bgDiffD #AF5FAF 133 magenta
+" Color: bgDiffT #C6C6C6 251 grey
+" Color: fgDiffW #FFFFFF 231 white
+" Color: fgDiffB #000000 16 black
+" Color: bgDiffC8 #5F87AF 67 darkblue
+" Color: bgDiffD8 #AF5FAF 133 darkmagenta
+" vim: et ts=2 sw=2
diff --git a/runtime/compiler/icon.vim b/runtime/compiler/icon.vim
new file mode 100644
index 0000000000..40f67930f7
--- /dev/null
+++ b/runtime/compiler/icon.vim
@@ -0,0 +1,33 @@
+" Vim compiler file
+" Compiler: Icon Compiler
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jun 16
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "icont"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+CompilerSet makeprg=icont\ -s
+CompilerSet errorformat=%-G%\\d%\\+\ errors%\\=,
+ \%ERun-time\ error\ %n,
+ \%ERun-time\ error\ %n\ in\ %m,
+ \%ZTraceback:,
+ \%+Coffending\ value:\ %.%#,
+ \%CFile\ %f;\ Line\ %l,
+ \%EFile\ %f;\ Line\ %l\ #\ %m,
+ \%EFile\ %f;\ %m,
+ \%E%f:%l:\ #\ %m,
+ \%E%f:\ %m,
+ \%+C%.%#,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/jest.vim b/runtime/compiler/jest.vim
index fee70b7c55..a4bb549de1 100644
--- a/runtime/compiler/jest.vim
+++ b/runtime/compiler/jest.vim
@@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: Jest
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2018 May 15
+" Last Change: 2021 Nov 20
if exists("current_compiler")
finish
@@ -15,12 +15,14 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-" CompilerSet makeprg=npx\ jest\ --no-colors
+" CompilerSet makeprg=npx\ --no-install\ jest\ --no-colors
CompilerSet makeprg=jest\ --no-colors
-CompilerSet errorformat=%E\ \ ●\ %m,
+CompilerSet errorformat=%-A\ \ ●\ Console,
+ \%E\ \ ●\ %m,
\%Z\ %\\{4}%.%#Error:\ %f:\ %m\ (%l:%c):%\\=,
\%Z\ %\\{6}at\ %\\S%#\ (%f:%l:%c),
+ \%Z\ %\\{6}at\ %\\S%#\ %f:%l:%c,
\%+C\ %\\{4}%\\w%.%#,
\%+C\ %\\{4}%[-+]%.%#,
\%-C%.%#,
diff --git a/runtime/compiler/perl.vim b/runtime/compiler/perl.vim
index a857caed8f..21e384fb85 100644
--- a/runtime/compiler/perl.vim
+++ b/runtime/compiler/perl.vim
@@ -1,7 +1,11 @@
-" Vim Compiler File
-" Compiler: Perl syntax checks (perl -Wc)
-" Maintainer: Christian J. Robinson <heptite@gmail.com>
-" Last Change: 2019 Jul 22
+" Vim compiler file
+" Compiler: Perl syntax checks (perl -Wc)
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Author: Christian J. Robinson <heptite@gmail.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2021 Nov 2
if exists("current_compiler")
finish
@@ -15,10 +19,10 @@ endif
let s:savecpo = &cpo
set cpo&vim
-if exists('g:perl_compiler_force_warnings') && g:perl_compiler_force_warnings == 0
- let s:warnopt = 'w'
-else
+if get(g:, 'perl_compiler_force_warnings', 1)
let s:warnopt = 'W'
+else
+ let s:warnopt = 'w'
endif
if getline(1) =~# '-[^ ]*T'
diff --git a/runtime/compiler/perlcritic.vim b/runtime/compiler/perlcritic.vim
new file mode 100644
index 0000000000..cf0678eeb2
--- /dev/null
+++ b/runtime/compiler/perlcritic.vim
@@ -0,0 +1,27 @@
+" Vim compiler file
+" Compiler: perlcritic
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Author: Doug Kearns <dougkearns@gmail.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2021 Oct 20
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "perlcritic"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+CompilerSet makeprg=perlcritic\ --nocolor\ --quiet\ --verbose\ \"\\%f:\\%l:\\%c:\\%s:\\%m\\n\"
+CompilerSet errorformat=%f:%l:%c:%n:%m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/podchecker.vim b/runtime/compiler/podchecker.vim
new file mode 100644
index 0000000000..2cd4e13660
--- /dev/null
+++ b/runtime/compiler/podchecker.vim
@@ -0,0 +1,28 @@
+" Vim compiler file
+" Compiler: podchecker
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Author: Doug Kearns <dougkearns@gmail.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2021 Oct 20
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "podchecker"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+CompilerSet makeprg=podchecker\ -w
+CompilerSet errorformat=\*\*\*\ %tRROR:\ %m\ at\ line\ %l\ in\ file\ %f,
+ \\*\*\*\ %tARNING:\ %m\ at\ line\ %l\ in\ file\ %f,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/scdoc.vim b/runtime/compiler/scdoc.vim
index 2f6edc6322..c37969f89c 100644
--- a/runtime/compiler/scdoc.vim
+++ b/runtime/compiler/scdoc.vim
@@ -1,7 +1,8 @@
" scdoc compiler for Vim
" Compiler: scdoc
-" Maintainer: Greg Anders <greg@gpanders.com>
+" Maintainer: Gregory Anders <contact@gpanders.com>
" Last Updated: 2019-10-24
+" Upstream: https://github.com/gpanders/vim-scdoc
if exists('current_compiler')
finish
diff --git a/runtime/compiler/sml.vim b/runtime/compiler/sml.vim
index c7e1b1bf16..a0b13b6c8a 100644
--- a/runtime/compiler/sml.vim
+++ b/runtime/compiler/sml.vim
@@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: SML/NJ Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2020 Feb 10
+" Last Change: 2022 Feb 09
if exists("current_compiler")
finish
@@ -16,10 +16,10 @@ let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=sml
-CompilerSet errorformat=%f:%l.%c-%\\d%\\+.%\\d%\\+\ %trror:\ %m,
+CompilerSet errorformat=%f:%l.%c-%e.%k\ %trror:\ %m,
\%f:%l.%c\ %trror:\ %m,
- \%trror:\ %m
- \%f:%l.%c-%\\d%\\+.%\\d%\\+\ %tarning:\ %m,
+ \%trror:\ %m,
+ \%f:%l.%c-%e.%k\ %tarning:\ %m,
\%f:%l.%c\ %tarning:\ %m,
\%tarning:\ %m,
\%-G%.%#
diff --git a/runtime/delmenu.vim b/runtime/delmenu.vim
index 5c20290152..040cc09aa9 100644
--- a/runtime/delmenu.vim
+++ b/runtime/delmenu.vim
@@ -5,6 +5,7 @@
" Last Change: 2019 Dec 10
aunmenu *
+tlunmenu *
unlet! g:did_install_default_menus
unlet! g:did_install_syntax_menu
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 0daca0de53..c67187d857 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -59,7 +59,7 @@ Nvim instance:
# trailing '&' which is required since Nvim won't process events while
# running a blocking command):
#
- # :!./hello.rb &
+ # :!./hello.rb &
#
# Or from another shell by setting NVIM_LISTEN_ADDRESS:
# $ NVIM_LISTEN_ADDRESS=[address] ./hello.rb
@@ -148,9 +148,9 @@ indices, end-inclusive):
Most API functions are "deferred": they are queued on the main loop and
processed sequentially with normal input. So if the editor is waiting for
user input in a "modal" fashion (e.g. the |hit-enter-prompt|), the request
-will block. Non-deferred ({fast}) functions such as |nvim_get_mode()| and
+will block. Non-deferred (fast) functions such as |nvim_get_mode()| and
|nvim_input()| are served immediately (i.e. without waiting in the input
-queue). Lua code can use |vim.in_fast_event()| to detect a {fast} context.
+queue). Lua code can use |vim.in_fast_event()| to detect a fast context.
==============================================================================
API metadata *api-metadata*
@@ -186,7 +186,7 @@ About the `functions` map:
a type name, e.g. `nvim_buf_get_lines` is the `get_lines` method of
a Buffer instance. |dev-api|
- Global functions have the "method=false" flag and are prefixed with just
- `nvim_`, e.g. `nvim_get_buffers`.
+ `nvim_`, e.g. `nvim_list_bufs`.
*api-mapping*
External programs (clients) can use the metadata to discover the API, using
@@ -426,6 +426,14 @@ Two ways to create a floating window:
To close it use |nvim_win_close()| or a command such as |:close|.
+To check whether a window is floating, check whether the `relative` option in
+its config is non-empty: >
+
+ if vim.api.nvim_win_get_config(window_id).relative ~= '' then
+ -- window with this window_id is floating
+ end
+>
+
Buffer text can be highlighted by typical mechanisms (syntax highlighting,
|api-highlights|). The |hl-NormalFloat| group highlights normal text;
'winhighlight' can be used as usual to override groups locally. Floats inherit
@@ -434,6 +442,9 @@ to disable various visual features such as the 'number' column.
Currently, floating windows don't support some widgets like scrollbar.
+The output of |:mksession| does not include commands for restoring floating
+windows.
+
Example: create a float with scratch buffer: >
let buf = nvim_create_buf(v:false, v:true)
@@ -452,7 +463,7 @@ Extended marks (extmarks) represent buffer annotations that track text changes
in the buffer. They can represent cursors, folds, misspelled words, anything
that needs to track a logical location in the buffer over time. |api-indexing|
-Extmark position works like "bar" cursor: it exists between characters. Thus
+Extmark position works like "bar" cursor: it exists between characters. Thus,
the maximum extmark index on a line is 1 more than the character index: >
f o o b a r line contents
@@ -468,7 +479,7 @@ extmark position and enter some text, the extmark migrates forward. >
f o o z|b a r line (| = cursor)
4 extmark (after typing "z")
-If an extmark is on the last index of a line and you inputs a newline at that
+If an extmark is on the last index of a line and you input a newline at that
point, the extmark will accordingly migrate to the next line: >
f o o z b a r| line (| = cursor)
@@ -535,12 +546,12 @@ nvim__get_runtime({pat}, {all}, {*opts}) *nvim__get_runtime()*
Find files in runtime directories
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
- {pat} pattern of files to search for
- {all} whether to return all matches or only the first
- {options} is_lua: only search lua subdirs
+ {pat} pattern of files to search for
+ {all} whether to return all matches or only the first
+ {opts} is_lua: only search lua subdirs
Return: ~
list of absolute paths to the found files
@@ -594,7 +605,8 @@ nvim__id_float({flt}) *nvim__id_float()*
its argument.
nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()*
- TODO: Documentation
+ NB: if your UI doesn't use hlstate, this will not return
+ hlstate first time.
nvim__runtime_inspect() *nvim__runtime_inspect()*
TODO: Documentation
@@ -603,7 +615,7 @@ nvim__screenshot({path}) *nvim__screenshot()*
TODO: Documentation
Attributes: ~
- {fast}
+ |api-fast|
nvim__set_hl_ns({ns_id}) *nvim__set_hl_ns()*
Set active namespace for highlights.
@@ -615,7 +627,7 @@ nvim__set_hl_ns({ns_id}) *nvim__set_hl_ns()*
cycle.
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
{ns_id} the namespace to activate
@@ -626,58 +638,11 @@ nvim__stats() *nvim__stats()*
Return: ~
Map of various internal stats.
- *nvim_add_user_command()*
-nvim_add_user_command({name}, {command}, {*opts})
- Create a new user command |user-commands|
-
- {name} is the name of the new command. The name must begin
- with an uppercase letter.
-
- {command} is the replacement text or Lua function to execute.
-
- Example: >
- :call nvim_add_user_command('SayHello', 'echo "Hello world!"', {})
- :SayHello
- Hello world!
-<
+nvim__unpack({str}) *nvim__unpack()*
+ TODO: Documentation
- Parameters: ~
- {name} Name of the new user command. Must begin with
- an uppercase letter.
- {command} 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:
- • args: (string) The args passed to the
- command, if any |<args>|
- • 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>|
- {opts} Optional command attributes. See
- |command-attributes| for more details. To use
- boolean attributes (such as |:command-bang| or
- |:command-bar|) set the value to "true". In
- addition to the string options listed in
- |:command-complete|, the "complete" key also
- accepts a Lua function which works like the
- "customlist" completion mode
- |:command-completion-customlist|. Additional
- parameters:
- • desc: (string) Used for listing the command
- when a Lua function is used for {command}.
- • force: (boolean, default true) Override any
- previous definition.
+ Attributes: ~
+ |api-fast|
nvim_call_atomic({calls}) *nvim_call_atomic()*
Calls many API methods atomically.
@@ -691,6 +656,9 @@ nvim_call_atomic({calls}) *nvim_call_atomic()*
2. To minimize RPC overhead (roundtrips) of a sequence of many
requests.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{calls} an array of calls, where each call is described
by an array with two elements: the request name,
@@ -706,17 +674,21 @@ nvim_call_atomic({calls}) *nvim_call_atomic()*
be returned.
nvim_chan_send({chan}, {data}) *nvim_chan_send()*
- Send data to channel `id` . For a job, it writes it to the
+ 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 terimal output. See
- |channel-bytes| for more information.
+ (|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.
+ Attributes: ~
+ |RPC| only
+ |vim.api| only
+
Parameters: ~
{chan} id of the channel
{data} data to write. 8-bit clean: can contain NUL bytes.
@@ -767,12 +739,6 @@ nvim_del_mark({name}) *nvim_del_mark()*
|nvim_buf_del_mark()|
|nvim_get_mark()|
-nvim_del_user_command({name}) *nvim_del_user_command()*
- Delete a user-defined command.
-
- Parameters: ~
- {name} Name of the command to delete.
-
nvim_del_var({name}) *nvim_del_var()*
Removes a global (g:) variable.
@@ -812,7 +778,7 @@ nvim_eval_statusline({str}, {*opts}) *nvim_eval_statusline()*
Evaluates statusline string.
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
{str} Statusline string (see 'statusline').
@@ -822,10 +788,14 @@ nvim_eval_statusline({str}, {*opts}) *nvim_eval_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}.
Return: ~
Dictionary containing statusline information, with these
@@ -846,7 +816,10 @@ nvim_exec_lua({code}, {args}) *nvim_exec_lua()*
inside the chunk. The chunk can return a value.
Only statements are executed. To evaluate an expression,
- prefix it with `return` : return my_function(...)
+ prefix it with `return`: return my_function(...)
+
+ Attributes: ~
+ |RPC| only
Parameters: ~
{code} Lua code to execute
@@ -855,7 +828,7 @@ nvim_exec_lua({code}, {args}) *nvim_exec_lua()*
Return: ~
Return value of Lua code if present or NIL.
-nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
+nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()*
Sends input-keys to Nvim, subject to various quirks controlled
by `mode` flags. This is a blocking call, unlike
|nvim_input()|.
@@ -863,32 +836,25 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
On execution error: does not fail, but updates v:errmsg.
To input sequences like <C-o> use |nvim_replace_termcodes()|
- (typically with escape_csi=true) to replace |keycodes|, then
+ (typically with escape_ks=false) to replace |keycodes|, then
pass the result to nvim_feedkeys().
Example: >
:let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
- :call nvim_feedkeys(key, 'n', v:true)
+ :call nvim_feedkeys(key, 'n', v:false)
<
Parameters: ~
- {keys} to be typed
- {mode} behavior flags, see |feedkeys()|
- {escape_csi} If true, escape K_SPECIAL/CSI bytes in
- `keys`
+ {keys} to be typed
+ {mode} behavior flags, see |feedkeys()|
+ {escape_ks} If true, escape K_SPECIAL bytes in `keys`
+ This should be false if you already used
+ |nvim_replace_termcodes()|, and true
+ otherwise.
See also: ~
feedkeys()
- vim_strsave_escape_csi
-
-nvim_get_all_options_info() *nvim_get_all_options_info()*
- Gets the option information for all options.
-
- The dictionary has the full option names as keys and option
- metadata dictionaries as detailed at |nvim_get_option_info|.
-
- Return: ~
- dictionary of all options
+ vim_strsave_escape_ks
nvim_get_api_info() *nvim_get_api_info()*
Returns a 2-tuple (Array), where item 0 is the current channel
@@ -898,7 +864,8 @@ nvim_get_api_info() *nvim_get_api_info()*
2-tuple [{channel-id}, {api-metadata}]
Attributes: ~
- {fast}
+ |api-fast|
+ |RPC| only
nvim_get_chan_info({chan}) *nvim_get_chan_info()*
Gets information about a channel.
@@ -922,7 +889,7 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()*
• "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 winpty on Windows).
+ is used (e.g. for conpty on Windows).
• "buffer" (optional) Buffer with connected |terminal|
instance.
• "client" (optional) Info about the peer (client on the
@@ -953,19 +920,6 @@ nvim_get_color_map() *nvim_get_color_map()*
Return: ~
Map of color names and RGB values.
-nvim_get_commands({*opts}) *nvim_get_commands()*
- Gets a map of global (non-buffer-local) Ex commands.
-
- Currently only |user-commands| are supported, not builtin Ex
- commands.
-
- Parameters: ~
- {opts} Optional parameters. Currently only supports
- {"builtin":false}
-
- Return: ~
- Map of maps describing commands.
-
nvim_get_context({*opts}) *nvim_get_context()*
Gets a map of the current editor state.
@@ -1074,66 +1028,16 @@ nvim_get_mode() *nvim_get_mode()*
Dictionary { "mode": String, "blocking": Boolean }
Attributes: ~
- {fast}
-
-nvim_get_option({name}) *nvim_get_option()*
- Gets the global value of an option.
-
- Parameters: ~
- {name} Option name
-
- Return: ~
- Option value (global)
-
-nvim_get_option_info({name}) *nvim_get_option_info()*
- Gets the option information for one option
-
- 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
-
- Parameters: ~
- {name} Option name
-
- Return: ~
- Option Information
-
-nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()*
- Gets the value of an option. The behavior of this function
- matches that of |:set|: the local value of an option is
- returned if it exists; otherwise, the global value is
- returned. Local values always correspond to the current buffer
- or window. To get a buffer-local or window-local option for a
- specific buffer or window, use |nvim_buf_get_option()| or
- |nvim_win_get_option()|.
-
- Parameters: ~
- {name} Option name
- {opts} Optional parameters
- • scope: One of 'global' or 'local'. Analogous to
- |:setglobal| and |:setlocal|, respectively.
-
- Return: ~
- Option value
+ |api-fast|
nvim_get_proc({pid}) *nvim_get_proc()*
- Gets info describing process `pid` .
+ Gets info describing process `pid`.
Return: ~
Map of process properties, or NIL if process not found.
nvim_get_proc_children({pid}) *nvim_get_proc_children()*
- Gets the immediate children of process `pid` .
+ Gets the immediate children of process `pid`.
Return: ~
Array of child process ids, empty if process not found.
@@ -1150,7 +1054,7 @@ nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()*
returned then.
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
{name} pattern of files to search for
@@ -1194,7 +1098,7 @@ nvim_input({keys}) *nvim_input()*
|api-level| 6.
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
{keys} to be typed
@@ -1219,7 +1123,7 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
|nvim_input()| has the same limitation.
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
{button} Mouse button: one of "left", "right",
@@ -1242,8 +1146,8 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
nvim_list_bufs() *nvim_list_bufs()*
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: ~
List of buffer handles
@@ -1352,7 +1256,7 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()*
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
+ is strictly decided by `vim.paste()`). On error, subsequent
calls are ignored ("drained") until the next paste is
initiated (phase 1 or -1).
@@ -1405,7 +1309,7 @@ nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
{from_part} Legacy Vim parameter. Usually true.
{do_lt} Also translate <lt>. Ignored if `special` is
false.
- {special} Replace |keycodes|, e.g. <CR> becomes a "\n"
+ {special} Replace |keycodes|, e.g. <CR> becomes a "\r"
char.
See also: ~
@@ -1429,7 +1333,7 @@ nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})
{insert} Whether the selection should be inserted in the
buffer.
{finish} Finish the completion and dismiss the popupmenu.
- Implies `insert` .
+ Implies `insert`.
{opts} Optional parameters. Reserved for future use.
*nvim_set_client_info()*
@@ -1448,6 +1352,9 @@ nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
"Something is better than nothing". You don't need to
include all the fields.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{name} Short name for the connected client
{version} Dictionary describing the version, with
@@ -1538,25 +1445,58 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
Parameters: ~
{window} Window handle
-nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()*
- Set a highlight group.
+nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
+ Sets a highlight group.
- TODO: ns_id = 0, should modify :highlight namespace TODO val
- should take update vs reset flag
+ 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'.
- Parameters: ~
- {ns_id} number of namespace for this highlight
- {name} highlight group name, like ErrorMsg
- {val} highlight definition map, like
- |nvim_get_hl_by_name|. in addition the following
- keys are also recognized: `default` : don't
- override existing definition, like `hi default`
- `ctermfg` : sets foreground of cterm color
- `ctermbg` : sets background of cterm color
- `cterm` : cterm attribute map. sets attributed
- for cterm colors. similer to `hi cterm` Note: by
- default cterm attributes are same as attributes
- of gui color
+ Note:
+ 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.
+
+ Parameters: ~
+ {ns_id} Namespace id for this highlight
+ |nvim_create_namespace()|. Use 0 to set a
+ highlight group globally |:highlight|.
+ {name} Highlight group name, e.g. "ErrorMsg"
+ {val} Highlight definition map, accepts the following
+ keys:
+ • fg (or foreground): color name or "#RRGGBB",
+ see note.
+ • bg (or background): color name or "#RRGGBB",
+ see note.
+ • sp (or special): color name or "#RRGGBB"
+ • 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
+ |highlight-ctermfg|
+ • ctermbg: Sets background of cterm color
+ |highlight-ctermbg|
+ • cterm: cterm attribute map, like
+ |highlight-args|. If not set, cterm attributes
+ will match those from the attribute map
+ documented above.
nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
@@ -1581,34 +1521,15 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
for |:map|.
{lhs} Left-hand-side |{lhs}| of the mapping.
{rhs} Right-hand-side |{rhs}| of the mapping.
- {opts} Optional parameters map. Accepts all
- |:map-arguments| as keys excluding |<buffer>| but
- including |noremap| and "desc". |desc| can be used
- to give a description to keymap. When called from
- Lua, also accepts a "callback" key that takes a
- Lua function to call when the mapping is executed.
- Values are Booleans. Unknown key is an error.
-
-nvim_set_option({name}, {value}) *nvim_set_option()*
- Sets the global value of an option.
-
- Parameters: ~
- {name} Option name
- {value} New option value
-
- *nvim_set_option_value()*
-nvim_set_option_value({name}, {value}, {*opts})
- Sets the value of an option. The behavior of this function
- matches that of |:set|: for global-local options, both the
- global and local value are set unless otherwise specified with
- {scope}.
-
- Parameters: ~
- {name} Option name
- {value} New option value
- {opts} Optional parameters
- • scope: One of 'global' or 'local'. Analogous to
- |:setglobal| and |:setlocal|, respectively.
+ {opts} Optional parameters map: keys are
+ |:map-arguments|, values are booleans (default
+ false). Accepts all |:map-arguments| as keys
+ excluding |<buffer>| but including |noremap| and
+ "desc". Unknown key is an error. "desc" can be
+ used to give a description to the mapping. When
+ called from Lua, also accepts a "callback" key
+ that takes a Lua function to call when the mapping
+ is executed.
nvim_set_var({name}, {value}) *nvim_set_var()*
Sets a global (g:) variable.
@@ -1625,8 +1546,8 @@ nvim_set_vvar({name}, {value}) *nvim_set_vvar()*
{value} Variable value
nvim_strwidth({text}) *nvim_strwidth()*
- Calculates the number of display cells occupied by `text` .
- <Tab> counts as one cell.
+ Calculates the number of display cells occupied by `text`.
+ Control characters including <Tab> count as one cell.
Parameters: ~
{text} Some text
@@ -1637,12 +1558,18 @@ nvim_strwidth({text}) *nvim_strwidth()*
nvim_subscribe({event}) *nvim_subscribe()*
Subscribes to event broadcasts.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{event} Event type string
nvim_unsubscribe({event}) *nvim_unsubscribe()*
Unsubscribes to event broadcasts.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{event} Event type string
@@ -1654,8 +1581,7 @@ Vimscript Functions *api-vimscript*
nvim_call_dict_function({dict}, {fn}, {args})
Calls a VimL |Dictionary-function| with the given arguments.
- On execution error: fails with VimL error, does not update
- v:errmsg.
+ On execution error: fails with VimL error, updates v:errmsg.
Parameters: ~
{dict} Dictionary, or String evaluating to a VimL |self|
@@ -1669,8 +1595,7 @@ nvim_call_dict_function({dict}, {fn}, {args})
nvim_call_function({fn}, {args}) *nvim_call_function()*
Calls a VimL function with the given arguments.
- On execution error: fails with VimL error, does not update
- v:errmsg.
+ On execution error: fails with VimL error, updates v:errmsg.
Parameters: ~
{fn} Function to call
@@ -1680,23 +1605,25 @@ nvim_call_function({fn}, {args}) *nvim_call_function()*
Result of the function call
nvim_command({command}) *nvim_command()*
- Executes an ex-command.
+ Executes an Ex command.
- On execution error: fails with VimL error, does not update
- v:errmsg.
+ On execution error: fails with VimL error, updates v:errmsg.
- Parameters: ~
- {command} Ex-command string
+ Prefer using |nvim_cmd()| or |nvim_exec()| over this. To
+ evaluate multiple lines of Vim script or an Ex command
+ directly, use |nvim_exec()|. 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()|.
- See also: ~
- |nvim_exec()|
+ Parameters: ~
+ {command} Ex command string
nvim_eval({expr}) *nvim_eval()*
Evaluates a VimL |expression|. Dictionaries and Lists are
recursively expanded.
- On execution error: fails with VimL error, does not update
- v:errmsg.
+ On execution error: fails with VimL error, updates v:errmsg.
Parameters: ~
{expr} VimL expression string
@@ -1705,14 +1632,13 @@ nvim_eval({expr}) *nvim_eval()*
Evaluation result or expanded object
nvim_exec({src}, {output}) *nvim_exec()*
- Executes Vimscript (multiline block of Ex-commands), like
+ Executes Vimscript (multiline block of Ex commands), like
anonymous |:source|.
Unlike |nvim_command()| this function supports heredocs,
script-scope (s:), etc.
- On execution error: fails with VimL error, does not update
- v:errmsg.
+ On execution error: fails with VimL error, updates v:errmsg.
Parameters: ~
{src} Vimscript code
@@ -1726,13 +1652,14 @@ nvim_exec({src}, {output}) *nvim_exec()*
See also: ~
|execute()|
|nvim_command()|
+ |nvim_cmd()|
*nvim_parse_expression()*
nvim_parse_expression({expr}, {flags}, {highlight})
Parse a VimL expression.
Attributes: ~
- {fast}
+ |api-fast|
Parameters: ~
{expr} Expression to parse. Always treated as a
@@ -1827,6 +1754,358 @@ nvim_parse_expression({expr}, {flags}, {highlight})
==============================================================================
+Command Functions *api-command*
+
+ *nvim_buf_create_user_command()*
+nvim_buf_create_user_command({buffer}, {name}, {command}, {*opts})
+ Create a new user command |user-commands| in the given buffer.
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer.
+
+ See also: ~
+ nvim_create_user_command
+
+ *nvim_buf_del_user_command()*
+nvim_buf_del_user_command({buffer}, {name})
+ Delete a buffer-local user-defined command.
+
+ Only commands created with |:command-buffer| or
+ |nvim_buf_create_user_command()| can be deleted with this
+ function.
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer.
+ {name} Name of the command to delete.
+
+nvim_buf_get_commands({buffer}, {*opts}) *nvim_buf_get_commands()*
+ Gets a map of buffer-local |user-commands|.
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {opts} Optional parameters. Currently not used.
+
+ Return: ~
+ Map of maps describing 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 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.
+
+ On execution error: fails with VimL 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 "addr", "nargs" and
+ "nextcmd" which are ignored if provided. All
+ values except for "cmd" are optional.
+ {opts} Optional parameters.
+ • output: (boolean, default false) Whether to
+ return command output.
+
+ Return: ~
+ Command output (non-error, non-shell |:!|) if `output` is
+ true, else empty string.
+
+ See also: ~
+ |nvim_exec()|
+ |nvim_command()|
+
+ *nvim_create_user_command()*
+nvim_create_user_command({name}, {command}, {*opts})
+ Create a new user command |user-commands|
+
+ {name} is the name of the new command. The name must begin
+ with an uppercase letter.
+
+ {command} is the replacement text or Lua function to execute.
+
+ Example: >
+ :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {})
+ :SayHello
+ Hello world!
+<
+
+ Parameters: ~
+ {name} Name of the new user command. Must begin with
+ an uppercase letter.
+ {command} 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:
+ • 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>|
+ • 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()|.
+ {opts} Optional command attributes. See
+ |command-attributes| for more details. To use
+ boolean attributes (such as |:command-bang| or
+ |:command-bar|) set the value to "true". In
+ addition to the string options listed in
+ |:command-complete|, the "complete" key also
+ accepts a Lua function which works like the
+ "customlist" completion mode
+ |:command-completion-customlist|. Additional
+ 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|
+
+nvim_del_user_command({name}) *nvim_del_user_command()*
+ Delete a user-defined command.
+
+ Parameters: ~
+ {name} Name of the command to delete.
+
+nvim_get_commands({*opts}) *nvim_get_commands()*
+ Gets a map of global (non-buffer-local) Ex commands.
+
+ Currently only |user-commands| are supported, not builtin Ex
+ commands.
+
+ Parameters: ~
+ {opts} Optional parameters. Currently only supports
+ {"builtin":false}
+
+ Return: ~
+ Map of maps describing commands.
+
+nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
+ Parse command line.
+
+ Doesn't check the validity of command arguments.
+
+ Attributes: ~
+ |api-fast|
+
+ Parameters: ~
+ {str} Command line string to parse. Cannot contain "\n".
+ {opts} Optional parameters. Reserved for future use.
+
+ Return: ~
+ Dictionary containing command information, with these
+ keys:
+ • cmd: (string) Command name.
+ • range: (array) Command <range>. Can have 0-2 elements
+ depending on how many items the range contains. Has no
+ elements if command doesn't accept a range or if no
+ range was specified, one element if only a single range
+ item was specified and two elements if both range items
+ were specified.
+ • count: (number) Any |<count>| that was supplied to the
+ command. -1 if command cannot take a count.
+ • reg: (number) The optional command |<register>|, if
+ specified. Empty string if not specified or if command
+ cannot take a register.
+ • bang: (boolean) Whether command contains a |<bang>| (!)
+ modifier.
+ • args: (array) Command arguments.
+ • addr: (string) Value of |:command-addr|. Uses short
+ name.
+ • 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.
+ • 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|.
+ • 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|.
+ • keepalt: (boolean) |:keepalt|.
+ • keepjumps: (boolean) |:keepjumps|.
+ • keepmarks: (boolean) |:keepmarks|.
+ • keeppatterns: (boolean) |:keeppatterns|.
+ • lockmarks: (boolean) |:lockmarks|.
+ • noswapfile: (boolean) |:noswapfile|.
+ • tab: (integer) |:tab|.
+ • 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|.
+
+
+==============================================================================
+Options Functions *api-options*
+
+nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()*
+ Gets a buffer option value
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {name} Option name
+
+ Return: ~
+ Option value
+
+nvim_buf_set_option({buffer}, {name}, {value}) *nvim_buf_set_option()*
+ Sets a buffer option value. Passing 'nil' as value deletes the
+ option (only works if there's a global fallback)
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {name} Option name
+ {value} Option value
+
+nvim_get_all_options_info() *nvim_get_all_options_info()*
+ Gets the option information for all options.
+
+ The dictionary has the full option names as keys and option
+ metadata dictionaries as detailed at |nvim_get_option_info|.
+
+ Return: ~
+ dictionary of all options
+
+nvim_get_option({name}) *nvim_get_option()*
+ Gets the global value of an option.
+
+ Parameters: ~
+ {name} Option name
+
+ Return: ~
+ Option value (global)
+
+nvim_get_option_info({name}) *nvim_get_option_info()*
+ Gets the option information for one option
+
+ 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
+
+ Parameters: ~
+ {name} Option name
+
+ Return: ~
+ Option Information
+
+nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()*
+ Gets the value of an option. The behavior of this function
+ matches that of |:set|: the local value of an option is
+ returned if it exists; otherwise, the global value is
+ returned. Local values always correspond to the current buffer
+ or window, unless "buf" or "win" is set in {opts}.
+
+ Parameters: ~
+ {name} Option name
+ {opts} 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: ~
+ Option value
+
+nvim_set_option({name}, {value}) *nvim_set_option()*
+ Sets the global value of an option.
+
+ Parameters: ~
+ {name} Option name
+ {value} New option value
+
+ *nvim_set_option_value()*
+nvim_set_option_value({name}, {value}, {*opts})
+ Sets the value of an option. The behavior of this function
+ matches that of |:set|: for global-local options, both the
+ global and local value are set unless otherwise specified with
+ {scope}.
+
+ Note the options {win} and {buf} cannot be used together.
+
+ Parameters: ~
+ {name} Option name
+ {value} New option value
+ {opts} 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.
+
+nvim_win_get_option({window}, {name}) *nvim_win_get_option()*
+ Gets a window option value
+
+ Parameters: ~
+ {window} Window handle, or 0 for current window
+ {name} Option name
+
+ Return: ~
+ Option value
+
+nvim_win_set_option({window}, {name}, {value}) *nvim_win_set_option()*
+ Sets a window option value. Passing 'nil' as value deletes the
+ option(only works if there's a global fallback)
+
+ Parameters: ~
+ {window} Window handle, or 0 for current window
+ {name} Option name
+ {value} Option value
+
+
+==============================================================================
Buffer Functions *api-buffer*
@@ -1852,16 +2131,6 @@ nvim__buf_redraw_range({buffer}, {first}, {last})
nvim__buf_stats({buffer}) *nvim__buf_stats()*
TODO: Documentation
- *nvim_buf_add_user_command()*
-nvim_buf_add_user_command({buffer}, {name}, {command}, {*opts})
- Create a new user command |user-commands| in the given buffer.
-
- Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer.
-
- See also: ~
- nvim_add_user_command
-
nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
Activates buffer-update events on a channel, or as Lua
callbacks.
@@ -1877,9 +2146,10 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
{buffer} Buffer handle, or 0 for current buffer
{send_buffer} 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
+ notification will be
+ `nvim_buf_lines_event`. Else the first
+ notification will be
+ `nvim_buf_changedtick_event`. Not for Lua
callbacks.
{opts} Optional parameters.
• on_lines: Lua callback invoked on change.
@@ -1930,12 +2200,12 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• on_reload: Lua callback invoked on
reload. The entire buffer content should
be considered changed. Args:
- • the string "detach"
+ • the string "reload"
• buffer handle
• utf_sizes: include UTF-32 and UTF-16 size
of the replaced region, as args to
- `on_lines` .
+ `on_lines`.
• preview: also attach to command preview
(i.e. 'inccommand') events.
@@ -1961,6 +2231,9 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
This is useful e.g. to call vimL functions that only work with
the current buffer/window currently, like |termopen()|.
+ Attributes: ~
+ |vim.api| only
+
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{fun} Function to call inside the buffer (currently
@@ -1997,18 +2270,6 @@ nvim_buf_del_mark({buffer}, {name}) *nvim_buf_del_mark()*
|nvim_buf_set_mark()|
|nvim_del_mark()|
- *nvim_buf_del_user_command()*
-nvim_buf_del_user_command({buffer}, {name})
- Delete a buffer-local user-defined command.
-
- Only commands created with |:command-buffer| or
- |nvim_buf_add_user_command()| can be deleted with this
- function.
-
- Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer.
- {name} Name of the command to delete.
-
nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()*
Removes a buffer-scoped (b:) variable
@@ -2033,6 +2294,9 @@ nvim_buf_delete({buffer}, {opts}) *nvim_buf_delete()*
nvim_buf_detach({buffer}) *nvim_buf_detach()*
Deactivates buffer-update events on the channel.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@@ -2053,16 +2317,6 @@ nvim_buf_get_changedtick({buffer}) *nvim_buf_get_changedtick()*
Return: ~
`b:changedtick` value.
-nvim_buf_get_commands({buffer}, {*opts}) *nvim_buf_get_commands()*
- Gets a map of buffer-local |user-commands|.
-
- Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer
- {opts} Optional parameters. Currently not used.
-
- Return: ~
- Map of maps describing commands.
-
nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()*
Gets a list of buffer-local |mapping| definitions.
@@ -2088,7 +2342,7 @@ nvim_buf_get_lines({buffer}, {start}, {end}, {strict_indexing})
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{start} First line index
- {end} Last line index (exclusive)
+ {end} Last line index, exclusive
{strict_indexing} Whether out-of-bounds should be an
error.
@@ -2141,15 +2395,30 @@ nvim_buf_get_offset({buffer}, {index}) *nvim_buf_get_offset()*
Return: ~
Integer byte offset, or -1 for unloaded buffer.
-nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()*
- Gets a buffer option value
+ *nvim_buf_get_text()*
+nvim_buf_get_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
+ {opts})
+ Gets a range from the buffer.
+
+ This differs from |nvim_buf_get_lines()| in that it allows
+ retrieving only portions of a line.
+
+ Indexing is zero-based. Row indices are end-inclusive, and
+ column indices are end-exclusive.
+
+ Prefer |nvim_buf_get_lines()| when retrieving entire lines.
Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer
- {name} Option name
+ {buffer} Buffer handle, or 0 for current buffer
+ {start_row} First line index
+ {start_col} Starting column (byte offset) on first line
+ {end_row} Last line index, inclusive
+ {end_col} Ending column (byte offset) on last line,
+ exclusive
+ {opts} Optional parameters. Currently unused.
Return: ~
- Option value
+ Array of lines, or empty array for unloaded buffer.
nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
Gets a buffer-scoped (b:) variable.
@@ -2185,7 +2454,7 @@ nvim_buf_is_valid({buffer}) *nvim_buf_is_valid()*
true if the buffer is valid, false otherwise.
nvim_buf_line_count({buffer}) *nvim_buf_line_count()*
- Gets the buffer line count
+ Returns the number of lines in the given buffer.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@@ -2225,7 +2494,7 @@ nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement})
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{start} First line index
- {end} Last line index (exclusive)
+ {end} Last line index, exclusive
{strict_indexing} Whether out-of-bounds should be an
error.
{replacement} Array of lines to use as replacement
@@ -2261,40 +2530,33 @@ nvim_buf_set_name({buffer}, {name}) *nvim_buf_set_name()*
{buffer} Buffer handle, or 0 for current buffer
{name} Buffer name
-nvim_buf_set_option({buffer}, {name}, {value}) *nvim_buf_set_option()*
- Sets a buffer option value. Passing 'nil' as value deletes the
- option (only works if there's a global fallback)
-
- Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer
- {name} Option name
- {value} Option value
-
*nvim_buf_set_text()*
nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
{replacement})
Sets (replaces) a range in the buffer
- This is recommended over nvim_buf_set_lines when only
+ 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 and end-exclusive.
+ Indexing is zero-based. Row indices are end-inclusive, and
+ column indices are end-exclusive.
- To insert text at a given index, set `start` and `end` ranges
- to the same index. To delete a range, set `replacement` to an
- array containing an empty string, or simply an empty array.
+ 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 when adding or deleting entire lines
- only.
+ Prefer |nvim_buf_set_lines()| if you are only adding or
+ deleting entire lines.
Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer
- {start_row} First line index
- {start_column} First column
- {end_row} Last line index
- {end_column} Last column
- {replacement} Array of lines to use as replacement
+ {buffer} Buffer handle, or 0 for current buffer
+ {start_row} First line index
+ {start_col} Starting column (byte offset) on first line
+ {end_row} Last line index, inclusive
+ {end_col} Ending column (byte offset) on last line,
+ exclusive
+ {replacement} Array of lines to use as replacement
nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()*
Sets a buffer-scoped (b:) variable
@@ -2327,7 +2589,7 @@ nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},
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` .
+ `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
@@ -2407,8 +2669,8 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
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
+ If `end` is less than `start`, traversal works backwards.
+ (Useful with `limit`, to get the first marks prior to a given
position.)
Example:
@@ -2417,9 +2679,9 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
local pos = a.nvim_win_get_cursor(0)
local ns = a.nvim_create_namespace('my-plugin')
-- Create new extmark at line 1, column 1.
- local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, 0, {})
+ local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, {})
-- Create new extmark at line 3, column 1.
- local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, 0, {})
+ local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, {})
-- Get extmarks only from line 3.
local ms = a.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
-- Get all marks in this buffer + namespace.
@@ -2448,13 +2710,12 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
Creates or updates an extmark.
- To create a new extmark, pass id=0. The extmark id will be
- returned. To move an existing mark, pass its id.
-
- It is also allowed to create a new mark by passing in a
- previously unused id, but 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
@@ -2548,6 +2809,44 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• priority: a priority value for the highlight
group. For example treesitter highlighting
uses a value of 100.
+ • strict: boolean that indicates extmark should
+ not be placed if the line or column value is
+ past the end of the buffer or end of the line
+ respectively. Defaults to true.
+ • sign_text: string of length 1-2 used to
+ display in the sign column. Note: ranges are
+ unsupported and decorations are only applied
+ to start_row
+ • sign_hl_group: name of the highlight group
+ used to highlight the sign column text. Note:
+ ranges are unsupported and decorations are
+ only applied to start_row
+ • number_hl_group: name of the highlight group
+ used to highlight the number column. Note:
+ ranges are unsupported and decorations are
+ only applied to start_row
+ • line_hl_group: name of the highlight group
+ used to highlight the whole line. Note: ranges
+ are unsupported and decorations are only
+ applied to start_row
+ • cursorline_hl_group: name of the highlight
+ group used to highlight the line when the
+ cursor is on the same line as the mark and
+ 'cursorline' is enabled. Note: ranges are
+ unsupported and decorations are only applied
+ to start_row
+ • conceal: string which should be either empty
+ or a single character. Enable concealing
+ similar to |:syn-conceal|. When a character is
+ supplied it is used as |:syn-cchar|.
+ "hl_group" is used as highlight for the cchar
+ if provided, otherwise it defaults to
+ |hl-Conceal|.
+ • 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.
Return: ~
Id of the created/updated extmark
@@ -2605,6 +2904,9 @@ nvim_set_decoration_provider({ns_id}, {opts})
`vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite
dubious for the moment.
+ Attributes: ~
+ |vim.api| only
+
Parameters: ~
{ns_id} Namespace id from |nvim_create_namespace()|
{opts} Callbacks invoked during redraw:
@@ -2628,6 +2930,9 @@ Window Functions *api-window*
nvim_win_call({window}, {fun}) *nvim_win_call()*
Calls a function with window as temporary current window.
+ Attributes: ~
+ |vim.api| only
+
Parameters: ~
{window} Window handle, or 0 for current window
{fun} Function to call inside the window (currently
@@ -2698,16 +3003,6 @@ nvim_win_get_number({window}) *nvim_win_get_number()*
Return: ~
Window number
-nvim_win_get_option({window}, {name}) *nvim_win_get_option()*
- Gets a window option value
-
- Parameters: ~
- {window} Window handle, or 0 for current window
- {name} Option name
-
- Return: ~
- Option value
-
nvim_win_get_position({window}) *nvim_win_get_position()*
Gets the window position in display cells. First position is
zero.
@@ -2751,7 +3046,7 @@ nvim_win_hide({window}) *nvim_win_hide()*
|:hide| with a |window-ID|).
Like |:hide| the buffer becomes hidden unless another window
- is editing it, or 'bufhidden' is `unload` , `delete` or `wipe`
+ is editing it, or 'bufhidden' is `unload`, `delete` or `wipe`
as opposed to |:close| or |nvim_win_close|, which will close
the buffer.
@@ -2782,29 +3077,20 @@ nvim_win_set_buf({window}, {buffer}) *nvim_win_set_buf()*
nvim_win_set_cursor({window}, {pos}) *nvim_win_set_cursor()*
Sets the (1,0)-indexed cursor position in the window.
- |api-indexing|
+ |api-indexing| This scrolls the window even if it is not the
+ current one.
Parameters: ~
{window} Window handle, or 0 for current window
{pos} (row, col) tuple representing the new position
nvim_win_set_height({window}, {height}) *nvim_win_set_height()*
- Sets the window height. This will only succeed if the screen
- is split horizontally.
+ Sets the window height.
Parameters: ~
{window} Window handle, or 0 for current window
{height} Height as a count of rows
-nvim_win_set_option({window}, {name}, {value}) *nvim_win_set_option()*
- Sets a window option value. Passing 'nil' as value deletes the
- option(only works if there's a global fallback)
-
- Parameters: ~
- {window} Window handle, or 0 for current window
- {name} Option name
- {value} Option value
-
nvim_win_set_var({window}, {name}, {value}) *nvim_win_set_var()*
Sets a window-scoped (w:) variable
@@ -2967,9 +3253,10 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
">", "", "", "", "<" ] will only make
vertical borders but not horizontal ones. By
default, `FloatBorder` highlight is used,
- which links to `VertSplit` when not defined.
- It could also be specified by character: [
- {"+", "MyCorner"}, {"x", "MyBorder"} ].
+ which links to `WinSeparator` when not
+ defined. It could also be specified by
+ character: [ {"+", "MyCorner"}, {"x",
+ "MyBorder"} ].
• noautocmd: If true then no buffer-related
autocommand events such as |BufEnter|,
@@ -2999,7 +3286,7 @@ nvim_win_set_config({window}, {*config}) *nvim_win_set_config()*
layouts).
When reconfiguring a floating window, absent option keys will
- not be changed. `row` / `col` and `relative` must be
+ not be changed. `row`/`col` and `relative` must be
reconfigured together.
Parameters: ~
@@ -3078,6 +3365,282 @@ nvim_tabpage_set_var({tabpage}, {name}, {value})
==============================================================================
+Autocmd Functions *api-autocmd*
+
+nvim_clear_autocmds({*opts}) *nvim_clear_autocmds()*
+ Clear all autocommands that match the corresponding {opts}. To
+ delete a particular autocmd, see |nvim_del_autocmd|.
+
+ Parameters: ~
+ {opts} 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.
+
+nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()*
+ Create or get an autocommand group |autocmd-groups|.
+
+ To get an existing group id, do: >
+ local id = vim.api.nvim_create_augroup("MyGroup", {
+ clear = false
+ })
+<
+
+ Parameters: ~
+ {name} String: The name of the group
+ {opts} Dictionary Parameters
+ • clear (bool) optional: defaults to true. Clear
+ existing commands if the group already exists
+ |autocmd-groups|.
+
+ Return: ~
+ Integer id of the created group.
+
+ See also: ~
+ |autocmd-groups|
+
+nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
+ Create an |autocommand|
+
+ The API allows for two (mutually exclusive) types of actions
+ to be executed when the autocommand triggers: a callback
+ function (Lua or Vimscript), or a command (like regular
+ autocommands).
+
+ Example using callback: >
+ -- Lua function
+ local myluafun = function() print("This buffer enters") end
+
+ -- Vimscript function name (as a string)
+ local myvimfun = "g:MyVimFunction"
+
+ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
+ pattern = {"*.c", "*.h"},
+ callback = myluafun, -- Or myvimfun
+ })
+<
+
+ Lua functions receive a table with information about the
+ autocmd event as an argument. To use a function which itself
+ accepts another (optional) parameter, wrap the function in a
+ lambda:
+>
+ -- Lua function with an optional parameter.
+ -- The autocmd callback would pass a table as argument but this
+ -- function expects number|nil
+ local myluafun = function(bufnr) bufnr = bufnr or vim.api.nvim_get_current_buf() end
+
+ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
+ pattern = {"*.c", "*.h"},
+ callback = function() myluafun() end,
+ })
+<
+
+ Example using command: >
+ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
+ pattern = {"*.c", "*.h"},
+ command = "echo 'Entering a C or C++ file'",
+ })
+<
+
+ Example values for pattern: >
+ pattern = "*.py"
+ pattern = { "*.py", "*.pyi" }
+<
+
+ Example values for event: >
+ "BufWritePre"
+ {"CursorHold", "BufWritePre", "BufWritePost"}
+<
+
+ Parameters: ~
+ {event} (string|array) The event or events to register
+ this autocommand
+ {opts} Dictionary of autocommand options:
+ • group (string|integer) optional: the
+ autocommand group name or id to match against.
+ • pattern (string|array) optional: pattern or
+ patterns to match against |autocmd-pattern|.
+ • buffer (integer) optional: buffer number for
+ buffer local autocommands |autocmd-buflocal|.
+ Cannot be used with {pattern}.
+ • desc (string) optional: description of the
+ autocommand.
+ • callback (function|string) optional: if a
+ string, the name of a Vimscript function to
+ call when this autocommand is triggered.
+ Otherwise, a Lua function which is called when
+ this autocommand is triggered. Cannot be used
+ with {command}. Lua callbacks can return true
+ to delete the autocommand; in addition, they
+ accept a single table argument with the
+ following keys:
+ • id: (number) the autocommand id
+ • event: (string) the name of the event that
+ triggered the autocommand |autocmd-events|
+ • group: (number|nil) the autocommand group id,
+ if it exists
+ • match: (string) the expanded value of
+ |<amatch>|
+ • buf: (number) the expanded value of |<abuf>|
+ • file: (string) the expanded value of
+ |<afile>|
+ • data: (any) arbitrary data passed to
+ |nvim_exec_autocmds()|
+
+ • command (string) optional: Vim command to
+ execute on event. Cannot be used with
+ {callback}
+ • once (boolean) optional: defaults to false. Run
+ the autocommand only once |autocmd-once|.
+ • nested (boolean) optional: defaults to false.
+ Run nested autocommands |autocmd-nested|.
+
+ Return: ~
+ Integer id of the created autocommand.
+
+ See also: ~
+ |autocommand|
+ |nvim_del_autocmd()|
+
+nvim_del_augroup_by_id({id}) *nvim_del_augroup_by_id()*
+ 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.
+
+ Parameters: ~
+ {id} Integer The id of the group.
+
+ See also: ~
+ |nvim_del_augroup_by_name()|
+ |nvim_create_augroup()|
+
+nvim_del_augroup_by_name({name}) *nvim_del_augroup_by_name()*
+ Delete an autocommand group by name.
+
+ NOTE: behavior differs from |augroup-delete|. When deleting a
+ group, autocommands contained in this group will also be
+ deleted and cleared. This group will no longer exist.
+
+ Parameters: ~
+ {name} String The name of the group.
+
+ See also: ~
+ |autocommand-groups|
+
+nvim_del_autocmd({id}) *nvim_del_autocmd()*
+ Delete an autocommand by id.
+
+ NOTE: Only autocommands created via the API have an id.
+
+ Parameters: ~
+ {id} Integer The id returned by nvim_create_autocmd
+
+ See also: ~
+ |nvim_create_autocmd()|
+
+nvim_exec_autocmds({event}, {*opts}) *nvim_exec_autocmds()*
+ Execute all autocommands for {event} that match the
+ corresponding {opts} |autocmd-execute|.
+
+ Parameters: ~
+ {event} (String|Array) The event or events to execute
+ {opts} 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.
+
+ See also: ~
+ |:doautocmd|
+
+nvim_get_autocmds({*opts}) *nvim_get_autocmds()*
+ Get all autocommands that match the corresponding {opts}.
+
+ These examples will get autocommands matching ALL the given
+ criteria: >
+ -- 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.
+
+ Parameters: ~
+ {opts} 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|.
+
+ Return: ~
+ 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.
+
+
+==============================================================================
UI Functions *api-ui*
nvim_ui_attach({width}, {height}, {options}) *nvim_ui_attach()*
@@ -3093,6 +3656,9 @@ nvim_ui_attach({width}, {height}, {options}) *nvim_ui_attach()*
A requests 80x40 but client B requests 200x100, the global
screen has size 80x40.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{width} Requested screen columns
{height} Requested screen rows
@@ -3103,6 +3669,9 @@ nvim_ui_detach() *nvim_ui_detach()*
Removes the client from the list of UIs. |nvim_list_uis()|
+ Attributes: ~
+ |RPC| only
+
*nvim_ui_pum_set_bounds()*
nvim_ui_pum_set_bounds({width}, {height}, {row}, {col})
Tells Nvim the geometry of the popumenu, to align floating
@@ -3116,6 +3685,9 @@ nvim_ui_pum_set_bounds({width}, {height}, {row}, {col})
nor be anchored to exact grid corners, so one can set
floating-point numbers to the popup menu geometry.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{width} Popupmenu width.
{height} Popupmenu height.
@@ -3126,15 +3698,24 @@ nvim_ui_pum_set_height({height}) *nvim_ui_pum_set_height()*
Tells Nvim the number of elements displaying in the popumenu,
to decide <PageUp> and <PageDown> movement.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{height} Popupmenu height, must be greater than zero.
nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()*
TODO: Documentation
+ Attributes: ~
+ |RPC| only
+
nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()*
TODO: Documentation
+ Attributes: ~
+ |RPC| only
+
*nvim_ui_try_resize_grid()*
nvim_ui_try_resize_grid({grid}, {width}, {height})
Tell Nvim to resize a grid. Triggers a grid_resize event with
@@ -3143,6 +3724,9 @@ nvim_ui_try_resize_grid({grid}, {width}, {height})
On invalid grid handle, fails with error.
+ Attributes: ~
+ |RPC| only
+
Parameters: ~
{grid} The handle of the grid to be changed.
{width} The new requested width.
diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt
index 5d3bf7a761..0df861111c 100644
--- a/runtime/doc/arabic.txt
+++ b/runtime/doc/arabic.txt
@@ -175,7 +175,7 @@ o Enable Arabic settings [short-cut]
vertical separator like "l" or "𝖨" may be used. It may also be
hidden by changing its color to the foreground color: >
:set fillchars=vert:l
- :hi VertSplit ctermbg=White
+ :hi WinSeparator ctermbg=White
< Note that this is a workaround, not a proper solution.
If, on the other hand, you'd like to be verbose and explicit and
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 46d9a3b57a..59e5c078a3 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -40,10 +40,10 @@ effects. Be careful not to destroy your text.
2. Defining autocommands *autocmd-define*
*:au* *:autocmd*
-:au[tocmd] [group] {event} {pat} [++once] [++nested] {cmd}
+:au[tocmd] [group] {event} {aupat} [++once] [++nested] {cmd}
Add {cmd} to the list of commands that Vim will
execute automatically on {event} for a file matching
- {pat} |autocmd-pattern|.
+ {aupat} |autocmd-pattern|.
Note: A quote character is seen as argument to the
:autocmd and won't start a comment.
Nvim always adds {cmd} after existing autocommands so
@@ -69,6 +69,7 @@ Or use `:execute`: >
:augroup mine | exe "au! BufRead *" | augroup END
:augroup mine | exe "au BufRead * set tw=70" | augroup END
+< *autocmd-expand*
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be
expanded when the Event is recognized, and the {cmd} is executed. The only
@@ -119,19 +120,19 @@ prompt. When one command outputs two messages this can happen anyway.
==============================================================================
3. Removing autocommands *autocmd-remove*
-:au[tocmd]! [group] {event} {pat} [++once] [++nested] {cmd}
+:au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd}
Remove all autocommands associated with {event} and
- {pat}, and add the command {cmd}.
+ {aupat}, and add the command {cmd}.
See |autocmd-once| for [++once].
See |autocmd-nested| for [++nested].
-:au[tocmd]! [group] {event} {pat}
+:au[tocmd]! [group] {event} {aupat}
Remove all autocommands associated with {event} and
- {pat}.
+ {aupat}.
-:au[tocmd]! [group] * {pat}
- Remove all autocommands associated with {pat} for all
- events.
+:au[tocmd]! [group] * {aupat}
+ Remove all autocommands associated with {aupat} for
+ all events.
:au[tocmd]! [group] {event}
Remove ALL autocommands for {event}.
@@ -151,12 +152,12 @@ with ":augroup"); otherwise, Vim uses the group defined with [group].
==============================================================================
4. Listing autocommands *autocmd-list*
-:au[tocmd] [group] {event} {pat}
+:au[tocmd] [group] {event} {aupat}
Show the autocommands associated with {event} and
- {pat}.
+ {aupat}.
-:au[tocmd] [group] * {pat}
- Show the autocommands associated with {pat} for all
+:au[tocmd] [group] * {aupat}
+ Show the autocommands associated with {aupat} for all
events.
:au[tocmd] [group] {event}
@@ -275,14 +276,14 @@ BufRead or BufReadPost When starting to edit a new buffer, after
processing modelines. See |BufWinEnter| to do
something after processing modelines.
Also triggered:
- - when writing an unnamed buffer such that the
- buffer gets a name
+ - when writing an unnamed buffer in a way that
+ the buffer gets a name
- after successfully recovering a file
- for the "filetypedetect" group when
executing ":filetype detect"
Not triggered:
- - for ":r file"
- - if the file doesn't exist
+ - for the `:read file` command
+ - when the file doesn't exist
*BufReadCmd*
BufReadCmd Before starting to edit a new buffer. Should
read the file into the buffer. |Cmd-event|
@@ -499,10 +500,10 @@ CursorMoved After the cursor was moved in Normal or Visual
mode or to another window. Also when the text
of the cursor line has been changed, e.g. with
"x", "rx" or "p".
- Not triggered when there is typeahead, while
- executing a script file, when an operator is
- pending, or when moving to another window while
- remaining at the same cursor position.
+ Not always triggered when there is typeahead,
+ while executing commands in a script file, or
+ when an operator is pending. Always triggered
+ when moving to another window.
For an example see |match-parens|.
Note: Cannot be skipped with |:noautocmd|.
Careful: This is triggered very often, don't
@@ -525,12 +526,32 @@ DirChanged After the |current-directory| was changed.
"global" to trigger on `:cd`
"auto" to trigger on 'autochdir'.
Sets these |v:event| keys:
- cwd: current working directory
- scope: "global", "tab", "window"
+ cwd: current working directory
+ scope: "global", "tabpage", "window"
changed_window: v:true if we fired the event
switching window (or tab)
<afile> is set to the new directory name.
Non-recursive (event cannot trigger itself).
+ *DirChangedPre*
+DirChangedPre When the |current-directory| is going to be
+ changed, as with |DirChanged|.
+ The pattern is like with |DirChanged|.
+ Sets these |v:event| keys:
+ directory: new working directory
+ scope: "global", "tabpage", "window"
+ changed_window: v:true if we fired the event
+ switching window (or tab)
+ <afile> is set to the new directory name.
+ Non-recursive (event cannot trigger itself).
+ *ExitPre*
+ExitPre When using `:quit`, `:wq` in a way it makes
+ Vim exit, or using `:qall`, just after
+ |QuitPre|. Can be used to close any
+ non-essential window. Exiting may still be
+ cancelled if there is a modified buffer that
+ isn't automatically saved, use |VimLeavePre|
+ for really exiting.
+ See also |QuitPre|, |WinClosed|.
*FileAppendCmd*
FileAppendCmd Before appending to a file. Should do the
appending to the file. Use the '[ and ']
@@ -557,15 +578,6 @@ FileChangedRO Before making the first change to a read-only
*E881*
If the number of lines changes saving for undo
may fail and the change will be aborted.
- *ExitPre*
-ExitPre When using `:quit`, `:wq` in a way it makes
- Vim exit, or using `:qall`, just after
- |QuitPre|. Can be used to close any
- non-essential window. Exiting may still be
- cancelled if there is a modified buffer that
- isn't automatically saved, use |VimLeavePre|
- for really exiting.
- See also |QuitPre|, |WinClosed|.
*FileChangedShell*
FileChangedShell When Vim notices that the modification time of
a file has changed since editing started.
@@ -663,15 +675,19 @@ FuncUndefined When a user function is used but it isn't
alternative is to use an autoloaded function.
See |autoload-functions|.
*UIEnter*
-UIEnter After a UI connects via |nvim_ui_attach()|,
- after VimEnter. Can be used for GUI-specific
- configuration.
+UIEnter After a UI connects via |nvim_ui_attach()|, or
+ after builtin TUI is started, after |VimEnter|.
Sets these |v:event| keys:
- chan
+ chan: 0 for builtin TUI
+ 1 for |--embed|
+ |channel-id| of the UI otherwise
*UILeave*
-UILeave After a UI disconnects from Nvim.
+UILeave After a UI disconnects from Nvim, or after
+ builtin TUI is stopped, after |VimLeave|.
Sets these |v:event| keys:
- chan
+ chan: 0 for builtin TUI
+ 1 for |--embed|
+ |channel-id| of the UI otherwise
*InsertChange*
InsertChange When typing <Insert> while in Insert or
Replace mode. The |v:insertmode| variable
@@ -711,13 +727,14 @@ MenuPopup Just before showing the popup menu (under the
right mouse button). Useful for adjusting the
menu for what is under the cursor or mouse
pointer.
- The pattern is matched against a single
- character representing the mode:
+ The pattern is matched against one or two
+ characters representing the mode:
n Normal
v Visual
o Operator-pending
i Insert
c Command line
+ tl Terminal
*ModeChanged*
ModeChanged After changing the mode. The pattern is
matched against `'old_mode:new_mode'`, for
@@ -855,7 +872,7 @@ ShellCmdPost After executing a shell command with |:!cmd|,
*Signal*
Signal After Nvim receives a signal. The pattern is
matched against the signal name. Only
- "SIGUSR1" is supported. Example: >
+ "SIGUSR1" and "SIGWINCH" are supported. Example: >
autocmd Signal SIGUSR1 call some#func()
< *ShellFilterPost*
ShellFilterPost After executing a shell command with
@@ -1064,27 +1081,36 @@ WinLeave Before leaving a window. If the window to be
executes the BufLeave autocommands before the
WinLeave autocommands (but not for ":new").
Not used for ":qa" or ":q" when exiting Vim.
- After WinClosed.
+ Before WinClosed.
*WinNew*
WinNew When a new window was created. Not done for
the first window, when Vim has just started.
Before WinEnter.
- *WinScrolled*
-WinScrolled After scrolling the viewport of the current
- window.
+ *WinScrolled*
+WinScrolled After scrolling the content of a window or
+ resizing a window.
+ The pattern is matched against the
+ |window-ID|. Both <amatch> and <afile> are
+ set to the |window-ID|.
+ Non-recursive (the event cannot trigger
+ itself). However, if the command causes the
+ window to scroll or change size another
+ WinScrolled event will be triggered later.
+ Does not trigger when the command is added,
+ only after the first scroll or resize.
==============================================================================
-6. Patterns *autocmd-pattern* *{pat}*
+6. Patterns *autocmd-pattern* *{aupat}*
-The {pat} argument can be a comma separated list. This works as if the
-command was given with each pattern separately. Thus this command: >
+The {aupat} argument of `:autocmd` can be a comma-separated list. This works
+as if the command was given with each pattern separately. Thus this command: >
:autocmd BufRead *.txt,*.info set et
Is equivalent to: >
:autocmd BufRead *.txt set et
:autocmd BufRead *.info set et
-The file pattern {pat} is tested for a match against the file name in one of
+The file pattern {aupat} is tested for a match against the file name in one of
two ways:
1. When there is no '/' in the pattern, Vim checks for a match against only
the tail part of the file name (without its leading directory path).
@@ -1395,7 +1421,7 @@ Examples for reading and writing compressed files: >
: autocmd BufReadPre,FileReadPre *.gz set bin
: autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
: autocmd BufReadPost,FileReadPost *.gz set nobin
- : autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r")
+ : autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " .. expand("%:r")
: autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
: autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
@@ -1494,7 +1520,7 @@ To insert the current date and time in a *.html file when writing it: >
: else
: let l = line("$")
: endif
- : exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
+ : exe "1," .. l .. "g/Last modified: /s/Last modified: .*/Last modified: " ..
: \ strftime("%Y %b %d")
:endfun
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
new file mode 100644
index 0000000000..df5a636070
--- /dev/null
+++ b/runtime/doc/builtin.txt
@@ -0,0 +1,9087 @@
+*builtin.txt* Nvim
+
+
+ VIM REFERENCE MANUAL by Bram Moolenaar
+
+
+Builtin functions *builtin-functions*
+
+1. Overview |builtin-function-list|
+2. Details |builtin-function-details|
+3. Matching a pattern in a String |string-match|
+
+==============================================================================
+1. Overview *builtin-function-list*
+
+Use CTRL-] on the function name to jump to the full explanation.
+
+USAGE RESULT DESCRIPTION ~
+
+abs({expr}) Float or Number absolute value of {expr}
+acos({expr}) Float arc cosine of {expr}
+add({object}, {item}) List/Blob append {item} to {object}
+and({expr}, {expr}) Number bitwise AND
+api_info() Dict api metadata
+append({lnum}, {text}) Number append {text} below line {lnum}
+appendbufline({expr}, {lnum}, {text})
+ Number append {text} below line {lnum}
+ in buffer {expr}
+argc([{winid}]) Number number of files in the argument list
+argidx() Number current index in the argument list
+arglistid([{winnr} [, {tabnr}]]) Number argument list id
+argv({nr} [, {winid}]) String {nr} entry of the argument list
+argv([-1, {winid}]) List the argument list
+asin({expr}) Float arc sine of {expr}
+assert_beeps({cmd}) Number assert {cmd} causes a beep
+assert_equal({exp}, {act} [, {msg}])
+ Number assert {exp} is equal to {act}
+assert_equalfile({fname-one}, {fname-two} [, {msg}])
+ Number assert file contents are equal
+assert_exception({error} [, {msg}])
+ Number assert {error} is in v:exception
+assert_fails({cmd} [, {error}]) Number assert {cmd} fails
+assert_false({actual} [, {msg}])
+ Number assert {actual} is false
+assert_inrange({lower}, {upper}, {actual} [, {msg}])
+ Number assert {actual} is inside the range
+assert_match({pat}, {text} [, {msg}])
+ Number assert {pat} matches {text}
+assert_nobeep({cmd}) Number assert {cmd} does not cause a beep
+assert_notequal({exp}, {act} [, {msg}])
+ Number assert {exp} is not equal {act}
+assert_notmatch({pat}, {text} [, {msg}])
+ Number assert {pat} not matches {text}
+assert_report({msg}) Number report a test failure
+assert_true({actual} [, {msg}]) Number assert {actual} is true
+atan({expr}) Float arc tangent of {expr}
+atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
+browse({save}, {title}, {initdir}, {default})
+ String put up a file requester
+browsedir({title}, {initdir}) String put up a directory requester
+bufadd({name}) Number add a buffer to the buffer list
+bufexists({expr}) Number |TRUE| if buffer {expr} exists
+buflisted({expr}) Number |TRUE| if buffer {expr} is listed
+bufload({expr}) Number load buffer {expr} if not loaded yet
+bufloaded({expr}) Number |TRUE| if buffer {expr} is loaded
+bufname([{expr}]) String Name of the buffer {expr}
+bufnr([{expr} [, {create}]]) Number Number of the buffer {expr}
+bufwinid({expr}) Number |window-ID| of buffer {expr}
+bufwinnr({expr}) Number window number of buffer {expr}
+byte2line({byte}) Number line number at byte count {byte}
+byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr}
+byteidxcomp({expr}, {nr}) Number byte index of {nr}'th char in {expr}
+call({func}, {arglist} [, {dict}])
+ any call {func} with arguments {arglist}
+ceil({expr}) Float round {expr} up
+changenr() Number current change number
+chanclose({id} [, {stream}]) Number Closes a channel or one of its streams
+chansend({id}, {data}) Number Writes {data} to channel
+char2nr({expr} [, {utf8}]) Number ASCII/UTF-8 value of first char in {expr}
+charcol({expr}) Number column number of cursor or mark
+charidx({string}, {idx} [, {countcc}])
+ Number char index of byte {idx} in {string}
+chdir({dir}) String change current working directory
+cindent({lnum}) Number C indent for line {lnum}
+clearmatches([{win}]) none clear all matches
+col({expr}) Number column byte index of cursor or mark
+complete({startcol}, {matches}) none set Insert mode completion
+complete_add({expr}) Number add completion match
+complete_check() Number check for key typed during completion
+complete_info([{what}]) Dict get current completion information
+confirm({msg} [, {choices} [, {default} [, {type}]]])
+ Number number of choice picked by user
+copy({expr}) any make a shallow copy of {expr}
+cos({expr}) Float cosine of {expr}
+cosh({expr}) Float hyperbolic cosine of {expr}
+count({comp}, {expr} [, {ic} [, {start}]])
+ Number count how many {expr} are in {comp}
+cscope_connection([{num}, {dbpath} [, {prepend}]])
+ Number checks existence of cscope connection
+ctxget([{index}]) Dict return the |context| dict at {index}
+ctxpop() none pop and restore |context| from the
+ |context-stack|
+ctxpush([{types}]) none push the current |context| to the
+ |context-stack|
+ctxset({context} [, {index}]) none set |context| at {index}
+ctxsize() Number return |context-stack| size
+cursor({lnum}, {col} [, {off}])
+ Number move cursor to {lnum}, {col}, {off}
+cursor({list}) Number move cursor to position in {list}
+debugbreak({pid}) Number interrupt process being debugged
+deepcopy({expr} [, {noref}]) any make a full copy of {expr}
+delete({fname} [, {flags}]) Number delete the file or directory {fname}
+deletebufline({buf}, {first} [, {last}])
+ Number delete lines from buffer {buf}
+dictwatcheradd({dict}, {pattern}, {callback})
+ Start watching a dictionary
+dictwatcherdel({dict}, {pattern}, {callback})
+ Stop watching a dictionary
+did_filetype() Number |TRUE| if FileType autocommand event used
+diff_filler({lnum}) Number diff filler lines about {lnum}
+diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
+digraph_get({chars}) String get the digraph of {chars}
+digraph_getlist([{listall}]) List get all |digraph|s
+digraph_set({chars}, {digraph}) Boolean register |digraph|
+digraph_setlist({digraphlist}) Boolean register multiple |digraph|s
+empty({expr}) Number |TRUE| if {expr} is empty
+environ() Dict return environment variables
+escape({string}, {chars}) String escape {chars} in {string} with '\'
+eval({string}) any evaluate {string} into its value
+eventhandler() Number |TRUE| if inside an event handler
+executable({expr}) Number 1 if executable {expr} exists
+execute({command}) String execute and capture output of {command}
+exepath({expr}) String full path of the command {expr}
+exists({expr}) Number |TRUE| if {expr} exists
+extend({expr1}, {expr2} [, {expr3}])
+ List/Dict insert items of {expr2} into {expr1}
+exp({expr}) Float exponential of {expr}
+expand({expr} [, {nosuf} [, {list}]])
+ any expand special keywords in {expr}
+expandcmd({expr}) String expand {expr} like with `:edit`
+feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer
+filereadable({file}) Number |TRUE| if {file} is a readable file
+filewritable({file}) Number |TRUE| if {file} is a writable file
+filter({expr1}, {expr2}) List/Dict remove items from {expr1} where
+ {expr2} is 0
+finddir({name} [, {path} [, {count}]])
+ String find directory {name} in {path}
+findfile({name} [, {path} [, {count}]])
+ String find file {name} in {path}
+flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels
+float2nr({expr}) Number convert Float {expr} to a Number
+floor({expr}) Float round {expr} down
+fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2}
+fnameescape({fname}) String escape special characters in {fname}
+fnamemodify({fname}, {mods}) String modify file name
+foldclosed({lnum}) Number first line of fold at {lnum} if closed
+foldclosedend({lnum}) Number last line of fold at {lnum} if closed
+foldlevel({lnum}) Number fold level at {lnum}
+foldtext() String line displayed for closed fold
+foldtextresult({lnum}) String text for closed fold at {lnum}
+fullcommand({name}) String get full command from {name}
+funcref({name} [, {arglist}] [, {dict}])
+ Funcref reference to function {name}
+function({name} [, {arglist}] [, {dict}])
+ Funcref named reference to function {name}
+garbagecollect([{atexit}]) none free memory, breaking cyclic references
+get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
+get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
+get({func}, {what}) any get property of funcref/partial {func}
+getbufinfo([{buf}]) List information about buffers
+getbufline({buf}, {lnum} [, {end}])
+ List lines {lnum} to {end} of buffer {buf}
+getbufvar({buf}, {varname} [, {def}])
+ any variable {varname} in buffer {buf}
+getchangelist([{buf}]) List list of change list items
+getchar([expr]) Number or String
+ get one character from the user
+getcharmod() Number modifiers for the last typed character
+getcharpos({expr}) List position of cursor, mark, etc.
+getcharsearch() Dict last character search
+getcharstr([expr]) String get one character from the user
+getcmdcompltype() String return the type of the current
+ command-line completion
+getcmdline() String return the current command-line
+getcmdpos() Number return cursor position in command-line
+getcmdscreenpos() Number return cursor screen position in
+ command-line
+getcmdtype() String return current command-line type
+getcmdwintype() String return current command-line window type
+getcompletion({pat}, {type} [, {filtered}])
+ List list of cmdline completion matches
+getcurpos([{winnr}]) List position of the cursor
+getcursorcharpos([{winnr}]) List character position of the cursor
+getcwd([{winnr} [, {tabnr}]]) String get the current working directory
+getenv({name}) String return environment variable
+getfontname([{name}]) String name of font being used
+getfperm({fname}) String file permissions of file {fname}
+getfsize({fname}) Number size in bytes of file {fname}
+getftime({fname}) Number last modification time of file
+getftype({fname}) String description of type of file {fname}
+getjumplist([{winnr} [, {tabnr}]])
+ List list of jump list items
+getline({lnum}) String line {lnum} of current buffer
+getline({lnum}, {end}) List lines {lnum} to {end} of current buffer
+getloclist({nr}) List list of location list items
+getloclist({nr}, {what}) Dict get specific location list properties
+getmarklist([{buf}]) List list of global/local marks
+getmatches([{win}]) List list of current matches
+getmousepos() Dict last known mouse position
+getpid() Number process ID of Vim
+getpos({expr}) List position of cursor, mark, etc.
+getqflist() List list of quickfix items
+getqflist({what}) Dict get specific quickfix list properties
+getreg([{regname} [, 1 [, {list}]]])
+ String or List contents of a register
+getreginfo([{regname}]) Dict information about a register
+getregtype([{regname}]) String type of a register
+gettabinfo([{expr}]) List list of tab pages
+gettabvar({nr}, {varname} [, {def}])
+ any variable {varname} in tab {nr} or {def}
+gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
+ any {name} in {winnr} in tab page {tabnr}
+gettagstack([{nr}]) Dict get the tag stack of window {nr}
+getwininfo([{winid}]) List list of info about each window
+getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window
+getwinposx() Number X coord in pixels of Vim window
+getwinposy() Number Y coord in pixels of Vim window
+getwinvar({nr}, {varname} [, {def}])
+ any variable {varname} in window {nr}
+glob({expr} [, {nosuf} [, {list} [, {alllinks}]]])
+ any expand file wildcards in {expr}
+glob2regpat({expr}) String convert a glob pat into a search pat
+globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]])
+ String do glob({expr}) for all dirs in {path}
+has({feature}) Number |TRUE| if feature {feature} supported
+has_key({dict}, {key}) Number |TRUE| if {dict} has entry {key}
+haslocaldir([{winnr} [, {tabnr}]])
+ Number |TRUE| if the window executed |:lcd| or
+ the tab executed |:tcd|
+hasmapto({what} [, {mode} [, {abbr}]])
+ Number |TRUE| if mapping to {what} exists
+histadd({history}, {item}) String add an item to a history
+histdel({history} [, {item}]) String remove an item from a history
+histget({history} [, {index}]) String get the item {index} from a history
+histnr({history}) Number highest index of a history
+hlexists({name}) Number |TRUE| if highlight group {name} exists
+hlID({name}) Number syntax ID of highlight group {name}
+hostname() String name of the machine Vim is running on
+iconv({expr}, {from}, {to}) String convert encoding of {expr}
+indent({lnum}) Number indent of line {lnum}
+index({object}, {expr} [, {start} [, {ic}]])
+ Number index in {object} where {expr} appears
+input({prompt} [, {text} [, {completion}]])
+ String get input from the user
+inputlist({textlist}) Number let the user pick from a choice list
+inputrestore() Number restore typeahead
+inputsave() Number save and clear typeahead
+inputsecret({prompt} [, {text}])
+ String like input() but hiding the text
+insert({object}, {item} [, {idx}])
+ List insert {item} in {object} [before {idx}]
+interrupt() none interrupt script execution
+invert({expr}) Number bitwise invert
+isdirectory({directory}) Number |TRUE| if {directory} is a directory
+isinf({expr}) Number determine if {expr} is infinity value
+ (positive or negative)
+islocked({expr}) Number |TRUE| if {expr} is locked
+isnan({expr}) Number |TRUE| if {expr} is NaN
+id({expr}) String identifier of the container
+items({dict}) List key-value pairs in {dict}
+jobpid({id}) Number Returns pid of a job.
+jobresize({id}, {width}, {height})
+ Number Resize pseudo terminal window of a job
+jobstart({cmd} [, {opts}]) Number Spawns {cmd} as a job
+jobstop({id}) Number Stops a job
+jobwait({ids} [, {timeout}]) Number Wait for a set of jobs
+join({list} [, {sep}]) String join {list} items into one String
+json_decode({expr}) any Convert {expr} from JSON
+json_encode({expr}) String Convert {expr} to JSON
+keys({dict}) List keys in {dict}
+len({expr}) Number the length of {expr}
+libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
+libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
+line({expr} [, {winid}]) Number line nr of cursor, last line or mark
+line2byte({lnum}) Number byte count of line {lnum}
+lispindent({lnum}) Number Lisp indent for line {lnum}
+list2str({list} [, {utf8}]) String turn numbers in {list} into a String
+localtime() Number current time
+log({expr}) Float natural logarithm (base e) of {expr}
+log10({expr}) Float logarithm of Float {expr} to base 10
+luaeval({expr} [, {expr}]) any evaluate |Lua| expression
+map({expr1}, {expr2}) List/Dict change each item in {expr1} to {expr}
+maparg({name} [, {mode} [, {abbr} [, {dict}]]])
+ String or Dict
+ rhs of mapping {name} in mode {mode}
+mapcheck({name} [, {mode} [, {abbr}]])
+ String check for mappings matching {name}
+match({expr}, {pat} [, {start} [, {count}]])
+ Number position where {pat} matches in {expr}
+matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
+ Number highlight {pattern} with {group}
+matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
+ Number highlight positions with {group}
+matcharg({nr}) List arguments of |:match|
+matchdelete({id} [, {win}]) Number delete match identified by {id}
+matchend({expr}, {pat} [, {start} [, {count}]])
+ Number position where {pat} ends in {expr}
+matchfuzzy({list}, {str} [, {dict}])
+ List fuzzy match {str} in {list}
+matchfuzzypos({list}, {str} [, {dict}])
+ List fuzzy match {str} in {list}
+matchlist({expr}, {pat} [, {start} [, {count}]])
+ List match and submatches of {pat} in {expr}
+matchstr({expr}, {pat} [, {start} [, {count}]])
+ String {count}'th match of {pat} in {expr}
+matchstrpos({expr}, {pat} [, {start} [, {count}]])
+ List {count}'th match of {pat} in {expr}
+max({expr}) Number maximum value of items in {expr}
+menu_get({path} [, {modes}]) List description of |menus| matched by {path}
+min({expr}) Number minimum value of items in {expr}
+mkdir({name} [, {path} [, {prot}]])
+ Number create directory {name}
+mode([expr]) String current editing mode
+msgpackdump({list} [, {type}]) List/Blob dump objects to msgpack
+msgpackparse({data}) List parse msgpack to a list of objects
+nextnonblank({lnum}) Number line nr of non-blank line >= {lnum}
+nr2char({expr} [, {utf8}]) String single char with ASCII/UTF-8 value {expr}
+nvim_...({args}...) any call nvim |api| functions
+or({expr}, {expr}) Number bitwise OR
+pathshorten({expr} [, {len}]) String shorten directory names in a path
+perleval({expr}) any evaluate |perl| expression
+pow({x}, {y}) Float {x} to the power of {y}
+prevnonblank({lnum}) Number line nr of non-blank line <= {lnum}
+printf({fmt}, {expr1}...) String format text
+prompt_getprompt({buf}) String get prompt text
+prompt_setcallback({buf}, {expr}) none set prompt callback function
+prompt_setinterrupt({buf}, {text}) none set prompt interrupt function
+prompt_setprompt({buf}, {text}) none set prompt text
+pum_getpos() Dict position and size of pum if visible
+pumvisible() Number whether popup menu is visible
+pyeval({expr}) any evaluate |Python| expression
+py3eval({expr}) any evaluate |python3| expression
+pyxeval({expr}) any evaluate |python_x| expression
+rand([{expr}]) Number get pseudo-random number
+range({expr} [, {max} [, {stride}]])
+ List items from {expr} to {max}
+readdir({dir} [, {expr}]) List file names in {dir} selected by {expr}
+readfile({fname} [, {type} [, {max}]])
+ List get list of lines from file {fname}
+reduce({object}, {func} [, {initial}])
+ any reduce {object} using {func}
+reg_executing() String get the executing register name
+reg_recorded() String get the last recorded register name
+reg_recording() String get the recording register name
+reltime([{start} [, {end}]]) List get time value
+reltimefloat({time}) Float turn the time value into a Float
+reltimestr({time}) String turn time value into a String
+remove({list}, {idx} [, {end}]) any/List
+ remove items {idx}-{end} from {list}
+remove({blob}, {idx} [, {end}]) Number/Blob
+ remove bytes {idx}-{end} from {blob}
+remove({dict}, {key}) any remove entry {key} from {dict}
+rename({from}, {to}) Number rename (move) file from {from} to {to}
+repeat({expr}, {count}) String repeat {expr} {count} times
+resolve({filename}) String get filename a shortcut points to
+reverse({list}) List reverse {list} in-place
+round({expr}) Float round off {expr}
+rubyeval({expr}) any evaluate |Ruby| expression
+rpcnotify({channel}, {event} [, {args}...])
+ Sends an |RPC| notification to {channel}
+rpcrequest({channel}, {method} [, {args}...])
+ Sends an |RPC| request to {channel}
+screenattr({row}, {col}) Number attribute at screen position
+screenchar({row}, {col}) Number character at screen position
+screenchars({row}, {col}) List List of characters at screen position
+screencol() Number current cursor column
+screenpos({winid}, {lnum}, {col}) Dict screen row and col of a text character
+screenrow() Number current cursor row
+screenstring({row}, {col}) String characters at screen position
+search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
+ Number search for {pattern}
+searchcount([{options}]) Dict Get or update the last search count
+searchdecl({name} [, {global} [, {thisblock}]])
+ Number search for variable declaration
+searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]])
+ Number search for other end of start/end pair
+searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]])
+ List search for other end of start/end pair
+searchpos({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
+ List search for {pattern}
+serverlist() String get a list of available servers
+setbufline({expr}, {lnum}, {text})
+ Number set line {lnum} to {text} in buffer
+ {expr}
+setbufvar({buf}, {varname}, {val}) set {varname} in buffer {buf} to {val}
+setcharpos({expr}, {list}) Number set the {expr} position to {list}
+setcharsearch({dict}) Dict set character search from {dict}
+setcmdpos({pos}) Number set cursor position in command-line
+setcursorcharpos({list}) Number move cursor to position in {list}
+setenv({name}, {val}) none set environment variable
+setfperm({fname}, {mode} Number set {fname} file permissions to {mode}
+setline({lnum}, {line}) Number set line {lnum} to {line}
+setloclist({nr}, {list} [, {action}])
+ Number modify location list using {list}
+setloclist({nr}, {list}, {action}, {what})
+ Number modify specific location list props
+setmatches({list} [, {win}]) Number restore a list of matches
+setpos({expr}, {list}) Number set the {expr} position to {list}
+setqflist({list} [, {action}]) Number modify quickfix list using {list}
+setqflist({list}, {action}, {what})
+ Number modify specific quickfix list props
+setreg({n}, {v} [, {opt}]) Number set register to value and type
+settabvar({nr}, {varname}, {val}) set {varname} in tab page {nr} to {val}
+settabwinvar({tabnr}, {winnr}, {varname}, {val}) set {varname} in window
+ {winnr} in tab page {tabnr} to {val}
+settagstack({nr}, {dict} [, {action}])
+ Number modify tag stack using {dict}
+setwinvar({nr}, {varname}, {val}) set {varname} in window {nr} to {val}
+sha256({string}) String SHA256 checksum of {string}
+shellescape({string} [, {special}])
+ String escape {string} for use as shell
+ command argument
+shiftwidth([{col}]) Number effective value of 'shiftwidth'
+sign_define({name} [, {dict}]) Number define or update a sign
+sign_define({list}) List define or update a list of signs
+sign_getdefined([{name}]) List get a list of defined signs
+sign_getplaced([{buf} [, {dict}]])
+ List get a list of placed signs
+sign_jump({id}, {group}, {buf})
+ Number jump to a sign
+sign_place({id}, {group}, {name}, {buf} [, {dict}])
+ Number place a sign
+sign_placelist({list}) List place a list of signs
+sign_undefine([{name}]) Number undefine a sign
+sign_undefine({list}) List undefine a list of signs
+sign_unplace({group} [, {dict}])
+ Number unplace a sign
+sign_unplacelist({list}) List unplace a list of signs
+simplify({filename}) String simplify filename as much as possible
+sin({expr}) Float sine of {expr}
+sinh({expr}) Float hyperbolic sine of {expr}
+sockconnect({mode}, {address} [, {opts}])
+ Number Connects to socket
+sort({list} [, {func} [, {dict}]])
+ List sort {list}, using {func} to compare
+soundfold({word}) String sound-fold {word}
+spellbadword() String badly spelled word at cursor
+spellsuggest({word} [, {max} [, {capital}]])
+ List spelling suggestions
+split({expr} [, {pat} [, {keepempty}]])
+ List make |List| from {pat} separated {expr}
+sqrt({expr}) Float square root of {expr}
+srand([{expr}]) List get seed for |rand()|
+stdioopen({dict}) Number open stdio in a headless instance.
+stdpath({what}) String/List returns the standard path(s) for {what}
+str2float({expr} [, {quoted}]) Float convert String to Float
+str2list({expr} [, {utf8}]) List convert each character of {expr} to
+ ASCII/UTF-8 value
+str2nr({expr} [, {base} [, {quoted}]])
+ Number convert String to Number
+strchars({expr} [, {skipcc}]) Number character length of the String {expr}
+strcharpart({str}, {start} [, {len}])
+ String {len} characters of {str} at
+ character {start}
+strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
+strftime({format} [, {time}]) String format time with a specified format
+strgetchar({str}, {index}) Number get char {index} from {str}
+stridx({haystack}, {needle} [, {start}])
+ Number index of {needle} in {haystack}
+string({expr}) String String representation of {expr} value
+strlen({expr}) Number length of the String {expr}
+strpart({str}, {start} [, {len} [, {chars}]])
+ String {len} bytes/chars of {str} at
+ byte {start}
+strptime({format}, {timestring})
+ Number Convert {timestring} to unix timestamp
+strridx({haystack}, {needle} [, {start}])
+ Number last index of {needle} in {haystack}
+strtrans({expr}) String translate string to make it printable
+strwidth({expr}) Number display cell length of the String {expr}
+submatch({nr} [, {list}]) String or List
+ specific match in ":s" or substitute()
+substitute({expr}, {pat}, {sub}, {flags})
+ String all {pat} in {expr} replaced with {sub}
+swapinfo({fname}) Dict information about swap file {fname}
+swapname({buf}) String swap file of buffer {buf}
+synID({lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col}
+synIDattr({synID}, {what} [, {mode}])
+ String attribute {what} of syntax ID {synID}
+synIDtrans({synID}) Number translated syntax ID of {synID}
+synconcealed({lnum}, {col}) List info about concealing
+synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and {col}
+system({cmd} [, {input}]) String output of shell command/filter {cmd}
+systemlist({cmd} [, {input}]) List output of shell command/filter {cmd}
+tabpagebuflist([{arg}]) List list of buffer numbers in tab page
+tabpagenr([{arg}]) Number number of current or last tab page
+tabpagewinnr({tabarg} [, {arg}])
+ Number number of current window in tab page
+taglist({expr} [, {filename}]) List list of tags matching {expr}
+tagfiles() List tags files used
+tan({expr}) Float tangent of {expr}
+tanh({expr}) Float hyperbolic tangent of {expr}
+tempname() String name for a temporary file
+test_garbagecollect_now() none free memory right now for testing
+timer_info([{id}]) List information about timers
+timer_pause({id}, {pause}) none pause or unpause a timer
+timer_start({time}, {callback} [, {options}])
+ Number create a timer
+timer_stop({timer}) none stop a timer
+timer_stopall() none stop all timers
+tolower({expr}) String the String {expr} switched to lowercase
+toupper({expr}) String the String {expr} switched to uppercase
+tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
+ to chars in {tostr}
+trim({text} [, {mask} [, {dir}]])
+ String trim characters in {mask} from {text}
+trunc({expr}) Float truncate Float {expr}
+type({name}) Number type of variable {name}
+undofile({name}) String undo file name for {name}
+undotree() List undo file tree
+uniq({list} [, {func} [, {dict}]])
+ List remove adjacent duplicates from a list
+values({dict}) List values in {dict}
+virtcol({expr}) Number screen column of cursor or mark
+visualmode([expr]) String last visual mode used
+wait({timeout}, {condition} [, {interval}])
+ Number Wait until {condition} is satisfied
+wildmenumode() Number whether 'wildmenu' mode is active
+win_execute({id}, {command} [, {silent}])
+ String execute {command} in window {id}
+win_findbuf({bufnr}) List find windows containing {bufnr}
+win_getid([{win} [, {tab}]]) Number get |window-ID| for {win} in {tab}
+win_gettype([{nr}]) String type of window {nr}
+win_gotoid({expr}) Number go to |window-ID| {expr}
+win_id2tabwin({expr}) List get tab and window nr from |window-ID|
+win_id2win({expr}) Number get window nr from |window-ID|
+win_move_separator({nr}) Number move window vertical separator
+win_move_statusline({nr}) Number move window status line
+win_screenpos({nr}) List get screen position of window {nr}
+win_splitmove({nr}, {target} [, {options}])
+ Number move window {nr} to split of {target}
+winbufnr({nr}) Number buffer number of window {nr}
+wincol() Number window column of the cursor
+windowsversion() String MS-Windows OS version
+winheight({nr}) Number height of window {nr}
+winlayout([{tabnr}]) List layout of windows in tab {tabnr}
+winline() Number window line of the cursor
+winnr([{expr}]) Number number of current window
+winrestcmd() String returns command to restore window sizes
+winrestview({dict}) none restore view of current window
+winsaveview() Dict save view of current window
+winwidth({nr}) Number width of window {nr}
+wordcount() Dict get byte/char/word statistics
+writefile({object}, {fname} [, {flags}])
+ Number write |Blob| or |List| of lines to file
+xor({expr}, {expr}) Number bitwise XOR
+
+==============================================================================
+2. Details *builtin-function-details*
+
+Not all functions are here, some have been moved to a help file covering the
+specific functionality.
+
+abs({expr}) *abs()*
+ Return the absolute value of {expr}. When {expr} evaluates to
+ a |Float| abs() returns a |Float|. When {expr} can be
+ converted to a |Number| abs() returns a |Number|. Otherwise
+ abs() gives an error message and returns -1.
+ Examples: >
+ echo abs(1.456)
+< 1.456 >
+ echo abs(-5.456)
+< 5.456 >
+ echo abs(-4)
+< 4
+
+ Can also be used as a |method|: >
+ Compute()->abs()
+
+acos({expr}) *acos()*
+ Return the arc cosine of {expr} measured in radians, as a
+ |Float| in the range of [0, pi].
+ {expr} must evaluate to a |Float| or a |Number| in the range
+ [-1, 1].
+ Returns NaN if {expr} is outside the range [-1, 1]. Returns
+ 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo acos(0)
+< 1.570796 >
+ :echo acos(-0.5)
+< 2.094395
+
+ Can also be used as a |method|: >
+ Compute()->acos()
+
+add({object}, {expr}) *add()*
+ Append the item {expr} to |List| or |Blob| {object}. Returns
+ the resulting |List| or |Blob|. Examples: >
+ :let alist = add([1, 2, 3], item)
+ :call add(mylist, "woodstock")
+< Note that when {expr} is a |List| it is appended as a single
+ item. Use |extend()| to concatenate |Lists|.
+ When {object} is a |Blob| then {expr} must be a number.
+ Use |insert()| to add an item at another position.
+ Returns 1 if {object} is not a |List| or a |Blob|.
+
+ Can also be used as a |method|: >
+ mylist->add(val1)->add(val2)
+
+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.
+ Example: >
+ :let flag = and(bits, 0x80)
+< Can also be used as a |method|: >
+ :let flag = bits->and(0x80)
+
+api_info() *api_info()*
+ Returns Dictionary of |api-metadata|.
+
+ View it in a nice human-readable format: >
+ :lua print(vim.inspect(vim.fn.api_info()))
+
+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.
+ Otherwise append {text} as one text line below line {lnum} in
+ the current buffer.
+ {lnum} can be zero to insert a line before the first one.
+ {lnum} is used like with |getline()|.
+ Returns 1 for failure ({lnum} out of range or out of memory),
+ 0 for success. Example: >
+ :let failed = append(line('$'), "# THE END")
+ :let failed = append(0, ["Chapter 1", "the beginning"])
+
+< Can also be used as a |method| after a List: >
+ mylist->append(lnum)
+
+appendbufline({buf}, {lnum}, {text}) *appendbufline()*
+ Like |append()| but append the text in buffer {expr}.
+
+ This function works only for loaded buffers. First call
+ |bufload()| if needed.
+
+ For the use of {buf}, see |bufname()|.
+
+ {lnum} is used like with |append()|. Note that using |line()|
+ would use the current buffer, not the one appending to.
+ Use "$" to append at the end of the buffer.
+
+ On success 0 is returned, on failure 1 is returned.
+
+ If {buf} is not a valid buffer or {lnum} is not valid, an
+ error message is given. Example: >
+ :let failed = appendbufline(13, 0, "# THE START")
+<
+ Can also be used as a |method| after a List: >
+ mylist->appendbufline(buf, lnum)
+
+argc([{winid}]) *argc()*
+ The result is the number of files in the argument list. See
+ |arglist|.
+ If {winid} is not supplied, the argument list of the current
+ window is used.
+ If {winid} is -1, the global argument list is used.
+ Otherwise {winid} specifies the window of which the argument
+ list is used: either the window number or the window ID.
+ Returns -1 if the {winid} argument is invalid.
+
+ *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|.
+
+ *arglistid()*
+arglistid([{winnr} [, {tabnr}]])
+ Return the argument list ID. This is a number which
+ identifies the argument list being used. Zero is used for the
+ global argument list. See |arglist|.
+ Returns -1 if the arguments are invalid.
+
+ Without arguments use the current window.
+ With {winnr} only use this window in the current tab page.
+ With {winnr} and {tabnr} use the window in the specified tab
+ page.
+ {winnr} can be the window number or the |window-ID|.
+
+ *argv()*
+argv([{nr} [, {winid}]])
+ The result is the {nr}th file in the argument list. See
+ |arglist|. "argv(0)" is the first one. Example: >
+ :let i = 0
+ :while i < argc()
+ : let f = escape(fnameescape(argv(i)), '.')
+ : exe 'amenu Arg.' .. f .. ' :e ' .. f .. '<CR>'
+ : let i = i + 1
+ :endwhile
+< Without the {nr} argument, or when {nr} is -1, a |List| with
+ the whole |arglist| is returned.
+
+ The {winid} argument specifies the window ID, see |argc()|.
+ For the Vim command line arguments see |v:argv|.
+
+ Returns an empty string if {nr}th argument is not present in
+ the argument list. Returns an empty List if the {winid}
+ argument is invalid.
+
+asin({expr}) *asin()*
+ Return the arc sine of {expr} measured in radians, as a |Float|
+ in the range of [-pi/2, pi/2].
+ {expr} must evaluate to a |Float| or a |Number| in the range
+ [-1, 1].
+ Returns NaN if {expr} is outside the range [-1, 1]. Returns
+ 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo asin(0.8)
+< 0.927295 >
+ :echo asin(-0.5)
+< -0.523599
+
+ Can also be used as a |method|: >
+ Compute()->asin()
+
+
+assert_ functions are documented here: |assert-functions-details|
+
+
+atan({expr}) *atan()*
+ Return the principal value of the arc tangent of {expr}, in
+ the range [-pi/2, +pi/2] radians, as a |Float|.
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo atan(100)
+< 1.560797 >
+ :echo atan(-4.01)
+< -1.326405
+
+ Can also be used as a |method|: >
+ Compute()->atan()
+
+atan2({expr1}, {expr2}) *atan2()*
+ Return the arc tangent of {expr1} / {expr2}, measured in
+ radians, as a |Float| in the range [-pi, pi].
+ {expr1} and {expr2} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
+ |Number|.
+ Examples: >
+ :echo atan2(-1, 1)
+< -0.785398 >
+ :echo atan2(1, -1)
+< 2.356194
+
+ Can also be used as a |method|: >
+ Compute()->atan2(1)
+
+ *browse()*
+browse({save}, {title}, {initdir}, {default})
+ Put up a file requester. This only works when "has("browse")"
+ returns |TRUE| (only in some GUI versions).
+ The input fields are:
+ {save} when |TRUE|, select file to write
+ {title} title for the requester
+ {initdir} directory to start browsing in
+ {default} default file name
+ An empty string is returned when the "Cancel" button is hit,
+ something went wrong, or browsing is not possible.
+
+ *browsedir()*
+browsedir({title}, {initdir})
+ Put up a directory requester. This only works when
+ "has("browse")" returns |TRUE| (only in some GUI versions).
+ On systems where a directory browser is not supported a file
+ browser is used. In that case: select a file in the directory
+ to be used.
+ The input fields are:
+ {title} title for the requester
+ {initdir} directory to start browsing in
+ When the "Cancel" button is hit, something went wrong, or
+ browsing is not possible, an empty string is returned.
+
+bufadd({name}) *bufadd()*
+ Add a buffer to the buffer list with String {name}.
+ If a buffer for file {name} already exists, return that buffer
+ number. Otherwise return the buffer number of the newly
+ created buffer. When {name} is an empty string then a new
+ buffer is always created.
+ The buffer will not have 'buflisted' set and not be loaded
+ yet. To add some text to the buffer use this: >
+ let bufnr = bufadd('someName')
+ call bufload(bufnr)
+ call setbufline(bufnr, 1, ['some', 'text'])
+< Returns 0 on error.
+ Can also be used as a |method|: >
+ let bufnr = 'somename'->bufadd()
+
+bufexists({buf}) *bufexists()*
+ The result is a Number, which is |TRUE| if a buffer called
+ {buf} exists.
+ If the {buf} argument is a number, buffer numbers are used.
+ Number zero is the alternate buffer for the current window.
+
+ If the {buf} argument is a string it must match a buffer name
+ exactly. The name can be:
+ - Relative to the current directory.
+ - A full path.
+ - The name of a buffer with 'buftype' set to "nofile".
+ - A URL name.
+ Unlisted buffers will be found.
+ Note that help files are listed by their short name in the
+ output of |:buffers|, but bufexists() requires using their
+ long name to be able to find them.
+ bufexists() may report a buffer exists, but to use the name
+ with a |:buffer| command you may need to use |expand()|. Esp
+ for MS-Windows 8.3 names in the form "c:\DOCUME~1"
+ Use "bufexists(0)" to test for the existence of an alternate
+ file name.
+
+ Can also be used as a |method|: >
+ let exists = 'somename'->bufexists()
+
+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()|.
+
+ Can also be used as a |method|: >
+ let listed = 'somename'->buflisted()
+
+bufload({buf}) *bufload()*
+ Ensure the buffer {buf} is loaded. When the buffer name
+ refers to an existing file then the file is read. Otherwise
+ the buffer will be empty. If the buffer was already loaded
+ then there is no change.
+ If there is an existing swap file for the file of the buffer,
+ there will be no dialog, the buffer will be loaded anyway.
+ The {buf} argument is used like with |bufexists()|.
+
+ Can also be used as a |method|: >
+ eval 'somename'->bufload()
+
+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()|.
+
+ Can also be used as a |method|: >
+ let loaded = 'somename'->bufloaded()
+
+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
+ "[No Name]".
+ If {buf} is omitted the current buffer is used.
+ If {buf} is a Number, that buffer number's name is given.
+ Number zero is the alternate buffer for the current window.
+ If {buf} is a String, it is used as a |file-pattern| to match
+ with the buffer names. This is always done like 'magic' is
+ set and 'cpoptions' is empty. When there is more than one
+ match an empty string is returned.
+ "" or "%" can be used for the current buffer, "#" for the
+ alternate buffer.
+ A full match is preferred, otherwise a match at the start, end
+ or middle of the buffer name is accepted. If you only want a
+ full match then put "^" at the start and "$" at the end of the
+ pattern.
+ Listed buffers are found first. If there is a single match
+ with a listed buffer, that one is returned. Next unlisted
+ buffers are searched for.
+ If the {buf} is a String, but you want to use it as a buffer
+ number, force it to be a Number by adding zero to it: >
+ :echo bufname("3" + 0)
+< Can also be used as a |method|: >
+ echo bufnr->bufname()
+
+< If the buffer doesn't exist, or doesn't have a name, an empty
+ string is returned. >
+ bufname("#") alternate buffer name
+ bufname(3) name of buffer 3
+ bufname("%") name of current buffer
+ bufname("file2") name of buffer where "file2" matches.
+<
+ *bufnr()*
+bufnr([{buf} [, {create}]])
+ The result is the number of a buffer, as it is displayed by
+ the `:ls` command. For the use of {buf}, see |bufname()|
+ above.
+ If the buffer doesn't exist, -1 is returned. Or, if the
+ {create} argument is present and TRUE, a new, unlisted,
+ buffer is created and its number is returned.
+ bufnr("$") is the last buffer: >
+ :let last_buffer = bufnr("$")
+< The result is a Number, which is the highest buffer number
+ of existing buffers. Note that not all buffers with a smaller
+ number necessarily exist, because ":bwipeout" may have removed
+ them. Use bufexists() to test for the existence of a buffer.
+
+ Can also be used as a |method|: >
+ echo bufref->bufnr()
+
+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},
+ see |bufname()| above. If buffer {buf} doesn't exist or
+ there is no such window, -1 is returned. Example: >
+
+ echo "A window containing buffer 1 is " .. (bufwinid(1))
+<
+ Only deals with the current tab page.
+
+ Can also be used as a |method|: >
+ FindBuffer()->bufwinid()
+
+bufwinnr({buf}) *bufwinnr()*
+ Like |bufwinid()| but return the window number instead of the
+ |window-ID|.
+ If buffer {buf} doesn't exist or there is no such window, -1
+ is returned. Example: >
+
+ echo "A window containing buffer 1 is " .. (bufwinnr(1))
+
+< The number can be used with |CTRL-W_w| and ":wincmd w"
+ |:wincmd|.
+
+ Can also be used as a |method|: >
+ FindBuffer()->bufwinnr()
+
+byte2line({byte}) *byte2line()*
+ Return the line number that contains the character at byte
+ count {byte} in the current buffer. This includes the
+ end-of-line character, depending on the 'fileformat' option
+ for the current buffer. The first character has byte count
+ one.
+ Also see |line2byte()|, |go| and |:goto|.
+
+ Returns -1 if the {byte} value is invalid.
+
+ Can also be used as a |method|: >
+ GetOffset()->byte2line()
+
+byteidx({expr}, {nr}) *byteidx()*
+ Return byte index of the {nr}'th character in the String
+ {expr}. Use zero for the first character, it then returns
+ zero.
+ If there are no multibyte characters the returned value is
+ equal to {nr}.
+ Composing characters are not counted separately, their byte
+ length is added to the preceding base character. See
+ |byteidxcomp()| below for counting composing characters
+ separately.
+ Example : >
+ echo matchstr(str, ".", byteidx(str, 3))
+< will display the fourth character. Another way to do the
+ same: >
+ let s = strpart(str, byteidx(str, 3))
+ echo strpart(s, 0, byteidx(s, 1))
+< Also see |strgetchar()| and |strcharpart()|.
+
+ If there are less than {nr} characters -1 is returned.
+ If there are exactly {nr} characters the length of the string
+ in bytes is returned.
+
+ Can also be used as a |method|: >
+ GetName()->byteidx(idx)
+
+byteidxcomp({expr}, {nr}) *byteidxcomp()*
+ Like byteidx(), except that a composing character is counted
+ as a separate character. Example: >
+ let s = 'e' .. nr2char(0x301)
+ echo byteidx(s, 1)
+ echo byteidxcomp(s, 1)
+ echo byteidxcomp(s, 2)
+< The first and third echo result in 3 ('e' plus composing
+ character is 3 bytes), the second echo results in 1 ('e' is
+ one byte).
+
+ Can also be used as a |method|: >
+ GetName()->byteidxcomp(idx)
+
+call({func}, {arglist} [, {dict}]) *call()* *E699*
+ Call function {func} with the items in |List| {arglist} as
+ arguments.
+ {func} can either be a |Funcref| or the name of a function.
+ a:firstline and a:lastline are set to the cursor line.
+ Returns the return value of the called function.
+ {dict} is for functions with the "dict" attribute. It will be
+ used to set the local variable "self". |Dictionary-function|
+
+ Can also be used as a |method|: >
+ GetFunc()->call([arg, arg], dict)
+
+ceil({expr}) *ceil()*
+ Return the smallest integral value greater than or equal to
+ {expr} as a |Float| (round up).
+ {expr} must evaluate to a |Float| or a |Number|.
+ Examples: >
+ echo ceil(1.456)
+< 2.0 >
+ echo ceil(-5.456)
+< -5.0 >
+ echo ceil(4.0)
+< 4.0
+
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+
+ Can also be used as a |method|: >
+ Compute()->ceil()
+
+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
+ with the |:undo| command.
+ When a change was made it is the number of that change. After
+ redo it is the number of the redone change. After undo it is
+ one less than the number of the undone change.
+ Returns 0 if the undo list is empty.
+
+chanclose({id} [, {stream}]) *chanclose()*
+ Close a channel or a specific stream associated with it.
+ For a job, {stream} can be one of "stdin", "stdout",
+ "stderr" or "rpc" (closes stdin/stdout for a job started
+ with `"rpc":v:true`) If {stream} is omitted, all streams
+ are closed. If the channel is a pty, this will then close the
+ pty master, sending SIGHUP to the job process.
+ For a socket, there is only one stream, and {stream} should be
+ ommited.
+
+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|,
+ it writes to Nvim's stdout. Returns the number of bytes
+ written if the write succeeded, 0 otherwise.
+ See |channel-bytes| for more information.
+
+ {data} may be a string, string convertible, |Blob|, or a list.
+ If {data} is a list, the items will be joined by newlines; any
+ newlines in an item will be sent as NUL. To send a final
+ newline, include a final empty string. Example: >
+ :call chansend(id, ["abc", "123\n456", ""])
+< will send "abc<NL>123<NUL>456<NL>".
+
+ chansend() writes raw data, not RPC messages. If the channel
+ was created with `"rpc":v:true` then the channel expects RPC
+ messages, use |rpcnotify()| and |rpcrequest()| instead.
+
+
+char2nr({string} [, {utf8}]) *char2nr()*
+ Return Number value of the first char in {string}.
+ Examples: >
+ char2nr(" ") returns 32
+ char2nr("ABC") returns 65
+ char2nr("á") returns 225
+ char2nr("á"[0]) returns 195
+ char2nr("\<M-x>") returns 128
+< Non-ASCII characters are always treated as UTF-8 characters.
+ {utf8} is ignored, it exists only for backwards-compatibility.
+ A combining character is a separate character.
+ |nr2char()| does the opposite.
+
+ Returns 0 if {string} is not a |String|.
+
+ Can also be used as a |method|: >
+ GetChar()->char2nr()
+<
+ *charcol()*
+charcol({expr}) Same as |col()| but returns the character index of the column
+ position given with {expr} instead of the byte position.
+
+ Example:
+ With the cursor on '세' in line 5 with text "여보세요": >
+ charcol('.') returns 3
+ col('.') returns 7
+
+< Can also be used as a |method|: >
+ GetPos()->col()
+<
+ *charidx()*
+charidx({string}, {idx} [, {countcc}])
+ Return the character index of the byte at {idx} in {string}.
+ The index of the first character is zero.
+ If there are no multibyte characters the returned value is
+ equal to {idx}.
+ When {countcc} is omitted or |FALSE|, then composing characters
+ are not counted separately, their byte length is
+ added to the preceding base character.
+ When {countcc} is |TRUE|, then composing characters are
+ counted as separate characters.
+ Returns -1 if the arguments are invalid or if {idx} is greater
+ than the index of the last byte in {string}. An error is
+ given if the first argument is not a string, the second
+ argument is not a number or when the third argument is present
+ and is not zero or one.
+ See |byteidx()| and |byteidxcomp()| for getting the byte index
+ from the character index.
+ Examples: >
+ echo charidx('áb́ć', 3) returns 1
+ echo charidx('áb́ć', 6, 1) returns 4
+ echo charidx('áb́ć', 16) returns -1
+<
+ Can also be used as a |method|: >
+ GetName()->charidx(idx)
+
+chdir({dir}) *chdir()*
+ Change the current working directory to {dir}. The scope of
+ the directory change depends on the directory of the current
+ window:
+ - If the current window has a window-local directory
+ (|:lcd|), then changes the window local directory.
+ - Otherwise, if the current tabpage has a local
+ directory (|:tcd|) then changes the tabpage local
+ directory.
+ - Otherwise, changes the global directory.
+ If successful, returns the previous working directory. Pass
+ this to another chdir() to restore the directory.
+ On failure, returns an empty string.
+
+ Example: >
+ let save_dir = chdir(newdir)
+ if save_dir
+ " ... do some work
+ call chdir(save_dir)
+ endif
+<
+cindent({lnum}) *cindent()*
+ Get the amount of indent for line {lnum} according the C
+ indenting rules, as with 'cindent'.
+ The indent is counted in spaces, the value of 'tabstop' is
+ relevant. {lnum} is used just like in |getline()|.
+ When {lnum} is invalid -1 is returned.
+ See |C-indenting|.
+
+ Can also be used as a |method|: >
+ GetLnum()->cindent()
+
+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.
+
+ Can also be used as a |method|: >
+ GetWin()->clearmatches()
+<
+ *col()*
+col({expr}) 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.
+ 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.
+ 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: >
+ col(".") column of cursor
+ col("$") length of cursor line plus one
+ col("'t") column of mark t
+ col("'" .. markname) column of mark markname
+< The first column is 1. Returns 0 if {expr} is invalid.
+ For an uppercase mark the column may actually be in another
+ buffer.
+ For the cursor position, when 'virtualedit' is active, the
+ column is one higher if the cursor is after the end of the
+ line. This can be used to obtain the column in Insert mode: >
+ :imap <F2> <C-O>:let save_ve = &ve<CR>
+ \<C-O>:set ve=all<CR>
+ \<C-O>:echo col(".") .. "\n" <Bar>
+ \let &ve = save_ve<CR>
+
+< Can also be used as a |method|: >
+ GetPos()->col()
+<
+
+complete({startcol}, {matches}) *complete()* *E785*
+ Set the matches for Insert mode completion.
+ Can only be used in Insert mode. You need to use a mapping
+ with CTRL-R = (see |i_CTRL-R|). It does not work after CTRL-O
+ or with an expression mapping.
+ {startcol} is the byte offset in the line where the completed
+ text start. The text up to the cursor is the original text
+ that will be replaced by the matches. Use col('.') for an
+ empty string. "col('.') - 1" will replace one character by a
+ match.
+ {matches} must be a |List|. Each |List| item is one match.
+ See |complete-items| for the kind of items that are possible.
+ "longest" in 'completeopt' is ignored.
+ Note that the after calling this function you need to avoid
+ inserting anything that would cause completion to stop.
+ The match can be selected with CTRL-N and CTRL-P as usual with
+ Insert mode completion. The popup menu will appear if
+ specified, see |ins-completion-menu|.
+ Example: >
+ inoremap <F5> <C-R>=ListMonths()<CR>
+
+ func! ListMonths()
+ call complete(col('.'), ['January', 'February', 'March',
+ \ 'April', 'May', 'June', 'July', 'August', 'September',
+ \ 'October', 'November', 'December'])
+ return ''
+ endfunc
+< This isn't very useful, but it shows how it works. Note that
+ an empty string is returned to avoid a zero being inserted.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetMatches()->complete(col('.'))
+
+complete_add({expr}) *complete_add()*
+ Add {expr} to the list of matches. Only to be used by the
+ function specified with the 'completefunc' option.
+ Returns 0 for failure (empty string or out of memory),
+ 1 when the match was added, 2 when the match was already in
+ the list.
+ See |complete-functions| for an explanation of {expr}. It is
+ the same as one item in the list that 'omnifunc' would return.
+
+ Can also be used as a |method|: >
+ GetMoreMatches()->complete_add()
+
+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.
+ Returns |TRUE| when searching for matches is to be aborted,
+ zero otherwise.
+ Only to be used by the function specified with the
+ 'completefunc' option.
+
+
+complete_info([{what}]) *complete_info()*
+ Returns a |Dictionary| with information about Insert mode
+ completion. See |ins-completion|.
+ The items are:
+ mode Current completion mode name string.
+ See |complete_info_mode| for the values.
+ pum_visible |TRUE| if popup menu is visible.
+ See |pumvisible()|.
+ items List of completion matches. Each item is a
+ dictionary containing the entries "word",
+ "abbr", "menu", "kind", "info" and "user_data".
+ See |complete-items|.
+ selected Selected item index. First index is zero.
+ Index is -1 if no item is selected (showing
+ typed text only, or the last completion after
+ no item is selected when using the <Up> or
+ <Down> keys)
+ inserted Inserted string. [NOT IMPLEMENT YET]
+
+ *complete_info_mode*
+ mode values are:
+ "" Not in completion mode
+ "keyword" Keyword completion |i_CTRL-X_CTRL-N|
+ "ctrl_x" Just pressed CTRL-X |i_CTRL-X|
+ "scroll" Scrolling with |i_CTRL-X_CTRL-E| or
+ |i_CTRL-X_CTRL-Y|
+ "whole_line" Whole lines |i_CTRL-X_CTRL-L|
+ "files" File names |i_CTRL-X_CTRL-F|
+ "tags" Tags |i_CTRL-X_CTRL-]|
+ "path_defines" Definition completion |i_CTRL-X_CTRL-D|
+ "path_patterns" Include completion |i_CTRL-X_CTRL-I|
+ "dictionary" Dictionary |i_CTRL-X_CTRL-K|
+ "thesaurus" Thesaurus |i_CTRL-X_CTRL-T|
+ "cmdline" Vim Command line |i_CTRL-X_CTRL-V|
+ "function" User defined completion |i_CTRL-X_CTRL-U|
+ "omni" Omni completion |i_CTRL-X_CTRL-O|
+ "spell" Spelling suggestions |i_CTRL-X_s|
+ "eval" |complete()| completion
+ "unknown" Other internal modes
+
+ If the optional {what} list argument is supplied, then only
+ the items listed in {what} are returned. Unsupported items in
+ {what} are silently ignored.
+
+ To get the position and size of the popup menu, see
+ |pum_getpos()|. It's also available in |v:event| during the
+ |CompleteChanged| event.
+
+ Returns an empty |Dictionary| on error.
+
+ Examples: >
+ " Get all items
+ call complete_info()
+ " Get only 'mode'
+ call complete_info(['mode'])
+ " Get only 'mode' and 'pum_visible'
+ call complete_info(['mode', 'pum_visible'])
+
+< Can also be used as a |method|: >
+ GetItems()->complete_info()
+<
+ *confirm()*
+confirm({msg} [, {choices} [, {default} [, {type}]]])
+ confirm() offers the user a dialog, from which a choice can be
+ made. It returns the number of the choice. For the first
+ choice this is 1.
+
+ {msg} is displayed in a dialog with {choices} as the
+ alternatives. When {choices} is missing or empty, "&OK" is
+ used (and translated).
+ {msg} is a String, use '\n' to include a newline. Only on
+ some systems the string is wrapped when it doesn't fit.
+
+ {choices} is a String, with the individual choices separated
+ by '\n', e.g. >
+ confirm("Save changes?", "&Yes\n&No\n&Cancel")
+< The letter after the '&' is the shortcut key for that choice.
+ Thus you can type 'c' to select "Cancel". The shortcut does
+ not need to be the first letter: >
+ confirm("file has been modified", "&Save\nSave &All")
+< For the console, the first letter of each choice is used as
+ the default shortcut key. Case is ignored.
+
+ The optional {type} String argument gives the type of dialog.
+ It can be one of these values: "Error", "Question", "Info",
+ "Warning" or "Generic". Only the first character is relevant.
+ When {type} is omitted, "Generic" is used.
+
+ The optional {type} argument gives the type of dialog. This
+ is only used for the icon of the Win32 GUI. It can be one of
+ these values: "Error", "Question", "Info", "Warning" or
+ "Generic". Only the first character is relevant.
+ When {type} is omitted, "Generic" is used.
+
+ If the user aborts the dialog by pressing <Esc>, CTRL-C,
+ or another valid interrupt key, confirm() returns 0.
+
+ An example: >
+ let choice = confirm("What do you want?",
+ \ "&Apples\n&Oranges\n&Bananas", 2)
+ if choice == 0
+ echo "make up your mind!"
+ elseif choice == 3
+ echo "tasteful"
+ else
+ echo "I prefer bananas myself."
+ endif
+< In a GUI dialog, buttons are used. The layout of the buttons
+ depends on the 'v' flag in 'guioptions'. If it is included,
+ the buttons are always put vertically. Otherwise, confirm()
+ tries to put the buttons in one horizontal line. If they
+ don't fit, a vertical layout is used anyway. For some systems
+ the horizontal layout is always used.
+
+ Can also be used as a |method|in: >
+ BuildMessage()->confirm("&Yes\n&No")
+<
+ *copy()*
+copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
+ different from using {expr} directly.
+ When {expr} is a |List| a shallow copy is created. This means
+ that the original |List| can be changed without changing the
+ copy, and vice versa. But the items are identical, thus
+ changing an item changes the contents of both |Lists|.
+ A |Dictionary| is copied in a similar way as a |List|.
+ Also see |deepcopy()|.
+ Can also be used as a |method|: >
+ mylist->copy()
+
+cos({expr}) *cos()*
+ Return the cosine of {expr}, measured in radians, as a |Float|.
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo cos(100)
+< 0.862319 >
+ :echo cos(-4.01)
+< -0.646043
+
+ Can also be used as a |method|: >
+ Compute()->cos()
+
+cosh({expr}) *cosh()*
+ Return the hyperbolic cosine of {expr} as a |Float| in the range
+ [1, inf].
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo cosh(0.5)
+< 1.127626 >
+ :echo cosh(-0.5)
+< -1.127626
+
+ Can also be used as a |method|: >
+ Compute()->cosh()
+
+count({comp}, {expr} [, {ic} [, {start}]]) *count()*
+ Return the number of times an item with value {expr} appears
+ in |String|, |List| or |Dictionary| {comp}.
+
+ If {start} is given then start with the item with this index.
+ {start} can only be used with a |List|.
+
+ When {ic} is given and it's |TRUE| then case is ignored.
+
+ When {comp} is a string then the number of not overlapping
+ occurrences of {expr} is returned. Zero is returned when
+ {expr} is an empty string.
+
+ Can also be used as a |method|: >
+ mylist->count(val)
+<
+ *cscope_connection()*
+cscope_connection([{num} , {dbpath} [, {prepend}]])
+ Checks for the existence of a |cscope| connection. If no
+ parameters are specified, then the function returns:
+ 0, if there are no cscope connections;
+ 1, if there is at least one cscope connection.
+
+ If parameters are specified, then the value of {num}
+ determines how existence of a cscope connection is checked:
+
+ {num} Description of existence check
+ ----- ------------------------------
+ 0 Same as no parameters (e.g., "cscope_connection()").
+ 1 Ignore {prepend}, and use partial string matches for
+ {dbpath}.
+ 2 Ignore {prepend}, and use exact string matches for
+ {dbpath}.
+ 3 Use {prepend}, use partial string matches for both
+ {dbpath} and {prepend}.
+ 4 Use {prepend}, use exact string matches for both
+ {dbpath} and {prepend}.
+
+ Note: All string comparisons are case sensitive!
+
+ Examples. Suppose we had the following (from ":cs show"): >
+
+ # pid database name prepend path
+ 0 27664 cscope.out /usr/local
+<
+ Invocation Return Val ~
+ ---------- ---------- >
+ cscope_connection() 1
+ cscope_connection(1, "out") 1
+ cscope_connection(2, "out") 0
+ cscope_connection(3, "out") 0
+ cscope_connection(3, "out", "local") 1
+ cscope_connection(4, "out") 0
+ cscope_connection(4, "out", "local") 0
+ cscope_connection(4, "cscope.out", "/usr/local") 1
+<
+
+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).
+
+ctxpop() *ctxpop()*
+ Pops and restores the |context| at the top of the
+ |context-stack|.
+
+ctxpush([{types}]) *ctxpush()*
+ Pushes the current editor state (|context|) on the
+ |context-stack|.
+ If {types} is given and is a |List| of |String|s, it specifies
+ which |context-types| to include in the pushed context.
+ Otherwise, all context types are included.
+
+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).
+
+ctxsize() *ctxsize()*
+ Returns the size of the |context-stack|.
+
+cursor({lnum}, {col} [, {off}]) *cursor()*
+cursor({list})
+ Positions the cursor at the column (byte count) {col} in the
+ line {lnum}. The first column is one.
+
+ When there is one argument {list} this is used as a |List|
+ with two, three or four item:
+ [{lnum}, {col}]
+ [{lnum}, {col}, {off}]
+ [{lnum}, {col}, {off}, {curswant}]
+ This is like the return value of |getpos()| or |getcurpos()|,
+ but without the first item.
+
+ To position the cursor using the character count, use
+ |setcursorcharpos()|.
+
+ Does not change the jumplist.
+ If {lnum} is greater than the number of lines in the buffer,
+ the cursor will be positioned at the last line in the buffer.
+ If {lnum} is zero, the cursor will stay in the current line.
+ If {col} is greater than the number of bytes in the line,
+ the cursor will be positioned at the last character in the
+ line.
+ If {col} is zero, the cursor will stay in the current column.
+ If {curswant} is given it is used to set the preferred column
+ for vertical movement. Otherwise {col} is used.
+
+ When 'virtualedit' is used {off} specifies the offset in
+ screen columns from the start of the character. E.g., a
+ position within a <Tab> or after the last character.
+ Returns 0 when the position could be set, -1 otherwise.
+
+ Can also be used as a |method|: >
+ GetCursorPos()->cursor()
+
+deepcopy({expr} [, {noref}]) *deepcopy()* *E698*
+ Make a copy of {expr}. For Numbers and Strings this isn't
+ different from using {expr} directly.
+ When {expr} is a |List| a full copy is created. This means
+ that the original |List| can be changed without changing the
+ copy, and vice versa. When an item is a |List|, a copy for it
+ is made, recursively. Thus changing an item in the copy does
+ not change the contents of the original |List|.
+
+ When {noref} is omitted or zero a contained |List| or
+ |Dictionary| is only copied once. All references point to
+ this single copy. With {noref} set to 1 every occurrence of a
+ |List| or |Dictionary| results in a new copy. This also means
+ that a cyclic reference causes deepcopy() to fail.
+ *E724*
+ Nesting is possible up to 100 levels. When there is an item
+ that refers back to a higher level making a deep copy with
+ {noref} set to 1 will fail.
+ Also see |copy()|.
+
+ Can also be used as a |method|: >
+ GetObject()->deepcopy()
+
+delete({fname} [, {flags}]) *delete()*
+ Without {flags} or with {flags} empty: Deletes the file by the
+ name {fname}.
+
+ This also works when {fname} is a symbolic link. The symbolic
+ link itself is deleted, not what it points to.
+
+ When {flags} is "d": Deletes the directory by the name
+ {fname}. This fails when directory {fname} is not empty.
+
+ When {flags} is "rf": Deletes the directory by the name
+ {fname} and everything in it, recursively. BE CAREFUL!
+ Note: on MS-Windows it is not possible to delete a directory
+ that is being used.
+
+ The result is a Number, which is 0/false if the delete
+ operation was successful and -1/true when the deletion failed
+ or partly failed.
+
+ Can also be used as a |method|: >
+ GetName()->delete()
+
+deletebufline({buf}, {first} [, {last}]) *deletebufline()*
+ Delete lines {first} to {last} (inclusive) from buffer {buf}.
+ If {last} is omitted then delete line {first} only.
+ On success 0 is returned, on failure 1 is returned.
+
+ This function works only for loaded buffers. First call
+ |bufload()| if needed.
+
+ For the use of {buf}, see |bufname()| above.
+
+ {first} and {last} are used like with |getline()|. Note that
+ when using |line()| this refers to the current buffer. Use "$"
+ to refer to the last line in buffer {buf}.
+
+ Can also be used as a |method|: >
+ GetBuffer()->deletebufline(1)
+<
+dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()*
+ Adds a watcher to a dictionary. A dictionary watcher is
+ identified by three components:
+
+ - A dictionary({dict});
+ - A key pattern({pattern}).
+ - A function({callback}).
+
+ After this is called, every change on {dict} and on keys
+ matching {pattern} will result in {callback} being invoked.
+
+ For example, to watch all global variables: >
+ silent! call dictwatcherdel(g:, '*', 'OnDictChanged')
+ function! OnDictChanged(d,k,z)
+ echomsg string(a:k) string(a:z)
+ endfunction
+ call dictwatcheradd(g:, '*', 'OnDictChanged')
+<
+ For now {pattern} only accepts very simple patterns that can
+ contain a '*' at the end of the string, in which case it will
+ match every key that begins with the substring before the '*'.
+ That means if '*' is not the last character of {pattern}, only
+ keys that are exactly equal as {pattern} will be matched.
+
+ The {callback} receives three arguments:
+
+ - The dictionary being watched.
+ - The key which changed.
+ - A dictionary containing the new and old values for the key.
+
+ The type of change can be determined by examining the keys
+ present on the third argument:
+
+ - If contains both `old` and `new`, the key was updated.
+ - If it contains only `new`, the key was added.
+ - If it contains only `old`, the key was deleted.
+
+ This function can be used by plugins to implement options with
+ validation and parsing logic.
+
+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.
+
+ *did_filetype()*
+did_filetype() Returns |TRUE| when autocommands are being executed and the
+ FileType event has been triggered at least once. Can be used
+ to avoid triggering the FileType event again in the scripts
+ that detect the file type. |FileType|
+ Returns |FALSE| when `:setf FALLBACK` was used.
+ When editing another file, the counter is reset, thus this
+ really checks if the FileType event has been triggered for the
+ current buffer. This allows an autocommand that starts
+ editing another buffer to set 'filetype' and load a syntax
+ file.
+
+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
+ another diff'ed window. These filler lines are shown in the
+ display but don't exist in the buffer.
+ {lnum} is used like with |getline()|. Thus "." is the current
+ line, "'m" mark m, etc.
+ Returns 0 if the current window is not in diff mode.
+
+ Can also be used as a |method|: >
+ GetLnum()->diff_filler()
+
+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
+ diff change zero is returned.
+ {lnum} is used like with |getline()|. Thus "." is the current
+ line, "'m" mark m, etc.
+ {col} is 1 for the leftmost column, {lnum} is 1 for the first
+ line.
+ The highlight ID can be used with |synIDattr()| to obtain
+ syntax information about the highlighting.
+
+ Can also be used as a |method|: >
+ GetLnum()->diff_hlID(col)
+<
+
+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
+ characters, or the digraph of {chars} does not exist, an error
+ is given and an empty string is returned.
+
+ Also see |digraph_getlist()|.
+
+ Examples: >
+ " Get a built-in digraph
+ :echo digraph_get('00') " Returns '∞'
+
+ " Get a user-defined digraph
+ :call digraph_set('aa', 'あ')
+ :echo digraph_get('aa') " Returns 'あ'
+<
+ Can also be used as a |method|: >
+ GetChars()->digraph_get()
+<
+
+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
+ digraphs. Otherwise, return only user-defined digraphs.
+
+ Also see |digraph_get()|.
+
+ Examples: >
+ " Get user-defined digraphs
+ :echo digraph_getlist()
+
+ " Get all the digraphs, including default digraphs
+ :echo digraph_getlist(1)
+<
+ Can also be used as a |method|: >
+ GetNumber()->digraph_getlist()
+<
+
+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
+ encoded character. *E1215*
+ Be careful, composing characters are NOT ignored. This
+ function is similar to |:digraphs| command, but useful to add
+ digraphs start with a white space.
+
+ The function result is v:true if |digraph| is registered. If
+ this fails an error message is given and v:false is returned.
+
+ If you want to define multiple digraphs at once, you can use
+ |digraph_setlist()|.
+
+ Example: >
+ call digraph_set(' ', 'あ')
+<
+ Can be used as a |method|: >
+ GetString()->digraph_set('あ')
+<
+
+digraph_setlist({digraphlist}) *digraph_setlist()*
+ Similar to |digraph_set()| but this function can add multiple
+ digraphs at once. {digraphlist} is a list composed of lists,
+ where each list contains two strings with {chars} and
+ {digraph} as in |digraph_set()|. *E1216*
+ Example: >
+ call digraph_setlist([['aa', 'あ'], ['ii', 'い']])
+<
+ It is similar to the following: >
+ for [chars, digraph] in [['aa', 'あ'], ['ii', 'い']]
+ call digraph_set(chars, digraph)
+ endfor
+< Except that the function returns after the first error,
+ following digraphs will not be added.
+
+ Can be used as a |method|: >
+ GetList()->digraph_setlist()
+<
+
+empty({expr}) *empty()*
+ Return the Number 1 if {expr} is empty, zero otherwise.
+ - A |List| or |Dictionary| is empty when it does not have any
+ items.
+ - A |String| is empty when its length is zero.
+ - A |Number| and |Float| are empty when their value is zero.
+ - |v:false| and |v:null| are empty, |v:true| is not.
+ - A |Blob| is empty when its length is zero.
+
+ Can also be used as a |method|: >
+ mylist->empty()
+
+environ() *environ()*
+ Return all of environment variables as dictionary. You can
+ check if an environment variable exists like this: >
+ :echo has_key(environ(), 'HOME')
+< Note that the variable name may be CamelCase; to ignore case
+ use this: >
+ :echo index(keys(environ()), 'HOME', 0, 1) != -1
+
+escape({string}, {chars}) *escape()*
+ Escape the characters in {chars} that occur in {string} with a
+ backslash. Example: >
+ :echo escape('c:\program files\vim', ' \')
+< results in: >
+ c:\\program\ files\\vim
+< Also see |shellescape()| and |fnameescape()|.
+
+ Can also be used as a |method|: >
+ GetText()->escape(' \')
+<
+ *eval()*
+eval({string}) Evaluate {string} and return the result. Especially useful to
+ turn the result of |string()| back into the original value.
+ This works for Numbers, Floats, Strings, Blobs and composites
+ of them. Also works for |Funcref|s that refer to existing
+ functions.
+
+ Can also be used as a |method|: >
+ argv->join()->eval()
+
+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.
+
+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*
+ 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
+ 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|).
+ The result is a Number:
+ 1 exists
+ 0 does not exist
+ -1 not implemented on this system
+ |exepath()| can be used to get the full path of an executable.
+
+ Can also be used as a |method|: >
+ GetCommand()->executable()
+
+execute({command} [, {silent}]) *execute()*
+ Execute {command} and capture its output.
+ If {command} is a |String|, returns {command} output.
+ If {command} is a |List|, returns concatenated outputs.
+ Examples: >
+ echo execute('echon "foo"')
+< foo >
+ echo execute(['echon "foo"', 'echon "bar"'])
+< foobar
+
+ The optional {silent} argument can have these values:
+ "" no `:silent` used
+ "silent" `:silent` used
+ "silent!" `:silent!` used
+ The default is "silent". Note that with "silent!", unlike
+ `:redir`, error messages are dropped.
+
+ To get a list of lines use |split()| on the result: >
+ execute('args')->split("\n")
+
+< This function is not available in the |sandbox|.
+ Note: If nested, an outer execute() will not observe output of
+ the inner calls.
+ Note: Text attributes (highlights) are not captured.
+ To execute a command in another window than the current one
+ use `win_execute()`.
+
+ Can also be used as a |method|: >
+ GetCommand()->execute()
+
+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.
+
+ Can also be used as a |method|: >
+ GetCommand()->exepath()
+<
+ *exists()*
+exists({expr}) The result is a Number, which is |TRUE| if {expr} is
+ defined, zero otherwise.
+
+ For checking for a supported feature use |has()|.
+ For checking if a file exists use |filereadable()|.
+
+ The {expr} argument is a string, which contains one of these:
+ varname internal variable (see
+ dict.key |internal-variables|). Also works
+ list[i] for |curly-braces-names|, |Dictionary|
+ entries, |List| items, etc.
+ Beware that evaluating an index may
+ cause an error message for an invalid
+ expression. E.g.: >
+ :let l = [1, 2, 3]
+ :echo exists("l[5]")
+< 0 >
+ :echo exists("l[xx]")
+< E121: Undefined variable: xx
+ 0
+ &option-name Vim option (only checks if it exists,
+ not if it really works)
+ +option-name Vim option that works.
+ $ENVNAME environment variable (could also be
+ done by comparing with an empty
+ string)
+ *funcname built-in function (see |functions|)
+ or user defined function (see
+ |user-function|). Also works for a
+ variable that is a Funcref.
+ :cmdname Ex command: built-in command, user
+ command or command modifier |:command|.
+ Returns:
+ 1 for match with start of a command
+ 2 full match with a command
+ 3 matches several user commands
+ To check for a supported command
+ always check the return value to be 2.
+ :2match The |:2match| command.
+ :3match The |:3match| command.
+ #event autocommand defined for this event
+ #event#pattern autocommand defined for this event and
+ pattern (the pattern is taken
+ literally and compared to the
+ autocommand patterns character by
+ character)
+ #group autocommand group exists
+ #group#event autocommand defined for this group and
+ event.
+ #group#event#pattern
+ autocommand defined for this group,
+ event and pattern.
+ ##event autocommand for this event is
+ supported.
+
+ Examples: >
+ exists("&mouse")
+ exists("$HOSTNAME")
+ exists("*strftime")
+ exists("*s:MyFunc")
+ exists("*MyFunc")
+ exists("bufcount")
+ exists(":Make")
+ exists("#CursorHold")
+ exists("#BufReadPre#*.gz")
+ exists("#filetypeindent")
+ exists("#filetypeindent#FileType")
+ exists("#filetypeindent#FileType#*")
+ exists("##ColorScheme")
+< There must be no space between the symbol (&/$/*/#) and the
+ name.
+ There must be no extra characters after the name, although in
+ a few cases this is ignored. That may become stricter in the
+ future, thus don't count on it!
+ Working example: >
+ exists(":make")
+< NOT working example: >
+ exists(":make install")
+
+< Note that the argument must be a string, not the name of the
+ variable itself. For example: >
+ exists(bufcount)
+< This doesn't check for existence of the "bufcount" variable,
+ but gets the value of "bufcount", and checks if that exists.
+
+ Can also be used as a |method|: >
+ Varname()->exists()
+
+exp({expr}) *exp()*
+ Return the exponential of {expr} as a |Float| in the range
+ [0, inf].
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo exp(2)
+< 7.389056 >
+ :echo exp(-1)
+< 0.367879
+
+ Can also be used as a |method|: >
+ Compute()->exp()
+
+debugbreak({pid}) *debugbreak()*
+ Specifically used to interrupt a program being debugged. It
+ will cause process {pid} to get a SIGTRAP. Behavior for other
+ processes is undefined. See |terminal-debugger|.
+ {Sends a SIGINT to a process {pid} other than MS-Windows}
+
+ Returns |TRUE| if successfully interrupted the program.
+ Otherwise returns |FALSE|.
+
+ Can also be used as a |method|: >
+ GetPid()->debugbreak()
+
+expand({string} [, {nosuf} [, {list}]]) *expand()*
+ Expand wildcards and the following special keywords in
+ {string}. 'wildignorecase' applies.
+
+ If {list} is given and it is |TRUE|, a List will be returned.
+ Otherwise the result is a String and when there are several
+ matches, they are separated by <NL> characters.
+
+ If the expansion fails, the result is an empty string. A name
+ for a non-existing file is not included, unless {string} does
+ not start with '%', '#' or '<', see below.
+
+ When {string} starts with '%', '#' or '<', the expansion is
+ done like for the |cmdline-special| variables with their
+ associated modifiers. Here is a short overview:
+
+ % current file name
+ # alternate file name
+ #n alternate file name n
+ <cfile> file name under the cursor
+ <afile> autocmd file name
+ <abuf> autocmd buffer number (as a String!)
+ <amatch> autocmd matched name
+ <sfile> sourced script file or function name
+ <slnum> sourced script line number or function
+ line number
+ <sflnum> script file line number, also when in
+ a function
+ <SID> "<SNR>123_" where "123" is the
+ current script ID |<SID>|
+ <cword> word under the cursor
+ <cWORD> WORD under the cursor
+ <client> the {clientid} of the last received
+ message
+ Modifiers:
+ :p expand to full path
+ :h head (last path component removed)
+ :t tail (last path component only)
+ :r root (one extension removed)
+ :e extension only
+
+ Example: >
+ :let &tags = expand("%:p:h") .. "/tags"
+< Note that when expanding a string that starts with '%', '#' or
+ '<', any following text is ignored. This does NOT work: >
+ :let doesntwork = expand("%:h.bak")
+< Use this: >
+ :let doeswork = expand("%:h") .. ".bak"
+< Also note that expanding "<cfile>" and others only returns the
+ referenced file name without further expansion. If "<cfile>"
+ is "~/.cshrc", you need to do another expand() to have the
+ "~/" expanded into the path of the home directory: >
+ :echo expand(expand("<cfile>"))
+<
+ There cannot be white space between the variables and the
+ following modifier. The |fnamemodify()| function can be used
+ to modify normal file names.
+
+ When using '%' or '#', and the current or alternate file name
+ is not defined, an empty string is used. Using "%:p" in a
+ buffer with no name, results in the current directory, with a
+ '/' added.
+
+ When {string} does not start with '%', '#' or '<', it is
+ expanded like a file name is expanded on the command line.
+ 'suffixes' and 'wildignore' are used, unless the optional
+ {nosuf} argument is given and it is |TRUE|.
+ Names for non-existing files are included. The "**" item can
+ be used to search in a directory tree. For example, to find
+ all "README" files in the current directory and below: >
+ :echo expand("**/README")
+<
+ expand() can also be used to expand variables and environment
+ variables that are only known in a shell. But this can be
+ slow, because a shell may be used to do the expansion. See
+ |expr-env-expand|.
+ The expanded variable is still handled like a list of file
+ names. When an environment variable cannot be expanded, it is
+ left unchanged. Thus ":echo expand('$FOOBAR')" results in
+ "$FOOBAR".
+
+ See |glob()| for finding existing files. See |system()| for
+ getting the raw output of an external command.
+
+ Can also be used as a |method|: >
+ Getpattern()->expand()
+
+expandcmd({string}) *expandcmd()*
+ Expand special items in String {string} like what is done for
+ an Ex command such as `:edit`. This expands special keywords,
+ like with |expand()|, and environment variables, anywhere in
+ {string}. "~user" and "~/path" are only expanded at the
+ start.
+ Returns the expanded string. Example: >
+ :echo expandcmd('make %<.o')
+
+< Can also be used as a |method|: >
+ GetCommand()->expandcmd()
+<
+extend({expr1}, {expr2} [, {expr3}]) *extend()*
+ {expr1} and {expr2} must be both |Lists| or both
+ |Dictionaries|.
+
+ If they are |Lists|: Append {expr2} to {expr1}.
+ If {expr3} is given insert the items of {expr2} before the
+ item with index {expr3} in {expr1}. When {expr3} is zero
+ insert before the first item. When {expr3} is equal to
+ len({expr1}) then {expr2} is appended.
+ Examples: >
+ :echo sort(extend(mylist, [7, 5]))
+ :call extend(mylist, [2, 3], 1)
+< When {expr1} is the same List as {expr2} then the number of
+ items copied is equal to the original length of the List.
+ E.g., when {expr3} is 1 you get N new copies of the first item
+ (where N is the original length of the List).
+ Use |add()| to concatenate one item to a list. To concatenate
+ two lists into a new list use the + operator: >
+ :let newlist = [1, 2, 3] + [4, 5]
+<
+ If they are |Dictionaries|:
+ Add all entries from {expr2} to {expr1}.
+ If a key exists in both {expr1} and {expr2} then {expr3} is
+ used to decide what to do:
+ {expr3} = "keep": keep the value of {expr1}
+ {expr3} = "force": use the value of {expr2}
+ {expr3} = "error": give an error message *E737*
+ When {expr3} is omitted then "force" is assumed.
+
+ {expr1} is changed when {expr2} is not empty. If necessary
+ make a copy of {expr1} first.
+ {expr2} remains unchanged.
+ When {expr1} is locked and {expr2} is not empty the operation
+ fails.
+ Returns {expr1}. Returns 0 on error.
+
+ Can also be used as a |method|: >
+ mylist->extend(otherlist)
+
+feedkeys({string} [, {mode}]) *feedkeys()*
+ Characters in {string} are queued for processing as if they
+ come from a mapping or were typed by the user.
+
+ By default the string is added to the end of the typeahead
+ buffer, thus if a mapping is still being executed the
+ characters come after them. Use the 'i' flag to insert before
+ other characters, they will be executed next, before any
+ characters from a mapping.
+
+ The function does not wait for processing of keys contained in
+ {string}.
+
+ To include special keys into {string}, use double-quotes
+ and "\..." notation |expr-quote|. For example,
+ feedkeys("\<CR>") simulates pressing of the <Enter> key. But
+ feedkeys('\<CR>') pushes 5 characters.
+ The |<Ignore>| keycode may be used to exit the
+ wait-for-character without doing anything.
+
+ {mode} is a String, which can contain these character flags:
+ 'm' Remap keys. This is default. If {mode} is absent,
+ keys are remapped.
+ 'n' Do not remap keys.
+ 't' Handle keys as if typed; otherwise they are handled as
+ if coming from a mapping. This matters for undo,
+ opening folds, etc.
+ 'i' Insert the string instead of appending (see above).
+ 'x' Execute commands until typeahead is empty. This is
+ similar to using ":normal!". You can call feedkeys()
+ several times without 'x' and then one time with 'x'
+ (possibly with an empty {string}) to execute all the
+ typeahead. Note that when Vim ends in Insert mode it
+ will behave as if <Esc> is typed, to avoid getting
+ stuck, waiting for a character to be typed before the
+ script continues.
+ Note that if you manage to call feedkeys() while
+ executing commands, thus calling it recursively, then
+ all typehead will be consumed by the last call.
+ '!' When used with 'x' will not end Insert mode. Can be
+ used in a test when a timer is set to exit Insert mode
+ a little later. Useful for testing CursorHoldI.
+
+ Return value is always 0.
+
+ Can also be used as a |method|: >
+ GetInput()->feedkeys()
+
+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,
+ or is a directory, the result is |FALSE|. {file} is any
+ expression, which is used as a String.
+ If you don't care about the file being readable you can use
+ |glob()|.
+ {file} is used as-is, you may want to expand wildcards first: >
+ echo filereadable('~/.vimrc')
+ 0
+ echo filereadable(expand('~/.vimrc'))
+ 1
+
+< Can also be used as a |method|: >
+ GetName()->filereadable()
+
+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.
+
+ Can also be used as a |method|: >
+ GetName()->filewriteable()
+
+filter({expr1}, {expr2}) *filter()*
+ {expr1} must be a |List|, |Blob|, or a |Dictionary|.
+ For each item in {expr1} evaluate {expr2} and when the result
+ is zero remove the item from the |List| or |Dictionary|. For a
+ |Blob| each byte is removed.
+
+ {expr2} must be a |string| or |Funcref|.
+
+ If {expr2} is a |string|, inside {expr2} |v:val| has the value
+ of the current item. For a |Dictionary| |v:key| has the key
+ of the current item and for a |List| |v:key| has the index of
+ the current item. For a |Blob| |v:key| has the index of the
+ current byte.
+
+ Examples: >
+ call filter(mylist, 'v:val !~ "OLD"')
+< Removes the items where "OLD" appears. >
+ call filter(mydict, 'v:key >= 8')
+< Removes the items with a key below 8. >
+ call filter(var, 0)
+< Removes all the items, thus clears the |List| or |Dictionary|.
+
+ Note that {expr2} is the result of expression and is then
+ used as an expression again. Often it is good to use a
+ |literal-string| to avoid having to double backslashes.
+
+ If {expr2} is a |Funcref| it must take two arguments:
+ 1. the key or the index of the current item.
+ 2. the value of the current item.
+ The function must return |TRUE| if the item should be kept.
+ Example that keeps the odd items of a list: >
+ func Odd(idx, val)
+ return a:idx % 2 == 1
+ endfunc
+ call filter(mylist, function('Odd'))
+< It is shorter when using a |lambda|: >
+ call filter(myList, {idx, val -> idx * val <= 42})
+< If you do not use "val" you can leave it out: >
+ call filter(myList, {idx -> idx % 2 == 1})
+<
+ The operation is done in-place. If you want a |List| or
+ |Dictionary| to remain unmodified make a copy first: >
+ :let l = filter(copy(mylist), 'v:val =~ "KEEP"')
+
+< Returns {expr1}, the |List|, |Blob| or |Dictionary| that was
+ filtered. When an error is encountered while evaluating
+ {expr2} no further items in {expr1} are processed. When
+ {expr2} is a Funcref errors inside a function are ignored,
+ unless it was defined with the "abort" flag.
+
+ Can also be used as a |method|: >
+ mylist->filter(expr2)
+
+finddir({name} [, {path} [, {count}]]) *finddir()*
+ Find directory {name} in {path}. Supports both downwards and
+ upwards recursive directory searches. See |file-searching|
+ for the syntax of {path}.
+
+ Returns the path of the first found match. When the found
+ directory is below the current directory a relative path is
+ returned. Otherwise a full path is returned.
+ If {path} is omitted or empty then 'path' is used.
+
+ If the optional {count} is given, find {count}'s occurrence of
+ {name} in {path} instead of the first one.
+ When {count} is negative return all the matches in a |List|.
+
+ Returns an empty string if the directory is not found.
+
+ This is quite similar to the ex-command `:find`.
+
+ Can also be used as a |method|: >
+ GetName()->finddir()
+
+findfile({name} [, {path} [, {count}]]) *findfile()*
+ Just like |finddir()|, but find a file instead of a directory.
+ Uses 'suffixesadd'.
+ Example: >
+ :echo findfile("tags.vim", ".;")
+< Searches from the directory of the current file upwards until
+ it finds the file "tags.vim".
+
+ Can also be used as a |method|: >
+ GetName()->findfile()
+
+flatten({list} [, {maxdepth}]) *flatten()*
+ Flatten {list} up to {maxdepth} levels. Without {maxdepth}
+ the result is a |List| without nesting, as if {maxdepth} is
+ a very large number.
+ The {list} is changed in place, make a copy first if you do
+ not want that.
+ *E900*
+ {maxdepth} means how deep in nested lists changes are made.
+ {list} is not modified when {maxdepth} is 0.
+ {maxdepth} must be positive number.
+
+ If there is an error the number zero is returned.
+
+ Example: >
+ :echo flatten([1, [2, [3, 4]], 5])
+< [1, 2, 3, 4, 5] >
+ :echo flatten([1, [2, [3, 4]], 5], 1)
+< [1, 2, [3, 4], 5]
+
+ Can also be used as a |method|: >
+ mylist->flatten()
+<
+float2nr({expr}) *float2nr()*
+ Convert {expr} to a Number by omitting the part after the
+ decimal point.
+ {expr} must evaluate to a |Float| or a Number.
+ Returns 0 if {expr} is not a |Float| or a |Number|.
+ When the value of {expr} is out of range for a |Number| the
+ result is truncated to 0x7fffffff or -0x7fffffff (or when
+ 64-bit Number support is enabled, 0x7fffffffffffffff or
+ -0x7fffffffffffffff). NaN results in -0x80000000 (or when
+ 64-bit Number support is enabled, -0x8000000000000000).
+ Examples: >
+ echo float2nr(3.95)
+< 3 >
+ echo float2nr(-23.45)
+< -23 >
+ echo float2nr(1.0e100)
+< 2147483647 (or 9223372036854775807) >
+ echo float2nr(-1.0e150)
+< -2147483647 (or -9223372036854775807) >
+ echo float2nr(1.0e-100)
+< 0
+
+ Can also be used as a |method|: >
+ Compute()->float2nr()
+
+floor({expr}) *floor()*
+ Return the largest integral value less than or equal to
+ {expr} as a |Float| (round down).
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ echo floor(1.856)
+< 1.0 >
+ echo floor(-5.456)
+< -6.0 >
+ echo floor(4.0)
+< 4.0
+
+ Can also be used as a |method|: >
+ Compute()->floor()
+
+fmod({expr1}, {expr2}) *fmod()*
+ Return the remainder of {expr1} / {expr2}, even if the
+ division is not representable. Returns {expr1} - i * {expr2}
+ for some integer i such that if {expr2} is non-zero, the
+ result has the same sign as {expr1} and magnitude less than
+ the magnitude of {expr2}. If {expr2} is zero, the value
+ returned is zero. The value returned is a |Float|.
+ {expr1} and {expr2} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
+ |Number|.
+ Examples: >
+ :echo fmod(12.33, 1.22)
+< 0.13 >
+ :echo fmod(-12.33, 1.22)
+< -0.13
+
+ Can also be used as a |method|: >
+ Compute()->fmod(1.22)
+
+fnameescape({string}) *fnameescape()*
+ Escape {string} for use as file name command argument. All
+ characters that have a special meaning, such as '%' and '|'
+ are escaped with a backslash.
+ For most systems the characters escaped are
+ " \t\n*?[{`$\\%#'\"|!<". For systems where a backslash
+ appears in a filename, it depends on the value of 'isfname'.
+ A leading '+' and '>' is also escaped (special after |:edit|
+ and |:write|). And a "-" by itself (special after |:cd|).
+ Returns an empty string on error.
+ Example: >
+ :let fname = '+some str%nge|name'
+ :exe "edit " .. fnameescape(fname)
+< results in executing: >
+ edit \+some\ str\%nge\|name
+<
+ Can also be used as a |method|: >
+ GetName()->fnameescape()
+
+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
+ command line. See |filename-modifiers|.
+ Example: >
+ :echo fnamemodify("main.c", ":p:h")
+< results in: >
+ /home/user/vim/vim/src
+< If {mods} is empty or an unsupported modifier is used then
+ {fname} is returned.
+ When {fname} is empty then with {mods} ":h" returns ".", so
+ that `:cd` can be used with it. This is different from
+ expand('%:h') without a buffer name, which returns an empty
+ string.
+ Note: Environment variables don't work in {fname}, use
+ |expand()| first then.
+
+ Can also be used as a |method|: >
+ GetName()->fnamemodify(':p:h')
+
+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.
+ If the line {lnum} is not in a closed fold, -1 is returned.
+ {lnum} is used like with |getline()|. Thus "." is the current
+ line, "'m" mark m, etc.
+
+ Can also be used as a |method|: >
+ GetLnum()->foldclosed()
+
+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.
+ If the line {lnum} is not in a closed fold, -1 is returned.
+ {lnum} is used like with |getline()|. Thus "." is the current
+ line, "'m" mark m, etc.
+
+ Can also be used as a |method|: >
+ GetLnum()->foldclosedend()
+
+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
+ returned. If there is no fold at line {lnum}, zero is
+ returned. It doesn't matter if the folds are open or closed.
+ When used while updating folds (from 'foldexpr') -1 is
+ returned for lines where folds are still to be updated and the
+ foldlevel is unknown. As a special case the level of the
+ previous line is usually available.
+ {lnum} is used like with |getline()|. Thus "." is the current
+ line, "'m" mark m, etc.
+
+ Can also be used as a |method|: >
+ GetLnum()->foldlevel()
+<
+ *foldtext()*
+foldtext() Returns a String, to be displayed for a closed fold. This is
+ the default function used for the 'foldtext' option and should
+ only be called from evaluating 'foldtext'. It uses the
+ |v:foldstart|, |v:foldend| and |v:folddashes| variables.
+ The returned string looks like this: >
+ +-- 45 lines: abcdef
+< The number of leading dashes depends on the foldlevel. The
+ "45" is the number of lines in the fold. "abcdef" is the text
+ in the first non-blank line of the fold. Leading white space,
+ "//" or "/*" and the text from the 'foldmarker' and
+ 'commentstring' options is removed.
+ When used to draw the actual foldtext, the rest of the line
+ will be filled with the fold char from the 'fillchars'
+ setting.
+ Returns an empty string when there is no fold.
+
+foldtextresult({lnum}) *foldtextresult()*
+ Returns the text that is displayed for the closed fold at line
+ {lnum}. Evaluates 'foldtext' in the appropriate context.
+ When there is no closed fold at {lnum} an empty string is
+ returned.
+ {lnum} is used like with |getline()|. Thus "." is the current
+ line, "'m" mark m, etc.
+ Useful when exporting folded text, e.g., to HTML.
+
+ Can also be used as a |method|: >
+ GetLnum()->foldtextresult()
+<
+fullcommand({name}) *fullcommand()*
+ Get the full command name from a short abbreviated command
+ name; see |20.2| for details on command abbreviations.
+
+ The string argument {name} may start with a `:` and can
+ include a [range], these are skipped and not returned.
+ Returns an empty string if a command doesn't exist or if it's
+ ambiguous (for user-defined commands).
+
+ For example `fullcommand('s')`, `fullcommand('sub')`,
+ `fullcommand(':%substitute')` all return "substitute".
+
+ Can also be used as a |method|: >
+ GetName()->fullcommand()
+<
+ *funcref()*
+funcref({name} [, {arglist}] [, {dict}])
+ Just like |function()|, but the returned Funcref will lookup
+ the function by reference, not by name. This matters when the
+ function {name} is redefined later.
+
+ Unlike |function()|, {name} must be an existing user function.
+ It only works for an autoloaded function if it has already
+ been loaded (to avoid mistakenly loading the autoload script
+ when only intending to use the function name, use |function()|
+ instead). {name} cannot be a builtin function.
+ Returns 0 on error.
+
+ Can also be used as a |method|: >
+ GetFuncname()->funcref([arg])
+<
+ *function()* *E700* *E922* *E923*
+function({name} [, {arglist}] [, {dict}])
+ Return a |Funcref| variable that refers to function {name}.
+ {name} can be a user defined function or an internal function.
+
+ {name} can also be a Funcref or a partial. When it is a
+ partial the dict stored in it will be used and the {dict}
+ argument is not allowed. E.g.: >
+ let FuncWithArg = function(dict.Func, [arg])
+ let Broken = function(dict.Func, [arg], dict)
+<
+ When using the Funcref the function will be found by {name},
+ also when it was redefined later. Use |funcref()| to keep the
+ same function.
+
+ When {arglist} or {dict} is present this creates a partial.
+ That means the argument list and/or the dictionary is stored in
+ the Funcref and will be used when the Funcref is called.
+
+ The arguments are passed to the function in front of other
+ arguments, but after any argument from |method|. Example: >
+ func Callback(arg1, arg2, name)
+ ...
+ let Partial = function('Callback', ['one', 'two'])
+ ...
+ call Partial('name')
+< Invokes the function as with: >
+ call Callback('one', 'two', 'name')
+
+< The Dictionary is only useful when calling a "dict" function.
+ In that case the {dict} is passed in as "self". Example: >
+ function Callback() dict
+ echo "called for " .. self.name
+ endfunction
+ ...
+ let context = {"name": "example"}
+ let Func = function('Callback', context)
+ ...
+ call Func() " will echo: called for example
+
+< The argument list and the Dictionary can be combined: >
+ function Callback(arg1, count) dict
+ ...
+ let context = {"name": "example"}
+ let Func = function('Callback', ['one'], context)
+ ...
+ call Func(500)
+< Invokes the function as with: >
+ call context.Callback('one', 500)
+<
+ Returns 0 on error.
+
+ Can also be used as a |method|: >
+ GetFuncname()->function([arg])
+
+garbagecollect([{atexit}]) *garbagecollect()*
+ Cleanup unused |Lists| and |Dictionaries| that have circular
+ references.
+
+ There is hardly ever a need to invoke this function, as it is
+ automatically done when Vim runs out of memory or is waiting
+ for the user to press a key after 'updatetime'. Items without
+ circular references are always freed when they become unused.
+ This is useful if you have deleted a very big |List| and/or
+ |Dictionary| with circular references in a script that runs
+ for a long time.
+
+ When the optional {atexit} argument is one, garbage
+ collection will also be done when exiting Vim, if it wasn't
+ done before. This is useful when checking for memory leaks.
+
+ The garbage collection is not done immediately but only when
+ it's safe to perform. This is when waiting for the user to
+ type a character.
+
+get({list}, {idx} [, {default}]) *get()*
+ Get item {idx} from |List| {list}. When this item is not
+ available return {default}. Return zero when {default} is
+ omitted.
+ Can also be used as a |method|: >
+ mylist->get(idx)
+get({blob}, {idx} [, {default}])
+ Get byte {idx} from |Blob| {blob}. When this byte is not
+ available return {default}. Return -1 when {default} is
+ omitted.
+get({dict}, {key} [, {default}])
+ Get item with key {key} from |Dictionary| {dict}. When this
+ item is not available return {default}. Return zero when
+ {default} is omitted. Useful example: >
+ let val = get(g:, 'var_name', 'default')
+< This gets the value of g:var_name if it exists, and uses
+ 'default' when it does not exist.
+get({func}, {what})
+ 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
+ Returns zero on error.
+
+ *getbufinfo()*
+getbufinfo([{buf}])
+getbufinfo([{dict}])
+ Get information about buffers as a List of Dictionaries.
+
+ Without an argument information about all the buffers is
+ returned.
+
+ When the argument is a |Dictionary| only the buffers matching
+ the specified criteria are returned. The following keys can
+ be specified in {dict}:
+ buflisted include only listed buffers.
+ bufloaded include only loaded buffers.
+ bufmodified include only modified buffers.
+
+ Otherwise, {buf} specifies a particular buffer to return
+ information for. For the use of {buf}, see |bufname()|
+ above. If the buffer is found the returned List has one item.
+ Otherwise the result is an empty list.
+
+ Each returned List item is a dictionary with the following
+ entries:
+ bufnr Buffer number.
+ changed TRUE if the buffer is modified.
+ changedtick Number of changes made to the buffer.
+ hidden TRUE if the buffer is hidden.
+ lastused Timestamp in seconds, like
+ |localtime()|, when the buffer was
+ last used.
+ listed TRUE if the buffer is listed.
+ lnum Line number used for the buffer when
+ opened in the current window.
+ Only valid if the buffer has been
+ displayed in the window in the past.
+ If you want the line number of the
+ last known cursor position in a given
+ window, use |line()|: >
+ :echo line('.', {winid})
+<
+ linecount Number of lines in the buffer (only
+ valid when loaded)
+ loaded TRUE if the buffer is loaded.
+ name Full path to the file in the buffer.
+ signs List of signs placed in the buffer.
+ Each list item is a dictionary with
+ the following fields:
+ id sign identifier
+ lnum line number
+ name sign name
+ variables A reference to the dictionary with
+ buffer-local variables.
+ windows List of |window-ID|s that display this
+ buffer
+
+ Examples: >
+ for buf in getbufinfo()
+ echo buf.name
+ endfor
+ for buf in getbufinfo({'buflisted':1})
+ if buf.changed
+ ....
+ endif
+ endfor
+<
+ To get buffer-local options use: >
+ getbufvar({bufnr}, '&option_name')
+<
+ Can also be used as a |method|: >
+ GetBufnr()->getbufinfo()
+<
+ *getbufline()*
+getbufline({buf}, {lnum} [, {end}])
+ Return a |List| with the lines starting from {lnum} to {end}
+ (inclusive) in the buffer {buf}. If {end} is omitted, a
+ |List| with only the line {lnum} is returned.
+
+ For the use of {buf}, see |bufname()| above.
+
+ For {lnum} and {end} "$" can be used for the last line of the
+ buffer. Otherwise a number must be used.
+
+ When {lnum} is smaller than 1 or bigger than the number of
+ lines in the buffer, an empty |List| is returned.
+
+ When {end} is greater than the number of lines in the buffer,
+ it is treated as {end} is set to the number of lines in the
+ buffer. When {end} is before {lnum} an empty |List| is
+ returned.
+
+ This function works only for loaded buffers. For unloaded and
+ non-existing buffers, an empty |List| is returned.
+
+ Example: >
+ :let lines = getbufline(bufnr("myfile"), 1, "$")
+
+< Can also be used as a |method|: >
+ GetBufnr()->getbufline(lnum)
+
+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:"
+ must be used.
+ The {varname} argument is a string.
+ When {varname} is empty returns a |Dictionary| with all the
+ buffer-local variables.
+ When {varname} is equal to "&" returns a |Dictionary| with all
+ the buffer-local options.
+ Otherwise, when {varname} starts with "&" returns the value of
+ a buffer-local option.
+ This also works for a global or buffer-local option, but it
+ doesn't work for a global variable, window-local variable or
+ window-local option.
+ For the use of {buf}, see |bufname()| above.
+ When the buffer or variable doesn't exist {def} or an empty
+ string is returned, there is no error message.
+ Examples: >
+ :let bufmodified = getbufvar(1, "&mod")
+ :echo "todo myvar = " .. getbufvar("todo", "myvar")
+
+< Can also be used as a |method|: >
+ GetBufnr()->getbufvar(varname)
+<
+getchangelist([{buf}]) *getchangelist()*
+ Returns the |changelist| for the buffer {buf}. For the use
+ of {buf}, see |bufname()| above. If buffer {buf} doesn't
+ exist, an empty list is returned.
+
+ The returned list contains two entries: a list with the change
+ locations and the current position in the list. Each
+ entry in the change list is a dictionary with the following
+ entries:
+ col column number
+ coladd column offset for 'virtualedit'
+ lnum line number
+ If buffer {buf} is the current buffer, then the current
+ position refers to the position in the list. For other
+ buffers, it is set to the length of the list.
+
+ Can also be used as a |method|: >
+ GetBufnr()->getchangelist()
+
+getchar([expr]) *getchar()*
+ Get a single character from the user or input stream.
+ If [expr] is omitted, wait until a character is available.
+ If [expr] is 0, only get a character when one is available.
+ Return zero otherwise.
+ If [expr] is 1, only check if a character is available, it is
+ not consumed. Return zero if no character available.
+ If you prefer always getting a string use |getcharstr()|.
+
+ Without [expr] and when [expr] is 0 a whole character or
+ special key is returned. If it is a single character, the
+ result is a Number. Use |nr2char()| to convert it to a String.
+ Otherwise a String is returned with the encoded character.
+ For a special key it's a String with a sequence of bytes
+ starting with 0x80 (decimal: 128). This is the same value as
+ the String "\<Key>", e.g., "\<Left>". The returned value is
+ also a String when a modifier (shift, control, alt) was used
+ that is not included in the character.
+
+ When [expr] is 0 and Esc is typed, there will be a short delay
+ while Vim waits to see if this is the start of an escape
+ sequence.
+
+ When [expr] is 1 only the first byte is returned. For a
+ one-byte character it is the character itself as a number.
+ Use nr2char() to convert it to a String.
+
+ Use getcharmod() to obtain any additional modifiers.
+
+ When the user clicks a mouse button, the mouse event will be
+ returned. The position can then be found in |v:mouse_col|,
+ |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|.
+ |getmousepos()| can also be used. Mouse move events will be
+ ignored.
+ This example positions the mouse as it would normally happen: >
+ let c = getchar()
+ if c == "\<LeftMouse>" && v:mouse_win > 0
+ exe v:mouse_win .. "wincmd w"
+ exe v:mouse_lnum
+ exe "normal " .. v:mouse_col .. "|"
+ endif
+<
+ There is no prompt, you will somehow have to make clear to the
+ user that a character has to be typed. The screen is not
+ redrawn, e.g. when resizing the window.
+
+ There is no mapping for the character.
+ Key codes are replaced, thus when the user presses the <Del>
+ key you get the code for the <Del> key, not the raw character
+ sequence. Examples: >
+ getchar() == "\<Del>"
+ getchar() == "\<S-Left>"
+< This example redefines "f" to ignore case: >
+ :nmap f :call FindChar()<CR>
+ :function FindChar()
+ : let c = nr2char(getchar())
+ : while col('.') < col('$') - 1
+ : normal l
+ : if getline('.')[col('.') - 1] ==? c
+ : break
+ : endif
+ : endwhile
+ :endfunction
+<
+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.
+ These values are added together:
+ 2 shift
+ 4 control
+ 8 alt (meta)
+ 16 meta (when it's different from ALT)
+ 32 mouse double click
+ 64 mouse triple click
+ 96 mouse quadruple click (== 32 + 64)
+ 128 command (Macintosh only)
+ Only the modifiers that have not been included in the
+ character itself are obtained. Thus Shift-a results in "A"
+ without a modifier. Returns 0 if no modifiers are used.
+
+ *getcharpos()*
+getcharpos({expr})
+ Get the position for String {expr}. Same as |getpos()| but the
+ column number in the returned List is a character index
+ instead of a byte index.
+
+ Example:
+ With the cursor on '세' in line 5 with text "여보세요": >
+ getcharpos('.') returns [0, 5, 3, 0]
+ getpos('.') returns [0, 5, 7, 0]
+<
+ Can also be used as a |method|: >
+ GetMark()->getcharpos()
+
+getcharsearch() *getcharsearch()*
+ Return the current character search information as a {dict}
+ with the following entries:
+
+ char character previously used for a character
+ search (|t|, |f|, |T|, or |F|); empty string
+ if no character search has been performed
+ forward direction of character search; 1 for forward,
+ 0 for backward
+ until type of character search; 1 for a |t| or |T|
+ character search, 0 for an |f| or |F|
+ character search
+
+ This can be useful to always have |;| and |,| search
+ forward/backward regardless of the direction of the previous
+ character search: >
+ :nnoremap <expr> ; getcharsearch().forward ? ';' : ','
+ :nnoremap <expr> , getcharsearch().forward ? ',' : ';'
+< Also see |setcharsearch()|.
+
+
+getcharstr([expr]) *getcharstr()*
+ Get a single character from the user or input stream as a
+ string.
+ If [expr] is omitted, wait until a character is available.
+ If [expr] is 0 or false, only get a character when one is
+ available. Return an empty string otherwise.
+ If [expr] is 1 or true, only check if a character is
+ available, it is not consumed. Return an empty string
+ if no character is available.
+ Otherwise this works like |getchar()|, except that a number
+ result is converted to a 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()| and |getcmdline()|.
+ Returns an empty string when completion is not defined.
+
+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_=|.
+ Example: >
+ :cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
+< Also see |getcmdtype()|, |getcmdpos()| and |setcmdpos()|.
+ Returns an empty string when entering a password or using
+ |inputsecret()|.
+
+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()| and |getcmdline()|.
+
+getcmdscreenpos() *getcmdscreenpos()*
+ 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.
+ 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 |getcmdpos()|, |setcmdpos()|.
+
+getcmdtype() *getcmdtype()*
+ Return the current command-line type. Possible return values
+ are:
+ : normal Ex command
+ > debug mode command |debug-mode|
+ / forward search command
+ ? backward search command
+ @ |input()| command
+ - |:insert| or |:append| command
+ = |i_CTRL-R_=|
+ Only works when editing the command line, thus requires use of
+ |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
+ Returns an empty string otherwise.
+ Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|.
+
+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.
+
+getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
+ Return a list of command-line completion matches. The String
+ {type} argument specifies what for. The following completion
+ types are supported:
+
+ arglist file names in argument list
+ augroup autocmd groups
+ buffer buffer names
+ behave :behave suboptions
+ cmdline |cmdline-completion| result
+ color color schemes
+ command Ex command
+ compiler compilers
+ cscope |:cscope| suboptions
+ diff_buffer |:diffget| and |:diffput| completion
+ dir directory names
+ environment environment variable names
+ event autocommand events
+ expression Vim expression
+ file file and directory names
+ file_in_path file and directory names in |'path'|
+ filetype filetype names |'filetype'|
+ function function name
+ help help subjects
+ highlight highlight groups
+ history :history suboptions
+ locale locale names (as output of locale -a)
+ mapclear buffer argument
+ mapping mapping name
+ menu menus
+ messages |:messages| suboptions
+ option options
+ packadd optional package |pack-add| names
+ shellcmd Shell command
+ sign |:sign| suboptions
+ syntax syntax file names |'syntax'|
+ syntime |:syntime| suboptions
+ tag tags
+ tag_listfiles tags, file names
+ user user names
+ var user variables
+
+ If {pat} is an empty string, then all the matches are
+ returned. Otherwise only items matching {pat} are returned.
+ See |wildcards| for the use of special characters in {pat}.
+
+ If the optional {filtered} flag is set to 1, then 'wildignore'
+ is applied to filter the results. Otherwise all the matches
+ are returned. The 'wildignorecase' option always applies.
+
+ If {type} is "cmdline", then the |cmdline-completion| result is
+ returned. For example, to complete the possible values after
+ a ":call" command: >
+ echo getcompletion('call ', 'cmdline')
+<
+ If there are no matches, an empty list is returned. An
+ invalid value for {type} produces an error.
+
+ Can also be used as a |method|: >
+ GetPattern()->getcompletion('color')
+<
+ *getcurpos()*
+getcurpos([{winid}])
+ Get the position of the cursor. This is like getpos('.'), but
+ includes an extra "curswant" in the list:
+ [0, lnum, col, off, curswant] ~
+ The "curswant" number is the preferred column when moving the
+ cursor vertically. Also see |getcursorcharpos()| and
+ |getpos()|.
+ The first "bufnum" item is always zero. The byte position of
+ the cursor is returned in 'col'. To get the character
+ position, use |getcursorcharpos()|.
+
+ The optional {winid} argument can specify the window. It can
+ be the window number or the |window-ID|. The last known
+ cursor position is returned, this may be invalid for the
+ current value of the buffer if it is not the current window.
+ If {winid} is invalid a list with zeroes is returned.
+
+ This can be used to save and restore the cursor position: >
+ let save_cursor = getcurpos()
+ MoveTheCursorAround
+ call setpos('.', save_cursor)
+< Note that this only works within the window. See
+ |winrestview()| for restoring more state.
+
+ Can also be used as a |method|: >
+ GetWinid()->getcurpos()
+<
+ *getcursorcharpos()*
+getcursorcharpos([{winid}])
+ Same as |getcurpos()| but the column number in the returned
+ List is a character index instead of a byte index.
+
+ Example:
+ With the cursor on '보' in line 3 with text "여보세요": >
+ getcursorcharpos() returns [0, 3, 2, 0, 3]
+ getcurpos() returns [0, 3, 4, 0, 3]
+<
+ Can also be used as a |method|: >
+ GetWinid()->getcursorcharpos()
+
+getcwd([{winnr} [, {tabnr}]]) *getcwd()*
+ With no arguments, returns the name of the effective
+ |current-directory|. With {winnr} or {tabnr} the working
+ directory of that scope is returned, and 'autochdir' is
+ ignored.
+ Tabs and windows are identified by their respective numbers,
+ 0 means current tab or window. Missing tab number implies 0.
+ Thus the following are equivalent: >
+ getcwd(0)
+ getcwd(0, 0)
+< If {winnr} is -1 it is ignored, only the tab is resolved.
+ {winnr} can be the window number or the |window-ID|.
+ If both {winnr} and {tabnr} are -1 the global working
+ directory is returned.
+ Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
+
+ Can also be used as a |method|: >
+ GetWinnr()->getcwd()
+
+getenv({name}) *getenv()*
+ Return the value of environment variable {name}. The {name}
+ argument is a string, without a leading '$'. Example: >
+ myHome = getenv('HOME')
+
+< When the variable does not exist |v:null| is returned. That
+ is different from a variable set to an empty string.
+ See also |expr-env|.
+
+ Can also be used as a |method|: >
+ GetVarname()->getenv()
+
+getfontname([{name}]) *getfontname()*
+ Without an argument returns the name of the normal font being
+ used. Like what is used for the Normal highlight group
+ |hl-Normal|.
+ With an argument a check is done whether String {name} is a
+ valid font name. If not then an empty string is returned.
+ Otherwise the actual font name is returned, or {name} if the
+ GUI does not support obtaining the real name.
+ Only works when the GUI is running, thus not in your vimrc or
+ gvimrc file. Use the |GUIEnter| autocommand to use this
+ function just after the GUI has started.
+
+getfperm({fname}) *getfperm()*
+ The result is a String, which is the read, write, and execute
+ permissions of the given file {fname}.
+ If {fname} does not exist or its directory cannot be read, an
+ empty string is returned.
+ The result is of the form "rwxrwxrwx", where each group of
+ "rwx" flags represent, in turn, the permissions of the owner
+ of the file, the group the file belongs to, and other users.
+ If a user does not have a given permission the flag for this
+ is replaced with the string "-". Examples: >
+ :echo getfperm("/etc/passwd")
+ :echo getfperm(expand("~/.config/nvim/init.vim"))
+< This will hopefully (from a security point of view) display
+ the string "rw-r--r--" or even "rw-------".
+
+ Can also be used as a |method|: >
+ GetFilename()->getfperm()
+<
+ For setting permissions use |setfperm()|.
+
+getfsize({fname}) *getfsize()*
+ The result is a Number, which is the size in bytes of the
+ given file {fname}.
+ If {fname} is a directory, 0 is returned.
+ If the file {fname} can't be found, -1 is returned.
+ If the size of {fname} is too big to fit in a Number then -2
+ is returned.
+
+ Can also be used as a |method|: >
+ GetFilename()->getfsize()
+
+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
+ since 1st Jan 1970, and may be passed to strftime(). See also
+ |localtime()| and |strftime()|.
+ If the file {fname} can't be found -1 is returned.
+
+ Can also be used as a |method|: >
+ GetFilename()->getftime()
+
+getftype({fname}) *getftype()*
+ The result is a String, which is a description of the kind of
+ file of the given file {fname}.
+ If {fname} does not exist an empty string is returned.
+ Here is a table over different kinds of files and their
+ results:
+ Normal file "file"
+ Directory "dir"
+ Symbolic link "link"
+ Block device "bdev"
+ Character device "cdev"
+ Socket "socket"
+ FIFO "fifo"
+ All other "other"
+ Example: >
+ getftype("/home")
+< Note that a type such as "link" will only be returned on
+ systems that support it. On some systems only "dir" and
+ "file" are returned.
+
+ Can also be used as a |method|: >
+ GetFilename()->getftype()
+
+getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
+ Returns the |jumplist| for the specified window.
+
+ Without arguments use the current window.
+ With {winnr} only use this window in the current tab page.
+ {winnr} can also be a |window-ID|.
+ With {winnr} and {tabnr} use the window in the specified tab
+ page. If {winnr} or {tabnr} is invalid, an empty list is
+ returned.
+
+ The returned list contains two entries: a list with the jump
+ locations and the last used jump position number in the list.
+ Each entry in the jump location list is a dictionary with
+ the following entries:
+ bufnr buffer number
+ col column number
+ coladd column offset for 'virtualedit'
+ filename filename if available
+ lnum line number
+
+ Can also be used as a |method|: >
+ GetWinnr()->getjumplist()
+
+< *getline()*
+getline({lnum} [, {end}])
+ Without {end} the result is a String, which is line {lnum}
+ from the current buffer. Example: >
+ getline(1)
+< When {lnum} is a String that doesn't start with a
+ digit, |line()| is called to translate the String into a Number.
+ To get the line under the cursor: >
+ getline(".")
+< When {lnum} is a number smaller than 1 or bigger than the
+ number of lines in the buffer, an empty string is returned.
+
+ When {end} is given the result is a |List| where each item is
+ a line from the current buffer in the range {lnum} to {end},
+ including line {end}.
+ {end} is used in the same way as {lnum}.
+ Non-existing lines are silently omitted.
+ When {end} is before {lnum} an empty |List| is returned.
+ Example: >
+ :let start = line('.')
+ :let end = search("^$") - 1
+ :let lines = getline(start, end)
+
+< Can also be used as a |method|: >
+ ComputeLnum()->getline()
+
+< To get lines from another buffer see |getbufline()|
+
+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|.
+ When {nr} is zero the current window is used.
+
+ For a location list window, the displayed location list is
+ returned. For an invalid window number {nr}, an empty list is
+ returned. Otherwise, same as |getqflist()|.
+
+ If the optional {what} dictionary argument is supplied, then
+ returns the items listed in {what} as a dictionary. Refer to
+ |getqflist()| for the supported items in {what}.
+
+ In addition to the items supported by |getqflist()| in {what},
+ the following item is supported by |getloclist()|:
+
+ filewinid id of the window used to display files
+ from the location list. This field is
+ applicable only when called from a
+ location list window. See
+ |location-list-file-window| for more
+ details.
+
+ Returns a |Dictionary| with default values if there is no
+ location list for the window {nr}.
+ Returns an empty Dictionary if window {nr} does not exist.
+
+ Examples (See also |getqflist-examples|): >
+ :echo getloclist(3, {'all': 0})
+ :echo getloclist(5, {'filewinid': 0})
+
+
+getmarklist([{buf}]) *getmarklist()*
+ Without the {buf} argument returns a |List| with information
+ about all the global marks. |mark|
+
+ If the optional {buf} argument is specified, returns the
+ local marks defined in buffer {buf}. For the use of {buf},
+ see |bufname()|. If {buf} is invalid, an empty list is
+ returned.
+
+ Each item in the returned List is a |Dict| with the following:
+ mark name of the mark prefixed by "'"
+ pos a |List| with the position of the mark:
+ [bufnum, lnum, col, off]
+ Refer to |getpos()| for more information.
+ file file name
+
+ Refer to |getpos()| for getting information about a specific
+ mark.
+
+ Can also be used as a |method|: >
+ GetBufnr()->getmarklist()
+
+getmatches([{win}]) *getmatches()*
+ Returns a |List| with all matches previously defined for the
+ current window by |matchadd()| and the |:match| commands.
+ |getmatches()| is useful in combination with |setmatches()|,
+ as |setmatches()| can restore a list of matches saved by
+ |getmatches()|.
+ If {win} is specified, use the window with this number or
+ window ID instead of the current window. If {win} is invalid,
+ an empty list is returned.
+ Example: >
+ :echo getmatches()
+< [{'group': 'MyGroup1', 'pattern': 'TODO',
+ 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
+ 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
+ :let m = getmatches()
+ :call clearmatches()
+ :echo getmatches()
+< [] >
+ :call setmatches(m)
+ :echo getmatches()
+< [{'group': 'MyGroup1', 'pattern': 'TODO',
+ 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
+ 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
+ :unlet m
+<
+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
+ items are:
+ screenrow screen row
+ screencol screen column
+ winid Window ID of the click
+ winrow row inside "winid"
+ wincol column inside "winid"
+ line text line inside "winid"
+ column text column inside "winid"
+ All numbers are 1-based.
+
+ If not over a window, e.g. when in the command line, then only
+ "screenrow" and "screencol" are valid, the others are zero.
+
+ When on the status line below a window or the vertical
+ separater right of a window, the "line" and "column" values
+ are zero.
+
+ When the position is after the text then "column" is the
+ length of the text in bytes plus one.
+
+ If the mouse is over a focusable floating window then that
+ window is used.
+
+ When using |getchar()| the Vim variables |v:mouse_lnum|,
+ |v:mouse_col| and |v:mouse_winid| also provide these values.
+
+ *getpid()*
+getpid() Return a Number which is the process ID of the Vim process.
+ This is a unique number, until Vim exits.
+
+ *getpos()*
+getpos({expr}) Get the position for String {expr}. For possible values of
+ {expr} see |line()|. For getting the cursor position see
+ |getcurpos()|.
+ 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
+ is the buffer number of the mark.
+ "lnum" and "col" are the position in the buffer. The first
+ column is 1.
+ The "off" number is zero, unless 'virtualedit' is used. Then
+ 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.
+ The column number in the returned List is the byte position
+ within the line. To get the character position in the line,
+ use |getcharpos()|.
+ The column number can be very large, e.g. 2147483647, 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: >
+ let save_a_mark = getpos("'a")
+ ...
+ call setpos("'a", save_a_mark)
+< Also see |getcharpos()|, |getcurpos()| and |setpos()|.
+
+ Can also be used as a |method|: >
+ GetMark()->getpos()
+
+getqflist([{what}]) *getqflist()*
+ Returns a |List| with all the current quickfix errors. Each
+ list item is a dictionary with these entries:
+ bufnr number of buffer that has the file name, use
+ bufname() to get the name
+ module module name
+ lnum line number in the buffer (first line is 1)
+ end_lnum
+ end of line number if the item is multiline
+ col column number (first column is 1)
+ end_col end of column number if the item has range
+ vcol |TRUE|: "col" is visual column
+ |FALSE|: "col" is byte index
+ nr error number
+ pattern search pattern used to locate the error
+ text description of the error
+ type type of the error, 'E', '1', etc.
+ valid |TRUE|: recognized error message
+
+ When there is no error list or it's empty, an empty list is
+ returned. Quickfix list entries with a non-existing buffer
+ number are returned with "bufnr" set to zero (Note: some
+ functions accept buffer number zero for the alternate buffer,
+ you may need to explicitly check for zero).
+
+ Useful application: Find pattern matches in multiple files and
+ do something with them: >
+ :vimgrep /theword/jg *.c
+ :for d in getqflist()
+ : echo bufname(d.bufnr) ':' d.lnum '=' d.text
+ :endfor
+<
+ If the optional {what} dictionary argument is supplied, then
+ returns only the items listed in {what} as a dictionary. The
+ following string items are supported in {what}:
+ changedtick get the total number of changes made
+ to the list |quickfix-changedtick|
+ context get the |quickfix-context|
+ efm errorformat to use when parsing "lines". If
+ not present, then the 'errorformat' option
+ value is used.
+ id get information for the quickfix list with
+ |quickfix-ID|; zero means the id for the
+ current list or the list specified by "nr"
+ idx get information for the quickfix entry at this
+ index in the list specified by 'id' or 'nr'.
+ If set to zero, then uses the current entry.
+ See |quickfix-index|
+ items quickfix list entries
+ lines parse a list of lines using 'efm' and return
+ the resulting entries. Only a |List| type is
+ accepted. The current quickfix list is not
+ modified. See |quickfix-parse|.
+ nr get information for this quickfix list; zero
+ means the current quickfix list and "$" means
+ the last quickfix list
+ qfbufnr number of the buffer displayed in the quickfix
+ window. Returns 0 if the quickfix buffer is
+ not present. See |quickfix-buffer|.
+ size number of entries in the quickfix list
+ title get the list title |quickfix-title|
+ winid get the quickfix |window-ID|
+ all all of the above quickfix properties
+ Non-string items in {what} are ignored. To get the value of a
+ particular item, set it to zero.
+ If "nr" is not present then the current quickfix list is used.
+ If both "nr" and a non-zero "id" are specified, then the list
+ specified by "id" is used.
+ To get the number of lists in the quickfix stack, set "nr" to
+ "$" in {what}. The "nr" value in the returned dictionary
+ contains the quickfix stack size.
+ When "lines" is specified, all the other items except "efm"
+ are ignored. The returned dictionary contains the entry
+ "items" with the list of entries.
+
+ The returned dictionary contains the following entries:
+ changedtick total number of changes made to the
+ list |quickfix-changedtick|
+ context quickfix list context. See |quickfix-context|
+ If not present, set to "".
+ id quickfix list ID |quickfix-ID|. If not
+ present, set to 0.
+ idx index of the quickfix entry in the list. If not
+ present, set to 0.
+ items quickfix list entries. If not present, set to
+ an empty list.
+ nr quickfix list number. If not present, set to 0
+ qfbufnr number of the buffer displayed in the quickfix
+ window. If not present, set to 0.
+ size number of entries in the quickfix list. If not
+ present, set to 0.
+ title quickfix list title text. If not present, set
+ to "".
+ winid quickfix |window-ID|. If not present, set to 0
+
+ Examples (See also |getqflist-examples|): >
+ :echo getqflist({'all': 1})
+ :echo getqflist({'nr': 2, 'title': 1})
+ :echo getqflist({'lines' : ["F1:10:L10"]})
+<
+getreg([{regname} [, 1 [, {list}]]]) *getreg()*
+ The result is a String, which is the contents of register
+ {regname}. Example: >
+ :let cliptext = getreg('*')
+< When register {regname} was not set the result is an empty
+ string.
+ The {regname} argument must be a string.
+
+ getreg('=') returns the last evaluated value of the expression
+ register. (For use in maps.)
+ getreg('=', 1) returns the expression itself, so that it can
+ be restored with |setreg()|. For other registers the extra
+ argument is ignored, thus you can always give it.
+
+ If {list} is present and |TRUE|, the result type is changed
+ to |List|. Each list item is one text line. Use it if you care
+ about zero bytes possibly present inside register: without
+ third argument both NLs and zero bytes are represented as NLs
+ (see |NL-used-for-Nul|).
+ When the register was not set an empty list is returned.
+
+ If {regname} is not specified, |v:register| is used.
+
+ Can also be used as a |method|: >
+ GetRegname()->getreg()
+
+getreginfo([{regname}]) *getreginfo()*
+ Returns detailed information about register {regname} as a
+ Dictionary with the following entries:
+ regcontents List of lines contained in register
+ {regname}, like
+ |getreg|({regname}, 1, 1).
+ regtype the type of register {regname}, as in
+ |getregtype()|.
+ isunnamed Boolean flag, v:true if this register
+ is currently pointed to by the unnamed
+ register.
+ points_to for the unnamed register, gives the
+ single letter name of the register
+ currently pointed to (see |quotequote|).
+ For example, after deleting a line
+ with `dd`, this field will be "1",
+ which is the register that got the
+ deleted text.
+
+ The {regname} argument is a string. If {regname} is invalid
+ or not set, an empty Dictionary will be returned.
+ If {regname} is not specified, |v:register| is used.
+ The returned Dictionary can be passed to |setreg()|.
+
+ Can also be used as a |method|: >
+ GetRegname()->getreginfo()
+
+getregtype([{regname}]) *getregtype()*
+ The result is a String, which is type of register {regname}.
+ The value will be one of:
+ "v" for |charwise| text
+ "V" for |linewise| text
+ "<CTRL-V>{width}" for |blockwise-visual| text
+ "" for an empty or unknown register
+ <CTRL-V> is one character with value 0x16.
+ The {regname} argument is a string. If {regname} is not
+ specified, |v:register| is used.
+
+ Can also be used as a |method|: >
+ GetRegname()->getregtype()
+
+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
+ |Dictionary|. Otherwise, {tabnr} specifies the tab page
+ number and information about that one is returned. If the tab
+ page does not exist an empty List is returned.
+
+ Each List item is a |Dictionary| with the following entries:
+ tabnr tab page number.
+ variables a reference to the dictionary with
+ tabpage-local variables
+ windows List of |window-ID|s in the tab page.
+
+ Can also be used as a |method|: >
+ GetTabnr()->gettabinfo()
+
+gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
+ Get the value of a tab-local variable {varname} in tab page
+ {tabnr}. |t:var|
+ Tabs are numbered starting with one.
+ The {varname} argument is a string. When {varname} is empty a
+ dictionary with all tab-local variables is returned.
+ Note that the name without "t:" must be used.
+ When the tab or variable doesn't exist {def} or an empty
+ string is returned, there is no error message.
+
+ Can also be used as a |method|: >
+ GetTabnr()->gettabvar(varname)
+
+gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
+ Get the value of window-local variable {varname} in window
+ {winnr} in tab page {tabnr}.
+ The {varname} argument is a string. When {varname} is empty a
+ dictionary with all window-local variables is returned.
+ When {varname} is equal to "&" get the values of all
+ window-local options in a |Dictionary|.
+ Otherwise, when {varname} starts with "&" get the value of a
+ window-local option.
+ Note that {varname} must be the name without "w:".
+ Tabs are numbered starting with one. For the current tabpage
+ use |getwinvar()|.
+ {winnr} can be the window number or the |window-ID|.
+ When {winnr} is zero the current window is used.
+ This also works for a global option, buffer-local option and
+ window-local option, but it doesn't work for a global variable
+ or buffer-local variable.
+ When the tab, window or variable doesn't exist {def} or an
+ empty string is returned, there is no error message.
+ Examples: >
+ :let list_is_on = gettabwinvar(1, 2, '&list')
+ :echo "myvar = " .. gettabwinvar(3, 1, 'myvar')
+<
+ To obtain all window-local variables use: >
+ gettabwinvar({tabnr}, {winnr}, '&')
+
+< Can also be used as a |method|: >
+ GetTabnr()->gettabwinvar(winnr, varname)
+
+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|.
+ When {winnr} is not specified, the current window is used.
+ When window {winnr} doesn't exist, an empty Dict is returned.
+
+ The returned dictionary contains the following entries:
+ curidx Current index in the stack. When at
+ top of the stack, set to (length + 1).
+ Index of bottom of the stack is 1.
+ items List of items in the stack. Each item
+ is a dictionary containing the
+ entries described below.
+ length Number of entries in the stack.
+
+ Each item in the stack is a dictionary with the following
+ entries:
+ bufnr buffer number of the current jump
+ from cursor position before the tag jump.
+ See |getpos()| for the format of the
+ returned list.
+ matchnr current matching tag number. Used when
+ multiple matching tags are found for a
+ name.
+ tagname name of the tag
+
+ See |tagstack| for more information about the tag stack.
+
+ Can also be used as a |method|: >
+ GetWinnr()->gettagstack()
+
+getwininfo([{winid}]) *getwininfo()*
+ Returns information about windows as a |List| with Dictionaries.
+
+ If {winid} is given Information about the window with that ID
+ is returned, as a |List| with one item. If the window does not
+ exist the result is an empty list.
+
+ Without {winid} information about all the windows in all the
+ tab pages is returned.
+
+ Each List item is a |Dictionary| with the following entries:
+ botline last complete displayed buffer line
+ bufnr number of buffer in the window
+ height window height (excluding winbar)
+ loclist 1 if showing a location list
+ quickfix 1 if quickfix or location list window
+ terminal 1 if a terminal window
+ tabnr tab page number
+ topline first displayed buffer line
+ variables a reference to the dictionary with
+ window-local variables
+ width window width
+ winbar 1 if the window has a toolbar, 0
+ otherwise
+ wincol leftmost screen column of the window;
+ "col" from |win_screenpos()|
+ textoff number of columns occupied by any
+ 'foldcolumn', 'signcolumn' and line
+ number in front of the text
+ winid |window-ID|
+ winnr window number
+ winrow topmost screen line of the window;
+ "row" from |win_screenpos()|
+
+ Can also be used as a |method|: >
+ GetWinnr()->getwininfo()
+
+getwinpos([{timeout}]) *getwinpos()*
+ The result is a |List| with two numbers, the result of
+ |getwinposx()| and |getwinposy()| combined:
+ [x-pos, y-pos]
+ {timeout} can be used to specify how long to wait in msec for
+ a response from the terminal. When omitted 100 msec is used.
+
+ Use a longer time for a remote terminal.
+ When using a value less than 10 and no response is received
+ within that time, a previously reported position is returned,
+ if available. This can be used to poll for the position and
+ do some work in the meantime: >
+ while 1
+ let res = getwinpos(1)
+ if res[0] >= 0
+ break
+ endif
+ " Do some work here
+ endwhile
+<
+ Can also be used as a |method|: >
+ GetTimeout()->getwinpos()
+<
+ *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`.
+
+ *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`.
+
+getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
+ Like |gettabwinvar()| for the current tabpage.
+ Examples: >
+ :let list_is_on = getwinvar(2, '&list')
+ :echo "myvar = " .. getwinvar(1, 'myvar')
+
+< Can also be used as a |method|: >
+ GetWinnr()->getwinvar(varname)
+<
+glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()*
+ Expand the file wildcards in {expr}. See |wildcards| for the
+ use of special characters.
+
+ Unless the optional {nosuf} argument is given and is |TRUE|,
+ the 'suffixes' and 'wildignore' options apply: Names matching
+ one of the patterns in 'wildignore' will be skipped and
+ 'suffixes' affect the ordering of matches.
+ 'wildignorecase' always applies.
+
+ When {list} is present and it is |TRUE| the result is a |List|
+ with all matching files. The advantage of using a List is,
+ you also get filenames containing newlines correctly.
+ Otherwise the result is a String and when there are several
+ matches, they are separated by <NL> characters.
+
+ If the expansion fails, the result is an empty String or List.
+
+ You can also use |readdir()| if you need to do complicated
+ things, such as limiting the number of matches.
+
+ A name for a non-existing file is not included. A symbolic
+ link is only included if it points to an existing file.
+ However, when the {alllinks} argument is present and it is
+ |TRUE| then all symbolic links are included.
+
+ For most systems backticks can be used to get files names from
+ any external command. Example: >
+ :let tagfiles = glob("`find . -name tags -print`")
+ :let &tags = substitute(tagfiles, "\n", ",", "g")
+< The result of the program inside the backticks should be one
+ item per line. Spaces inside an item are allowed.
+
+ See |expand()| for expanding special Vim variables. See
+ |system()| for getting the raw output of an external command.
+
+ Can also be used as a |method|: >
+ GetExpr()->glob()
+
+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
+ is a file name. E.g. >
+ if filename =~ glob2regpat('Make*.mak')
+< This is equivalent to: >
+ if filename =~ '^Make.*\.mak$'
+< When {string} is an empty string the result is "^$", match an
+ empty string.
+ Note that the result depends on the system. On MS-Windows
+ a backslash usually means a path separator.
+
+ Can also be used as a |method|: >
+ GetExpr()->glob2regpat()
+< *globpath()*
+globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]])
+ Perform glob() for String {expr} on all directories in {path}
+ and concatenate the results. Example: >
+ :echo globpath(&rtp, "syntax/c.vim")
+<
+ {path} is a comma-separated list of directory names. Each
+ directory name is prepended to {expr} and expanded like with
+ |glob()|. A path separator is inserted when needed.
+ To add a comma inside a directory name escape it with a
+ backslash. Note that on MS-Windows a directory may have a
+ trailing backslash, remove it if you put a comma after it.
+ If the expansion fails for one of the directories, there is no
+ error message.
+
+ Unless the optional {nosuf} argument is given and is |TRUE|,
+ the 'suffixes' and 'wildignore' options apply: Names matching
+ one of the patterns in 'wildignore' will be skipped and
+ 'suffixes' affect the ordering of matches.
+
+ When {list} is present and it is |TRUE| the result is a |List|
+ with all matching files. The advantage of using a List is, you
+ also get filenames containing newlines correctly. Otherwise
+ the result is a String and when there are several matches,
+ they are separated by <NL> characters. Example: >
+ :echo globpath(&rtp, "syntax/c.vim", 0, 1)
+<
+ {allinks} is used as with |glob()|.
+
+ The "**" item can be used to search in a directory tree.
+ For example, to find all "README.txt" files in the directories
+ in 'runtimepath' and below: >
+ :echo globpath(&rtp, "**/README.txt")
+< Upwards search and limiting the depth of "**" is not
+ supported, thus using 'path' will not always work properly.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetExpr()->globpath(&rtp)
+<
+ *has()*
+has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
+ {feature} argument is a feature name like "nvim-0.2.1" or
+ "win32", see below. See also |exists()|.
+
+ If the code has a syntax error, then Nvim may skip the rest
+ of the line and miss |:endif|. >
+ if has('feature') | let x = this->breaks->without->the->feature | endif
+<
+ Put |:if| and |:endif| on separate lines to avoid the
+ syntax error. >
+ if has('feature')
+ let x = this->breaks->without->the->feature
+ endif
+<
+ Vim's compile-time feature-names (prefixed with "+") are not
+ recognized because Nvim is always compiled with all possible
+ features. |feature-compile|
+
+ Feature names can be:
+ 1. Nvim version. For example the "nvim-0.2.1" feature means
+ that Nvim is version 0.2.1 or later: >
+ :if has("nvim-0.2.1")
+
+< 2. Runtime condition or other pseudo-feature. For example the
+ "win32" feature checks if the current system is Windows: >
+ :if has("win32")
+< *feature-list*
+ List of supported pseudo-feature names:
+ acl |ACL| support.
+ bsd BSD system (not macOS, use "mac" for that).
+ clipboard |clipboard| provider is available.
+ fname_case Case in file names matters (for Darwin and MS-Windows
+ this is not present).
+ iconv Can use |iconv()| for conversion.
+ linux Linux system.
+ mac MacOS system.
+ nvim This is Nvim.
+ python3 Legacy Vim |python3| interface. |has-python|
+ pythonx Legacy Vim |python_x| interface. |has-pythonx|
+ sun SunOS system.
+ ttyin input is a terminal (tty).
+ ttyout output is a terminal (tty).
+ unix Unix system.
+ *vim_starting* True during |startup|.
+ win32 Windows system (32 or 64 bit).
+ win64 Windows system (64 bit).
+ wsl WSL (Windows Subsystem for Linux) system.
+
+ *has-patch*
+ 3. Vim patch. For example the "patch123" feature means that
+ Vim patch 123 at the current |v:version| was included: >
+ :if v:version > 602 || v:version == 602 && has("patch148")
+
+< 4. Vim version. For example the "patch-7.4.237" feature means
+ that Nvim is Vim-compatible to version 7.4.237 or later. >
+ :if has("patch-7.4.237")
+
+
+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.
+
+ Can also be used as a |method|: >
+ mydict->has_key(key)
+
+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
+ has set a local path via |:tcd|, otherwise 0.
+
+ Tabs and windows are identified by their respective numbers,
+ 0 means current tab or window. Missing argument implies 0.
+ Thus the following are equivalent: >
+ haslocaldir()
+ haslocaldir(0)
+ haslocaldir(0, 0)
+< With {winnr} use that window in the current tabpage.
+ With {winnr} and {tabnr} use the window in that tabpage.
+ {winnr} can be the window number or the |window-ID|.
+ If {winnr} is -1 it is ignored, only the tab is resolved.
+ Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
+
+ Can also be used as a |method|: >
+ GetWinnr()->haslocaldir()
+
+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
+ mapped to) and this mapping exists in one of the modes
+ indicated by {mode}.
+ The arguments {what} and {mode} are strings.
+ When {abbr} is there and it is |TRUE| use abbreviations
+ instead of mappings. Don't forget to specify Insert and/or
+ Command-line mode.
+ Both the global mappings and the mappings local to the current
+ buffer are checked for a match.
+ If no matching mapping is found FALSE is returned.
+ The following characters are recognized in {mode}:
+ n Normal mode
+ v Visual and Select mode
+ x Visual mode
+ s Select mode
+ o Operator-pending mode
+ i Insert mode
+ l Language-Argument ("r", "f", "t", etc.)
+ c Command-line mode
+ When {mode} is omitted, "nvo" is used.
+
+ This function is useful to check if a mapping already exists
+ to a function in a Vim script. Example: >
+ :if !hasmapto('\ABCdoit')
+ : map <Leader>d \ABCdoit
+ :endif
+< This installs the mapping to "\ABCdoit" only if there isn't
+ already a mapping to "\ABCdoit".
+
+ Can also be used as a |method|: >
+ GetRHS()->hasmapto()
+
+histadd({history}, {item}) *histadd()*
+ Add the String {item} to the history {history} which can be
+ one of: *hist-names*
+ "cmd" or ":" command line history
+ "search" or "/" search pattern history
+ "expr" or "=" typed expression history
+ "input" or "@" input line history
+ "debug" or ">" debug command history
+ empty the current or last used history
+ The {history} string does not need to be the whole name, one
+ character is sufficient.
+ If {item} does already exist in the history, it will be
+ shifted to become the newest entry.
+ The result is a Number: TRUE if the operation was successful,
+ otherwise FALSE is returned.
+
+ Example: >
+ :call histadd("input", strftime("%Y %b %d"))
+ :let date=input("Enter date: ")
+< This function is not available in the |sandbox|.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetHistory()->histadd('search')
+
+histdel({history} [, {item}]) *histdel()*
+ Clear {history}, i.e. delete all its entries. See |hist-names|
+ for the possible values of {history}.
+
+ If the parameter {item} evaluates to a String, it is used as a
+ regular expression. All entries matching that expression will
+ be removed from the history (if there are any).
+ Upper/lowercase must match, unless "\c" is used |/\c|.
+ If {item} evaluates to a Number, it will be interpreted as
+ an index, see |:history-indexing|. The respective entry will
+ be removed if it exists.
+
+ The result is TRUE for a successful operation, otherwise FALSE
+ is returned.
+
+ Examples:
+ Clear expression register history: >
+ :call histdel("expr")
+<
+ Remove all entries starting with "*" from the search history: >
+ :call histdel("/", '^\*')
+<
+ The following three are equivalent: >
+ :call histdel("search", histnr("search"))
+ :call histdel("search", -1)
+ :call histdel("search", '^' .. histget("search", -1) .. '$')
+<
+ To delete the last search pattern and use the last-but-one for
+ the "n" command and 'hlsearch': >
+ :call histdel("search", -1)
+ :let @/ = histget("search", -1)
+<
+ Can also be used as a |method|: >
+ GetHistory()->histdel()
+
+histget({history} [, {index}]) *histget()*
+ The result is a String, the entry with Number {index} from
+ {history}. See |hist-names| for the possible values of
+ {history}, and |:history-indexing| for {index}. If there is
+ no such entry, an empty String is returned. When {index} is
+ omitted, the most recent item from the history is used.
+
+ Examples:
+ Redo the second last search from history. >
+ :execute '/' .. histget("search", -2)
+
+< Define an Ex command ":H {num}" that supports re-execution of
+ the {num}th entry from the output of |:history|. >
+ :command -nargs=1 H execute histget("cmd", 0+<args>)
+<
+ Can also be used as a |method|: >
+ GetHistory()->histget()
+
+histnr({history}) *histnr()*
+ The result is the Number of the current entry in {history}.
+ See |hist-names| for the possible values of {history}.
+ If an error occurred, -1 is returned.
+
+ Example: >
+ :let inp_index = histnr("expr")
+
+< Can also be used as a |method|: >
+ GetHistory()->histnr()
+<
+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
+ defined in some way. Not necessarily when highlighting has
+ been defined for it, it may also have been used for a syntax
+ item.
+
+ Can also be used as a |method|: >
+ GetName()->hlexists()
+<
+ *hlID()*
+hlID({name}) The result is a Number, which is the ID of the highlight group
+ with name {name}. When the highlight group doesn't exist,
+ zero is returned.
+ This can be used to retrieve information about the highlight
+ group. For example, to get the background color of the
+ "Comment" group: >
+ :echo synIDattr(synIDtrans(hlID("Comment")), "bg")
+<
+ Can also be used as a |method|: >
+ GetName()->hlID()
+
+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.
+
+iconv({string}, {from}, {to}) *iconv()*
+ The result is a String, which is the text {string} converted
+ from encoding {from} to encoding {to}.
+ When the conversion completely fails an empty string is
+ returned. When some characters could not be converted they
+ are replaced with "?".
+ The encoding names are whatever the iconv() library function
+ can accept, see ":!man 3 iconv".
+ Note that Vim uses UTF-8 for all Unicode encodings, conversion
+ 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.
+
+ Can also be used as a |method|: >
+ GetText()->iconv('latin1', 'utf-8')
+<
+ *indent()*
+indent({lnum}) The result is a Number, which is indent of line {lnum} in the
+ current buffer. The indent is counted in spaces, the value
+ of 'tabstop' is relevant. {lnum} is used just like in
+ |getline()|.
+ When {lnum} is invalid -1 is returned.
+
+ Can also be used as a |method|: >
+ GetLnum()->indent()
+
+index({object}, {expr} [, {start} [, {ic}]]) *index()*
+ If {object} is a |List| return the lowest index where the item
+ has a value equal to {expr}. There is no automatic
+ conversion, so 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.
+
+ If {object} is a |Blob| return the lowest index where the byte
+ value is equal to {expr}.
+
+ If {start} is given then start looking at the item with index
+ {start} (may be negative for an item relative to the end).
+ When {ic} is given and it is |TRUE|, ignore case. Otherwise
+ case must match.
+ -1 is returned when {expr} is not found in {object}.
+ Example: >
+ :let idx = index(words, "the")
+ :if index(numbers, 123) >= 0
+
+< Can also be used as a |method|: >
+ GetObject()->index(what)
+
+input({prompt} [, {text} [, {completion}]]) *input()*
+input({opts})
+ The result is a String, which is whatever the user typed on
+ the command-line. The {prompt} argument is either a prompt
+ string, or a blank string (for no prompt). A '\n' can be used
+ in the prompt to start a new line.
+
+ In the second form it accepts a single dictionary with the
+ following keys, any of which may be omitted:
+
+ Key Default Description ~
+ prompt "" Same as {prompt} in the first form.
+ default "" Same as {text} in the first form.
+ completion nothing Same as {completion} in the first form.
+ cancelreturn "" The value returned when the dialog is
+ cancelled.
+ highlight nothing Highlight handler: |Funcref|.
+
+ The highlighting set with |:echohl| is used for the prompt.
+ The input is entered just like a command-line, with the same
+ editing commands and mappings. There is a separate history
+ for lines typed for input().
+ Example: >
+ :if input("Coffee or beer? ") == "beer"
+ : echo "Cheers!"
+ :endif
+<
+ If the optional {text} argument is present and not empty, this
+ is used for the default reply, as if the user typed this.
+ Example: >
+ :let color = input("Color? ", "white")
+
+< The optional {completion} argument specifies the type of
+ completion supported for the input. Without it completion is
+ not performed. The supported completion types are the same as
+ that can be supplied to a user-defined command using the
+ "-complete=" argument. Refer to |:command-completion| for
+ more information. Example: >
+ let fname = input("File: ", "", "file")
+
+< *input()-highlight* *E5400* *E5402*
+ The optional `highlight` key allows specifying function which
+ will be used for highlighting user input. This function
+ receives user input as its only argument and must return
+ a list of 3-tuples [hl_start_col, hl_end_col + 1, hl_group]
+ where
+ hl_start_col is the first highlighted column,
+ hl_end_col is the last highlighted column (+ 1!),
+ hl_group is |:hi| group used for highlighting.
+ *E5403* *E5404* *E5405* *E5406*
+ Both hl_start_col and hl_end_col + 1 must point to the start
+ of the multibyte character (highlighting must not break
+ multibyte characters), hl_end_col + 1 may be equal to the
+ input length. Start column must be in range [0, len(input)),
+ end column must be in range (hl_start_col, len(input)],
+ sections must be ordered so that next hl_start_col is greater
+ then or equal to previous hl_end_col.
+
+ Example (try some input with parentheses): >
+ highlight RBP1 guibg=Red ctermbg=red
+ highlight RBP2 guibg=Yellow ctermbg=yellow
+ highlight RBP3 guibg=Green ctermbg=green
+ highlight RBP4 guibg=Blue ctermbg=blue
+ let g:rainbow_levels = 4
+ function! RainbowParens(cmdline)
+ let ret = []
+ let i = 0
+ let lvl = 0
+ while i < len(a:cmdline)
+ if a:cmdline[i] is# '('
+ call add(ret, [i, i + 1, 'RBP' .. ((lvl % g:rainbow_levels) + 1)])
+ let lvl += 1
+ elseif a:cmdline[i] is# ')'
+ let lvl -= 1
+ call add(ret, [i, i + 1, 'RBP' .. ((lvl % g:rainbow_levels) + 1)])
+ endif
+ let i += 1
+ endwhile
+ return ret
+ endfunction
+ call input({'prompt':'>','highlight':'RainbowParens'})
+<
+ Highlight function is called at least once for each new
+ displayed input string, before command-line is redrawn. It is
+ expected that function is pure for the duration of one input()
+ call, i.e. it produces the same output for the same input, so
+ output may be memoized. Function is run like under |:silent|
+ modifier. If the function causes any errors, it will be
+ skipped for the duration of the current input() call.
+
+ Highlighting is disabled if command-line contains arabic
+ characters.
+
+ NOTE: This function must not be used in a startup file, for
+ the versions that only run in GUI mode (e.g., the Win32 GUI).
+ Note: When input() is called from within a mapping it will
+ consume remaining characters from that mapping, because a
+ mapping is handled like the characters were typed.
+ Use |inputsave()| before input() and |inputrestore()|
+ after input() to avoid that. Another solution is to avoid
+ that further characters follow in the mapping, e.g., by using
+ |:execute| or |:normal|.
+
+ Example with a mapping: >
+ :nmap \x :call GetFoo()<CR>:exe "/" .. Foo<CR>
+ :function GetFoo()
+ : call inputsave()
+ : let g:Foo = input("enter search pattern: ")
+ : call inputrestore()
+ :endfunction
+
+< Can also be used as a |method|: >
+ GetPrompt()->input()
+
+inputlist({textlist}) *inputlist()*
+ {textlist} must be a |List| of strings. This |List| is
+ displayed, one string per line. The user will be prompted to
+ enter a number, which is returned.
+ The user can also select an item by clicking on it with the
+ mouse, if the mouse is enabled in the command line ('mouse' is
+ "a" or includes "c"). For the first string 0 is returned.
+ When clicking above the first item a negative number is
+ returned. When clicking on the prompt one more than the
+ length of {textlist} is returned.
+ Make sure {textlist} has less than 'lines' entries, otherwise
+ it won't work. It's a good idea to put the entry number at
+ the start of the string. And put a prompt in the first item.
+ Example: >
+ let color = inputlist(['Select color:', '1. red',
+ \ '2. green', '3. blue'])
+
+< Can also be used as a |method|: >
+ GetChoices()->inputlist()
+
+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.
+
+inputsave() *inputsave()*
+ Preserve typeahead (also from mappings) and clear it, so that
+ a following prompt gets input from the user. Should be
+ followed by a matching inputrestore() after the prompt. Can
+ be used several times, in which case there must be just as
+ many inputrestore() calls.
+ Returns TRUE when out of memory, FALSE otherwise.
+
+inputsecret({prompt} [, {text}]) *inputsecret()*
+ This function acts much like the |input()| function with but
+ two exceptions:
+ a) the user's response will be displayed as a sequence of
+ asterisks ("*") thereby keeping the entry secret, and
+ b) the user's response will not be recorded on the input
+ |history| stack.
+ The result is a String, which is whatever the user actually
+ typed on the command-line in response to the issued prompt.
+ NOTE: Command-line completion is not supported.
+
+ Can also be used as a |method|: >
+ GetPrompt()->inputsecret()
+
+insert({object}, {item} [, {idx}]) *insert()*
+ When {object} is a |List| or a |Blob| insert {item} at the start
+ of it.
+
+ If {idx} is specified insert {item} before the item with index
+ {idx}. If {idx} is zero it goes before the first item, just
+ like omitting {idx}. A negative {idx} is also possible, see
+ |list-index|. -1 inserts just before the last item.
+
+ Returns the resulting |List| or |Blob|. Examples: >
+ :let mylist = insert([2, 3, 5], 1)
+ :call insert(mylist, 4, -1)
+ :call insert(mylist, 6, len(mylist))
+< The last example can be done simpler with |add()|.
+ Note that when {item} is a |List| it is inserted as a single
+ item. Use |extend()| to concatenate |Lists|.
+
+ Can also be used as a |method|: >
+ mylist->insert(item)
+
+interrupt() *interrupt()*
+ Interrupt script execution. It works more or less like the
+ user typing CTRL-C, most commands won't execute and control
+ returns to the user. This is useful to abort execution
+ from lower down, e.g. in an autocommand. Example: >
+ :function s:check_typoname(file)
+ : if fnamemodify(a:file, ':t') == '['
+ : echomsg 'Maybe typo'
+ : call interrupt()
+ : endif
+ :endfunction
+ :au BufWritePre * call s:check_typoname(expand('<amatch>'))
+
+invert({expr}) *invert()*
+ Bitwise invert. The argument is converted to a number. A
+ List, Dict or Float argument causes an error. Example: >
+ :let bits = invert(bits)
+< Can also be used as a |method|: >
+ :let bits = bits->invert()
+
+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.
+
+ Can also be used as a |method|: >
+ GetName()->isdirectory()
+
+isinf({expr}) *isinf()*
+ Return 1 if {expr} is a positive infinity, or -1 a negative
+ infinity, otherwise 0. >
+ :echo isinf(1.0 / 0.0)
+< 1 >
+ :echo isinf(-1.0 / 0.0)
+< -1
+
+ Can also be used as a |method|: >
+ Compute()->isinf()
+
+islocked({expr}) *islocked()* *E786*
+ The result is a Number, which is |TRUE| when {expr} is the
+ name of a locked variable.
+ The string argument {expr} must be the name of a variable,
+ |List| item or |Dictionary| entry, not the variable itself!
+ Example: >
+ :let alist = [0, ['a', 'b'], 2, 3]
+ :lockvar 1 alist
+ :echo islocked('alist') " 1
+ :echo islocked('alist[1]') " 0
+
+< When {expr} is a variable that does not exist you get an error
+ message. Use |exists()| to check for existence.
+
+ Can also be used as a |method|: >
+ GetName()->islocked()
+
+id({expr}) *id()*
+ Returns a |String| which is a unique identifier of the
+ container type (|List|, |Dict|, |Blob| and |Partial|). It is
+ guaranteed that for the mentioned types `id(v1) ==# id(v2)`
+ returns true iff `type(v1) == type(v2) && v1 is v2`.
+ 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
+ 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.
+
+ It is not guaranteed that `id(no_longer_existing_container)`
+ will not be equal to some other `id()`: new containers may
+ reuse identifiers of the garbage-collected ones.
+
+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}
+ entry and the value of this entry. The |List| is in arbitrary
+ order. Also see |keys()| and |values()|.
+ Example: >
+ for [key, value] in items(mydict)
+ echo key .. ': ' .. value
+ endfor
+
+< Can also be used as a |method|: >
+ mydict->items()
+
+isnan({expr}) *isnan()*
+ Return |TRUE| if {expr} is a float with value NaN. >
+ echo isnan(0.0 / 0.0)
+< 1
+
+ Can also be used as a |method|: >
+ Compute()->isnan()
+
+jobpid({job}) *jobpid()*
+ Return the PID (process id) of |job-id| {job}.
+
+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`.
+
+jobstart({cmd} [, {opts}]) *jobstart()*
+ Spawns {cmd} as a job.
+ If {cmd} is a List it runs directly (no 'shell').
+ If {cmd} is a String it runs in the 'shell', like this: >
+ :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
+< (See |shell-unquoting| for details.)
+
+ Example: >
+ :call jobstart('nvim -h', {'on_stdout':{j,d,e->append(line('.'),d)}})
+<
+ Returns |job-id| on success, 0 on invalid arguments (or job
+ table is full), -1 if {cmd}[0] or 'shell' is not executable.
+ The returned job-id is a valid |channel-id| representing the
+ job's stdio streams. Use |chansend()| (or |rpcnotify()| and
+ |rpcrequest()| if "rpc" was enabled) to send data to stdin and
+ |chanclose()| to close the streams without stopping the job.
+
+ See |job-control| and |RPC|.
+
+ NOTE: on Windows if {cmd} is a List:
+ - cmd[0] must be an executable (not a "built-in"). If it is
+ in $PATH it can be called by name, without an extension: >
+ :call jobstart(['ping', 'neovim.io'])
+< If it is a full or partial path, extension is required: >
+ :call jobstart(['System32\ping.exe', 'neovim.io'])
+< - {cmd} is collapsed to a string of quoted args as expected
+ by CommandLineToArgvW https://msdn.microsoft.com/bb776391
+ unless cmd[0] is some form of "cmd.exe".
+
+ *jobstart-env*
+ The job environment is initialized as follows:
+ $NVIM is set to |v:servername| of the parent Nvim
+ $NVIM_LISTEN_ADDRESS is unset
+ $NVIM_LOG_FILE is unset
+ $VIM is unset
+ $VIMRUNTIME is unset
+ You can set these with the `env` option.
+
+ *jobstart-options*
+ {opts} is a dictionary with these keys:
+ clear_env: (boolean) `env` defines the job environment
+ exactly, instead of merging current environment.
+ cwd: (string, default=|current-directory|) Working
+ directory of the job.
+ detach: (boolean) Detach the job process: it will not be
+ killed when Nvim exits. If the process exits
+ before Nvim, `on_exit` will be invoked.
+ env: (dict) Map of environment variable name:value
+ pairs extending (or replacing with |clear_env|)
+ the current environment. |jobstart-env|
+ height: (number) Height of the `pty` terminal.
+ |on_exit|: (function) Callback invoked when the job exits.
+ |on_stdout|: (function) Callback invoked when the job emits
+ stdout data.
+ |on_stderr|: (function) Callback invoked when the job emits
+ stderr data.
+ overlapped: (boolean) Set FILE_FLAG_OVERLAPPED for the
+ standard input/output passed to the child process.
+ Normally you do not need to set this.
+ (Only available on MS-Windows, On other
+ platforms, this option is silently ignored.)
+ pty: (boolean) Connect the job to a new pseudo
+ terminal, and its streams to the master file
+ descriptor. `on_stdout` receives all output,
+ `on_stderr` is ignored. |terminal-start|
+ rpc: (boolean) Use |msgpack-rpc| to communicate with
+ the job over stdio. Then `on_stdout` is ignored,
+ but `on_stderr` can still be used.
+ stderr_buffered: (boolean) Collect data until EOF (stream closed)
+ before invoking `on_stderr`. |channel-buffered|
+ stdout_buffered: (boolean) Collect data until EOF (stream
+ closed) before invoking `on_stdout`. |channel-buffered|
+ stdin: (string) Either "pipe" (default) to connect the
+ job's stdin to a channel or "null" to disconnect
+ stdin.
+ width: (number) Width of the `pty` terminal.
+
+ {opts} is passed as |self| dictionary to the callback; the
+ caller may set other keys to pass application-specific data.
+
+ Returns:
+ - |channel-id| on success
+ - 0 on invalid arguments
+ - -1 if {cmd}[0] is not executable.
+ See also |job-control|, |channel|, |msgpack-rpc|.
+
+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
+ will be sent. When the job terminates its |on_exit| handler
+ (if any) will be invoked.
+ See |job-control|.
+
+ Returns 1 for valid job id, 0 for invalid id, including jobs have
+ exited or stopped.
+
+jobwait({jobs} [, {timeout}]) *jobwait()*
+ Waits for jobs and their |on_exit| handlers to complete.
+
+ {jobs} is a List of |job-id|s to wait for.
+ {timeout} is the maximum waiting time in milliseconds. If
+ omitted or -1, wait forever.
+
+ Timeout of 0 can be used to check the status of a job: >
+ let running = jobwait([{job-id}], 0)[0] == -1
+<
+ During jobwait() callbacks for jobs not in the {jobs} list may
+ be invoked. The screen will not redraw unless |:redraw| is
+ invoked by a callback.
+
+ Returns a list of len({jobs}) integers, where each integer is
+ the status of the corresponding job:
+ Exit-code, if the job exited
+ -1 if the timeout was exceeded
+ -2 if the job was interrupted (by |CTRL-C|)
+ -3 if the job-id is invalid
+
+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
+ {sep} is omitted a single space is used.
+ Note that {sep} is not added at the end. You might want to
+ add it there too: >
+ let lines = join(mylist, "\n") .. "\n"
+< String items are used as-is. |Lists| and |Dictionaries| are
+ converted into a string like with |string()|.
+ The opposite function is |split()|.
+
+ Can also be used as a |method|: >
+ mylist->join()
+
+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
+ Vim value. In the following cases it will output
+ |msgpack-special-dict|:
+ 1. Dictionary contains duplicate key.
+ 2. Dictionary contains empty key.
+ 3. String contains NUL byte. Two special dictionaries: for
+ dictionary and for string will be emitted in case string
+ with NUL byte was a dictionary key.
+
+ Note: function treats its input as UTF-8 always. The JSON
+ standard allows only a few encodings, of which UTF-8 is
+ recommended and the only one required to be supported.
+ Non-UTF-8 characters are an error.
+
+ Can also be used as a |method|: >
+ ReadObject()->json_decode()
+
+json_encode({expr}) *json_encode()*
+ Convert {expr} into a JSON string. Accepts
+ |msgpack-special-dict| as the input. Will not convert
+ |Funcref|s, mappings with non-string keys (can be created as
+ |msgpack-special-dict|), values with self-referencing
+ containers, strings which contain non-UTF-8 characters,
+ pseudo-UTF-8 strings which contain codepoints reserved for
+ surrogate pairs (such strings are not valid UTF-8 strings).
+ Non-printable characters are converted into "\u1234" escapes
+ or special escapes like "\t", other are dumped as-is.
+ |Blob|s are converted to arrays of the individual bytes.
+
+ Can also be used as a |method|: >
+ GetObject()->json_encode()
+
+keys({dict}) *keys()*
+ Return a |List| with all the keys of {dict}. The |List| is in
+ arbitrary order. Also see |items()| and |values()|.
+
+ Can also be used as a |method|: >
+ mydict->keys()
+
+< *len()* *E701*
+len({expr}) 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
+ used, as with |strlen()|.
+ When {expr} is a |List| the number of items in the |List| is
+ returned.
+ When {expr} is a |Blob| the number of bytes is returned.
+ When {expr} is a |Dictionary| the number of entries in the
+ |Dictionary| is returned.
+ Otherwise an error is given and returns zero.
+
+ Can also be used as a |method|: >
+ mylist->len()
+
+< *libcall()* *E364* *E368*
+libcall({libname}, {funcname}, {argument})
+ Call function {funcname} in the run-time library {libname}
+ with single argument {argument}.
+ This is useful to call functions in a library that you
+ especially made to be used with Vim. Since only one argument
+ is possible, calling standard library functions is rather
+ limited.
+ The result is the String returned by the function. If the
+ function returns NULL, this will appear as an empty string ""
+ to Vim.
+ If the function returns a number, use libcallnr()!
+ If {argument} is a number, it is passed to the function as an
+ int; if {argument} is a string, it is passed as a
+ null-terminated string.
+
+ libcall() allows you to write your own 'plug-in' extensions to
+ Vim without having to recompile the program. It is NOT a
+ means to call system functions! If you try to do so Vim will
+ very probably crash.
+
+ For Win32, the functions you write must be placed in a DLL
+ and use the normal C calling convention (NOT Pascal which is
+ used in Windows System DLLs). The function must take exactly
+ one parameter, either a character pointer or a long integer,
+ and must return a character pointer or NULL. The character
+ pointer returned must point to memory that will remain valid
+ after the function has returned (e.g. in static data in the
+ DLL). If it points to allocated memory, that memory will
+ leak away. Using a static buffer in the function should work,
+ it's then freed when the DLL is unloaded.
+
+ WARNING: If the function returns a non-valid pointer, Vim may
+ crash! This also happens if the function returns a number,
+ because Vim thinks it's a pointer.
+ For Win32 systems, {libname} should be the filename of the DLL
+ without the ".DLL" suffix. A full path is only required if
+ the DLL is not in the usual places.
+ For Unix: When compiling your own plugins, remember that the
+ object code must be compiled as position-independent ('PIC').
+ Examples: >
+ :echo libcall("libc.so", "getenv", "HOME")
+
+< Can also be used as a |method|, the base is passed as the
+ third argument: >
+ GetValue()->libcall("libc.so", "getenv")
+<
+ *libcallnr()*
+libcallnr({libname}, {funcname}, {argument})
+ Just like |libcall()|, but used for a function that returns an
+ int instead of a string.
+ Examples: >
+ :echo libcallnr("/usr/lib/libc.so", "getpid", "")
+ :call libcallnr("libc.so", "printf", "Hello World!\n")
+ :call libcallnr("libc.so", "sleep", 10)
+<
+ Can also be used as a |method|, the base is passed as the
+ third argument: >
+ GetValue()->libcallnr("libc.so", "printf")
+<
+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.
+ 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: >
+ line(".") line number of the cursor
+ line(".", winid) idem, in window "winid"
+ line("'t") line number of mark t
+ line("'" .. marker) line number of mark marker
+<
+ To jump to the last known position when opening a file see
+ |last-position-jump|.
+
+ Can also be used as a |method|: >
+ GetValue()->line()
+
+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
+ the 'fileformat' option for the current buffer. The first
+ line returns 1. UTF-8 encoding is used, 'fileencoding' is
+ ignored. This can also be used to get the byte count for the
+ line just below the last line: >
+ line2byte(line("$") + 1)
+< This is the buffer size plus one. If 'fileencoding' is empty
+ it is the file size plus one. {lnum} is used like with
+ |getline()|. When {lnum} is invalid -1 is returned.
+ Also see |byte2line()|, |go| and |:goto|.
+
+ Can also be used as a |method|: >
+ GetLnum()->line2byte()
+
+lispindent({lnum}) *lispindent()*
+ Get the amount of indent for line {lnum} according the lisp
+ indenting rules, as with 'lisp'.
+ The indent is counted in spaces, the value of 'tabstop' is
+ relevant. {lnum} is used just like in |getline()|.
+ When {lnum} is invalid, -1 is returned.
+
+ Can also be used as a |method|: >
+ GetLnum()->lispindent()
+
+list2str({list} [, {utf8}]) *list2str()*
+ Convert each number in {list} to a character string can
+ concatenate them all. Examples: >
+ list2str([32]) returns " "
+ list2str([65, 66, 67]) returns "ABC"
+< The same can be done (slowly) with: >
+ join(map(list, {nr, val -> nr2char(val)}), '')
+< |str2list()| does the opposite.
+
+ UTF-8 encoding is always used, {utf8} option has no effect,
+ and exists only for backwards-compatibility.
+ With UTF-8 composing characters work as expected: >
+ list2str([97, 769]) returns "á"
+<
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ GetList()->list2str()
+
+localtime() *localtime()*
+ Return the current time, measured as seconds since 1st Jan
+ 1970. See also |strftime()|, |strptime()| and |getftime()|.
+
+
+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
+ (0, inf].
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo log(10)
+< 2.302585 >
+ :echo log(exp(5))
+< 5.0
+
+ Can also be used as a |method|: >
+ Compute()->log()
+
+log10({expr}) *log10()*
+ Return the logarithm of Float {expr} to base 10 as a |Float|.
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo log10(1000)
+< 3.0 >
+ :echo log10(0.01)
+< -2.0
+
+ Can also be used as a |method|: >
+ Compute()->log10()
+
+luaeval({expr} [, {expr}])
+ Evaluate Lua expression {expr} and return its result converted
+ to Vim data structures. See |lua-eval| for more details.
+
+ Can also be used as a |method|: >
+ GetExpr()->luaeval()
+
+map({expr1}, {expr2}) *map()*
+ {expr1} must be a |List|, |Blob| or |Dictionary|.
+ Replace each item in {expr1} with the result of evaluating
+ {expr2}. For a |Blob| each byte is replaced.
+
+ {expr2} must be a |string| or |Funcref|.
+
+ If {expr2} is a |string|, inside {expr2} |v:val| has the value
+ of the current item. For a |Dictionary| |v:key| has the key
+ of the current item and for a |List| |v:key| has the index of
+ the current item. For a |Blob| |v:key| has the index of the
+ current byte.
+ Example: >
+ :call map(mylist, '"> " .. v:val .. " <"')
+< This puts "> " before and " <" after each item in "mylist".
+
+ Note that {expr2} is the result of an expression and is then
+ used as an expression again. Often it is good to use a
+ |literal-string| to avoid having to double backslashes. You
+ still have to double ' quotes
+
+ If {expr2} is a |Funcref| it is called with two arguments:
+ 1. The key or the index of the current item.
+ 2. the value of the current item.
+ The function must return the new value of the item. Example
+ that changes each value by "key-value": >
+ func KeyValue(key, val)
+ return a:key .. '-' .. a:val
+ endfunc
+ call map(myDict, function('KeyValue'))
+< It is shorter when using a |lambda|: >
+ call map(myDict, {key, val -> key .. '-' .. val})
+< If you do not use "val" you can leave it out: >
+ call map(myDict, {key -> 'item: ' .. key})
+< If you do not use "key" you can use a short name: >
+ call map(myDict, {_, val -> 'item: ' .. val})
+<
+ The operation is done in-place. If you want a |List| or
+ |Dictionary| to remain unmodified make a copy first: >
+ :let tlist = map(copy(mylist), ' v:val .. "\t"')
+
+< Returns {expr1}, the |List|, |Blob| or |Dictionary| that was
+ filtered. When an error is encountered while evaluating
+ {expr2} no further items in {expr1} are processed. When
+ {expr2} is a Funcref errors inside a function are ignored,
+ unless it was defined with the "abort" flag.
+
+ Can also be used as a |method|: >
+ mylist->map(expr2)
+
+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
+ characters translated like in the output of the ":map" command
+ listing.
+
+ When there is no mapping for {name}, an empty String is
+ returned if {dict} is FALSE, otherwise returns an empty Dict.
+ When the mapping for {name} is empty, then "<Nop>" is
+ returned.
+
+ The {name} can have special key names, like in the ":map"
+ command.
+
+ {mode} can be one of these strings:
+ "n" Normal
+ "v" Visual (including Select)
+ "o" Operator-pending
+ "i" Insert
+ "c" Cmd-line
+ "s" Select
+ "x" Visual
+ "l" langmap |language-mapping|
+ "t" Terminal
+ "" Normal, Visual and Operator-pending
+ When {mode} is omitted, the modes for "" are used.
+
+ When {abbr} is there and it is |TRUE| use abbreviations
+ instead of mappings.
+
+ When {dict} is there and it is |TRUE| return a dictionary
+ containing all the information of the mapping with the
+ following items:
+ "lhs" The {lhs} of the mapping.
+ "rhs" The {rhs} of the mapping as typed.
+ "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>.
+ "expr" 1 for an expression mapping (|:map-<expr>|).
+ "buffer" 1 for a buffer local mapping (|:map-local|).
+ "mode" Modes for which the mapping is defined. In
+ addition to the modes mentioned above, these
+ characters will be used:
+ " " Normal, Visual and Operator-pending
+ "!" Insert and Commandline mode
+ (|mapmode-ic|)
+ "sid" The script local ID, used for <sid> mappings
+ (|<SID>|).
+ "lnum" The line number in "sid", zero if unknown.
+ "nowait" Do not wait for other, longer mappings.
+ (|:map-<nowait>|).
+
+ The mappings local to the current buffer are checked first,
+ then the global mappings.
+ This function can be used to map a key even when it's already
+ mapped, and have it do the original mapping too. Sketch: >
+ exe 'nnoremap <Tab> ==' .. maparg('<Tab>', 'n')
+
+< Can also be used as a |method|: >
+ GetKey()->maparg('n')
+
+mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
+ Check if there is a mapping that matches with {name} in mode
+ {mode}. See |maparg()| for {mode} and special names in
+ {name}.
+ When {abbr} is there and it is non-zero use abbreviations
+ instead of mappings.
+ A match happens with a mapping that starts with {name} and
+ with a mapping which is equal to the start of {name}.
+
+ matches mapping "a" "ab" "abc" ~
+ mapcheck("a") yes yes yes
+ mapcheck("abc") yes yes yes
+ mapcheck("ax") yes no no
+ mapcheck("b") no no no
+
+ The difference with maparg() is that mapcheck() finds a
+ mapping that matches with {name}, while maparg() only finds a
+ mapping for {name} exactly.
+ When there is no mapping that starts with {name}, an empty
+ String is returned. If there is one, the RHS of that mapping
+ is returned. If there are several mappings that start with
+ {name}, the RHS of one of them is returned. This will be
+ "<Nop>" if the RHS is empty.
+ The mappings local to the current buffer are checked first,
+ then the global mappings.
+ This function can be used to check if a mapping can be added
+ without being ambiguous. Example: >
+ :if mapcheck("_vv") == ""
+ : map _vv :set guifont=7x13<CR>
+ :endif
+< This avoids adding the "_vv" mapping when there already is a
+ mapping for "_v" or for "_vvv".
+
+ Can also be used as a |method|: >
+ GetKey()->mapcheck('n')
+
+match({expr}, {pat} [, {start} [, {count}]]) *match()*
+ When {expr} is a |List| then this returns the index of the
+ first item where {pat} matches. Each item is used as a
+ String, |Lists| and |Dictionaries| are used as echoed.
+
+ Otherwise, {expr} is used as a String. The result is a
+ Number, which gives the index (byte offset) in {expr} where
+ {pat} matches.
+
+ A match at the first character or |List| item returns zero.
+ If there is no match -1 is returned.
+
+ For getting submatches see |matchlist()|.
+ Example: >
+ :echo match("testing", "ing") " results in 4
+ :echo match([1, 'x'], '\a') " results in 1
+< See |string-match| for how {pat} is used.
+ *strpbrk()*
+ Vim doesn't have a strpbrk() function. But you can do: >
+ :let sepidx = match(line, '[.,;: \t]')
+< *strcasestr()*
+ Vim doesn't have a strcasestr() function. But you can add
+ "\c" to the pattern to ignore case: >
+ :let idx = match(haystack, '\cneedle')
+<
+ If {start} is given, the search starts from byte index
+ {start} in a String or item {start} in a |List|.
+ The result, however, is still the index counted from the
+ first character/item. Example: >
+ :echo match("testing", "ing", 2)
+< result is again "4". >
+ :echo match("testing", "ing", 4)
+< result is again "4". >
+ :echo match("testing", "t", 2)
+< result is "3".
+ For a String, if {start} > 0 then it is like the string starts
+ {start} bytes later, thus "^" will match at {start}. Except
+ when {count} is given, then it's like matches before the
+ {start} byte are ignored (this is a bit complicated to keep it
+ backwards compatible).
+ For a String, if {start} < 0, it will be set to 0. For a list
+ the index is counted from the end.
+ If {start} is out of range ({start} > strlen({expr}) for a
+ String or {start} > len({expr}) for a |List|) -1 is returned.
+
+ When {count} is given use the {count}'th match. When a match
+ is found in a String the search for the next one starts one
+ character further. Thus this example results in 1: >
+ echo match("testing", "..", 0, 2)
+< In a |List| the search continues in the next item.
+ Note that when {count} is added the way {start} works changes,
+ see above.
+
+ See |pattern| for the patterns that are accepted.
+ The 'ignorecase' option is used to set the ignore-caseness of
+ the pattern. 'smartcase' is NOT used. The matching is always
+ done like 'magic' is set and 'cpoptions' is empty.
+ Note that a match at the start is preferred, thus when the
+ pattern is using "*" (any number of matches) it tends to find
+ zero matches at the start instead of a number of matches
+ further down in the text.
+
+ Can also be used as a |method|: >
+ GetText()->match('word')
+ GetList()->match('word')
+<
+ *matchadd()* *E798* *E799* *E801* *E957*
+matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
+ Defines a pattern to be highlighted in the current window (a
+ "match"). It will be highlighted with {group}. Returns an
+ identification number (ID), which can be used to delete the
+ match using |matchdelete()|. The ID is bound to the window.
+ Matching is case sensitive and magic, unless case sensitivity
+ or magicness are explicitly overridden in {pattern}. The
+ 'magic', 'smartcase' and 'ignorecase' options are not used.
+ The "Conceal" value is special, it causes the match to be
+ concealed.
+
+ The optional {priority} argument assigns a priority to the
+ match. A match with a high priority will have its
+ highlighting overrule that of a match with a lower priority.
+ A priority is specified as an integer (negative numbers are no
+ exception). If the {priority} argument is not specified, the
+ default priority is 10. The priority of 'hlsearch' is zero,
+ hence all matches with a priority greater than zero will
+ overrule it. Syntax highlighting (see 'syntax') is a separate
+ mechanism, and regardless of the chosen priority a match will
+ always overrule syntax highlighting.
+
+ The optional {id} argument allows the request for a specific
+ match ID. If a specified ID is already taken, an error
+ message will appear and the match will not be added. An ID
+ is specified as a positive integer (zero excluded). IDs 1, 2
+ and 3 are reserved for |:match|, |:2match| and |:3match|,
+ respectively. If the {id} argument is not specified or -1,
+ |matchadd()| automatically chooses a free ID.
+
+ The optional {dict} argument allows for further custom
+ values. Currently this is used to specify a match specific
+ conceal character that will be shown for |hl-Conceal|
+ highlighted matches. The dict can have the following members:
+
+ conceal Special character to show instead of the
+ match (only for |hl-Conceal| highlighed
+ matches, see |:syn-cchar|)
+ window Instead of the current window use the
+ window with this number or window ID.
+
+ The number of matches is not limited, as it is the case with
+ the |:match| commands.
+
+ Returns -1 on error.
+
+ Example: >
+ :highlight MyGroup ctermbg=green guibg=green
+ :let m = matchadd("MyGroup", "TODO")
+< Deletion of the pattern: >
+ :call matchdelete(m)
+
+< A list of matches defined by |matchadd()| and |:match| are
+ available from |getmatches()|. All matches can be deleted in
+ one operation by |clearmatches()|.
+
+ Can also be used as a |method|: >
+ GetGroup()->matchadd('TODO')
+<
+ *matchaddpos()*
+matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
+ 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.
+ *E5030* *E5031*
+ {pos} is a list of positions. Each position can be one of
+ these:
+ - A number. This whole line will be highlighted. The first
+ line has number 1.
+ - A list with one number, e.g., [23]. The whole line with this
+ number will be highlighted.
+ - A list with two numbers, e.g., [23, 11]. The first number is
+ the line number, the second one is the column number (first
+ column is 1, the value must correspond to the byte index as
+ |col()| would return). The character at this position will
+ be highlighted.
+ - A list with three numbers, e.g., [23, 11, 3]. As above, but
+ the third number gives the length of the highlight in bytes.
+
+ Entries with zero and negative line numbers are silently
+ ignored, as well as entries with negative column numbers and
+ lengths.
+
+ The maximum number of positions in {pos} is 8.
+
+ Returns -1 on error.
+
+ Example: >
+ :highlight MyGroup ctermbg=green guibg=green
+ :let m = matchaddpos("MyGroup", [[23, 24], 34])
+< Deletion of the pattern: >
+ :call matchdelete(m)
+
+< Matches added by |matchaddpos()| are returned by
+ |getmatches()|.
+
+ Can also be used as a |method|: >
+ GetGroup()->matchaddpos([23, 11])
+
+matcharg({nr}) *matcharg()*
+ Selects the {nr} match item, as set with a |:match|,
+ |:2match| or |:3match| command.
+ Return a |List| with two elements:
+ The name of the highlight group used
+ The pattern used.
+ When {nr} is not 1, 2 or 3 returns an empty |List|.
+ When there is no match item set returns ['', ''].
+ This is useful to save and restore a |:match|.
+ Highlighting matches using the |:match| commands are limited
+ to three matches. |matchadd()| does not have this limitation.
+
+ Can also be used as a |method|: >
+ GetMatch()->matcharg()
+
+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,
+ otherwise -1. See example for |matchadd()|. All matches can
+ be deleted in one operation by |clearmatches()|.
+ If {win} is specified, use the window with this number or
+ window ID instead of the current window.
+
+ Can also be used as a |method|: >
+ GetMatch()->matchdelete()
+
+matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
+ Same as |match()|, but return the index of first character
+ after the match. Example: >
+ :echo matchend("testing", "ing")
+< results in "7".
+ *strspn()* *strcspn()*
+ Vim doesn't have a strspn() or strcspn() function, but you can
+ do it with matchend(): >
+ :let span = matchend(line, '[a-zA-Z]')
+ :let span = matchend(line, '[^a-zA-Z]')
+< Except that -1 is returned when there are no matches.
+
+ The {start}, if given, has the same meaning as for |match()|. >
+ :echo matchend("testing", "ing", 2)
+< results in "7". >
+ :echo matchend("testing", "ing", 5)
+< result is "-1".
+ When {expr} is a |List| the result is equal to |match()|.
+
+ Can also be used as a |method|: >
+ GetText()->matchend('word')
+
+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
+ the returned list are sorted based on the matching score.
+
+ The optional {dict} argument always supports the following
+ items:
+ matchseq When this item is present return only matches
+ that contain the characters in {str} in the
+ given sequence.
+ limit Maximum number of matches in {list} to be
+ returned. Zero means no limit.
+
+ If {list} is a list of dictionaries, then the optional {dict}
+ argument supports the following additional items:
+ key Key of the item which is fuzzy matched against
+ {str}. The value of this item should be a
+ string.
+ text_cb |Funcref| that will be called for every item
+ in {list} to get the text for fuzzy matching.
+ This should accept a dictionary item as the
+ argument and return the text for that item to
+ use for fuzzy matching.
+
+ {str} is treated as a literal string and regular expression
+ matching is NOT supported. The maximum supported {str} length
+ is 256.
+
+ When {str} has multiple words each separated by white space,
+ then the list of strings that have all the words is returned.
+
+ If there are no matching strings or there is an error, then an
+ empty list is returned. If length of {str} is greater than
+ 256, then returns an empty list.
+
+ When {limit} is given, matchfuzzy() will find up to this
+ number of matches in {list} and return them in sorted order.
+
+ Refer to |fuzzy-matching| for more information about fuzzy
+ matching strings.
+
+ Example: >
+ :echo matchfuzzy(["clay", "crow"], "cay")
+< results in ["clay"]. >
+ :echo getbufinfo()->map({_, v -> v.name})->matchfuzzy("ndl")
+< results in a list of buffer names fuzzy matching "ndl". >
+ :echo getbufinfo()->matchfuzzy("ndl", {'key' : 'name'})
+< results in a list of buffer information dicts with buffer
+ names fuzzy matching "ndl". >
+ :echo getbufinfo()->matchfuzzy("spl",
+ \ {'text_cb' : {v -> v.name}})
+< results in a list of buffer information dicts with buffer
+ names fuzzy matching "spl". >
+ :echo v:oldfiles->matchfuzzy("test")
+< results in a list of file names fuzzy matching "test". >
+ :let l = readfile("buffer.c")->matchfuzzy("str")
+< results in a list of lines in "buffer.c" fuzzy matching "str". >
+ :echo ['one two', 'two one']->matchfuzzy('two one')
+< results in ['two one', 'one two']. >
+ :echo ['one two', 'two one']->matchfuzzy('two one',
+ \ {'matchseq': 1})
+< results in ['two one'].
+
+matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
+ Same as |matchfuzzy()|, but returns the list of matched
+ strings, the list of character positions where characters
+ in {str} matches and a list of matching scores. You can
+ use |byteidx()| to convert a character position to a byte
+ position.
+
+ If {str} matches multiple times in a string, then only the
+ positions for the best match is returned.
+
+ If there are no matching strings or there is an error, then a
+ list with three empty list items is returned.
+
+ Example: >
+ :echo matchfuzzypos(['testing'], 'tsg')
+< results in [['testing'], [[0, 2, 6]], [99]] >
+ :echo matchfuzzypos(['clay', 'lacy'], 'la')
+< results in [['lacy', 'clay'], [[0, 1], [1, 2]], [153, 133]] >
+ :echo [{'text': 'hello', 'id' : 10}]
+ \ ->matchfuzzypos('ll', {'key' : 'text'})
+< results in [[{'id': 10, 'text': 'hello'}], [[2, 3]], [127]]
+
+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
+ return. Following items are submatches, like "\1", "\2", etc.
+ in |:substitute|. When an optional submatch didn't match an
+ empty string is used. Example: >
+ echo matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')
+< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
+ When there is no match an empty list is returned.
+
+ You can pass in a List, but that is not very useful.
+
+ Can also be used as a |method|: >
+ GetText()->matchlist('word')
+
+matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
+ Same as |match()|, but return the matched string. Example: >
+ :echo matchstr("testing", "ing")
+< results in "ing".
+ When there is no match "" is returned.
+ The {start}, if given, has the same meaning as for |match()|. >
+ :echo matchstr("testing", "ing", 2)
+< results in "ing". >
+ :echo matchstr("testing", "ing", 5)
+< result is "".
+ When {expr} is a |List| then the matching item is returned.
+ The type isn't changed, it's not necessarily a String.
+
+ Can also be used as a |method|: >
+ GetText()->matchstr('word')
+
+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: >
+ :echo matchstrpos("testing", "ing")
+< results in ["ing", 4, 7].
+ When there is no match ["", -1, -1] is returned.
+ The {start}, if given, has the same meaning as for |match()|. >
+ :echo matchstrpos("testing", "ing", 2)
+< results in ["ing", 4, 7]. >
+ :echo matchstrpos("testing", "ing", 5)
+< result is ["", -1, -1].
+ When {expr} is a |List| then the matching item, the index
+ of first item where {pat} matches, the start position and the
+ end position of the match are returned. >
+ :echo matchstrpos([1, '__x'], '\a')
+< result is ["x", 1, 2, 3].
+ The type isn't changed, it's not necessarily a String.
+
+ Can also be used as a |method|: >
+ GetText()->matchstrpos('word')
+<
+ *max()*
+max({expr}) Return the maximum value of all items in {expr}. Example: >
+ echo max([apples, pears, oranges])
+
+< {expr} can be a |List| or a |Dictionary|. For a Dictionary,
+ it returns the maximum of all values in the Dictionary.
+ If {expr} is neither a List nor a Dictionary, or one of the
+ items in {expr} cannot be used as a Number this results in
+ an error. An empty |List| or |Dictionary| results in zero.
+
+ Can also be used as a |method|: >
+ mylist->max()
+
+menu_get({path} [, {modes}]) *menu_get()*
+ Returns a |List| of |Dictionaries| describing |menus| (defined
+ by |:menu|, |:amenu|, …), including |hidden-menus|.
+
+ {path} matches a menu by name, or all menus if {path} is an
+ empty string. Example: >
+ :echo menu_get('File','')
+ :echo menu_get('')
+<
+ {modes} is a string of zero or more modes (see |maparg()| or
+ |creating-menus| for the list of modes). "a" means "all".
+
+ Example: >
+ nnoremenu &Test.Test inormal
+ inoremenu Test.Test insert
+ vnoremenu Test.Test x
+ echo menu_get("")
+
+< returns something like this: >
+
+ [ {
+ "hidden": 0,
+ "name": "Test",
+ "priority": 500,
+ "shortcut": 84,
+ "submenus": [ {
+ "hidden": 0,
+ "mappings": {
+ i": {
+ "enabled": 1,
+ "noremap": 1,
+ "rhs": "insert",
+ "sid": 1,
+ "silent": 0
+ },
+ n": { ... },
+ s": { ... },
+ v": { ... }
+ },
+ "name": "Test",
+ "priority": 500,
+ "shortcut": 0
+ } ]
+ } ]
+<
+
+ *min()*
+min({expr}) Return the minimum value of all items in {expr}. Example: >
+ echo min([apples, pears, oranges])
+
+< {expr} can be a |List| or a |Dictionary|. For a Dictionary,
+ it returns the minimum of all values in the Dictionary.
+ If {expr} is neither a List nor a Dictionary, or one of the
+ items in {expr} cannot be used as a Number this results in
+ an error. An empty |List| or |Dictionary| results in zero.
+
+ Can also be used as a |method|: >
+ mylist->min()
+
+< *mkdir()* *E739*
+mkdir({name} [, {path} [, {prot}]])
+ Create directory {name}.
+
+ If {path} is "p" then intermediate directories are created as
+ necessary. Otherwise it must be "".
+
+ If {prot} is given it is used to set the protection bits of
+ the new directory. The default is 0o755 (rwxr-xr-x: r/w for
+ the user, readable for others). Use 0o700 to make it
+ unreadable for others.
+
+ {prot} is applied for all parts of {name}. Thus if you create
+ /tmp/foo/bar then /tmp/foo will be created with 0o700. Example: >
+ :call mkdir($HOME .. "/tmp/foo/bar", "p", 0o700)
+
+< This function is not available in the |sandbox|.
+
+ If you try to create an existing directory with {path} set to
+ "p" mkdir() will silently exit.
+
+ The function result is a Number, which is TRUE if the call was
+ successful or FALSE if the directory creation failed or partly
+ failed.
+
+ Can also be used as a |method|: >
+ GetName()->mkdir()
+<
+ *mode()*
+mode([expr]) Return a string that indicates the current mode.
+ If [expr] is supplied and it evaluates to a non-zero Number or
+ a non-empty String (|non-zero-arg|), then the full mode is
+ returned, otherwise only the first letter is returned.
+
+ n Normal
+ no Operator-pending
+ nov Operator-pending (forced charwise |o_v|)
+ noV Operator-pending (forced linewise |o_V|)
+ noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|)
+ CTRL-V is one character
+ niI Normal using |i_CTRL-O| in |Insert-mode|
+ niR Normal using |i_CTRL-O| in |Replace-mode|
+ niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
+ nt Normal in |terminal-emulator| (insert goes to
+ Terminal mode)
+ v Visual by character
+ vs Visual by character using |v_CTRL-O| in Select mode
+ V Visual by line
+ Vs Visual by line using |v_CTRL-O| in Select mode
+ CTRL-V Visual blockwise
+ CTRL-Vs Visual blockwise using |v_CTRL-O| in Select mode
+ s Select by character
+ S Select by line
+ CTRL-S Select blockwise
+ i Insert
+ ic Insert mode completion |compl-generic|
+ ix Insert mode |i_CTRL-X| completion
+ R Replace |R|
+ Rc Replace mode completion |compl-generic|
+ Rx Replace mode |i_CTRL-X| completion
+ Rv Virtual Replace |gR|
+ Rvc Virtual Replace mode completion |compl-generic|
+ Rvx Virtual Replace mode |i_CTRL-X| completion
+ c Command-line editing
+ cv Vim Ex mode |gQ|
+ r Hit-enter prompt
+ rm The -- more -- prompt
+ r? A |:confirm| query of some sort
+ ! Shell or external command is executing
+ t Terminal mode: keys go to the job
+
+ This is useful in the 'statusline' option or RPC calls. In
+ most other places it always returns "c" or "n".
+ Note that in the future more modes and more specific modes may
+ be added. It's better not to compare the whole string but only
+ the leading character(s).
+ Also see |visualmode()|.
+
+ Can also be used as a |method|: >
+ DoFull()->mode()
+
+msgpackdump({list} [, {type}]) *msgpackdump()*
+ Convert a list of VimL objects to msgpack. Returned value is a
+ |readfile()|-style list. When {type} contains "B", a |Blob| is
+ returned instead. Example: >
+ call writefile(msgpackdump([{}]), 'fname.mpack', 'b')
+< or, using a |Blob|: >
+ call writefile(msgpackdump([{}], 'B'), 'fname.mpack')
+<
+ This will write the single 0x80 byte to a `fname.mpack` file
+ (dictionary with zero items is represented by 0x80 byte in
+ messagepack).
+
+ Limitations: *E5004* *E5005*
+ 1. |Funcref|s cannot be dumped.
+ 2. Containers that reference themselves cannot be dumped.
+ 3. Dictionary keys are always dumped as STR strings.
+ 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.
+
+msgpackparse({data}) *msgpackparse()*
+ Convert a |readfile()|-style list or a |Blob| to a list of
+ VimL objects.
+ Example: >
+ let fname = expand('~/.config/nvim/shada/main.shada')
+ let mpack = readfile(fname, 'b')
+ let shada_objects = msgpackparse(mpack)
+< This will read ~/.config/nvim/shada/main.shada file to
+ `shada_objects` list.
+
+ Limitations:
+ 1. Mapping ordering is not preserved unless messagepack
+ mapping is dumped using generic mapping
+ (|msgpack-special-map|).
+ 2. Since the parser aims to preserve all data untouched
+ (except for 1.) some strings are parsed to
+ |msgpack-special-dict| format which is not convenient to
+ use.
+ *msgpack-special-dict*
+ Some messagepack strings may be parsed to special
+ dictionaries. Special dictionaries are dictionaries which
+
+ 1. Contain exactly two keys: `_TYPE` and `_VAL`.
+ 2. `_TYPE` key is one of the types found in |v:msgpack_types|
+ variable.
+ 3. Value for `_VAL` has the following format (Key column
+ contains name of the key from |v:msgpack_types|):
+
+ Key Value ~
+ nil Zero, ignored when dumping. Not returned by
+ |msgpackparse()| since |v:null| was introduced.
+ boolean One or zero. When dumping it is only checked that
+ value is a |Number|. Not returned by |msgpackparse()|
+ since |v:true| and |v:false| were introduced.
+ integer |List| with four numbers: sign (-1 or 1), highest two
+ bits, number with bits from 62nd to 31st, lowest 31
+ bits. I.e. to get actual number one will need to use
+ code like >
+ _VAL[0] * ((_VAL[1] << 62)
+ & (_VAL[2] << 31)
+ & _VAL[3])
+< Special dictionary with this type will appear in
+ |msgpackparse()| output under one of the following
+ circumstances:
+ 1. |Number| is 32-bit and value is either above
+ INT32_MAX or below INT32_MIN.
+ 2. |Number| is 64-bit and value is above INT64_MAX. It
+ cannot possibly be below INT64_MIN because msgpack
+ 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
+ byte. This value cannot appear in |msgpackparse()|
+ output since blobs were introduced.
+ array |List|. This value cannot appear in |msgpackparse()|
+ output.
+ *msgpack-special-map*
+ map |List| of |List|s with two items (key and value) each.
+ This value will appear in |msgpackparse()| output if
+ parsed mapping contains one of the following keys:
+ 1. Any key that is not a string (including keys which
+ are binary strings).
+ 2. String with NUL byte inside.
+ 3. Duplicate key.
+ 4. Empty key.
+ ext |List| with two values: first is a signed integer
+ representing extension type. Second is
+ |readfile()|-style list of strings.
+
+nextnonblank({lnum}) *nextnonblank()*
+ Return the line number of the first line at or below {lnum}
+ that is not blank. Example: >
+ if getline(nextnonblank(1)) =~ "Java"
+< When {lnum} is invalid or there is no non-blank line at or
+ below it, zero is returned.
+ {lnum} is used like with |getline()|.
+ See also |prevnonblank()|.
+
+ Can also be used as a |method|: >
+ GetLnum()->nextnonblank()
+
+nr2char({expr} [, {utf8}]) *nr2char()*
+ Return a string with a single character, which has the number
+ value {expr}. Examples: >
+ nr2char(64) returns "@"
+ nr2char(32) returns " "
+< Example for "utf-8": >
+ nr2char(300) returns I with bow character
+< UTF-8 encoding is always used, {utf8} option has no effect,
+ and exists only for backwards-compatibility.
+ Note that a NUL character in the file is specified with
+ nr2char(10), because NULs are represented with newline
+ characters. nr2char(0) is a real NUL and terminates the
+ string, thus results in an empty string.
+
+ Can also be used as a |method|: >
+ GetNumber()->nr2char()
+
+nvim_...({...}) *E5555* *nvim_...()* *eval-api*
+ Call nvim |api| functions. The type checking of arguments will
+ be stricter than for most other builtins. For instance,
+ if Integer is expected, a |Number| must be passed in, a
+ |String| will not be autoconverted.
+ Buffer numbers, as returned by |bufnr()| could be used as
+ first argument to nvim_buf_... functions. All functions
+ expecting an object (buffer, window or tabpage) can
+ also take the numerical value 0 to indicate the current
+ (focused) object.
+
+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.
+ Example: >
+ :let bits = or(bits, 0x80)
+< Can also be used as a |method|: >
+ :let bits = bits->or(0x80)
+
+pathshorten({expr} [, {len}]) *pathshorten()*
+ Shorten directory names in the path {path} and return the
+ result. The tail, the file name, is kept as-is. The other
+ components in the path are reduced to {len} letters in length.
+ If {len} is omitted or smaller than 1 then 1 is used (single
+ letters). Leading '~' and '.' characters are kept. Examples: >
+ :echo pathshorten('~/.config/nvim/autoload/file1.vim')
+< ~/.c/n/a/file1.vim ~
+>
+ :echo pathshorten('~/.config/nvim/autoload/file2.vim', 2)
+< ~/.co/nv/au/file2.vim ~
+ It doesn't matter if the path exists or not.
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ GetDirectories()->pathshorten()
+
+perleval({expr}) *perleval()*
+ Evaluate |perl| expression {expr} and return its result
+ converted to Vim data structures.
+ Numbers and strings are returned as they are (strings are
+ copied though).
+ Lists are represented as Vim |List| type.
+ Dictionaries are represented as Vim |Dictionary| type,
+ non-string keys result in error.
+
+ Note: If you want an array or hash, {expr} must return a
+ reference to it.
+ Example: >
+ :echo perleval('[1 .. 4]')
+< [1, 2, 3, 4]
+
+ Can also be used as a |method|: >
+ GetExpr()->perleval()
+
+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|.
+ Returns 0.0 if {x} or {y} is not a |Float| or a |Number|.
+ Examples: >
+ :echo pow(3, 3)
+< 27.0 >
+ :echo pow(2, 16)
+< 65536.0 >
+ :echo pow(32, 0.20)
+< 2.0
+
+ Can also be used as a |method|: >
+ Compute()->pow(3)
+
+prevnonblank({lnum}) *prevnonblank()*
+ Return the line number of the first line at or above {lnum}
+ that is not blank. Example: >
+ let ind = indent(prevnonblank(v:lnum - 1))
+< When {lnum} is invalid or there is no non-blank line at or
+ above it, zero is returned.
+ {lnum} is used like with |getline()|.
+ Also see |nextnonblank()|.
+
+ Can also be used as a |method|: >
+ GetLnum()->prevnonblank()
+
+printf({fmt}, {expr1} ...) *printf()*
+ Return a String with {fmt}, where "%" items are replaced by
+ the formatted form of their respective arguments. Example: >
+ printf("%4d: E%d %.30s", lnum, errno, msg)
+< May result in:
+ " 99: E42 asdfasdfasdfasdfasdfasdfasdfas" ~
+
+ When used as a |method| the base is passed as the second
+ argument: >
+ Compute()->printf("result: %d")
+<
+ You can use `call()` to pass the items as a list.
+
+ Often used items are:
+ %s string
+ %6S string right-aligned in 6 display cells
+ %6s string right-aligned in 6 bytes
+ %.9s string truncated to 9 bytes
+ %c single byte
+ %d decimal number
+ %5d decimal number padded with spaces to 5 characters
+ %b binary number
+ %08b binary number padded with zeros to at least 8 characters
+ %B binary number using upper case letters
+ %x hex number
+ %04x hex number padded with zeros to at least 4 characters
+ %X hex number using upper case letters
+ %o octal number
+ %f floating point number as 12.23, inf, -inf or nan
+ %F floating point number as 12.23, INF, -INF or NAN
+ %e floating point number as 1.23e3, inf, -inf or nan
+ %E floating point number as 1.23E3, INF, -INF or NAN
+ %g floating point number, as %f or %e depending on value
+ %G floating point number, as %F or %E depending on value
+ %% the % character itself
+ %p representation of the pointer to the container
+
+ Conversion specifications start with '%' and end with the
+ conversion type. All other characters are copied unchanged to
+ the result.
+
+ The "%" starts a conversion specification. The following
+ arguments appear in sequence:
+
+ % [flags] [field-width] [.precision] type
+
+ flags
+ Zero or more of the following flags:
+
+ # The value should be converted to an "alternate
+ form". For c, d, and s conversions, this option
+ has no effect. For o conversions, the precision
+ of the number is increased to force the first
+ character of the output string to a zero (except
+ if a zero value is printed with an explicit
+ precision of zero).
+ For x and X conversions, a non-zero result has
+ the string "0x" (or "0X" for X conversions)
+ prepended to it.
+
+ 0 (zero) Zero padding. For all conversions the converted
+ value is padded on the left with zeros rather
+ than blanks. If a precision is given with a
+ numeric conversion (d, o, x, and X), the 0 flag
+ is ignored.
+
+ - A negative field width flag; the converted value
+ is to be left adjusted on the field boundary.
+ The converted value is padded on the right with
+ blanks, rather than on the left with blanks or
+ zeros. A - overrides a 0 if both are given.
+
+ ' ' (space) A blank should be left before a positive
+ number produced by a signed conversion (d).
+
+ + A sign must always be placed before a number
+ produced by a signed conversion. A + overrides
+ a space if both are used.
+
+ field-width
+ An optional decimal digit string specifying a minimum
+ field width. If the converted value has fewer bytes
+ than the field width, it will be padded with spaces on
+ the left (or right, if the left-adjustment flag has
+ been given) to fill out the field width. For the S
+ conversion the count is in cells.
+
+ .precision
+ An optional precision, in the form of a period '.'
+ followed by an optional digit string. If the digit
+ string is omitted, the precision is taken as zero.
+ This gives the minimum number of digits to appear for
+ d, o, x, and X conversions, the maximum number of
+ bytes to be printed from a string for s conversions,
+ or the maximum number of cells to be printed from a
+ string for S conversions.
+ For floating point it is the number of digits after
+ the decimal point.
+
+ type
+ A character that specifies the type of conversion to
+ be applied, see below.
+
+ A field width or precision, or both, may be indicated by an
+ asterisk '*' instead of a digit string. In this case, a
+ Number argument supplies the field width or precision. A
+ negative field width is treated as a left adjustment flag
+ followed by a positive field width; a negative precision is
+ treated as though it were missing. Example: >
+ :echo printf("%d: %.*s", nr, width, line)
+< This limits the length of the text used from "line" to
+ "width" bytes.
+
+ The conversion specifiers and their meanings are:
+
+ *printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X*
+ dbBoxX The Number argument is converted to signed decimal (d),
+ unsigned binary (b and B), unsigned octal (o), or
+ unsigned hexadecimal (x and X) notation. The letters
+ "abcdef" are used for x conversions; the letters
+ "ABCDEF" are used for X conversions. The precision, if
+ any, gives the minimum number of digits that must
+ appear; if the converted value requires fewer digits, it
+ is padded on the left with zeros. In no case does a
+ non-existent or small field width cause truncation of a
+ numeric field; if the result of a conversion is wider
+ than the field width, the field is expanded to contain
+ the conversion result.
+ The 'h' modifier indicates the argument is 16 bits.
+ The 'l' modifier indicates the argument is 32 bits.
+ The 'L' modifier indicates the argument is 64 bits.
+ Generally, these modifiers are not useful. They are
+ ignored when type is known from the argument.
+
+ i alias for d
+ D alias for ld
+ U alias for lu
+ O alias for lo
+
+ *printf-c*
+ c The Number argument is converted to a byte, and the
+ resulting character is written.
+
+ *printf-s*
+ s The text of the String argument is used. If a
+ precision is specified, no more bytes than the number
+ specified are used.
+ If the argument is not a String type, it is
+ automatically converted to text with the same format
+ as ":echo".
+ *printf-S*
+ S The text of the String argument is used. If a
+ precision is specified, no more display cells than the
+ number specified are used.
+
+ *printf-f* *E807*
+ f F The Float argument is converted into a string of the
+ form 123.456. The precision specifies the number of
+ digits after the decimal point. When the precision is
+ zero the decimal point is omitted. When the precision
+ is not specified 6 is used. A really big number
+ (out of range or dividing by zero) results in "inf"
+ or "-inf" with %f (INF or -INF with %F).
+ "0.0 / 0.0" results in "nan" with %f (NAN with %F).
+ Example: >
+ echo printf("%.2f", 12.115)
+< 12.12
+ Note that roundoff depends on the system libraries.
+ Use |round()| when in doubt.
+
+ *printf-e* *printf-E*
+ e E The Float argument is converted into a string of the
+ form 1.234e+03 or 1.234E+03 when using 'E'. The
+ precision specifies the number of digits after the
+ decimal point, like with 'f'.
+
+ *printf-g* *printf-G*
+ g G The Float argument is converted like with 'f' if the
+ value is between 0.001 (inclusive) and 10000000.0
+ (exclusive). Otherwise 'e' is used for 'g' and 'E'
+ for 'G'. When no precision is specified superfluous
+ zeroes and '+' signs are removed, except for the zero
+ immediately after the decimal point. Thus 10000000.0
+ results in 1.0e7.
+
+ *printf-%*
+ % A '%' is written. No argument is converted. The
+ complete conversion specification is "%%".
+
+ When a Number argument is expected a String argument is also
+ accepted and automatically converted.
+ When a Float or String argument is expected a Number argument
+ is also accepted and automatically converted.
+ Any other argument type results in an error message.
+
+ *E766* *E767*
+ The number of {exprN} arguments must exactly match the number
+ of "%" items. If there are not sufficient or too many
+ arguments an error is given. Up to 18 arguments can be used.
+
+prompt_getprompt({buf}) *prompt_getprompt()*
+ Returns the effective prompt text for buffer {buf}. {buf} can
+ be a buffer name or number. See |prompt-buffer|.
+
+ If the buffer doesn't exist or isn't a prompt buffer, an empty
+ string is returned.
+
+ Can also be used as a |method|: >
+ GetBuffer()->prompt_getprompt()
+
+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
+ effect if {buf} has 'buftype' set to "prompt".
+
+ The callback is invoked when pressing Enter. The current
+ buffer will always be the prompt buffer. A new line for a
+ prompt is added before invoking the callback, thus the prompt
+ for which the callback was invoked will be in the last but one
+ line.
+ If the callback wants to add text to the buffer, it must
+ insert it above the last line, since that is where the current
+ prompt is. This can also be done asynchronously.
+ The callback is invoked with one argument, which is the text
+ that was entered at the prompt. This can be an empty string
+ if the user only typed Enter.
+ Example: >
+ call prompt_setcallback(bufnr(''), function('s:TextEntered'))
+ func s:TextEntered(text)
+ if a:text == 'exit' || a:text == 'quit'
+ stopinsert
+ close
+ else
+ call append(line('$') - 1, 'Entered: "' .. a:text .. '"')
+ " Reset 'modified' to allow the buffer to be closed.
+ set nomodified
+ endif
+ endfunc
+
+< Can also be used as a |method|: >
+ GetBuffer()->prompt_setcallback(callback)
+
+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
+ {buf} has 'buftype' set to "prompt".
+
+ This callback will be invoked when pressing CTRL-C in Insert
+ mode. Without setting a callback Vim will exit Insert mode,
+ as in any buffer.
+
+ Can also be used as a |method|: >
+ GetBuffer()->prompt_setinterrupt(callback)
+
+prompt_setprompt({buf}, {text}) *prompt_setprompt()*
+ Set prompt for buffer {buf} to {text}. You most likely want
+ {text} to end in a space.
+ The result is only visible if {buf} has 'buftype' set to
+ "prompt". Example: >
+ call prompt_setprompt(bufnr(''), 'command: ')
+<
+ Can also be used as a |method|: >
+ GetBuffer()->prompt_setprompt('command: ')
+
+pum_getpos() *pum_getpos()*
+ If the popup menu (see |ins-completion-menu|) is not visible,
+ returns an empty |Dictionary|, otherwise, returns a
+ |Dictionary| with the following keys:
+ height nr of items visible
+ width screen cells
+ row top screen row (0 first row)
+ col leftmost screen column (0 first col)
+ size total nr of items
+ scrollbar |TRUE| if scrollbar is visible
+
+ The values are the same as in |v:event| during |CompleteChanged|.
+
+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.
+
+py3eval({expr}) *py3eval()*
+ Evaluate Python expression {expr} and return its result
+ converted to Vim data structures.
+ Numbers and strings are returned as they are (strings are
+ copied though, Unicode strings are additionally converted to
+ UTF-8).
+ Lists are represented as Vim |List| type.
+ Dictionaries are represented as Vim |Dictionary| type with
+ keys converted to strings.
+
+ Can also be used as a |method|: >
+ GetExpr()->py3eval()
+<
+ *E858* *E859*
+pyeval({expr}) *pyeval()*
+ Evaluate Python expression {expr} and return its result
+ converted to Vim data structures.
+ Numbers and strings are returned as they are (strings are
+ copied though).
+ Lists are represented as Vim |List| type.
+ Dictionaries are represented as Vim |Dictionary| type,
+ non-string keys result in error.
+
+ Can also be used as a |method|: >
+ GetExpr()->pyeval()
+
+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()|
+
+ Can also be used as a |method|: >
+ GetExpr()->pyxeval()
+<
+ *E726* *E727*
+range({expr} [, {max} [, {stride}]]) *range()*
+ Returns a |List| with Numbers:
+ - If only {expr} is specified: [0, 1, ..., {expr} - 1]
+ - If {max} is specified: [{expr}, {expr} + 1, ..., {max}]
+ - If {stride} is specified: [{expr}, {expr} + {stride}, ...,
+ {max}] (increasing {expr} with {stride} each time, not
+ producing a value past {max}).
+ When the maximum is one before the start the result is an
+ empty list. When the maximum is more than one before the
+ start this is an error.
+ Examples: >
+ range(4) " [0, 1, 2, 3]
+ range(2, 4) " [2, 3, 4]
+ range(2, 9, 3) " [2, 5, 8]
+ range(2, -2, -1) " [2, 1, 0, -1, -2]
+ range(0) " []
+ range(2, 0) " error!
+<
+ Can also be used as a |method|: >
+ GetExpr()->range()
+<
+rand([{expr}]) *rand()*
+ Return a pseudo-random Number generated with an xoshiro128**
+ algorithm using seed {expr}. The returned number is 32 bits,
+ also on 64 bits systems, for consistency.
+ {expr} can be initialized by |srand()| and will be updated by
+ rand(). If {expr} is omitted, an internal seed value is used
+ and updated.
+ Returns -1 if {expr} is invalid.
+
+ Examples: >
+ :echo rand()
+ :let seed = srand()
+ :echo rand(seed)
+ :echo rand(seed) % 16 " random number 0 - 15
+<
+ Can also be used as a |method|: >
+ seed->rand()
+<
+ *readdir()*
+readdir({directory} [, {expr}])
+ Return a list with file and directory names in {directory}.
+
+ When {expr} is omitted all entries are included.
+ When {expr} is given, it is evaluated to check what to do:
+ If {expr} results in -1 then no further entries will
+ be handled.
+ If {expr} results in 0 then this entry will not be
+ added to the list.
+ If {expr} results in 1 then this entry will be added
+ to the list.
+ Each time {expr} is evaluated |v:val| is set to the entry name.
+ When {expr} is a function the name is passed as the argument.
+ For example, to get a list of files ending in ".txt": >
+ readdir(dirname, {n -> n =~ '.txt$'})
+< To skip hidden and backup files: >
+ readdir(dirname, {n -> n !~ '^\.\|\~$'})
+
+< If you want to get a directory tree: >
+ function! s:tree(dir)
+ return {a:dir : map(readdir(a:dir),
+ \ {_, x -> isdirectory(x) ?
+ \ {x : s:tree(a:dir .. '/' .. x)} : x})}
+ endfunction
+ echo s:tree(".")
+<
+ Returns an empty List on error.
+
+ Can also be used as a |method|: >
+ GetDirName()->readdir()
+<
+ *readfile()*
+readfile({fname} [, {type} [, {max}]])
+ Read file {fname} and return a |List|, each line of the file
+ as an item. Lines are broken at NL characters. Macintosh
+ files separated with CR will result in a single long line
+ (unless a NL appears somewhere).
+ All NUL characters are replaced with a NL character.
+ When {type} contains "b" binary mode is used:
+ - When the last line ends in a NL an extra empty list item is
+ added.
+ - No CR characters are removed.
+ When {type} contains "B" a |Blob| is returned with the binary
+ data of the file unmodified.
+ Otherwise:
+ - CR characters that appear before a NL are removed.
+ - Whether the last line ends in a NL or not does not matter.
+ - Any UTF-8 byte order mark is removed from the text.
+ When {max} is given this specifies the maximum number of lines
+ to be read. Useful if you only want to check the first ten
+ lines of a file: >
+ :for line in readfile(fname, '', 10)
+ : if line =~ 'Date' | echo line | endif
+ :endfor
+< When {max} is negative -{max} lines from the end of the file
+ are returned, or as many as there are.
+ When {max} is zero the result is an empty list.
+ Note that without {max} the whole file is read into memory.
+ Also note that there is no recognition of encoding. Read a
+ file into a buffer if you need to.
+ When the file can't be opened an error message is given and
+ the result is an empty list.
+ Also see |writefile()|.
+
+ Can also be used as a |method|: >
+ GetFileName()->readfile()
+
+reduce({object}, {func} [, {initial}]) *reduce()* *E998*
+ {func} is called for every item in {object}, which can be a
+ |List| or a |Blob|. {func} is called with two arguments: the
+ result so far and current item. After processing all items
+ the result is returned.
+
+ {initial} is the initial result. When omitted, the first item
+ in {object} is used and {func} is first called for the second
+ item. If {initial} is not given and {object} is empty no
+ result can be computed, an E998 error is given.
+
+ Examples: >
+ echo reduce([1, 3, 5], { acc, val -> acc + val })
+ echo reduce(['x', 'y'], { acc, val -> acc .. val }, 'a')
+ echo reduce(0z1122, { acc, val -> 2 * acc + val })
+<
+ Can also be used as a |method|: >
+ echo mylist->reduce({ acc, val -> acc + val }, 0)
+
+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 |@|.
+
+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|.
+
+reg_recording() *reg_recording()*
+ Returns the single letter name of the register being recorded.
+ Returns an empty string when not recording. See |q|.
+
+reltime([{start} [, {end}]]) *reltime()*
+ Return an item that represents a time value. The item is a
+ list with items that depend on the system.
+ The item can be passed to |reltimestr()| to convert it to a
+ string or |reltimefloat()| to convert to a Float.
+
+ Without an argument it returns the current "relative time", an
+ implementation-defined value meaningful only when used as an
+ argument to |reltime()|, |reltimestr()| and |reltimefloat()|.
+
+ With one argument it returns the time passed since the time
+ specified in the argument.
+ With two arguments it returns the time passed between {start}
+ and {end}.
+
+ The {start} and {end} arguments must be values returned by
+ reltime(). Returns zero on error.
+
+ Can also be used as a |method|: >
+ GetStart()->reltime()
+<
+ Note: |localtime()| returns the current (non-relative) time.
+
+reltimefloat({time}) *reltimefloat()*
+ Return a Float that represents the time value of {time}.
+ Unit of time is seconds.
+ Example:
+ let start = reltime()
+ call MyFunction()
+ let seconds = reltimefloat(reltime(start))
+ See the note of reltimestr() about overhead.
+ Also see |profiling|.
+ If there is an error an empty string is returned
+
+ Can also be used as a |method|: >
+ reltime(start)->reltimefloat()
+
+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
+ microseconds. Example: >
+ let start = reltime()
+ call MyFunction()
+ echo reltimestr(reltime(start))
+< Note that overhead for the commands will be added to the time.
+ Leading spaces are used to make the string align nicely. You
+ can use split() to remove it. >
+ echo split(reltimestr(reltime(start)))[0]
+< Also see |profiling|.
+ If there is an error an empty string is returned
+
+ Can also be used as a |method|: >
+ reltime(start)->reltimestr()
+<
+remove({list}, {idx} [, {end}]) *remove()*
+ Without {end}: Remove the item at {idx} from |List| {list} and
+ return the item.
+ With {end}: Remove items from {idx} to {end} (inclusive) and
+ return a |List| with these items. When {idx} points to the same
+ item as {end} a list with one item is returned. When {end}
+ points to an item before {idx} this is an error.
+ See |list-index| for possible values of {idx} and {end}.
+ Returns zero on error.
+ Example: >
+ :echo "last item: " .. remove(mylist, -1)
+ :call remove(mylist, 0, 9)
+<
+ Use |delete()| to remove a file.
+
+ Can also be used as a |method|: >
+ mylist->remove(idx)
+
+remove({blob}, {idx} [, {end}])
+ Without {end}: Remove the byte at {idx} from |Blob| {blob} and
+ return the byte.
+ With {end}: Remove bytes from {idx} to {end} (inclusive) and
+ return a |Blob| with these bytes. When {idx} points to the same
+ byte as {end} a |Blob| with one byte is returned. When {end}
+ points to a byte before {idx} this is an error.
+ Returns zero on error.
+ Example: >
+ :echo "last byte: " .. remove(myblob, -1)
+ :call remove(mylist, 0, 9)
+
+remove({dict}, {key})
+ Remove the entry from {dict} with key {key} and return it.
+ Example: >
+ :echo "removed " .. remove(dict, "one")
+< If there is no {key} in {dict} this is an error.
+ Returns zero on error.
+
+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
+ result is a Number, which is 0 if the file was renamed
+ successfully, and non-zero when the renaming failed.
+ NOTE: If {to} exists it is overwritten without warning.
+ This function is not available in the |sandbox|.
+
+ Can also be used as a |method|: >
+ GetOldName()->rename(newname)
+
+repeat({expr}, {count}) *repeat()*
+ Repeat {expr} {count} times and return the concatenated
+ result. Example: >
+ :let separator = repeat('-', 80)
+< When {count} is zero or negative the result is empty.
+ When {expr} is a |List| the result is {expr} concatenated
+ {count} times. Example: >
+ :let longlist = repeat(['a', 'b'], 3)
+< Results in ['a', 'b', 'a', 'b', 'a', 'b'].
+
+ Can also be used as a |method|: >
+ mylist->repeat(count)
+
+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.
+ On Unix, repeat resolving symbolic links in all path
+ components of {filename} and return the simplified result.
+ To cope with link cycles, resolving of symbolic links is
+ stopped after 100 iterations.
+ On other systems, return the simplified {filename}.
+ The simplification step is done as by |simplify()|.
+ resolve() keeps a leading path component specifying the
+ current directory (provided the result is still a relative
+ path name) and also keeps a trailing path separator.
+
+ Can also be used as a |method|: >
+ GetName()->resolve()
+<
+ *reverse()*
+reverse({object})
+ Reverse the order of items in {object} in-place.
+ {object} can be a |List| or a |Blob|.
+ Returns {object}.
+ Returns zero if {object} is not a List or a Blob.
+ If you want an object to remain unmodified make a copy first: >
+ :let revlist = reverse(copy(mylist))
+< Can also be used as a |method|: >
+ mylist->reverse()
+
+round({expr}) *round()*
+ Round off {expr} to the nearest integral value and return it
+ as a |Float|. If {expr} lies halfway between two integral
+ values, then use the larger one (away from zero).
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ echo round(0.456)
+< 0.0 >
+ echo round(4.5)
+< 5.0 >
+ echo round(-4.5)
+< -5.0
+
+ Can also be used as a |method|: >
+ Compute()->round()
+
+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.
+ Example: >
+ :au VimLeave call rpcnotify(0, "leaving")
+
+rpcrequest({channel}, {method} [, {args}...]) *rpcrequest()*
+ Sends a request to {channel} to invoke {method} via
+ |RPC| and blocks until a response is received.
+ Example: >
+ :let result = rpcrequest(rpc_chan, "func", 1, 2, 3)
+
+rpcstart({prog} [, {argv}]) *rpcstart()*
+ Deprecated. Replace >
+ :let id = rpcstart('prog', ['arg1', 'arg2'])
+< with >
+ :let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
+
+rubyeval({expr}) *rubyeval()*
+ Evaluate Ruby expression {expr} and return its result
+ converted to Vim data structures.
+ Numbers, floats and strings are returned as they are (strings
+ are copied though).
+ Arrays are represented as Vim |List| type.
+ Hashes are represented as Vim |Dictionary| type.
+ Other objects are represented as strings resulted from their
+ "Object#to_s" method.
+
+ Can also be used as a |method|: >
+ GetRubyExpr()->rubyeval()
+
+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.
+
+ Can also be used as a |method|: >
+ GetRow()->screenattr(col)
+
+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
+ screen position, also status lines, window separators and the
+ command line. The top left position is row one, column one
+ The character excludes composing characters. For double-byte
+ encodings it may only be the first byte.
+ This is mainly to be used for testing.
+ Returns -1 when row or col is out of range.
+
+ Can also be used as a |method|: >
+ GetRow()->screenchar(col)
+
+screenchars({row}, {col}) *screenchars()*
+ The result is a List of Numbers. The first number is the same
+ as what |screenchar()| returns. Further numbers are
+ composing characters on top of the base character.
+ This is mainly to be used for testing.
+ Returns an empty List when row or col is out of range.
+
+ Can also be used as a |method|: >
+ GetRow()->screenchars(col)
+
+screencol() *screencol()*
+ The result is a Number, which is the current screen column of
+ the cursor. The leftmost column has number 1.
+ This function is mainly used for testing.
+
+ Note: Always returns the current screen column, thus if used
+ in a command (e.g. ":echo screencol()") it will return the
+ column inside the command line, which is 1 when the command is
+ executed. To get the cursor position in the file use one of
+ the following mappings: >
+ nnoremap <expr> GG ":echom " .. screencol() .. "\n"
+ nnoremap <silent> GG :echom screencol()<CR>
+ noremap GG <Cmd>echom screencol()<Cr>
+<
+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
+ {col}. {col} is a one-based byte index.
+ The Dict has these members:
+ row screen row
+ col first screen column
+ endcol last screen column
+ curscol cursor screen column
+ If the specified position is not visible, all values are zero.
+ The "endcol" value differs from "col" when the character
+ occupies more than one screen cell. E.g. for a Tab "col" can
+ be 1 and "endcol" can be 8.
+ The "curscol" value is where the cursor would be placed. For
+ a Tab it would be the same as "endcol", while for a double
+ width character it would be the same as "col".
+ The |conceal| feature is ignored here, the column numbers are
+ as if 'conceallevel' is zero. You can set the cursor to the
+ right position and use |screencol()| to get the value with
+ |conceal| taken into account.
+ Returns an empty Dict if {winid} is invalid.
+
+ Can also be used as a |method|: >
+ GetWinid()->screenpos(lnum, col)
+
+screenrow() *screenrow()*
+ The result is a Number, which is the current screen row of the
+ cursor. The top line has number one.
+ This function is mainly used for testing.
+ Alternatively you can use |winline()|.
+
+ Note: Same restrictions as with |screencol()|.
+
+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.
+ This is like |screenchars()| but returning a String with the
+ characters.
+ This is mainly to be used for testing.
+ Returns an empty String when row or col is out of range.
+
+ Can also be used as a |method|: >
+ GetRow()->screenstring(col)
+<
+ *search()*
+search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
+ Search for regexp pattern {pattern}. The search starts at the
+ cursor position (you can use |cursor()| to set it).
+
+ When a match has been found its line number is returned.
+ If there is no match a 0 is returned and the cursor doesn't
+ move. No error message is given.
+
+ {flags} is a String, which can contain these character flags:
+ 'b' search Backward instead of forward
+ 'c' accept a match at the Cursor position
+ 'e' move to the End of the match
+ 'n' do Not move the cursor
+ 'p' return number of matching sub-Pattern (see below)
+ 's' Set the ' mark at the previous location of the cursor
+ 'w' Wrap around the end of the file
+ 'W' don't Wrap around the end of the file
+ 'z' start searching at the cursor column instead of Zero
+ If neither 'w' or 'W' is given, the 'wrapscan' option applies.
+
+ If the 's' flag is supplied, the ' mark is set, only if the
+ cursor is moved. The 's' flag cannot be combined with the 'n'
+ flag.
+
+ 'ignorecase', 'smartcase' and 'magic' are used.
+
+ When the 'z' flag is not given, forward searching always
+ starts in column zero and then matches before the cursor are
+ skipped. When the 'c' flag is present in 'cpo' the next
+ search starts after the match. Without the 'c' flag the next
+ search starts one column further. This matters for
+ overlapping matches.
+ When searching backwards and the 'z' flag is given then the
+ search starts in column zero, thus no match in the current
+ line will be found (unless wrapping around the end of the
+ file).
+
+ When the {stopline} argument is given then the search stops
+ after searching this line. This is useful to restrict the
+ search to a range of lines. Examples: >
+ let match = search('(', 'b', line("w0"))
+ let end = search('END', '', line("w$"))
+< When {stopline} is used and it is not zero this also implies
+ that the search does not wrap around the end of the file.
+ A zero value is equal to not giving the argument.
+
+ When the {timeout} argument is given the search stops when
+ more than this many milliseconds have passed. Thus when
+ {timeout} is 500 the search stops after half a second.
+ The value must not be negative. A zero value is like not
+ giving the argument.
+
+ 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
+ example, to skip a match in a comment or a string.
+ {skip} can be a string, which is evaluated as an expression, a
+ function reference or a lambda.
+ When {skip} is omitted or empty, every match is accepted.
+ When evaluating {skip} causes an error the search is aborted
+ and -1 returned.
+ *search()-sub-match*
+ With the 'p' flag the returned value is one more than the
+ first sub-match in \(\). One if none of them matched but the
+ whole pattern did match.
+ To get the column number too use |searchpos()|.
+
+ The cursor will be positioned at the match, unless the 'n'
+ flag is used.
+
+ Example (goes over all files in the argument list): >
+ :let n = 1
+ :while n <= argc() " loop over all files in arglist
+ : exe "argument " .. n
+ : " start at the last char in the file and wrap for the
+ : " first search to find match at start of file
+ : normal G$
+ : let flags = "w"
+ : while search("foo", flags) > 0
+ : s/foo/bar/g
+ : let flags = "W"
+ : endwhile
+ : update " write the file if modified
+ : let n = n + 1
+ :endwhile
+<
+ Example for using some flags: >
+ :echo search('\<if\|\(else\)\|\(endif\)', 'ncpe')
+< This will search for the keywords "if", "else", and "endif"
+ under or after the cursor. Because of the 'p' flag, it
+ returns 1, 2, or 3 depending on which keyword is found, or 0
+ if the search fails. With the cursor on the first word of the
+ line:
+ if (foo == 0) | let foo = foo + 1 | endif ~
+ the function returns 1. Without the 'c' flag, the function
+ finds the "endif" and returns 3. The same thing happens
+ without the 'e' flag if the cursor is on the "f" of "if".
+ The 'n' flag tells the function not to move the cursor.
+
+ Can also be used as a |method|: >
+ GetPattern()->search()
+
+searchcount([{options}]) *searchcount()*
+ Get or update the last search count, like what is displayed
+ without the "S" flag in 'shortmess'. This works even if
+ 'shortmess' does contain the "S" flag.
+
+ This returns a Dictionary. The dictionary is empty if the
+ previous pattern was not set and "pattern" was not specified.
+
+ key type meaning ~
+ current |Number| current position of match;
+ 0 if the cursor position is
+ before the first match
+ exact_match |Boolean| 1 if "current" is matched on
+ "pos", otherwise 0
+ total |Number| total count of matches found
+ incomplete |Number| 0: search was fully completed
+ 1: recomputing was timed out
+ 2: max count exceeded
+
+ For {options} see further down.
+
+ To get the last search count when |n| or |N| was pressed, call
+ this function with `recompute: 0` . This sometimes returns
+ wrong information because |n| and |N|'s maximum count is 99.
+ If it exceeded 99 the result must be max count + 1 (100). If
+ you want to get correct information, specify `recompute: 1`: >
+
+ " result == maxcount + 1 (100) when many matches
+ let result = searchcount(#{recompute: 0})
+
+ " Below returns correct result (recompute defaults
+ " to 1)
+ let result = searchcount()
+<
+ The function is useful to add the count to |statusline|: >
+ function! LastSearchCount() abort
+ let result = searchcount(#{recompute: 0})
+ if empty(result)
+ return ''
+ endif
+ if result.incomplete ==# 1 " timed out
+ return printf(' /%s [?/??]', @/)
+ elseif result.incomplete ==# 2 " max count exceeded
+ if result.total > result.maxcount &&
+ \ result.current > result.maxcount
+ return printf(' /%s [>%d/>%d]', @/,
+ \ result.current, result.total)
+ elseif result.total > result.maxcount
+ return printf(' /%s [%d/>%d]', @/,
+ \ result.current, result.total)
+ endif
+ endif
+ return printf(' /%s [%d/%d]', @/,
+ \ result.current, result.total)
+ endfunction
+ let &statusline ..= '%{LastSearchCount()}'
+
+ " Or if you want to show the count only when
+ " 'hlsearch' was on
+ " let &statusline ..=
+ " \ '%{v:hlsearch ? LastSearchCount() : ""}'
+<
+ You can also update the search count, which can be useful in a
+ |CursorMoved| or |CursorMovedI| autocommand: >
+
+ autocmd CursorMoved,CursorMovedI *
+ \ let s:searchcount_timer = timer_start(
+ \ 200, function('s:update_searchcount'))
+ function! s:update_searchcount(timer) abort
+ if a:timer ==# s:searchcount_timer
+ call searchcount(#{
+ \ recompute: 1, maxcount: 0, timeout: 100})
+ redrawstatus
+ endif
+ endfunction
+<
+ This can also be used to count matched texts with specified
+ pattern in the current buffer using "pattern": >
+
+ " Count '\<foo\>' in this buffer
+ " (Note that it also updates search count)
+ let result = searchcount(#{pattern: '\<foo\>'})
+
+ " To restore old search count by old pattern,
+ " search again
+ call searchcount()
+<
+ {options} must be a Dictionary. It can contain:
+ key type meaning ~
+ recompute |Boolean| if |TRUE|, recompute the count
+ like |n| or |N| was executed.
+ otherwise returns the last
+ result by |n|, |N|, or this
+ function is returned.
+ (default: |TRUE|)
+ pattern |String| recompute if this was given
+ and different with |@/|.
+ this works as same as the
+ below command is executed
+ before calling this function >
+ let @/ = pattern
+< (default: |@/|)
+ timeout |Number| 0 or negative number is no
+ timeout. timeout milliseconds
+ for recomputing the result
+ (default: 0)
+ maxcount |Number| 0 or negative number is no
+ limit. max count of matched
+ text while recomputing the
+ result. if search exceeded
+ total count, "total" value
+ becomes `maxcount + 1`
+ (default: 0)
+ pos |List| `[lnum, col, off]` value
+ when recomputing the result.
+ this changes "current" result
+ value. see |cursor()|, |getpos()
+ (default: cursor's position)
+
+ Can also be used as a |method|: >
+ GetSearchOpts()->searchcount()
+<
+searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()*
+ Search for the declaration of {name}.
+
+ With a non-zero {global} argument it works like |gD|, find
+ first match in the file. Otherwise it works like |gd|, find
+ first match in the function.
+
+ With a non-zero {thisblock} argument matches in a {} block
+ that ends before the cursor position are ignored. Avoids
+ finding variable declarations only valid in another scope.
+
+ Moves the cursor to the found match.
+ Returns zero for success, non-zero for failure.
+ Example: >
+ if searchdecl('myvar') == 0
+ echo getline('.')
+ endif
+<
+ Can also be used as a |method|: >
+ GetName()->searchdecl()
+<
+ *searchpair()*
+searchpair({start}, {middle}, {end} [, {flags} [, {skip}
+ [, {stopline} [, {timeout}]]]])
+ Search for the match of a nested start-end pair. This can be
+ used to find the "endif" that matches an "if", while other
+ if/endif pairs in between are ignored.
+ The search starts at the cursor. The default is to search
+ forward, include 'b' in {flags} to search backward.
+ If a match is found, the cursor is positioned at it and the
+ line number is returned. If no match is found 0 or -1 is
+ returned and the cursor doesn't move. No error message is
+ given.
+
+ {start}, {middle} and {end} are patterns, see |pattern|. They
+ must not contain \( \) pairs. Use of \%( \) is allowed. When
+ {middle} is not empty, it is found when searching from either
+ direction, but only when not in a nested start-end pair. A
+ typical use is: >
+ searchpair('\<if\>', '\<else\>', '\<endif\>')
+< By leaving {middle} empty the "else" is skipped.
+
+ {flags} 'b', 'c', 'n', 's', 'w' and 'W' are used like with
+ |search()|. Additionally:
+ 'r' Repeat until no more matches found; will find the
+ outer pair. Implies the 'W' flag.
+ 'm' Return number of matches instead of line number with
+ the match; will be > 1 when 'r' is used.
+ Note: it's nearly always a good idea to use the 'W' flag, to
+ avoid wrapping around the end of the file.
+
+ When a match for {start}, {middle} or {end} is found, the
+ {skip} expression is evaluated with the cursor positioned on
+ the start of the match. It should return non-zero if this
+ match is to be skipped. E.g., because it is inside a comment
+ or a string.
+ When {skip} is omitted or empty, every match is accepted.
+ When evaluating {skip} causes an error the search is aborted
+ and -1 returned.
+ {skip} can be a string, a lambda, a funcref or a partial.
+ Anything else makes the function fail.
+
+ For {stopline} and {timeout} see |search()|.
+
+ The value of 'ignorecase' is used. 'magic' is ignored, the
+ patterns are used like it's on.
+
+ The search starts exactly at the cursor. A match with
+ {start}, {middle} or {end} at the next character, in the
+ direction of searching, is the first one found. Example: >
+ if 1
+ if 2
+ endif 2
+ endif 1
+< When starting at the "if 2", with the cursor on the "i", and
+ searching forwards, the "endif 2" is found. When starting on
+ the character just before the "if 2", the "endif 1" will be
+ found. That's because the "if 2" will be found first, and
+ then this is considered to be a nested if/endif from "if 2" to
+ "endif 2".
+ When searching backwards and {end} is more than one character,
+ it may be useful to put "\zs" at the end of the pattern, so
+ that when the cursor is inside a match with the end it finds
+ the matching start.
+
+ Example, to find the "endif" command in a Vim script: >
+
+ :echo searchpair('\<if\>', '\<el\%[seif]\>', '\<en\%[dif]\>', 'W',
+ \ 'getline(".") =~ "^\\s*\""')
+
+< The cursor must be at or after the "if" for which a match is
+ to be found. Note that single-quote strings are used to avoid
+ having to double the backslashes. The skip expression only
+ catches comments at the start of a line, not after a command.
+ Also, a word "en" or "if" halfway through a line is considered
+ a match.
+ Another example, to search for the matching "{" of a "}": >
+
+ :echo searchpair('{', '', '}', 'bW')
+
+< This works when the cursor is at or before the "}" for which a
+ match is to be found. To reject matches that syntax
+ highlighting recognized as strings: >
+
+ :echo searchpair('{', '', '}', 'bW',
+ \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')
+<
+ *searchpairpos()*
+searchpairpos({start}, {middle}, {end} [, {flags} [, {skip}
+ [, {stopline} [, {timeout}]]]])
+ Same as |searchpair()|, but returns a |List| with the line and
+ column position of the match. The first element of the |List|
+ is the line number and the second element is the byte index of
+ the column position of the match. If no match is found,
+ returns [0, 0]. >
+
+ :let [lnum,col] = searchpairpos('{', '', '}', 'n')
+<
+ See |match-parens| for a bigger and more useful example.
+
+ *searchpos()*
+searchpos({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
+ Same as |search()|, but returns a |List| with the line and
+ column position of the match. The first element of the |List|
+ is the line number and the second element is the byte index of
+ the column position of the match. If no match is found,
+ returns [0, 0].
+ Example: >
+ :let [lnum, col] = searchpos('mypattern', 'n')
+
+< When the 'p' flag is given then there is an extra item with
+ the sub-pattern match number |search()-sub-match|. Example: >
+ :let [lnum, col, submatch] = searchpos('\(\l\)\|\(\u\)', 'np')
+< In this example "submatch" is 2 when a lowercase letter is
+ found |/\l|, 3 when an uppercase letter is found |/\u|.
+
+ Can also be used as a |method|: >
+ GetPattern()->searchpos()
+
+serverlist() *serverlist()*
+ Returns a list of server addresses, or empty if all servers
+ were stopped. |serverstart()| |serverstop()|
+ Example: >
+ :echo serverlist()
+
+serverstart([{address}]) *serverstart()*
+ Opens a socket or named pipe at {address} and listens for
+ |RPC| messages. Clients can send |API| commands to the
+ returned address to control Nvim.
+
+ Returns the address string (may differ from the requested
+ {address}).
+
+ - If {address} contains a colon ":" it is interpreted as
+ a TCP/IPv4/IPv6 address where the last ":" separates host
+ and port (empty or zero assigns a random port).
+ - Else it is interpreted as a named pipe or Unix domain socket
+ path. If there are no slashes it is treated as a name and
+ appended to a generated path.
+ - If {address} is empty it generates a path.
+
+ Example named pipe: >
+ if has('win32')
+ echo serverstart('\\.\pipe\nvim-pipe-1234')
+ else
+ echo serverstart('nvim.sock')
+ endif
+<
+ Example TCP/IP address: >
+ echo serverstart('::1:12345')
+
+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()|.
+
+setbufline({buf}, {lnum}, {text}) *setbufline()*
+ Set line {lnum} to {text} in buffer {buf}. This works like
+ |setline()| for the specified buffer.
+
+ This function works only for loaded buffers. First call
+ |bufload()| if needed.
+
+ To insert lines use |appendbufline()|.
+ Any text properties in {lnum} are cleared.
+
+ {text} can be a string to set one line, or a list of strings
+ to set multiple lines. If the list extends below the last
+ line then those lines are added.
+
+ For the use of {buf}, see |bufname()| above.
+
+ {lnum} is used like with |setline()|.
+ Use "$" to refer to the last line in buffer {buf}.
+ When {lnum} is just below the last line the {text} will be
+ added below the last line.
+ On success 0 is returned, on failure 1 is returned.
+
+ If {buf} is not a valid buffer or {lnum} is not valid, an
+ error message is given.
+
+ Can also be used as a |method|, the base is passed as the
+ third argument: >
+ GetText()->setbufline(buf, lnum)
+
+setbufvar({buf}, {varname}, {val}) *setbufvar()*
+ Set option or local variable {varname} in buffer {buf} to
+ {val}.
+ This also works for a global or local window option, but it
+ doesn't work for a global or local window variable.
+ For a local window option the global value is unchanged.
+ For the use of {buf}, see |bufname()| above.
+ The {varname} argument is a string.
+ Note that the variable name without "b:" must be used.
+ Examples: >
+ :call setbufvar(1, "&mod", 1)
+ :call setbufvar("todo", "myvar", "foobar")
+< This function is not available in the |sandbox|.
+
+ Can also be used as a |method|, the base is passed as the
+ third argument: >
+ GetValue()->setbufvar(buf, varname)
+
+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.
+
+ Example:
+ With the text "여보세요" in line 8: >
+ call setcharpos('.', [0, 8, 4, 0])
+< positions the cursor on the fourth character '요'. >
+ call setpos('.', [0, 8, 4, 0])
+< positions the cursor on the second character '보'.
+
+ Can also be used as a |method|: >
+ GetPosition()->setcharpos('.')
+
+setcharsearch({dict}) *setcharsearch()*
+ Set the current character search information to {dict},
+ which contains one or more of the following entries:
+
+ char character which will be used for a subsequent
+ |,| or |;| command; an empty string clears the
+ character search
+ forward direction of character search; 1 for forward,
+ 0 for backward
+ until type of character search; 1 for a |t| or |T|
+ character search, 0 for an |f| or |F|
+ character search
+
+ This can be useful to save/restore a user's character search
+ from a script: >
+ :let prevsearch = getcharsearch()
+ :" Perform a command which clobbers user's search
+ :call setcharsearch(prevsearch)
+< Also see |getcharsearch()|.
+
+ Can also be used as a |method|: >
+ SavedSearch()->setcharsearch()
+
+setcmdpos({pos}) *setcmdpos()*
+ Set the cursor position in the command line to byte position
+ {pos}. The first position is 1.
+ Use |getcmdpos()| to obtain the current position.
+ Only works while editing the command line, thus you must use
+ |c_CTRL-\_e|, |c_CTRL-R_=| or |c_CTRL-R_CTRL-R| with '='. For
+ |c_CTRL-\_e| and |c_CTRL-R_CTRL-R| with '=' the position is
+ set after the command line is set to the expression. For
+ |c_CTRL-R_=| it is set after evaluating the expression but
+ before inserting the resulting text.
+ When the number is too big the cursor is put at the end of the
+ line. A number smaller than one has undefined results.
+ Returns FALSE when successful, TRUE when not editing the
+ command line.
+
+ Can also be used as a |method|: >
+ GetPos()->setcmdpos()
+
+setcursorcharpos({lnum}, {col} [, {off}]) *setcursorcharpos()*
+setcursorcharpos({list})
+ Same as |cursor()| but uses the specified column number as the
+ character index instead of the byte index in the line.
+
+ Example:
+ With the text "여보세요" in line 4: >
+ call setcursorcharpos(4, 3)
+< positions the cursor on the third character '세'. >
+ call cursor(4, 3)
+< positions the cursor on the first character '여'.
+
+ Can also be used as a |method|: >
+ GetCursorPos()->setcursorcharpos()
+
+setenv({name}, {val}) *setenv()*
+ Set environment variable {name} to {val}. Example: >
+ call setenv('HOME', '/home/myhome')
+
+< When {val} is |v:null| the environment variable is deleted.
+ See also |expr-env|.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetPath()->setenv('PATH')
+
+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
+ "rwxrwxrwx", where each group of "rwx" flags represent, in
+ turn, the permissions of the owner of the file, the group the
+ file belongs to, and other users. A '-' character means the
+ permission is off, any other character means on. Multi-byte
+ characters are not supported.
+
+ For example "rw-r-----" means read-write for the user,
+ readable by the group, not accessible by others. "xx-x-----"
+ would do the same thing.
+
+ Returns non-zero for success, zero for failure.
+
+ Can also be used as a |method|: >
+ GetFilename()->setfperm(mode)
+<
+ To read permissions see |getfperm()|.
+
+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
+ |setbufline()|.
+
+ {lnum} is used like with |getline()|.
+ When {lnum} is just below the last line the {text} will be
+ added below the last line.
+
+ If this succeeds, FALSE is returned. If this fails (most likely
+ because {lnum} is invalid) TRUE is returned.
+
+ Example: >
+ :call setline(5, strftime("%c"))
+
+< When {text} is a |List| then line {lnum} and following lines
+ will be set to the items in the list. Example: >
+ :call setline(5, ['aaa', 'bbb', 'ccc'])
+< This is equivalent to: >
+ :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']]
+ : call setline(n, l)
+ :endfor
+
+< Note: The '[ and '] marks are not set.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetText()->setline(lnum)
+
+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|.
+ When {nr} is zero the current window is used.
+
+ For a location list window, the displayed location list is
+ modified. For an invalid window number {nr}, -1 is returned.
+ Otherwise, same as |setqflist()|.
+ Also see |location-list|.
+
+ For {action} see |setqflist-action|.
+
+ If the optional {what} dictionary argument is supplied, then
+ only the items listed in {what} are set. Refer to |setqflist()|
+ for the list of supported keys in {what}.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetLoclist()->setloclist(winnr)
+
+setmatches({list} [, {win}]) *setmatches()*
+ Restores a list of matches saved by |getmatches() for the
+ current window|. Returns 0 if successful, otherwise -1. All
+ current matches are cleared before the list is restored. See
+ example for |getmatches()|.
+ If {win} is specified, use the window with this number or
+ window ID instead of the current window.
+
+ Can also be used as a |method|: >
+ GetMatches()->setmatches()
+<
+ *setpos()*
+setpos({expr}, {list})
+ Set the position for String {expr}. Possible values:
+ . the cursor
+ 'x mark x
+
+ {list} must be a |List| with four or five numbers:
+ [bufnum, lnum, col, off]
+ [bufnum, lnum, col, off, curswant]
+
+ "bufnum" is the buffer number. Zero can be used for the
+ current buffer. When setting an uppercase mark "bufnum" is
+ used for the mark position. For other marks it specifies the
+ buffer to set the mark in. You can use the |bufnr()| function
+ to turn a file name into a buffer number.
+ For setting the cursor and the ' mark "bufnum" is ignored,
+ since these are associated with a window, not a buffer.
+ Does not change the jumplist.
+
+ "lnum" and "col" are the position in the buffer. The first
+ column is 1. Use a zero "lnum" to delete a mark. If "col" is
+ smaller than 1 then 1 is used. To use the character count
+ instead of the byte count, use |setcharpos()|.
+
+ The "off" number is only used when 'virtualedit' is set. Then
+ 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.
+
+ The "curswant" number is only used when setting the cursor
+ position. It sets the preferred column for when moving the
+ cursor vertically. When the "curswant" number is missing the
+ preferred column is not set. When it is present and setting a
+ mark position it is not used.
+
+ Note that for '< and '> changing the line number may result in
+ the marks to be effectively be swapped, so that '< is always
+ before '>.
+
+ Returns 0 when the position could be set, -1 otherwise.
+ An error message is given if {expr} is invalid.
+
+ Also see |setcharpos()|, |getpos()| and |getcurpos()|.
+
+ This does not restore the preferred column for moving
+ vertically; if you set the cursor position with this, |j| and
+ |k| motions will jump to previous columns! Use |cursor()| to
+ also set the preferred column. Also see the "curswant" key in
+ |winrestview()|.
+
+ Can also be used as a |method|: >
+ GetPosition()->setpos('.')
+
+setqflist({list} [, {action} [, {what}]]) *setqflist()*
+ Create or replace or add to the quickfix list.
+
+ If the optional {what} dictionary argument is supplied, then
+ only the items listed in {what} are set. The first {list}
+ argument is ignored. See below for the supported items in
+ {what}.
+ *setqflist-what*
+ When {what} is not present, the items in {list} are used. Each
+ item must be a dictionary. Non-dictionary items in {list} are
+ ignored. Each dictionary item can contain the following
+ entries:
+
+ bufnr buffer number; must be the number of a valid
+ buffer
+ filename name of a file; only used when "bufnr" is not
+ present or it is invalid.
+ module name of a module; if given it will be used in
+ quickfix error window instead of the filename.
+ lnum line number in the file
+ end_lnum end of lines, if the item spans multiple lines
+ pattern search pattern used to locate the error
+ col column number
+ vcol when non-zero: "col" is visual column
+ when zero: "col" is byte index
+ end_col end column, if the item spans multiple columns
+ nr error number
+ text description of the error
+ type single-character error type, 'E', 'W', etc.
+ valid recognized error message
+
+ The "col", "vcol", "nr", "type" and "text" entries are
+ optional. Either "lnum" or "pattern" entry can be used to
+ locate a matching error line.
+ If the "filename" and "bufnr" entries are not present or
+ neither the "lnum" or "pattern" entries are present, then the
+ item will not be handled as an error line.
+ If both "pattern" and "lnum" are present then "pattern" will
+ be used.
+ If the "valid" entry is not supplied, then the valid flag is
+ set when "bufnr" is a valid buffer or "filename" exists.
+ If you supply an empty {list}, the quickfix list will be
+ cleared.
+ Note that the list is not exactly the same as what
+ |getqflist()| returns.
+
+ {action} values: *setqflist-action* *E927*
+ 'a' The items from {list} are added to the existing
+ quickfix list. If there is no existing list, then a
+ new list is created.
+
+ 'r' The items from the current quickfix list are replaced
+ with the items from {list}. This can also be used to
+ clear the list: >
+ :call setqflist([], 'r')
+<
+ 'f' All the quickfix lists in the quickfix stack are
+ freed.
+
+ If {action} is not present or is set to ' ', then a new list
+ is created. The new quickfix list is added after the current
+ quickfix list in the stack and all the following lists are
+ freed. To add a new quickfix list at the end of the stack,
+ set "nr" in {what} to "$".
+
+ The following items can be specified in dictionary {what}:
+ context quickfix list context. See |quickfix-context|
+ efm errorformat to use when parsing text from
+ "lines". If this is not present, then the
+ 'errorformat' option value is used.
+ See |quickfix-parse|
+ id quickfix list identifier |quickfix-ID|
+ idx index of the current entry in the quickfix
+ list specified by 'id' or 'nr'. If set to '$',
+ then the last entry in the list is set as the
+ current entry. See |quickfix-index|
+ items list of quickfix entries. Same as the {list}
+ argument.
+ lines use 'errorformat' to parse a list of lines and
+ add the resulting entries to the quickfix list
+ {nr} or {id}. Only a |List| value is supported.
+ See |quickfix-parse|
+ nr list number in the quickfix stack; zero
+ means the current quickfix list and "$" means
+ the last quickfix list.
+ quickfixtextfunc
+ function to get the text to display in the
+ quickfix window. The value can be the name of
+ a function or a funcref or a lambda. Refer to
+ |quickfix-window-function| for an explanation
+ of how to write the function and an example.
+ title quickfix list title text. See |quickfix-title|
+ Unsupported keys in {what} are ignored.
+ If the "nr" item is not present, then the current quickfix list
+ is modified. When creating a new quickfix list, "nr" can be
+ set to a value one greater than the quickfix stack size.
+ When modifying a quickfix list, to guarantee that the correct
+ list is modified, "id" should be used instead of "nr" to
+ specify the list.
+
+ Examples (See also |setqflist-examples|): >
+ :call setqflist([], 'r', {'title': 'My search'})
+ :call setqflist([], 'r', {'nr': 2, 'title': 'Errors'})
+ :call setqflist([], 'a', {'id':qfid, 'lines':["F1:10:L10"]})
+<
+ Returns zero for success, -1 for failure.
+
+ This function can be used to create a quickfix list
+ independent of the 'errorformat' setting. Use a command like
+ `:cc 1` to jump to the first position.
+
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetErrorlist()->setqflist()
+<
+ *setreg()*
+setreg({regname}, {value} [, {options}])
+ Set the register {regname} to {value}.
+ The {regname} argument is a string.
+
+ {value} may be any value returned by |getreg()| or
+ |getreginfo()|, including a |List| or |Dict|.
+ If {options} contains "a" or {regname} is upper case,
+ then the value is appended.
+
+ {options} can also contain a register type specification:
+ "c" or "v" |charwise| mode
+ "l" or "V" |linewise| mode
+ "b" or "<CTRL-V>" |blockwise-visual| mode
+ If a number immediately follows "b" or "<CTRL-V>" then this is
+ used as the width of the selection - if it is not specified
+ then the width of the block is set to the number of characters
+ in the longest line (counting a <Tab> as 1 character).
+ If {options} contains "u" or '"', then the unnamed register is
+ set to point to register {regname}.
+
+ If {options} contains no register settings, then the default
+ is to use character mode unless {value} ends in a <NL> for
+ string {value} and linewise mode for list {value}. Blockwise
+ mode is never selected automatically.
+ Returns zero for success, non-zero for failure.
+
+ *E883*
+ Note: you may not use |List| containing more than one item to
+ set search and expression registers. Lists containing no
+ items act like empty strings.
+
+ Examples: >
+ :call setreg(v:register, @*)
+ :call setreg('*', @%, 'ac')
+ :call setreg('a', "1\n2\n3", 'b5')
+ :call setreg('"', { 'points_to': 'a'})
+
+< This example shows using the functions to save and restore a
+ register: >
+ :let var_a = getreginfo()
+ :call setreg('a', var_a)
+< or: >
+ :let var_a = getreg('a', 1, 1)
+ :let var_amode = getregtype('a')
+ ....
+ :call setreg('a', var_a, var_amode)
+< Note: you may not reliably restore register value
+ without using the third argument to |getreg()| as without it
+ newlines are represented as newlines AND Nul bytes are
+ represented as newlines as well, see |NL-used-for-Nul|.
+
+ You can also change the type of a register by appending
+ nothing: >
+ :call setreg('a', '', 'al')
+
+< Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetText()->setreg('a')
+
+settabvar({tabnr}, {varname}, {val}) *settabvar()*
+ Set tab-local variable {varname} to {val} in tab page {tabnr}.
+ |t:var|
+ The {varname} argument is a string.
+ Note that the variable name without "t:" must be used.
+ Tabs are numbered starting with one.
+ This function is not available in the |sandbox|.
+
+ Can also be used as a |method|, the base is passed as the
+ third argument: >
+ GetValue()->settabvar(tab, name)
+
+settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
+ Set option or local variable {varname} in window {winnr} to
+ {val}.
+ Tabs are numbered starting with one. For the current tabpage
+ use |setwinvar()|.
+ {winnr} can be the window number or the |window-ID|.
+ When {winnr} is zero the current window is used.
+ This also works for a global or local buffer option, but it
+ doesn't work for a global or local buffer variable.
+ For a local buffer option the global value is unchanged.
+ Note that the variable name without "w:" must be used.
+ Examples: >
+ :call settabwinvar(1, 1, "&list", 0)
+ :call settabwinvar(3, 2, "myvar", "foobar")
+< This function is not available in the |sandbox|.
+
+ Can also be used as a |method|, the base is passed as the
+ fourth argument: >
+ GetValue()->settabwinvar(tab, winnr, name)
+
+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|.
+
+ For a list of supported items in {dict}, refer to
+ |gettagstack()|. "curidx" takes effect before changing the tag
+ stack.
+ *E962*
+ How the tag stack is modified depends on the {action}
+ argument:
+ - If {action} is not present or is set to 'r', then the tag
+ stack is replaced.
+ - If {action} is set to 'a', then new entries from {dict} are
+ pushed (added) onto the tag stack.
+ - If {action} is set to 't', then all the entries from the
+ current entry in the tag stack or "curidx" in {dict} are
+ removed and then new entries are pushed to the stack.
+
+ The current index is set to one after the length of the tag
+ stack after the modification.
+
+ Returns zero for success, -1 for failure.
+
+ Examples (for more examples see |tagstack-examples|):
+ Empty the tag stack of window 3: >
+ call settagstack(3, {'items' : []})
+
+< Save and restore the tag stack: >
+ let stack = gettagstack(1003)
+ " do something else
+ call settagstack(1003, stack)
+ unlet stack
+<
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetStack()->settagstack(winnr)
+
+setwinvar({nr}, {varname}, {val}) *setwinvar()*
+ Like |settabwinvar()| for the current tab page.
+ Examples: >
+ :call setwinvar(1, "&list", 0)
+ :call setwinvar(2, "myvar", "foobar")
+
+< Can also be used as a |method|, the base is passed as the
+ third argument: >
+ GetValue()->setwinvar(winnr, name)
+
+sha256({string}) *sha256()*
+ Returns a String with 64 hex characters, which is the SHA256
+ checksum of {string}.
+
+ Can also be used as a |method|: >
+ GetText()->sha256()
+
+shellescape({string} [, {special}]) *shellescape()*
+ Escape {string} for use as a shell command argument.
+
+ On Windows when 'shellslash' is not set, encloses {string} in
+ double-quotes and doubles all double-quotes within {string}.
+ Otherwise encloses {string} in single-quotes and replaces all
+ "'" with "'\''".
+
+ If {special} is a |non-zero-arg|:
+ - Special items such as "!", "%", "#" and "<cword>" will be
+ preceded by a backslash. The backslash will be removed again
+ by the |:!| command.
+ - The <NL> character is escaped.
+
+ If 'shell' contains "csh" in the tail:
+ - The "!" character will be escaped. This is because csh and
+ tcsh use "!" for history replacement even in single-quotes.
+ - The <NL> character is escaped (twice if {special} is
+ a |non-zero-arg|).
+
+ If 'shell' contains "fish" in the tail, the "\" character will
+ be escaped because in fish it is used as an escape character
+ inside single quotes.
+
+ Example of use with a |:!| command: >
+ :exe '!dir ' .. shellescape(expand('<cfile>'), 1)
+< This results in a directory listing for the file under the
+ cursor. Example of use with |system()|: >
+ :call system("chmod +w -- " .. shellescape(expand("%")))
+< See also |::S|.
+
+ Can also be used as a |method|: >
+ GetCommand()->shellescape()
+
+shiftwidth([{col}]) *shiftwidth()*
+ Returns the effective value of 'shiftwidth'. This is the
+ 'shiftwidth' value unless it is zero, in which case it is the
+ 'tabstop' value. To be backwards compatible in indent
+ plugins, use this: >
+ if exists('*shiftwidth')
+ func s:sw()
+ return shiftwidth()
+ endfunc
+ else
+ func s:sw()
+ return &sw
+ endfunc
+ endif
+< And then use s:sw() instead of &sw.
+
+ When there is one argument {col} this is used as column number
+ for which to return the 'shiftwidth' value. This matters for the
+ 'vartabstop' feature. If no {col} argument is given, column 1
+ will be assumed.
+
+ Can also be used as a |method|: >
+ GetColumn()->shiftwidth()
+
+sign_ functions are documented here: |sign-functions-details|
+
+simplify({filename}) *simplify()*
+ Simplify the file name as much as possible without changing
+ the meaning. Shortcuts (on MS-Windows) or symbolic links (on
+ Unix) are not resolved. If the first path component in
+ {filename} designates the current directory, this will be
+ valid for the result as well. A trailing path separator is
+ not removed either. On Unix "//path" is unchanged, but
+ "///path" is simplified to "/path" (this follows the Posix
+ standard).
+ Example: >
+ simplify("./dir/.././/file/") == "./file/"
+< Note: The combination "dir/.." is only removed if "dir" is
+ a searchable directory or does not exist. On Unix, it is also
+ removed when "dir" is a symbolic link within the same
+ directory. In order to resolve all the involved symbolic
+ links before simplifying the path name, use |resolve()|.
+
+ Can also be used as a |method|: >
+ GetName()->simplify()
+
+sin({expr}) *sin()*
+ Return the sine of {expr}, measured in radians, as a |Float|.
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo sin(100)
+< -0.506366 >
+ :echo sin(-4.01)
+< 0.763301
+
+ Can also be used as a |method|: >
+ Compute()->sin()
+
+sinh({expr}) *sinh()*
+ Return the hyperbolic sine of {expr} as a |Float| in the range
+ [-inf, inf].
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo sinh(0.5)
+< 0.521095 >
+ :echo sinh(-0.9)
+< -1.026517
+
+ Can also be used as a |method|: >
+ Compute()->sinh()
+
+sockconnect({mode}, {address} [, {opts}]) *sockconnect()*
+ Connect a socket to an address. If {mode} is "pipe" then
+ {address} should be the path of a named pipe. If {mode} is
+ "tcp" then {address} should be of the form "host:port" where
+ the host should be an ip adderess or host name, and port the
+ port number.
+
+ Returns a |channel| ID. Close the socket with |chanclose()|.
+ Use |chansend()| to send data over a bytes socket, and
+ |rpcrequest()| and |rpcnotify()| to communicate with a RPC
+ socket.
+
+ {opts} is an optional dictionary with these keys:
+ |on_data| : callback invoked when data was read from socket
+ data_buffered : read socket data in |channel-buffered| mode.
+ rpc : If set, |msgpack-rpc| will be used to communicate
+ over the socket.
+ Returns:
+ - The channel ID on success (greater than zero)
+ - 0 on invalid arguments or connection failure.
+
+sort({list} [, {func} [, {dict}]]) *sort()* *E702*
+ Sort the items in {list} in-place. Returns {list}.
+
+ If you want a list to remain unmodified make a copy first: >
+ :let sortedlist = sort(copy(mylist))
+
+< When {func} is omitted, is empty or zero, then sort() uses the
+ string representation of each item to sort on. Numbers sort
+ after Strings, |Lists| after Numbers. For sorting text in the
+ current buffer use |:sort|.
+
+ When {func} is given and it is '1' or 'i' then case is
+ ignored.
+
+ When {func} is given and it is 'l' then the current collation
+ locale is used for ordering. Implementation details: strcoll()
+ is used to compare strings. See |:language| check or set the
+ collation locale. |v:collate| can also be used to check the
+ current locale. Sorting using the locale typically ignores
+ case. Example: >
+ " ö is sorted similarly to o with English locale.
+ :language collate en_US.UTF8
+ :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l')
+< ['n', 'o', 'O', 'ö', 'p', 'z'] ~
+>
+ " ö is sorted after z with Swedish locale.
+ :language collate sv_SE.UTF8
+ :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l')
+< ['n', 'o', 'O', 'p', 'z', 'ö'] ~
+ This does not work properly on Mac.
+
+ When {func} is given and it is 'n' then all items will be
+ sorted numerical (Implementation detail: this uses the
+ strtod() function to parse numbers, Strings, Lists, Dicts and
+ Funcrefs will be considered as being 0).
+
+ When {func} is given and it is 'N' then all items will be
+ sorted numerical. This is like 'n' but a string containing
+ digits will be used as the number they represent.
+
+ When {func} is given and it is 'f' then all items will be
+ sorted numerical. All values must be a Number or a Float.
+
+ When {func} is a |Funcref| or a function name, this function
+ is called to compare items. The function is invoked with two
+ items as argument and must return zero if they are equal, 1 or
+ bigger if the first one sorts after the second one, -1 or
+ smaller if the first one sorts before the second one.
+
+ {dict} is for functions with the "dict" attribute. It will be
+ used to set the local variable "self". |Dictionary-function|
+
+ The sort is stable, items which compare equal (as number or as
+ string) will keep their relative position. E.g., when sorting
+ on numbers, text strings will sort next to each other, in the
+ same order as they were originally.
+
+ Can also be used as a |method|: >
+ mylist->sort()
+
+< Also see |uniq()|.
+
+ Example: >
+ func MyCompare(i1, i2)
+ return a:i1 == a:i2 ? 0 : a:i1 > a:i2 ? 1 : -1
+ endfunc
+ eval mylist->sort("MyCompare")
+< A shorter compare version for this specific simple case, which
+ ignores overflow: >
+ func MyCompare(i1, i2)
+ return a:i1 - a:i2
+ endfunc
+< For a simple expression you can use a lambda: >
+ eval mylist->sort({i1, i2 -> i1 - i2})
+<
+ *soundfold()*
+soundfold({word})
+ Return the sound-folded equivalent of {word}. Uses the first
+ language in 'spelllang' for the current window that supports
+ soundfolding. 'spell' must be set. When no sound folding is
+ possible the {word} is returned unmodified.
+ This can be used for making spelling suggestions. Note that
+ the method can be quite slow.
+
+ Can also be used as a |method|: >
+ GetWord()->soundfold()
+<
+ *spellbadword()*
+spellbadword([{sentence}])
+ Without argument: The result is the badly spelled word under
+ or after the cursor. The cursor is moved to the start of the
+ bad word. When no bad word is found in the cursor line the
+ result is an empty string and the cursor doesn't move.
+
+ With argument: The result is the first word in {sentence} that
+ is badly spelled. If there are no spelling mistakes the
+ result is an empty string.
+
+ The return value is a list with two items:
+ - The badly spelled word or an empty string.
+ - The type of the spelling error:
+ "bad" spelling mistake
+ "rare" rare word
+ "local" word only valid in another region
+ "caps" word should start with Capital
+ Example: >
+ echo spellbadword("the quik brown fox")
+< ['quik', 'bad'] ~
+
+ The spelling information for the current window and the value
+ of 'spelllang' are used.
+
+ Can also be used as a |method|: >
+ GetText()->spellbadword()
+<
+ *spellsuggest()*
+spellsuggest({word} [, {max} [, {capital}]])
+ Return a |List| with spelling suggestions to replace {word}.
+ When {max} is given up to this number of suggestions are
+ returned. Otherwise up to 25 suggestions are returned.
+
+ When the {capital} argument is given and it's non-zero only
+ suggestions with a leading capital will be given. Use this
+ after a match with 'spellcapcheck'.
+
+ {word} can be a badly spelled word followed by other text.
+ This allows for joining two words that were split. The
+ suggestions also include the following text, thus you can
+ replace a line.
+
+ {word} may also be a good word. Similar words will then be
+ returned. {word} itself is not included in the suggestions,
+ although it may appear capitalized.
+
+ The spelling information for the current window is used. The
+ values of 'spelllang' and 'spellsuggest' are used.
+
+ Can also be used as a |method|: >
+ GetWord()->spellsuggest()
+
+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.
+ Otherwise the string is split where {pattern} matches,
+ removing the matched characters. 'ignorecase' is not used
+ here, add \c to ignore case. |/\c|
+ When the first or last item is empty it is omitted, unless the
+ {keepempty} argument is given and it's non-zero.
+ Other empty items are kept when {pattern} matches at least one
+ character or when {keepempty} is non-zero.
+ Example: >
+ :let words = split(getline('.'), '\W\+')
+< To split a string in individual characters: >
+ :for c in split(mystring, '\zs')
+< If you want to keep the separator you can also use '\zs' at
+ the end of the pattern: >
+ :echo split('abc:def:ghi', ':\zs')
+< ['abc:', 'def:', 'ghi'] ~
+ Splitting a table where the first element can be empty: >
+ :let items = split(line, ':', 1)
+< The opposite function is |join()|.
+
+ Can also be used as a |method|: >
+ GetString()->split()
+
+sqrt({expr}) *sqrt()*
+ Return the non-negative square root of Float {expr} as a
+ |Float|.
+ {expr} must evaluate to a |Float| or a |Number|. When {expr}
+ is negative the result is NaN (Not a Number). Returns 0.0 if
+ {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo sqrt(100)
+< 10.0 >
+ :echo sqrt(-4.01)
+< str2float('nan')
+ NaN may be different, it depends on system libraries.
+
+ Can also be used as a |method|: >
+ Compute()->sqrt()
+
+srand([{expr}]) *srand()*
+ Initialize seed used by |rand()|:
+ - If {expr} is not given, seed values are initialized by
+ reading from /dev/urandom, if possible, or using time(NULL)
+ a.k.a. epoch time otherwise; this only has second accuracy.
+ - If {expr} is given it must be a Number. It is used to
+ initialize the seed values. This is useful for testing or
+ when a predictable sequence is intended.
+
+ Examples: >
+ :let seed = srand()
+ :let seed = srand(userinput)
+ :echo rand(seed)
+<
+ Can also be used as a |method|: >
+ userinput->srand()
+
+stdioopen({opts}) *stdioopen()*
+ With |--headless| this opens stdin and stdout as a |channel|.
+ May be called only once. See |channel-stdio|. stderr is not
+ handled by this function, see |v:stderr|.
+
+ Close the stdio handles with |chanclose()|. Use |chansend()|
+ to send data to stdout, and |rpcrequest()| and |rpcnotify()|
+ to communicate over RPC.
+
+ {opts} is a dictionary with these keys:
+ |on_stdin| : callback invoked when stdin is written to.
+ on_print : callback invoked when Nvim needs to print a
+ message, with the message (whose type is string)
+ as sole argument.
+ stdin_buffered : read stdin in |channel-buffered| mode.
+ rpc : If set, |msgpack-rpc| will be used to communicate
+ over stdio
+ Returns:
+ - |channel-id| on success (value is always 1)
+ - 0 on invalid arguments
+
+
+stdpath({what}) *stdpath()* *E6100*
+ Returns |standard-path| locations of various default files and
+ directories.
+
+ {what} Type Description ~
+ cache String Cache directory: arbitrary temporary
+ storage for plugins, etc.
+ config String User configuration directory. |init.vim|
+ is stored here.
+ config_dirs List Other configuration directories.
+ data String User data directory. The |shada-file|
+ is stored here.
+ data_dirs List Other data directories.
+ log String Logs directory (for use by plugins too).
+ run String Run directory: temporary, local storage
+ for sockets, named pipes, etc.
+ state String Session state directory: storage for file
+ drafts, undo, shada, etc.
+
+ Example: >
+ :echo stdpath("config")
+
+
+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,
+ see |floating-point-format|. But it's a bit more permissive.
+ E.g., "1e40" is accepted, while in an expression you need to
+ write "1.0e40". The hexadecimal form "0x123" is also
+ accepted, but not others, like binary or octal.
+ When {quoted} is present and non-zero then embedded single
+ quotes before the dot are ignored, thus "1'000.0" is a
+ thousand.
+ Text after the number is silently ignored.
+ The decimal point is always '.', no matter what the locale is
+ set to. A comma ends the number: "12,345.67" is converted to
+ 12.0. You can strip out thousands separators with
+ |substitute()|: >
+ let f = str2float(substitute(text, ',', '', 'g'))
+<
+ Returns 0.0 if the conversion fails.
+
+ Can also be used as a |method|: >
+ let f = text->substitute(',', '', 'g')->str2float()
+
+str2list({string} [, {utf8}]) *str2list()*
+ Return a list containing the number values which represent
+ each character in String {string}. Examples: >
+ str2list(" ") returns [32]
+ str2list("ABC") returns [65, 66, 67]
+< |list2str()| does the opposite.
+
+ UTF-8 encoding is always used, {utf8} option has no effect,
+ and exists only for backwards-compatibility.
+ With UTF-8 composing characters are handled properly: >
+ str2list("á") returns [97, 769]
+
+< Can also be used as a |method|: >
+ GetString()->str2list()
+
+str2nr({string} [, {base}]) *str2nr()*
+ Convert string {string} to a number.
+ {base} is the conversion base, it can be 2, 8, 10 or 16.
+ When {quoted} is present and non-zero then embedded single
+ quotes are ignored, thus "1'000'000" is a million.
+
+ When {base} is omitted base 10 is used. This also means that
+ a leading zero doesn't cause octal conversion to be used, as
+ with the default String to Number conversion. Example: >
+ let nr = str2nr('0123')
+<
+ When {base} is 16 a leading "0x" or "0X" is ignored. With a
+ different base the result will be zero. Similarly, when
+ {base} is 8 a leading "0", "0o" or "0O" is ignored, and when
+ {base} is 2 a leading "0b" or "0B" is ignored.
+ Text after the number is silently ignored.
+
+ Returns 0 if {string} is empty or on error.
+
+ Can also be used as a |method|: >
+ GetText()->str2nr()
+
+strcharpart({src}, {start} [, {len}]) *strcharpart()*
+ Like |strpart()| but using character index and length instead
+ of byte index and length. Composing characters are counted
+ separately.
+ When a character index is used where a character does not
+ exist it is assumed to be one character. For example: >
+ strcharpart('abc', -1, 2)
+< results in 'a'.
+
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ GetText()->strcharpart(5)
+
+strchars({string} [, {skipcc}]) *strchars()*
+ The result is a Number, which is the number of characters
+ in String {string}.
+ When {skipcc} is omitted or zero, composing characters are
+ counted separately.
+ When {skipcc} set to 1, Composing characters are ignored.
+
+ Returns zero on error.
+
+ Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
+
+ {skipcc} is only available after 7.4.755. For backward
+ compatibility, you can define a wrapper function: >
+ if has("patch-7.4.755")
+ function s:strchars(str, skipcc)
+ return strchars(a:str, a:skipcc)
+ endfunction
+ else
+ function s:strchars(str, skipcc)
+ if a:skipcc
+ return strlen(substitute(a:str, ".", "x", "g"))
+ else
+ return strchars(a:str)
+ endif
+ endfunction
+ endif
+<
+ Can also be used as a |method|: >
+ GetText()->strchars()
+
+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}
+ (first column is zero). When {col} is omitted zero is used.
+ Otherwise it is the screen column where to start. This
+ matters for Tab characters.
+ The option settings of the current window are used. This
+ matters for anything that's displayed differently, such as
+ 'tabstop' and 'display'.
+ When {string} contains characters with East Asian Width Class
+ Ambiguous, this function's return value depends on 'ambiwidth'.
+ Returns zero on error.
+ Also see |strlen()|, |strwidth()| and |strchars()|.
+
+ Can also be used as a |method|: >
+ GetText()->strdisplaywidth()
+
+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,
+ or the current time if no time is given. The accepted
+ {format} depends on your system, thus this is not portable!
+ See the manual page of the C function strftime() for the
+ format. The maximum length of the result is 80 characters.
+ See also |localtime()|, |getftime()| and |strptime()|.
+ The language can be changed with the |:language| command.
+ Examples: >
+ :echo strftime("%c") Sun Apr 27 11:49:23 1997
+ :echo strftime("%Y %b %d %X") 1997 Apr 27 11:53:25
+ :echo strftime("%y%m%d %T") 970427 11:53:55
+ :echo strftime("%H:%M") 11:55
+ :echo strftime("%c", getftime("file.c"))
+ Show mod time of file.c.
+
+< Can also be used as a |method|: >
+ GetFormat()->strftime()
+
+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
+ index. Composing characters are considered separate
+ characters here. Use |nr2char()| to convert the Number to a
+ String.
+ Returns -1 if {index} is invalid.
+ Also see |strcharpart()| and |strchars()|.
+
+ Can also be used as a |method|: >
+ GetText()->strgetchar(5)
+
+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}.
+ If {start} is specified, the search starts at index {start}.
+ This can be used to find a second match: >
+ :let colon1 = stridx(line, ":")
+ :let colon2 = stridx(line, ":", colon1 + 1)
+< The search is done case-sensitive.
+ For pattern searches use |match()|.
+ -1 is returned if the {needle} does not occur in {haystack}.
+ See also |strridx()|.
+ Examples: >
+ :echo stridx("An Example", "Example") 3
+ :echo stridx("Starting point", "Start") 0
+ :echo stridx("Starting point", "start") -1
+< *strstr()* *strchr()*
+ stridx() works similar to the C function strstr(). When used
+ with a single character it works similar to strchr().
+
+ Can also be used as a |method|: >
+ GetHaystack()->stridx(needle)
+
+ *string()*
+string({expr}) Return {expr} converted to a String. If {expr} is a Number,
+ Float, String, Blob or a composition of them, then the result
+ can be parsed back with |eval()|.
+ {expr} type result ~
+ String 'string'
+ Number 123
+ Float 123.123456 or 1.123456e8 or
+ `str2float('inf')`
+ Funcref `function('name')`
+ Blob 0z00112233.44556677.8899
+ List [item, item]
+ Dictionary {key: value, key: value}
+ Note that in String values the ' character is doubled.
+ Also see |strtrans()|.
+ Note 2: Output format is mostly compatible with YAML, except
+ for infinite and NaN floating-point values representations
+ which use |str2float()|. Strings are also dumped literally,
+ only single quote is escaped, which does not allow using YAML
+ for parsing back binary strings. |eval()| should always work for
+ strings and floats though and this is the only official
+ method, use |msgpackdump()| or |json_encode()| if you need to
+ share data with other application.
+
+ Can also be used as a |method|: >
+ mylist->string()
+
+strlen({string}) *strlen()*
+ The result is a Number, which is the length of the String
+ {string} in bytes.
+ If the argument is a Number it is first converted to a String.
+ For other types an error is given and zero is returned.
+ If you want to count the number of multibyte characters use
+ |strchars()|.
+ Also see |len()|, |strdisplaywidth()| and |strwidth()|.
+
+ Can also be used as a |method|: >
+ GetString()->strlen()
+
+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}.
+ When {chars} is present and TRUE then {len} is the number of
+ characters positions (composing characters are not counted
+ separately, thus "1" means one base character and any
+ following composing characters).
+ To count {start} as characters instead of bytes use
+ |strcharpart()|.
+
+ When bytes are selected which do not exist, this doesn't
+ result in an error, the bytes are simply omitted.
+ If {len} is missing, the copy continues from {start} till the
+ end of the {src}. >
+ strpart("abcdefg", 3, 2) == "de"
+ strpart("abcdefg", -2, 4) == "ab"
+ strpart("abcdefg", 5, 4) == "fg"
+ strpart("abcdefg", 3) == "defg"
+
+< Note: To get the first character, {start} must be 0. For
+ example, to get the character under the cursor: >
+ strpart(getline("."), col(".") - 1, 1, v:true)
+<
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ GetText()->strpart(5)
+
+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
+ the format specified in {format}.
+
+ The accepted {format} depends on your system, thus this is not
+ portable! See the manual page of the C function strptime()
+ for the format. Especially avoid "%c". The value of $TZ also
+ matters.
+
+ If the {timestring} cannot be parsed with {format} zero is
+ returned. If you do not know the format of {timestring} you
+ can try different {format} values until you get a non-zero
+ result.
+
+ See also |strftime()|.
+ Examples: >
+ :echo strptime("%Y %b %d %X", "1997 Apr 27 11:49:23")
+< 862156163 >
+ :echo strftime("%c", strptime("%y%m%d %T", "970427 11:53:55"))
+< Sun Apr 27 11:53:55 1997 >
+ :echo strftime("%c", strptime("%Y%m%d%H%M%S", "19970427115355") + 3600)
+< Sun Apr 27 12:53:55 1997
+
+ Can also be used as a |method|: >
+ GetFormat()->strptime(timestring)
+<
+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}.
+ When {start} is specified, matches beyond this index are
+ ignored. This can be used to find a match before a previous
+ match: >
+ :let lastcomma = strridx(line, ",")
+ :let comma2 = strridx(line, ",", lastcomma - 1)
+< The search is done case-sensitive.
+ For pattern searches use |match()|.
+ -1 is returned if the {needle} does not occur in {haystack}.
+ If the {needle} is empty the length of {haystack} is returned.
+ See also |stridx()|. Examples: >
+ :echo strridx("an angry armadillo", "an") 3
+< *strrchr()*
+ When used with a single character it works similar to the C
+ function strrchr().
+
+ Can also be used as a |method|: >
+ GetHaystack()->strridx(needle)
+
+strtrans({string}) *strtrans()*
+ The result is a String, which is {string} with all unprintable
+ characters translated into printable characters |'isprint'|.
+ Like they are shown in a window. Example: >
+ echo strtrans(@a)
+< This displays a newline in register a as "^@" instead of
+ starting a new line.
+
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ GetString()->strtrans()
+
+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
+ cell, alternatively use |strdisplaywidth()|.
+ When {string} contains characters with East Asian Width Class
+ Ambiguous, this function's return value depends on 'ambiwidth'.
+ Returns zero on error.
+ Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
+
+ Can also be used as a |method|: >
+ GetString()->strwidth()
+
+submatch({nr} [, {list}]) *submatch()* *E935*
+ Only for an expression in a |:substitute| command or
+ substitute() function.
+ Returns the {nr}'th submatch of the matched text. When {nr}
+ is 0 the whole matched text is returned.
+ Note that a NL in the string can stand for a line break of a
+ multi-line match or a NUL character in the text.
+ Also see |sub-replace-expression|.
+
+ If {list} is present and non-zero then submatch() returns
+ a list of strings, similar to |getline()| with two arguments.
+ NL characters in the text represent NUL characters in the
+ text.
+ Only returns more than one item for |:substitute|, inside
+ |substitute()| this list will always contain one or zero
+ items, since there are no real line breaks.
+
+ When substitute() is used recursively only the submatches in
+ the current (deepest) call can be obtained.
+
+ Returns an empty string or list on error.
+
+ Examples: >
+ :s/\d\+/\=submatch(0) + 1/
+ :echo substitute(text, '\d\+', '\=submatch(0) + 1', '')
+< This finds the first number in the line and adds one to it.
+ A line break is included as a newline character.
+
+ Can also be used as a |method|: >
+ GetNr()->submatch()
+
+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}.
+ When {flags} is "g", all matches of {pat} in {string} are
+ replaced. Otherwise {flags} should be "".
+
+ This works like the ":substitute" command (without any flags).
+ But the matching with {pat} is always done like the 'magic'
+ option is set and 'cpoptions' is empty (to make scripts
+ portable). 'ignorecase' is still relevant, use |/\c| or |/\C|
+ if you want to ignore or match case and ignore 'ignorecase'.
+ 'smartcase' is not used. See |string-match| for how {pat} is
+ used.
+
+ A "~" in {sub} is not replaced with the previous {sub}.
+ Note that some codes in {sub} have a special meaning
+ |sub-replace-special|. For example, to replace something with
+ "\n" (two characters), use "\\\\n" or '\\n'.
+
+ When {pat} does not match in {string}, {string} is returned
+ unmodified.
+
+ Example: >
+ :let &path = substitute(&path, ",\\=[^,]*$", "", "")
+< This removes the last component of the 'path' option. >
+ :echo substitute("testing", ".*", "\\U\\0", "")
+< results in "TESTING".
+
+ When {sub} starts with "\=", the remainder is interpreted as
+ an expression. See |sub-replace-expression|. Example: >
+ :echo substitute(s, '%\(\x\x\)',
+ \ '\=nr2char("0x" .. submatch(1))', 'g')
+
+< When {sub} is a Funcref that function is called, with one
+ optional argument. Example: >
+ :echo substitute(s, '%\(\x\x\)', SubNr, 'g')
+< The optional argument is a list which contains the whole
+ matched string and up to nine submatches, like what
+ |submatch()| returns. Example: >
+ :echo substitute(s, '%\(\x\x\)', {m -> '0x' .. m[1]}, 'g')
+
+< Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ GetString()->substitute(pat, sub, flags)
+
+swapinfo({fname}) *swapinfo()*
+ The result is a dictionary, which holds information about the
+ swapfile {fname}. The available fields are:
+ version Vim version
+ user user name
+ host host name
+ fname original file name
+ pid PID of the Vim process that created the swap
+ file
+ mtime last modification time in seconds
+ inode Optional: INODE number of the file
+ dirty 1 if file was modified, 0 if not
+ In case of failure an "error" item is added with the reason:
+ Cannot open file: file not found or in accessible
+ Cannot read file: cannot read first block
+ Not a swap file: does not contain correct block ID
+ Magic number mismatch: Info in first block is invalid
+
+ Can also be used as a |method|: >
+ GetFilename()->swapinfo()
+
+swapname({buf}) *swapname()*
+ The result is the swap file path of the buffer {buf}.
+ For the use of {buf}, see |bufname()| above.
+ If buffer {buf} is the current buffer, the result is equal to
+ |:swapname| (unless there is no swap file).
+ If buffer {buf} has no swap file, returns an empty string.
+
+ Can also be used as a |method|: >
+ GetBufname()->swapname()
+
+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.
+ The syntax ID can be used with |synIDattr()| and
+ |synIDtrans()| to obtain syntax information about text.
+
+ {col} is 1 for the leftmost column, {lnum} is 1 for the first
+ line. 'synmaxcol' applies, in a longer line zero is returned.
+ Note that when the position is after the last character,
+ that's where the cursor can be in Insert mode, synID() returns
+ zero. {lnum} is used like with |getline()|.
+
+ When {trans} is |TRUE|, transparent items are reduced to the
+ item that they reveal. This is useful when wanting to know
+ the effective color. When {trans} is |FALSE|, the transparent
+ item is returned. This is useful when wanting to know which
+ syntax item is effective (e.g. inside parens).
+ Warning: This function can be very slow. Best speed is
+ obtained by going through the file in forward direction.
+
+ Returns zero on error.
+
+ Example (echoes the name of the syntax item under the cursor): >
+ :echo synIDattr(synID(line("."), col("."), 1), "name")
+<
+
+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
+ about a syntax item.
+ {mode} can be "gui", "cterm" or "term", to get the attributes
+ for that mode. When {mode} is omitted, or an invalid value is
+ used, the attributes for the currently active highlighting are
+ used (GUI, cterm or term).
+ Use synIDtrans() to follow linked highlight groups.
+ {what} result
+ "name" the name of the syntax item
+ "fg" foreground color (GUI: color name used to set
+ the color, cterm: color number as a string,
+ term: empty string)
+ "bg" background color (as with "fg")
+ "font" font name (only available in the GUI)
+ |highlight-font|
+ "sp" special color (as with "fg") |highlight-guisp|
+ "fg#" like "fg", but for the GUI and the GUI is
+ running the name in "#RRGGBB" form
+ "bg#" like "fg#" for "bg"
+ "sp#" like "fg#" for "sp"
+ "bold" "1" if bold
+ "italic" "1" if italic
+ "reverse" "1" if reverse
+ "inverse" "1" if inverse (= reverse)
+ "standout" "1" if standout
+ "underline" "1" if underlined
+ "undercurl" "1" if undercurled
+ "underdouble" "1" if double underlined
+ "underdotted" "1" if dotted underlined
+ "underdashed" "1" if dashed underlined
+ "strikethrough" "1" if struckthrough
+
+ Example (echoes the color of the syntax item under the
+ cursor): >
+ :echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg")
+<
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
+
+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
+ highlight the character. Highlight links given with
+ ":highlight link" are followed.
+
+ Returns zero on error.
+
+ Can also be used as a |method|: >
+ :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
+
+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
+ position {lnum} and {col} is not part of a concealable
+ region, 1 if it is. {lnum} is used like with |getline()|.
+ 2. The second item in the list is a string. If the first item
+ is 1, the second item contains the text which will be
+ displayed in place of the concealed text, depending on the
+ current setting of 'conceallevel' and 'listchars'.
+ 3. The third and final item in the list is a number
+ representing the specific syntax region matched in the
+ line. When the character is not concealed the value is
+ zero. This allows detection of the beginning of a new
+ concealable region if there are two consecutive regions
+ with the same replacement character. For an example, if
+ the text is "123456" and both "23" and "45" are concealed
+ and replaced by the character "X", then:
+ call returns ~
+ synconcealed(lnum, 1) [0, '', 0]
+ synconcealed(lnum, 2) [1, 'X', 1]
+ synconcealed(lnum, 3) [1, 'X', 1]
+ synconcealed(lnum, 4) [1, 'X', 2]
+ synconcealed(lnum, 5) [1, 'X', 2]
+ synconcealed(lnum, 6) [0, '', 0]
+
+
+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
+ used like with |getline()|. Each item in the List is an ID
+ like what |synID()| returns.
+ The first item in the List is the outer region, following are
+ items contained in that one. The last one is what |synID()|
+ returns, unless not the whole item is highlighted or it is a
+ transparent item.
+ This function is useful for debugging a syntax file.
+ Example that shows the syntax stack under the cursor: >
+ for id in synstack(line("."), col("."))
+ echo synIDattr(id, "name")
+ endfor
+< When the position specified with {lnum} and {col} is invalid
+ an empty list is returned. The position just after the last
+ character in a line and the first column in an empty line are
+ valid positions.
+
+system({cmd} [, {input}]) *system()* *E677*
+ Gets the output of {cmd} as a |string| (|systemlist()| returns
+ a |List|) and sets |v:shell_error| to the error code.
+ {cmd} is treated as in |jobstart()|:
+ If {cmd} is a List it runs directly (no 'shell').
+ If {cmd} is a String it runs in the 'shell', like this: >
+ :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
+
+< Not to be used for interactive commands.
+
+ Result is a String, filtered to avoid platform-specific quirks:
+ - <CR><NL> is replaced with <NL>
+ - NUL characters are replaced with SOH (0x01)
+
+ Example: >
+ :echo system(['ls', expand('%:h')])
+
+< If {input} is a string it is written to a pipe and passed as
+ stdin to the command. The string is written as-is, line
+ separators are not changed.
+ If {input} is a |List| it is written to the pipe as
+ |writefile()| does with {binary} set to "b" (i.e. with
+ a newline between each list item, and newlines inside list
+ items converted to NULs).
+ When {input} is given and is a valid buffer id, the content of
+ the buffer is written to the file line by line, each line
+ terminated by NL (and NUL where the text has NL).
+ *E5677*
+ Note: system() cannot write to or read from backgrounded ("&")
+ shell commands, e.g.: >
+ :echo system("cat - &", "foo")
+< which is equivalent to: >
+ $ echo foo | bash -c 'cat - &'
+< The pipes are disconnected (unless overridden by shell
+ redirection syntax) before input can reach it. Use
+ |jobstart()| instead.
+
+ Note: Use |shellescape()| or |::S| with |expand()| or
+ |fnamemodify()| to escape special characters in a command
+ argument. 'shellquote' and 'shellxquote' must be properly
+ configured. Example: >
+ :echo system('ls '..shellescape(expand('%:h')))
+ :echo system('ls '..expand('%:h:S'))
+
+< Unlike ":!cmd" there is no automatic check for changed files.
+ Use |:checktime| to force a check.
+
+ Can also be used as a |method|: >
+ :echo GetCmd()->system()
+
+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
+ is the same as |readfile()| will output with {binary} argument
+ set to "b", except that a final newline is not preserved,
+ unless {keepempty} is non-zero.
+ Note that on MS-Windows you may get trailing CR characters.
+
+ To see the difference between "echo hello" and "echo -n hello"
+ use |system()| and |split()|: >
+ echo split(system('echo hello'), '\n', 1)
+<
+ Returns an empty string on error.
+
+ Can also be used as a |method|: >
+ :echo GetCmd()->systemlist()
+
+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.
+ {arg} specifies the number of the tab page to be used. When
+ omitted the current tab page is used.
+ When {arg} is invalid the number zero is returned.
+ To get a list of all buffers in all tabs use this: >
+ let buflist = []
+ for i in range(tabpagenr('$'))
+ call extend(buflist, tabpagebuflist(i + 1))
+ endfor
+< Note that a buffer may appear in more than one window.
+
+ Can also be used as a |method|: >
+ GetTabpage()->tabpagebuflist()
+
+tabpagenr([{arg}]) *tabpagenr()*
+ The result is a Number, which is the number of the current
+ tab page. The first tab page has number 1.
+
+ The optional argument {arg} supports the following values:
+ $ the number of the last tab page (the tab page
+ count).
+ # the number of the last accessed tab page
+ (where |g<Tab>| goes to). If there is no
+ previous tab page, 0 is returned.
+ The number can be used with the |:tab| command.
+
+ Returns zero on error.
+
+tabpagewinnr({tabarg} [, {arg}]) *tabpagewinnr()*
+ Like |winnr()| but for tab page {tabarg}.
+ {tabarg} specifies the number of tab page to be used.
+ {arg} is used like with |winnr()|:
+ - When omitted the current window number is returned. This is
+ the window which will be used when going to this tab page.
+ - When "$" the number of windows is returned.
+ - When "#" the previous window nr is returned.
+ Useful examples: >
+ tabpagewinnr(1) " current window of tab page 1
+ tabpagewinnr(4, '$') " number of windows in tab page 4
+< When {tabarg} is invalid zero is returned.
+
+ Can also be used as a |method|: >
+ GetTabpage()->tabpagewinnr()
+<
+ *tagfiles()*
+tagfiles() Returns a |List| with the file names used to search for tags
+ for the current buffer. This is the 'tags' option expanded.
+
+
+taglist({expr} [, {filename}]) *taglist()*
+ Returns a |List| of tags matching the regular expression {expr}.
+
+ If {filename} is passed it is used to prioritize the results
+ in the same way that |:tselect| does. See |tag-priority|.
+ {filename} should be the full path of the file.
+
+ Each list item is a dictionary with at least the following
+ entries:
+ name Name of the tag.
+ filename Name of the file where the tag is
+ defined. It is either relative to the
+ current directory or a full path.
+ cmd Ex command used to locate the tag in
+ the file.
+ kind Type of the tag. The value for this
+ entry depends on the language specific
+ kind values. Only available when
+ using a tags file generated by
+ Universal/Exuberant ctags or hdrtag.
+ static A file specific tag. Refer to
+ |static-tag| for more information.
+ More entries may be present, depending on the content of the
+ tags file: access, implementation, inherits and signature.
+ Refer to the ctags documentation for information about these
+ fields. For C code the fields "struct", "class" and "enum"
+ may appear, they give the name of the entity the tag is
+ contained in.
+
+ The ex-command "cmd" can be either an ex search pattern, a
+ line number or a line number followed by a byte number.
+
+ If there are no matching tags, then an empty list is returned.
+
+ To get an exact tag match, the anchors '^' and '$' should be
+ used in {expr}. This also make the function work faster.
+ Refer to |tag-regexp| for more information about the tag
+ search regular expression pattern.
+
+ Refer to |'tags'| for information about how the tags file is
+ located by Vim. Refer to |tags-file-format| for the format of
+ the tags file generated by the different ctags tools.
+
+ Can also be used as a |method|: >
+ GetTagpattern()->taglist()
+
+tempname() *tempname()* *temp-file-name*
+ The result is a String, which is the name of a file that
+ doesn't exist. It can be used for a temporary file. Example: >
+ :let tmpfile = tempname()
+ :exe "redir > " .. tmpfile
+< For Unix, the file will be in a private directory |tempfile|.
+ For MS-Windows forward slashes are used when the 'shellslash'
+ option is set or when 'shellcmdflag' starts with '-'.
+
+termopen({cmd} [, {opts}]) *termopen()*
+ Spawns {cmd} in a new pseudo-terminal session connected
+ to the current (unmodified) buffer. Parameters and behavior
+ are the same as |jobstart()| except "pty", "width", "height",
+ and "TERM" are ignored: "height" and "width" are taken from
+ the current window.
+ Returns the same values as |jobstart()|.
+
+ Terminal environment is initialized as in ||jobstart-env|,
+ except $TERM is set to "xterm-256color". Full behavior is
+ described in |terminal|.
+
+tan({expr}) *tan()*
+ Return the tangent of {expr}, measured in radians, as a |Float|
+ in the range [-inf, inf].
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo tan(10)
+< 0.648361 >
+ :echo tan(-4.01)
+< -1.181502
+
+ Can also be used as a |method|: >
+ Compute()->tan()
+
+tanh({expr}) *tanh()*
+ Return the hyperbolic tangent of {expr} as a |Float| in the
+ range [-1, 1].
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo tanh(0.5)
+< 0.462117 >
+ :echo tanh(-1)
+< -0.761594
+
+ Can also be used as a |method|: >
+ Compute()->tanh()
+<
+ *timer_info()*
+timer_info([{id}])
+ Return a list with information about timers.
+ When {id} is given only information about this timer is
+ returned. When timer {id} does not exist an empty list is
+ returned.
+ When {id} is omitted information about all timers is returned.
+
+ For each timer the information is stored in a |Dictionary| with
+ these items:
+ "id" the timer ID
+ "time" time the timer was started with
+ "repeat" number of times the timer will still fire;
+ -1 means forever
+ "callback" the callback
+
+ Can also be used as a |method|: >
+ GetTimer()->timer_info()
+<
+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
+ the callback to be invoked almost immediately if enough time
+ has passed.
+
+ Pausing a timer is useful to avoid the callback to be called
+ for a short time.
+
+ If {paused} evaluates to a non-zero Number or a non-empty
+ String, then the timer is paused, otherwise it is unpaused.
+ See |non-zero-arg|.
+
+ Can also be used as a |method|: >
+ GetTimer()->timer_pause(1)
+<
+ *timer_start()* *timer* *timers*
+timer_start({time}, {callback} [, {options}])
+ Create a timer and return the timer ID.
+
+ {time} is the waiting time in milliseconds. This is the
+ minimum time before invoking the callback. When the system is
+ busy or Vim is not waiting for input the time will be longer.
+
+ {callback} is the function to call. It can be the name of a
+ function or a |Funcref|. It is called with one argument, which
+ is the timer ID. The callback is only invoked when Vim is
+ waiting for input.
+
+ {options} is a dictionary. Supported entries:
+ "repeat" Number of times to repeat the callback.
+ -1 means forever. Default is 1.
+ If the timer causes an error three times in a
+ row the repeat is cancelled.
+
+ Returns -1 on error.
+
+ Example: >
+ func MyHandler(timer)
+ echo 'Handler called'
+ endfunc
+ let timer = timer_start(500, 'MyHandler',
+ \ {'repeat': 3})
+< This invokes MyHandler() three times at 500 msec intervals.
+
+ Can also be used as a |method|: >
+ GetMsec()->timer_start(callback)
+
+< Not available in the |sandbox|.
+
+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.
+
+ Can also be used as a |method|: >
+ GetTimer()->timer_stop()
+<
+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.
+
+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.
+
+ Can also be used as a |method|: >
+ GetText()->tolower()
+
+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.
+
+ Can also be used as a |method|: >
+ GetText()->toupper()
+
+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
+ position in the {tostr} string. Thus the first character in
+ {fromstr} is translated into the first character in {tostr}
+ and so on. Exactly like the unix "tr" command.
+ This code also deals with multibyte characters properly.
+
+ Returns an empty string on error.
+
+ Examples: >
+ echo tr("hello there", "ht", "HT")
+< returns "Hello THere" >
+ echo tr("<blob>", "<>", "{}")
+< returns "{blob}"
+
+ Can also be used as a |method|: >
+ GetText()->tr(from, to)
+
+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}.
+ If {mask} is not given, {mask} is all characters up to 0x20,
+ which includes Tab, space, NL and CR, plus the non-breaking
+ space character 0xa0.
+ The optional {dir} argument specifies where to remove the
+ characters:
+ 0 remove from the beginning and end of {text}
+ 1 remove only at the beginning of {text}
+ 2 remove only at the end of {text}
+ When omitted both ends are trimmed.
+ This function deals with multibyte characters properly.
+ Returns an empty string on error.
+
+ Examples: >
+ echo trim(" some text ")
+< returns "some text" >
+ echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") .. "_TAIL"
+< returns "RESERVE_TAIL" >
+ echo trim("rm<Xrm<>X>rrm", "rm<>")
+< returns "Xrm<>X" (characters in the middle are not removed) >
+ echo trim(" vim ", " ", 2)
+< returns " vim"
+
+ Can also be used as a |method|: >
+ GetText()->trim()
+
+trunc({expr}) *trunc()*
+ Return the largest integral value with magnitude less than or
+ equal to {expr} as a |Float| (truncate towards zero).
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ echo trunc(1.456)
+< 1.0 >
+ echo trunc(-5.456)
+< -5.0 >
+ echo trunc(4.0)
+< 4.0
+
+ Can also be used as a |method|: >
+ Compute()->trunc()
+
+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
+ v:t_ variable that has the value:
+ Number: 0 (|v:t_number|)
+ String: 1 (|v:t_string|)
+ Funcref: 2 (|v:t_func|)
+ List: 3 (|v:t_list|)
+ Dictionary: 4 (|v:t_dict|)
+ Float: 5 (|v:t_float|)
+ Boolean: 6 (|v:true| and |v:false|)
+ Null: 7 (|v:null|)
+ Blob: 10 (|v:t_blob|)
+ For backward compatibility, this method can be used: >
+ :if type(myvar) == type(0)
+ :if type(myvar) == type("")
+ :if type(myvar) == type(function("tr"))
+ :if type(myvar) == type([])
+ :if type(myvar) == type({})
+ :if type(myvar) == type(0.0)
+ :if type(myvar) == type(v:true)
+< In place of checking for |v:null| type it is better to check
+ for |v:null| directly as it is the only value of this type: >
+ :if myvar is v:null
+< To check if the v:t_ variables exist use this: >
+ :if exists('v:t_number')
+
+< Can also be used as a |method|: >
+ mylist->type()
+
+undofile({name}) *undofile()*
+ Return the name of the undo file that would be used for a file
+ with name {name} when writing. This uses the 'undodir'
+ option, finding directories that exist. It does not check if
+ the undo file exists.
+ {name} is always expanded to the full path, since that is what
+ is used internally.
+ If {name} is empty undofile() returns an empty string, since a
+ buffer without a file name will not write an undo file.
+ Useful in combination with |:wundo| and |:rundo|.
+
+ Can also be used as a |method|: >
+ GetFilename()->undofile()
+
+undotree() *undotree()*
+ Return the current state of the undo tree in a dictionary with
+ the following items:
+ "seq_last" The highest undo sequence number used.
+ "seq_cur" The sequence number of the current position in
+ the undo tree. This differs from "seq_last"
+ when some changes were undone.
+ "time_cur" Time last used for |:earlier| and related
+ commands. Use |strftime()| to convert to
+ something readable.
+ "save_last" Number of the last file write. Zero when no
+ write yet.
+ "save_cur" Number of the current position in the undo
+ tree.
+ "synced" Non-zero when the last undo block was synced.
+ This happens when waiting from input from the
+ user. See |undo-blocks|.
+ "entries" A list of dictionaries with information about
+ undo blocks.
+
+ The first item in the "entries" list is the oldest undo item.
+ Each List item is a |Dictionary| with these items:
+ "seq" Undo sequence number. Same as what appears in
+ |:undolist|.
+ "time" Timestamp when the change happened. Use
+ |strftime()| to convert to something readable.
+ "newhead" 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.
+ "curhead" 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.
+ "save" 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.
+ "alt" Alternate entry. This is again a List of undo
+ blocks. Each item may again have an "alt"
+ item.
+
+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
+ to remain unmodified make a copy first: >
+ :let newlist = uniq(copy(mylist))
+< The default compare function uses the string representation of
+ each item. For the use of {func} and {dict} see |sort()|.
+
+ Returns zero if {list} is not a |List|.
+
+ Can also be used as a |method|: >
+ mylist->uniq()
+
+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|.
+
+ Can also be used as a |method|: >
+ mydict->values()
+
+virtcol({expr}) *virtcol()*
+ The result is a Number, which is the screen column of the file
+ position given with {expr}. That is, the last screen position
+ occupied by the character at that position, when the screen
+ would be of unlimited width. When there is a <Tab> at the
+ position, the returned Number will be the column at the end of
+ the <Tab>. For example, for a <Tab> in column 1, with 'ts'
+ set to 8, it returns 8. |conceal| is ignored.
+ For the byte position use |col()|.
+ For the use of {expr} see |col()|.
+ When 'virtualedit' is used {expr} can be [lnum, col, off], where
+ "off" is the offset in screen columns from the start of the
+ character. E.g., a position within a <Tab> or after the last
+ character. When "off" is omitted zero is used.
+ When Virtual editing is active in the current mode, a position
+ beyond the end of the line can be returned. |'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.
+ Note that only marks in the current file can be used.
+ Examples: >
+ virtcol(".") with text "foo^Lbar", with cursor on the "^L", returns 5
+ virtcol("$") with text "foo^Lbar", returns 9
+ virtcol("'t") with text " there", with 't at 'h', returns 6
+< The first column is 1. 0 is returned for an error.
+ A more advanced example that echoes the maximum length of
+ all lines: >
+ echo max(map(range(1, line('$')), "virtcol([v:val, '$'])"))
+
+< Can also be used as a |method|: >
+ GetPos()->virtcol()
+
+visualmode([{expr}]) *visualmode()*
+ The result is a String, which describes the last Visual mode
+ used in the current buffer. Initially it returns an empty
+ string, but once Visual mode has been used, it returns "v",
+ "V", or "<CTRL-V>" (a single CTRL-V character) for
+ character-wise, line-wise, or block-wise Visual mode
+ respectively.
+ Example: >
+ :exe "normal " .. visualmode()
+< This enters the same Visual mode as before. It is also useful
+ in scripts if you wish to act differently depending on the
+ Visual mode that was used.
+ If Visual mode is active, use |mode()| to get the Visual mode
+ (e.g., in a |:vmap|).
+ If {expr} is supplied and it evaluates to a non-zero Number or
+ a non-empty String, then the Visual mode will be cleared and
+ the old value is returned. See |non-zero-arg|.
+
+wait({timeout}, {condition} [, {interval}]) *wait()*
+ Waits until {condition} evaluates to |TRUE|, where {condition}
+ is a |Funcref| or |string| containing an expression.
+
+ {timeout} is the maximum waiting time in milliseconds, -1
+ means forever.
+
+ Condition is evaluated on user events, internal events, and
+ every {interval} milliseconds (default: 200).
+
+ Returns a status integer:
+ 0 if the condition was satisfied before timeout
+ -1 if the timeout was exceeded
+ -2 if the function was interrupted (by |CTRL-C|)
+ -3 if an error occurred
+
+wildmenumode() *wildmenumode()*
+ Returns |TRUE| when the wildmenu is active and |FALSE|
+ otherwise. See 'wildmenu' and 'wildmode'.
+ This can be used in mappings to handle the 'wildcharm' option
+ gracefully. (Makes only sense with |mapmode-c| mappings).
+
+ For example to make <c-j> work like <down> in wildmode, use: >
+ :cnoremap <expr> <C-j> wildmenumode() ? "\<Down>\<Tab>" : "\<c-j>"
+<
+ (Note, this needs the 'wildcharm' option set appropriately).
+
+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,
+ without triggering autocommands or changing directory. When
+ executing {command} autocommands will be triggered, this may
+ have unexpected side effects. Use |:noautocmd| if needed.
+ Example: >
+ call win_execute(winid, 'syntax enable')
+<
+ Can also be used as a |method|, the base is passed as the
+ second argument: >
+ GetCommand()->win_execute(winid)
+
+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.
+
+ Can also be used as a |method|: >
+ GetBufnr()->win_findbuf()
+
+win_getid([{win} [, {tab}]]) *win_getid()*
+ Get the |window-ID| for the specified window.
+ When {win} is missing use the current window.
+ With {win} this is the window number. The top window has
+ number 1.
+ Without {tab} use the current tab, otherwise the tab with
+ number {tab}. The first tab has number one.
+ Return zero if the window cannot be found.
+
+ Can also be used as a |method|: >
+ GetWinnr()->win_getid()
+
+win_gettype([{nr}]) *win_gettype()*
+ Return the type of the window:
+ "autocmd" autocommand window. Temporary window
+ used to execute autocommands.
+ "command" command-line window |cmdwin|
+ (empty) normal window
+ "loclist" |location-list-window|
+ "popup" floating window |api-floatwin|
+ "preview" preview window |preview-window|
+ "quickfix" |quickfix-window|
+ "unknown" window {nr} not found
+
+ When {nr} is omitted return the type of the current window.
+ When {nr} is given return the type of this window by number or
+ |window-ID|.
+
+ Also see the 'buftype' option.
+
+ Can also be used as a |method|: >
+ GetWinid()->win_gettype()
+<
+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.
+
+ Can also be used as a |method|: >
+ GetWinid()->win_gotoid()
+
+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.
+
+ Can also be used as a |method|: >
+ GetWinid()->win_id2tabwin()
+
+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.
+
+ Can also be used as a |method|: >
+ GetWinid()->win_id2win()
+
+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}
+ can be a window number or |window-ID|. A positive {offset}
+ moves right and a negative {offset} moves left. Moving a
+ window's vertical separator will change the width of the
+ window and the width of other windows adjacent to the vertical
+ separator. The magnitude of movement may be smaller than
+ specified (e.g., as a consequence of maintaining
+ 'winminwidth'). Returns TRUE if the window can be found and
+ FALSE otherwise.
+ This will fail for the rightmost window and a full-width
+ window, since it has no separator on the right.
+
+ Can also be used as a |method|: >
+ GetWinnr()->win_move_separator(offset)
+
+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
+ window number or |window-ID|. A positive {offset} moves down
+ and a negative {offset} moves up. Moving a window's status
+ line will change the height of the window and the height of
+ other windows adjacent to the status line. The magnitude of
+ movement may be smaller than specified (e.g., as a consequence
+ of maintaining 'winminheight'). Returns TRUE if the window can
+ be found and FALSE otherwise.
+
+ Can also be used as a |method|: >
+ GetWinnr()->win_move_statusline(offset)
+
+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
+ [1, 1], unless there is a tabline, then it is [2, 1].
+ {nr} can be the window number or the |window-ID|. Use zero
+ for the current window.
+ Returns [0, 0] if the window cannot be found in the current
+ tabpage.
+
+ Can also be used as a |method|: >
+ GetWinid()->win_screenpos()
+<
+win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
+ Move the window {nr} to a new split of the window {target}.
+ This is similar to moving to {target}, creating a new window
+ using |:split| but having the same contents as window {nr}, and
+ then closing {nr}.
+
+ Both {nr} and {target} can be window numbers or |window-ID|s.
+ Both must be in the current tab page.
+
+ Returns zero for success, non-zero for failure.
+
+ {options} is a |Dictionary| with the following optional entries:
+ "vertical" When TRUE, the split is created vertically,
+ like with |:vsplit|.
+ "rightbelow" When TRUE, the split is made below or to the
+ right (if vertical). When FALSE, it is done
+ above or to the left (if vertical). When not
+ present, the values of 'splitbelow' and
+ 'splitright' are used.
+
+ Can also be used as a |method|: >
+ GetWinid()->win_splitmove(target)
+<
+ *winbufnr()*
+winbufnr({nr}) The result is a Number, which is the number of the buffer
+ associated with window {nr}. {nr} can be the window number or
+ the |window-ID|.
+ When {nr} is zero, the number of the buffer in the current
+ window is returned.
+ When window {nr} doesn't exist, -1 is returned.
+ Example: >
+ :echo "The file in the current window is " .. bufname(winbufnr(0))
+<
+ Can also be used as a |method|: >
+ FindWindow()->winbufnr()->bufname()
+<
+ *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.
+
+ *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.
+
+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|.
+ When {nr} is zero, the height of the current window is
+ returned. When window {nr} doesn't exist, -1 is returned.
+ An existing window always has a height of zero or more.
+ This excludes any window toolbar line.
+ Examples: >
+ :echo "The current window has " .. winheight(0) .. " lines."
+
+< Can also be used as a |method|: >
+ GetWinid()->winheight()
+<
+winlayout([{tabnr}]) *winlayout()*
+ The result is a nested List containing the layout of windows
+ in a tabpage.
+
+ Without {tabnr} use the current tabpage, otherwise the tabpage
+ with number {tabnr}. If the tabpage {tabnr} is not found,
+ returns an empty list.
+
+ For a leaf window, it returns:
+ ['leaf', {winid}]
+ For horizontally split windows, which form a column, it
+ returns:
+ ['col', [{nested list of windows}]]
+ For vertically split windows, which form a row, it returns:
+ ['row', [{nested list of windows}]]
+
+ Example: >
+ " Only one window in the tab page
+ :echo winlayout()
+ ['leaf', 1000]
+ " Two horizontally split windows
+ :echo winlayout()
+ ['col', [['leaf', 1000], ['leaf', 1001]]]
+ " The second tab page, with three horizontally split
+ " windows, with two vertically split windows in the
+ " middle window
+ :echo winlayout(2)
+ ['col', [['leaf', 1002], ['row', [['leaf', 1003],
+ ['leaf', 1001]]], ['leaf', 1000]]]
+<
+ Can also be used as a |method|: >
+ GetTabnr()->winlayout()
+<
+ *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
+ the window. The first line is one.
+ If the cursor was moved the view on the file will be updated
+ first, this may cause a scroll.
+
+ *winnr()*
+winnr([{arg}]) The result is a Number, which is the number of the current
+ window. The top window has number 1.
+ Returns zero for a popup window.
+
+ The optional argument {arg} supports the following values:
+ $ the number of the last window (the window
+ count).
+ # the number of the last accessed window (where
+ |CTRL-W_p| goes to). If there is no previous
+ window or it is in another tab page 0 is
+ returned.
+ {N}j the number of the Nth window below the
+ current window (where |CTRL-W_j| goes to).
+ {N}k the number of the Nth window above the current
+ window (where |CTRL-W_k| goes to).
+ {N}h the number of the Nth window left of the
+ current window (where |CTRL-W_h| goes to).
+ {N}l the number of the Nth window right of the
+ current window (where |CTRL-W_l| goes to).
+ The number can be used with |CTRL-W_w| and ":wincmd w"
+ |:wincmd|.
+ When {arg} is invalid an error is given and zero is returned.
+ Also see |tabpagewinnr()| and |win_getid()|.
+ Examples: >
+ let window_count = winnr('$')
+ let prev_window = winnr('#')
+ let wnum = winnr('3k')
+
+< Can also be used as a |method|: >
+ GetWinval()->winnr()
+<
+ *winrestcmd()*
+winrestcmd() Returns a sequence of |:resize| commands that should restore
+ the current window sizes. Only works properly when no windows
+ are opened or closed and the current window and tab page is
+ unchanged.
+ Example: >
+ :let cmd = winrestcmd()
+ :call MessWithWindowSizes()
+ :exe cmd
+<
+ *winrestview()*
+winrestview({dict})
+ Uses the |Dictionary| returned by |winsaveview()| to restore
+ the view of the current window.
+ Note: The {dict} does not have to contain all values, that are
+ returned by |winsaveview()|. If values are missing, those
+ settings won't be restored. So you can use: >
+ :call winrestview({'curswant': 4})
+<
+ This will only set the curswant value (the column the cursor
+ wants to move on vertical movements) of the cursor to column 5
+ (yes, that is 5), while all other settings will remain the
+ same. This is useful, if you set the cursor position manually.
+
+ If you have changed the values the result is unpredictable.
+ If the window size changed the result won't be the same.
+
+ Can also be used as a |method|: >
+ GetView()->winrestview()
+<
+ *winsaveview()*
+winsaveview() Returns a |Dictionary| that contains information to restore
+ the view of the current window. Use |winrestview()| to
+ restore the view.
+ This is useful if you have a mapping that jumps around in the
+ buffer and you want to go back to the original view.
+ This does not save fold information. Use the 'foldenable'
+ option to temporarily switch off folding, so that folds are
+ not opened when moving around. This may have side effects.
+ The return value includes:
+ lnum cursor line number
+ col cursor column (Note: the first column
+ zero, as opposed to what getpos()
+ returns)
+ coladd cursor column offset for 'virtualedit'
+ curswant column for vertical movement
+ topline first line in the window
+ topfill filler lines, only in diff mode
+ leftcol first column displayed; only used when
+ 'wrap' is off
+ skipcol columns skipped
+ Note that no option values are saved.
+
+
+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|.
+ When {nr} is zero, the width of the current window is
+ returned. When window {nr} doesn't exist, -1 is returned.
+ An existing window always has a width of zero or more.
+ Examples: >
+ :echo "The current window has " .. winwidth(0) .. " columns."
+ :if winwidth(0) <= 50
+ : 50 wincmd |
+ :endif
+< For getting the terminal or screen size, see the 'columns'
+ option.
+
+ Can also be used as a |method|: >
+ GetWinid()->winwidth()
+
+wordcount() *wordcount()*
+ The result is a dictionary of byte/chars/word statistics for
+ the current buffer. This is the same info as provided by
+ |g_CTRL-G|
+ The return value includes:
+ bytes Number of bytes in the buffer
+ chars Number of chars in the buffer
+ words Number of words in the buffer
+ cursor_bytes Number of bytes before cursor position
+ (not in Visual mode)
+ cursor_chars Number of chars before cursor position
+ (not in Visual mode)
+ cursor_words Number of words before cursor position
+ (not in Visual mode)
+ visual_bytes Number of bytes visually selected
+ (only in Visual mode)
+ visual_chars Number of chars visually selected
+ (only in Visual mode)
+ visual_words Number of words visually selected
+ (only in Visual mode)
+
+
+ *writefile()*
+writefile({object}, {fname} [, {flags}])
+ 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
+ or Number.
+ When {flags} contains "b" then binary mode is used: There will
+ not be a NL after the last list item. An empty item at the
+ end does cause the last line in the file to end in a NL.
+
+ When {object} is a |Blob| write the bytes to file {fname}
+ unmodified.
+
+ When {flags} contains "a" then append mode is used, lines are
+ appended to the file: >
+ :call writefile(["foo"], "event.log", "a")
+ :call writefile(["bar"], "event.log", "a")
+<
+ When {flags} contains "S" fsync() call is not used, with "s"
+ it is used, 'fsync' option applies by default. No fsync()
+ means that writefile() will finish faster, but writes may be
+ left in OS buffers and not yet written to disk. Such changes
+ will disappear if system crashes before OS does writing.
+
+ All NL characters are replaced with a NUL character.
+ Inserting CR characters needs to be done before passing {list}
+ to writefile().
+ An existing file is overwritten, if possible.
+ When the write fails -1 is returned, otherwise 0. There is an
+ error message if the file can't be created or when writing
+ fails.
+ Also see |readfile()|.
+ To copy a file byte for byte: >
+ :let fl = readfile("foo", "b")
+ :call writefile(fl, "foocopy", "b")
+
+< Can also be used as a |method|: >
+ GetText()->writefile("thefile")
+
+xor({expr}, {expr}) *xor()*
+ Bitwise XOR on the two arguments. The arguments are converted
+ to a number. A List, Dict or Float argument causes an error.
+ Example: >
+ :let bits = xor(bits, 0x80)
+<
+ Can also be used as a |method|: >
+ :let bits = bits->xor(0x80)
+<
+==============================================================================
+3. Matching a pattern in a String *string-match*
+
+This is common between several functions. A regexp pattern as explained at
+|pattern| is normally used to find a match in the buffer lines. When a
+pattern is used to find a match in a String, almost everything works in the
+same way. The difference is that a String is handled like it is one line.
+When it contains a "\n" character, this is not seen as a line break for the
+pattern. It can be matched with a "\n" in the pattern, or with ".". Example:
+>
+ :let a = "aaaa\nxxxx"
+ :echo matchstr(a, "..\n..")
+ aa
+ xx
+ :echo matchstr(a, "a.x")
+ a
+ x
+
+Don't forget that "^" will only match at the first character of the String and
+"$" at the last character of the string. They don't match after or before a
+"\n".
+
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 953f097a92..b905f53db7 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -42,8 +42,6 @@ For inserting text see |insert.txt|.
of the line and [count]-1 more lines [into register
x]; synonym for "d$".
(not |linewise|)
- When the '#' flag is in 'cpoptions' the count is
- ignored.
{Visual}["x]x or *v_x* *v_d* *v_<Del>*
{Visual}["x]d or
@@ -355,14 +353,14 @@ CTRL-A Add [count] to the number or alphabetic character at
*v_CTRL-A*
{Visual}CTRL-A Add [count] to the number or alphabetic character in
- the highlighted text. {not in Vi}
+ the highlighted text.
*v_g_CTRL-A*
{Visual}g CTRL-A Add [count] to the number or alphabetic character in
the highlighted text. If several lines are
highlighted, each one will be incremented by an
additional [count] (so effectively creating a
- [count] incrementing sequence). {not in Vi}
+ [count] incrementing sequence).
For Example, if you have this list of numbers:
1. ~
1. ~
@@ -381,14 +379,14 @@ CTRL-X Subtract [count] from the number or alphabetic
*v_CTRL-X*
{Visual}CTRL-X Subtract [count] from the number or alphabetic
- character in the highlighted text. {not in Vi}
+ character in the highlighted text.
*v_g_CTRL-X*
{Visual}g CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. If several lines
are highlighted, each value will be decremented by an
additional [count] (so effectively creating a [count]
- decrementing sequence). {not in Vi}
+ decrementing sequence).
The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned
binary/octal/hexadecimal numbers and alphabetic characters.
@@ -585,7 +583,7 @@ attack or other people reading your file). When Vim exits the directory and
all files in it are deleted. When Vim has the setuid bit set this may cause
problems, the temp file is owned by the setuid user but the filter command
probably runs as the original user.
-Directory for temporary files is created in the first suitable directory of:
+Directory for temporary files is created in the first possible directory of:
Unix: $TMPDIR, /tmp, current-dir, $HOME.
Windows: $TMPDIR, $TMP, $TEMP, $USERPROFILE, current-dir.
@@ -635,6 +633,9 @@ Directory for temporary files is created in the first suitable directory of:
actually work differently. You can use `:&&` to keep
the flags.
+ *&-default*
+ Mapped to ":&&<CR>" by default. |default-mappings|
+
*g&*
g& Synonym for `:%s//~/&` (repeat last substitute with
last search pattern on all lines with the same flags).
@@ -906,7 +907,7 @@ Consider using a character like "@" or ":". There is no problem if the result
of the expression contains the separation character.
Examples: >
- :s@\n@\="\r" . expand("$HOME") . "\r"@
+ :s@\n@\="\r" .. expand("$HOME") .. "\r"@
This replaces an end-of-line with a new line containing the value of $HOME. >
s/E/\="\<Char-0x20ac>"/g
@@ -1018,7 +1019,7 @@ inside of strings can change! Also see 'softtabstop' option. >
in [range] (default: current line |cmdline-ranges|),
[into register x].
- *p* *put* *E353*
+ *p* *put* *E353* *E1240*
["x]p Put the text [from register x] after the cursor
[count] times.
@@ -1065,7 +1066,7 @@ inside of strings can change! Also see 'softtabstop' option. >
the command. You need to escape the '|' and '"'
characters to prevent them from terminating the
command. Example: >
- :put ='path' . \",/test\"
+ :put ='path' .. \",/test\"
< If there is no expression after '=', Vim uses the
previous expression. You can see it with ":dis =".
@@ -1118,11 +1119,15 @@ register. With blockwise selection it also depends on the size of the block
and whether the corners are on an existing character. (Implementation detail:
it actually works by first putting the register after the selection and then
deleting the selection.)
-The previously selected text is put in the unnamed register. If you want to
-put the same text into a Visual selection several times you need to use
-another register. E.g., yank the text to copy, Visually select the text to
-replace and use "0p . You can repeat this as many times as you like, the
-unnamed register will be changed each time.
+With |p| the previously selected text is put in the unnamed register (and
+possibly the selection and/or clipboard). This is useful if you want to put
+that text somewhere else. But you cannot repeat the same change.
+With |P| the unnamed register is not changed (and neither the selection or
+clipboard), you can repeat the same change. But the deleted text cannot be
+used. If you do need it you can use |p| with another register. E.g., yank
+the text to copy, Visually select the text to replace and use "0p . You can
+repeat this as many times as you like, and the unnamed register will be
+changed each time.
When you use a blockwise Visual mode command and yank only a single line into
a register, a paste on a visual selected area will paste that single line on
@@ -1205,7 +1210,7 @@ to their previous contents. When the '>' flag is present in 'cpoptions' then
a line break is inserted before the appended text.
5. Read-only registers ":, ". and "%
-These are '%', '#', ':' and '.'. You can use them only with the "p", "P",
+These are '%', ':' and '.'. You can use them only with the "p", "P",
and ":put" commands and with CTRL-R.
*quote_.* *quote.* *E29*
". Contains the last inserted text (the same as what is inserted
@@ -1584,11 +1589,10 @@ You can use the 'formatoptions' option to influence how Vim formats text.
can separate the option letters with commas for readability.
letter meaning when present in 'formatoptions' ~
-
*fo-t*
-t Auto-wrap text using textwidth
+t Auto-wrap text using 'textwidth'
*fo-c*
-c Auto-wrap comments using textwidth, inserting the current comment
+c Auto-wrap comments using 'textwidth', inserting the current comment
leader automatically.
*fo-r*
r Automatically insert the current comment leader after hitting
@@ -1597,6 +1601,9 @@ r Automatically insert the current comment leader after hitting
o Automatically insert the current comment leader after hitting 'o' or
'O' in Normal mode. In case comment is unwanted in a specific place
use CTRL-U to quickly delete it. |i_CTRL-U|
+ *fo-/*
+/ When 'o' is included: do not insert the comment leader for a //
+ comment after a statement, only when // is at the start of the line.
*fo-q*
q Allow formatting of comments with "gq".
Note that formatting will not change blank lines or lines containing
@@ -1659,8 +1666,8 @@ B When joining lines, don't insert a space between two multibyte
1 Don't break a line after a one-letter word. It's broken before it
instead (if possible).
*fo-]*
-] Respect textwidth rigorously. With this flag set, no line can be
- longer than textwidth, unless line-break-prohibition rules make this
+] Respect 'textwidth' rigorously. With this flag set, no line can be
+ longer than 'textwidth', unless line-break-prohibition rules make this
impossible. Mainly for CJK scripts and works only if 'encoding' is
"utf-8".
*fo-j*
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index e14427494d..d4bed7a5f2 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -229,12 +229,12 @@ prompt. >
call chansend(g:shell_job, [a:text, ''])
endfunc
- " Function handling output from the shell: Added above the prompt.
+ " Function handling output from the shell: Add it above the prompt.
func GotOutput(channel, msg, name)
call append(line("$") - 1, a:msg)
endfunc
- " Function handling the shell exit: close the window.
+ " Function handling the shell exits: close the window.
func JobExit(job, status, event)
quit!
endfunc
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 641cd93386..3f3f1e6ba3 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -67,12 +67,19 @@ CTRL-V Insert next non-digit literally. Up to three digits form the
decimal value of a single byte. The non-digit and the three
digits are not considered for mapping. This works the same
way as in Insert mode (see above, |i_CTRL-V|).
+ For special keys, the CTRL modifier may be included into the
+ key to produce a control character. If there is no control
+ character for the key then its |key-notation| is inserted.
Note: Under Windows CTRL-V is often mapped to paste text.
Use CTRL-Q instead then.
*c_CTRL-Q*
CTRL-Q Same as CTRL-V. But with some terminals it is used for
control flow, it doesn't work then.
+CTRL-SHIFT-V *c_CTRL-SHIFT-V* *c_CTRL-SHIFT-Q*
+CTRL-SHIFT-Q Works just like CTRL-V, but do not try to include the CTRL
+ modifier into the key.
+
*c_<Left>* *c_Left*
<Left> cursor left
*c_<Right>* *c_Right*
@@ -207,7 +214,7 @@ CTRL-\ e {expr} *c_CTRL-\_e*
Example: >
:cmap <F7> <C-\>eAppendSome()<CR>
:func AppendSome()
- :let cmd = getcmdline() . " Some()"
+ :let cmd = getcmdline() .. " Some()"
:" place the cursor on the )
:call setcmdpos(strlen(cmd))
:return cmd
@@ -679,7 +686,7 @@ If more line specifiers are given than required for the command, the first
one(s) will be ignored.
Line numbers may be specified with: *:range* *{address}*
- {number} an absolute line number
+ {number} an absolute line number *E1247*
. the current line *:.*
$ the last line in the file *:$*
% equal to 1,$ (the entire file) *:%*
@@ -870,7 +877,7 @@ Note: these are typed literally, they are not special keys!
When the match is with a file name, it is expanded to the
full path.
*:<sfile>* *<sfile>*
- <sfile> When executing a ":source" command, is replaced with the
+ <sfile> When executing a `:source` command, is replaced with the
file name of the sourced file. *E498*
When executing a function, is replaced with:
"function {function-name}[{lnum}]"
@@ -879,7 +886,7 @@ Note: these are typed literally, they are not special keys!
Note that filename-modifiers are useless when <sfile> is
used inside a function.
*:<slnum>* *<slnum>*
- <slnum> When executing a ":source" command, is replaced with the
+ <slnum> When executing a `:source` command, is replaced with the
line number. *E842*
When executing a function it's the line number relative to
the start of the function.
@@ -908,8 +915,7 @@ These modifiers can be given, in this order:
directory.
:. Reduce file name to be relative to current directory, if
possible. File name is unmodified if it is not below the
- current directory, but on MS-Windows the drive is removed if
- it is the current drive.
+ current directory.
For maximum shortness, use ":~:.".
:h Head of the file name (the last component and any separators
removed). Cannot be used with :e, :r or :t.
@@ -1059,8 +1065,7 @@ line contains the command as typed so far. The left column will show a
character that indicates the type of command-line being edited, see
|cmdwin-char|.
-Vim will be in Normal mode when the editor is opened, except when 'insertmode'
-is set.
+Vim will be in Normal mode when the editor is opened.
The height of the window is specified with 'cmdwinheight' (or smaller if there
is no room). The window is always full width and is positioned just above the
@@ -1131,8 +1136,8 @@ save the command-line history and read it back later.
If the 'wildchar' option is set to <Tab>, and the command-line window is used
for an Ex command, then two mappings will be added to use <Tab> for completion
in the command-line window, like this: >
- :imap <buffer> <Tab> <C-X><C-V>
- :nmap <buffer> <Tab> a<C-X><C-V>
+ :inoremap <buffer> <Tab> <C-X><C-V>
+ :nnoremap <buffer> <Tab> a<C-X><C-V>
Note that hitting <Tab> in Normal mode will do completion on the next
character. That way it works at the end of the line.
If you don't want these mappings, disable them with: >
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 21a34178b3..eb6d9b6dc9 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -6,9 +6,8 @@
Nvim *deprecated*
-The items listed below are "deprecated". This means they will be removed in
-the future. They should not be used in new scripts, and old scripts should be
-updated.
+The items listed below are deprecated: they will be removed in the future.
+They should not be used in new scripts, and old scripts should be updated.
==============================================================================
@@ -25,8 +24,12 @@ Commands ~
*:wviminfo* Deprecated alias to |:wshada| command.
Environment Variables ~
-*$NVIM_LISTEN_ADDRESS* Deprecated in favor of |--listen|. If both are given,
- $NVIM_LISTEN_ADDRESS is ignored.
+*$NVIM_LISTEN_ADDRESS* Deprecated way to
+ * set the server name (use |--listen| instead)
+ * get the server name (use |v:servername| instead)
+ * detect a parent Nvim (use |$NVIM| instead)
+ Unset by |terminal| and |jobstart()| (unless explicitly
+ given by the "env" option). Ignored if --listen is given.
Events ~
*BufCreate* Use |BufAdd| instead.
@@ -55,6 +58,10 @@ Functions ~
without stopping the job. Use chanclose(id) to close
any socket.
+Highlights ~
+
+*hl-VertSplit* Use |hl-WinSeparator| instead.
+
LSP Diagnostics ~
For each of the functions below, use the corresponding function in
@@ -99,11 +106,13 @@ internally and are no longer exposed as part of the API. Instead, use
*vim.lsp.diagnostic.set_underline()*
*vim.lsp.diagnostic.set_virtual_text()*
-LSP Utility Functions ~
+LSP Functions ~
*vim.lsp.util.diagnostics_to_items()* Use |vim.diagnostic.toqflist()| instead.
*vim.lsp.util.set_qflist()* Use |setqflist()| instead.
*vim.lsp.util.set_loclist()* Use |setloclist()| instead.
+*vim.lsp.buf_get_clients()* Use |vim.lsp.get_active_clients()| with
+ {buffer = bufnr} instead.
Lua ~
*vim.register_keystroke_callback()* Use |vim.on_key()| instead.
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt
index 82f279e781..77253e7831 100644
--- a/runtime/doc/dev_style.txt
+++ b/runtime/doc/dev_style.txt
@@ -48,22 +48,6 @@ The format of the symbol name should be `NVIM_<DIRECTORY>_<FILE>_H`.
<
-Names and Order of Includes ~
-
-Use standard order for readability and to avoid hidden dependencies: C
-library, other libraries' `.h`, your project's `.h`.
-
- In foo.c order your includes as follows:
-
- 1. C system files.
- 2. Other libraries' `.h` files.
- 3. Your project's `.h` files.
-
- Exception: sometimes, system-specific code needs conditional includes.
- Such code can put conditional includes after other includes. Of course,
- keep your system-specific code small and localized.
-
-
Constants ~
Do not use macros to define constants in headers.
@@ -545,12 +529,12 @@ it is for and how it should be used. >
};
If the field comments are short, you can also put them next to the field. But
-be consistent within one struct. >
+be consistent within one struct, and follow the necessary doxygen style. >
struct wininfo_S {
- WinInfo *wi_next; /// Next entry or NULL for last entry.
- WinInfo *wi_prev; /// Previous entry or NULL for first entry.
- Win *wi_win; /// Pointer to window that did the wi_fpos.
+ WinInfo *wi_next; ///< Next entry or NULL for last entry.
+ WinInfo *wi_prev; ///< Previous entry or NULL for first entry.
+ Win *wi_win; ///< Pointer to window that did the wi_fpos.
...
};
@@ -787,15 +771,6 @@ getting used to, but it is important that all project contributors follow the
style rules so that they can all read and understand everyone's code easily.
-Line Length ~
-
-Each line of text in your code should be at most 100 characters long.
-
-Exception: if a comment line contains an example command or a literal URL
-longer than 100 characters, that line may be longer than 100 characters for ease
-of cut and paste.
-
-
Non-ASCII Characters ~
Non-ASCII characters should be rare, and must use UTF-8 formatting.
@@ -814,11 +789,6 @@ example, `"\uFEFF"`, is the Unicode zero-width no-break space character, which
would be invisible if included in the source as straight UTF-8.
-Spaces vs. Tabs ~
-
-Use only spaces, and indent 2 spaces at a time. Do not use tabs in your code.
-
-
Function Declarations and Definitions ~
Return type on the same line as function name, parameters on the same line if
@@ -928,7 +898,7 @@ no name, assume a zero-length name. >
Conditionals ~
-Don't use spaces inside parentheses. Always use curly braces. >
+Don't use spaces inside parentheses. >
if (condition) { // no spaces inside parentheses
... // 2 space indent.
@@ -938,19 +908,9 @@ Don't use spaces inside parentheses. Always use curly braces. >
...
}
-You must have a space between the `if` and the open parenthesis. You must also
-have a space between the close parenthesis and the curly brace, if you're
-using one. >
-
- if(condition) { // BAD: space missing after IF.
- if (condition){ // BAD: space missing before {.
- if (condition) { // GOOD: proper space after IF and before {.
-
-
Loops and Switch Statements ~
-Annotate non-trivial fall-through between cases. Empty loop bodies should use
-`{}` or `continue`.
+Annotate non-trivial fall-through between cases.
If not conditional on an enumerated value, switch statements should always
have a `default` case (in the case of an enumerated value, the compiler will
@@ -958,8 +918,8 @@ warn you if any values are not handled). If the default case should never
execute, simply `assert`: >
switch (var) {
- case 0: // 2 space indent
- ... // 4 space indent
+ case 0:
+ ...
break;
case 1:
...
@@ -968,16 +928,6 @@ execute, simply `assert`: >
assert(false);
}
-Empty loop bodies should use `{}` or `continue`, but not a single semicolon. >
-
- while (condition) {
- // Repeat test until it returns false.
- }
- for (int i = 0; i < kSomeNumber; i++) {} // GOOD: empty body.
- while (condition) continue; // GOOD: continue indicates no logic.
-
- while (condition); // BAD: looks like part of do/while loop.
-
Pointer Expressions ~
No spaces around period or arrow. Pointer operators do not have trailing
@@ -996,15 +946,6 @@ Note that:
- There are no spaces around the period or arrow when accessing a member.
- Pointer operators have no space after the * or &.
-When declaring a pointer variable or argument, place the asterisk adjacent to
-the variable name: >
-
- char *c;
-
- char * c; // BAD: spaces on both sides of *
- char* c; // BAD
-
-
Boolean Expressions ~
When you have a boolean expression that is longer than the standard line
@@ -1034,48 +975,12 @@ expr;`. >
return(result); // return is not a function!
-Preprocessor Directives ~
-
-The hash mark that starts a preprocessor directive should always be at the
-beginning of the line.
-
-Even when preprocessor directives are within the body of indented code, the
-directives should start at the beginning of the line.
-
-Nested directives should add one spaces after the hash mark for each level of
-indentation.
-
- // GOOD: directives at beginning of line >
- if (lopsided_score) {
- #if DISASTER_PENDING // Correct -- Starts at beginning of line
- drop_everything();
- # if NOTIFY // One space after #
- notify_client();
- # endif
- #endif
- BackToNormal();
- }
-
-< // BAD: indented directives >
- if (lopsided_score) {
- #if DISASTER_PENDING // Wrong! The "#if" should be at beginning of line
- drop_everything();
- #endif // Wrong! Do not indent "#endif"
- back_to_normal();
- }
-
-
Horizontal Whitespace ~
-Use of horizontal whitespace depends on location. Never put trailing
-whitespace at the end of a line.
+Use of horizontal whitespace depends on location.
General ~
>
- if (x) { // Open braces should always have a space before them.
- ...
- }
- int i = 0; // Semicolons usually have no space before them.
int x[] = { 0 }; // Spaces inside braces for braced-init-list.
<
@@ -1095,29 +1000,6 @@ whitespace at the end of a line.
};
<
- Macros ~
->
- #define FI(x) \ // Don't align \'s in macro definitions.
- foo(); \
- bar(); \
- ...
-<
-
- Loops and Conditionals ~
->
- if (b) { // Space after the keyword in condition.
- } else { // Spaces around else.
- }
- while (test) {} // There is usually no space inside parentheses.
- for (; i < 5; i++) { // For loops always have a space after the
- ... // semicolon and no a space before the
- ... // semicolon.
- }
- switch (i) {
- case 1: // No space before colon in a switch case.
- ...
- case 2: break; // Space after a colon if there's code after it.
-<
Operators ~
>
@@ -1127,8 +1009,6 @@ whitespace at the end of a line.
x++; // arguments.
if (x && !y)
...
- v = w*x + y/z; // Use spaces to indicate operator precedence.
- v = w * (x + z); // Parentheses should have no spaces inside them.
i = (int)d; // No spaces after a cast operator.
<
@@ -1136,12 +1016,6 @@ Vertical Whitespace ~
Minimize use of vertical whitespace.
-This is more a principle than a rule: don't use blank lines when you don't
-have to. In particular, don't put more than one or two blank lines between
-functions, resist starting functions with a blank line, don't end functions
-with a blank line, and be discriminating with your use of blank lines inside
-functions.
-
The basic principle is: The more code that fits on one screen, the easier it
is to follow and understand the control flow of the program. Of course,
readability can suffer from code being too dense as well as too spread out, so
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index 178b0dc62b..b31ac47bda 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -204,7 +204,7 @@ Docstring format:
- Use `<pre>` for code samples.
Example: the help for |vim.paste()| is generated from a docstring decorating
-vim.paste in src/nvim/lua/vim.lua like this: >
+vim.paste in runtime/lua/vim/_editor.lua like this: >
--- Paste handler, invoked by |nvim_paste()| when a conforming UI
--- (such as the |TUI|) pastes text into the editor.
@@ -243,12 +243,13 @@ If the function acts on an object then {thing} is the name of that object
with a {thing} that groups functions under a common concept).
Use existing common {action} names if possible:
- add Append to, or insert into, a collection
- del Delete a thing (or group of things)
- exec Execute code
- get Get a thing (or group of things by query)
- list Get all things
- set Set a thing (or group of things)
+ add Append to, or insert into, a collection
+ create Create a new thing
+ del Delete a thing (or group of things)
+ exec Execute code
+ get Get a thing (or group of things by query)
+ list Get all things
+ set Set a thing (or group of things)
Use consistent names for {thing} in all API functions. E.g. a buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others.
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index bb36fa46f6..2446506dec 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -39,16 +39,18 @@ modify the diagnostics for a buffer (e.g. |vim.diagnostic.set()|) then it
requires a namespace.
*diagnostic-structure*
-A diagnostic is a Lua table with the following keys:
+A diagnostic is a Lua table with the following keys. Required keys are
+indicated with (*):
bufnr: Buffer number
- lnum: The starting line of the diagnostic
+ lnum(*): The starting line of the diagnostic
end_lnum: The final line of the diagnostic
- col: The starting column of the diagnostic
+ col(*): The starting column of the diagnostic
end_col: The final column of the diagnostic
severity: The severity of the diagnostic |vim.diagnostic.severity|
- message: The diagnostic text
+ message(*): The diagnostic text
source: The source of the diagnostic
+ code: The diagnostic code
user_data: Arbitrary data plugins or users can add
Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
@@ -72,7 +74,7 @@ Functions that take a severity as an optional parameter (e.g.
2. A table with a "min" or "max" key (or both): >
- vim.diagnostic.get(0, { severity = {min=vim.diagnostic.severity.WARN})
+ vim.diagnostic.get(0, { severity = {min=vim.diagnostic.severity.WARN} })
The latter form allows users to specify a range of severities.
@@ -326,16 +328,17 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
Note:
Each of the configuration options below accepts one of the
following:
- • `false` : Disable this feature
- • `true` : Enable this feature, use default settings.
- • `table` : Enable this feature with overrides. Use an
+ • `false`: Disable this feature
+ • `true`: Enable this feature, use default settings.
+ • `table`: Enable this feature with overrides. Use an
empty table to use default values.
- • `function` : Function with signature (namespace, bufnr)
+ • `function`: Function with signature (namespace, bufnr)
that returns any of the above.
Parameters: ~
- {opts} table Configuration table with the following
- keys:
+ {opts} (table|nil) When omitted or "nil", retrieve
+ the current configuration. Otherwise, a
+ configuration table with the following keys:
• underline: (default true) Use underline for
diagnostics. Options:
• severity: Only underline diagnostics
@@ -398,7 +401,7 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
displayed before lower severities (e.g.
ERROR is displayed before WARN). Options:
• reverse: (boolean) Reverse sort order
- {namespace} number|nil Update the options for the given
+ {namespace} (number|nil) Update the options for the given
namespace. When omitted, update the global
diagnostic options.
@@ -406,28 +409,28 @@ disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer.
Parameters: ~
- {bufnr} number|nil Buffer number, or 0 for current
+ {bufnr} (number|nil) Buffer number, or 0 for current
buffer. When omitted, disable diagnostics in
all buffers.
- {namespace} number|nil Only disable diagnostics for the
+ {namespace} (number|nil) Only disable diagnostics for the
given namespace.
enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer.
Parameters: ~
- {bufnr} number|nil Buffer number, or 0 for current
+ {bufnr} (number|nil) Buffer number, or 0 for current
buffer. When omitted, enable diagnostics in
all buffers.
- {namespace} number|nil Only enable diagnostics for the
+ {namespace} (number|nil) Only enable diagnostics for the
given namespace.
fromqflist({list}) *vim.diagnostic.fromqflist()*
Convert a list of quickfix items to a list of diagnostics.
Parameters: ~
- {list} table A list of quickfix items from |getqflist()|
- or |getloclist()|.
+ {list} (table) A list of quickfix items from
+ |getqflist()| or |getloclist()|.
Return: ~
array of diagnostics |diagnostic-structure|
@@ -436,9 +439,10 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics.
Parameters: ~
- {bufnr} number|nil Buffer number to get diagnostics from.
- Use 0 for current buffer or nil for all buffers.
- {opts} table|nil A table with the following keys:
+ {bufnr} (number|nil) Buffer number to get diagnostics
+ from. Use 0 for current buffer or nil for all
+ buffers.
+ {opts} (table|nil) A table with the following keys:
• namespace: (number) Limit diagnostics to the
given namespace.
• lnum: (number) Limit diagnostics to the given
@@ -446,67 +450,68 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
• severity: See |diagnostic-severity|.
Return: ~
- table A list of diagnostic items |diagnostic-structure|.
+ (table) A list of diagnostic items |diagnostic-structure|.
get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata.
Parameters: ~
- {namespace} number Diagnostic namespace
+ {namespace} (number) Diagnostic namespace
Return: ~
- table Namespace metadata
+ (table) Namespace metadata
get_namespaces() *vim.diagnostic.get_namespaces()*
Get current diagnostic namespaces.
Return: ~
- table A list of active diagnostic namespaces
+ (table) A list of active diagnostic namespaces
|vim.diagnostic|.
get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position.
Parameters: ~
- {opts} table See |vim.diagnostic.goto_next()|
+ {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
- table Next diagnostic
+ (table) Next diagnostic
get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
Return the position of the next diagnostic in the current
buffer.
Parameters: ~
- {opts} table See |vim.diagnostic.goto_next()|
+ {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
- table Next diagnostic position as a (row, col) tuple.
+ (table) Next diagnostic position as a (row, col) tuple.
get_prev({opts}) *vim.diagnostic.get_prev()*
Get the previous diagnostic closest to the cursor position.
Parameters: ~
- {opts} table See |vim.diagnostic.goto_next()|
+ {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
- table Previous diagnostic
+ (table) Previous diagnostic
get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
Return the position of the previous diagnostic in the current
buffer.
Parameters: ~
- {opts} table See |vim.diagnostic.goto_next()|
+ {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
- table Previous diagnostic position as a (row, col) tuple.
+ (table) Previous diagnostic position as a (row, col)
+ tuple.
goto_next({opts}) *vim.diagnostic.goto_next()*
Move to the next diagnostic.
Parameters: ~
- {opts} table|nil Configuration table with the following
+ {opts} (table|nil) Configuration table with the following
keys:
• namespace: (number) Only consider diagnostics
from the given namespace.
@@ -530,7 +535,7 @@ goto_prev({opts}) *vim.diagnostic.goto_prev()*
Move to the previous diagnostic in the current buffer.
Parameters: ~
- {opts} table See |vim.diagnostic.goto_next()|
+ {opts} (table) See |vim.diagnostic.goto_next()|
hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics.
@@ -544,10 +549,10 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|.
Parameters: ~
- {namespace} number|nil Diagnostic namespace. When
+ {namespace} (number|nil) Diagnostic namespace. When
omitted, hide diagnostics from all
namespaces.
- {bufnr} number|nil Buffer number, or 0 for current
+ {bufnr} (number|nil) Buffer number, or 0 for current
buffer. When omitted, hide diagnostics in all
buffers.
@@ -570,16 +575,16 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
<
Parameters: ~
- {str} string String to parse diagnostics from.
- {pat} string Lua pattern with capture groups.
- {groups} table List of fields in a
+ {str} (string) String to parse diagnostics from.
+ {pat} (string) Lua pattern with capture groups.
+ {groups} (table) List of fields in a
|diagnostic-structure| to associate with
captures from {pat}.
- {severity_map} table A table mapping the severity field
+ {severity_map} (table) A table mapping the severity field
from {groups} with an item from
|vim.diagnostic.severity|.
- {defaults} table|nil Table of default values for any
- fields not listed in {groups}. When
+ {defaults} (table|nil) Table of default values for
+ any fields not listed in {groups}. When
omitted, numeric values default to 0 and
"severity" defaults to ERROR.
@@ -591,7 +596,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window.
Parameters: ~
- {opts} table|nil Configuration table with the same keys
+ {opts} (table|nil) Configuration table with the same keys
as |vim.lsp.util.open_floating_preview()| in
addition to the following:
• bufnr: (number) Buffer number to show
@@ -662,10 +667,10 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
|vim.diagnostic.hide()|.
Parameters: ~
- {namespace} number|nil Diagnostic namespace. When
+ {namespace} (number|nil) Diagnostic namespace. When
omitted, remove diagnostics from all
namespaces.
- {bufnr} number|nil Remove diagnostics for the given
+ {bufnr} (number|nil) Remove diagnostics for the given
buffer. When omitted, diagnostics are removed
for all buffers.
@@ -673,18 +678,18 @@ set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer.
Parameters: ~
- {namespace} number The diagnostic namespace
- {bufnr} number Buffer number
- {diagnostics} table A list of diagnostic items
+ {namespace} (number) The diagnostic namespace
+ {bufnr} (number) Buffer number
+ {diagnostics} (table) A list of diagnostic items
|diagnostic-structure|
- {opts} table|nil Display options to pass to
+ {opts} (table|nil) Display options to pass to
|vim.diagnostic.show()|
setloclist({opts}) *vim.diagnostic.setloclist()*
Add buffer diagnostics to the location list.
Parameters: ~
- {opts} table|nil Configuration table with the following
+ {opts} (table|nil) Configuration table with the following
keys:
• namespace: (number) Only add diagnostics from
the given namespace.
@@ -700,7 +705,7 @@ setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list.
Parameters: ~
- {opts} table|nil Configuration table with the following
+ {opts} (table|nil) Configuration table with the following
keys:
• namespace: (number) Only add diagnostics from
the given namespace.
@@ -715,20 +720,20 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer.
Parameters: ~
- {namespace} number|nil Diagnostic namespace. When
+ {namespace} (number|nil) Diagnostic namespace. When
omitted, show diagnostics from all
namespaces.
- {bufnr} number|nil Buffer number, or 0 for current
- buffer. When omitted, show diagnostics in
- all buffers.
- {diagnostics} table|nil The diagnostics to display. When
- omitted, use the saved diagnostics for the
- given namespace and buffer. This can be
+ {bufnr} (number|nil) Buffer number, or 0 for
+ current buffer. When omitted, show
+ diagnostics in all buffers.
+ {diagnostics} (table|nil) The diagnostics to display.
+ When omitted, use the saved diagnostics for
+ the given namespace and buffer. This can be
used to display a list of diagnostics
without saving them or to display only a
subset of diagnostics. May not be used when
{namespace} or {bufnr} is nil.
- {opts} table|nil Display options. See
+ {opts} (table|nil) Display options. See
|vim.diagnostic.config()|.
toqflist({diagnostics}) *vim.diagnostic.toqflist()*
@@ -736,7 +741,7 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()*
can be passed to |setqflist()| or |setloclist()|.
Parameters: ~
- {diagnostics} table List of diagnostics
+ {diagnostics} (table) List of diagnostics
|diagnostic-structure|.
Return: ~
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
index 6115a5d235..9c5792dd43 100644
--- a/runtime/doc/diff.txt
+++ b/runtime/doc/diff.txt
@@ -324,8 +324,9 @@ After setting this variable, reload the syntax script: >
FINDING THE DIFFERENCES *diff-diffexpr*
-The 'diffexpr' option can be set to use something else than the standard
-"diff" program to compare two files and find the differences. *E959*
+The 'diffexpr' option can be set to use something else than the internal diff
+support or the standard "diff" program to compare two files and find the
+differences.
When 'diffexpr' is empty, Vim uses this command to find the differences
between file1 and file2: >
@@ -358,7 +359,7 @@ format mentioned. These variables are set to the file names used:
v:fname_in original file
v:fname_new new version of the same file
- v:fname_out resulting diff file
+ v:fname_out where to write the resulting diff file
Additionally, 'diffexpr' should take care of "icase" and "iwhite" in the
'diffopt' option. 'diffexpr' cannot change the value of 'lines' and
@@ -370,13 +371,13 @@ Example (this does almost the same as 'diffexpr' being empty): >
function MyDiff()
let opt = ""
if &diffopt =~ "icase"
- let opt = opt . "-i "
+ let opt = opt .. "-i "
endif
if &diffopt =~ "iwhite"
- let opt = opt . "-b "
+ let opt = opt .. "-b "
endif
- silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new .
- \ " > " . v:fname_out
+ silent execute "!diff -a --binary " .. opt .. v:fname_in .. " " .. v:fname_new ..
+ \ " > " .. v:fname_out
redraw!
endfunction
@@ -426,8 +427,8 @@ Example (this does the same as 'patchexpr' being empty): >
set patchexpr=MyPatch()
function MyPatch()
- :call system("patch -o " . v:fname_out . " " . v:fname_in .
- \ " < " . v:fname_diff)
+ :call system("patch -o " .. v:fname_out .. " " .. v:fname_in ..
+ \ " < " .. v:fname_diff)
endfunction
Make sure that using the "patch" program doesn't have unwanted side effects.
diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt
index dd7e9a331a..eb3de0111f 100644
--- a/runtime/doc/digraph.txt
+++ b/runtime/doc/digraph.txt
@@ -35,6 +35,9 @@ An alternative is using the 'keymap' option.
< Avoid defining a digraph with '_' (underscore) as the
first character, it has a special meaning in the
future.
+ NOTE: This command cannot add a digraph that starts
+ with a white space. If you want to add such digraph,
+ you can use |digraph_set()| instead.
Example of the output of ":digraphs": >
TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 14df41e6c8..c19d9f482b 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -196,7 +196,7 @@ If you want to keep the changed buffer without saving it, switch on the
Edit {file} always. Discard any changes to the
current buffer.
Also see |++opt| and |+cmd|.
-
+ *:edit_#* *:e#*
:e[dit] [++opt] [+cmd] #[count]
Edit the [count]th buffer (as shown by |:files|).
This command does the same as [count] CTRL-^. But ":e
@@ -356,7 +356,7 @@ as a wildcard when "[" is in the 'isfname' option. A simple way to avoid this
is to use "path\[[]abc]", this matches the file "path\[abc]".
*starstar-wildcard*
-Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems.
+Expanding "**" is possible on Unix, Win32, macOS and a few other systems.
This allows searching a directory tree. This goes up to 100 directories deep.
Note there are some commands where this works slightly differently, see
|file-searching|.
@@ -411,9 +411,10 @@ does apply like to other wildcards.
Environment variables in the expression are expanded when evaluating the
expression, thus this works: >
- :e `=$HOME . '/.vimrc'`
-This does not work, $HOME is inside a string and used literally: >
- :e `='$HOME' . '/.vimrc'`
+ :e `=$HOME .. '/.vimrc'`
+This uses $HOME inside a string and it will be used literally, most likely not
+what you intended: >
+ :e `='$HOME' .. '/.vimrc'`
If the expression returns a string then names are to be separated with line
breaks. When the result is a |List| then each item is used as a name. Line
@@ -845,7 +846,7 @@ Note: When the 'write' option is off, you are not able to write any file.
*:w* *:write*
*E502* *E503* *E504* *E505*
- *E512* *E514* *E667* *E796* *E949*
+ *E512* *E514* *E667* *E949*
:w[rite] [++opt] Write the whole buffer to the current file. This is
the normal way to save changes to a file. It fails
when the 'readonly' option is set or when there is
@@ -1172,7 +1173,7 @@ Examples: >
If you want to always use ":confirm", set the 'confirm' option.
- *:browse* *:bro* *E338* *E614* *E615* *E616*
+ *:browse* *:bro* *E338* *E614* *E615* *E616*
:bro[wse] {command} Open a file selection dialog for an argument to
{command}. At present this works for |:e|, |:w|,
|:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|,
@@ -1331,6 +1332,7 @@ current directory for that window. Windows where the |:lcd| command has not
been used stick to the global or tab-local directory. When jumping to another
window the current directory is changed to the last specified local current
directory. If none was specified, the global or tab-local directory is used.
+When creating a new window it inherits the local directory of the current window.
When changing tabs the same behaviour applies. If the current tab has no
local working directory the global working directory is used.
@@ -1449,6 +1451,11 @@ If you don't get warned often enough you can use the following command.
if it exists now.
Once a file has been checked the timestamp is reset,
you will not be warned again.
+ Syntax highlighting, marks, diff status,
+ 'fileencoding', 'fileformat' and 'binary' options
+ are not changed. See |v:fcs_choice| to reload these
+ too (for example, if a code formatting tools has
+ changed the file).
:[N]checkt[ime] {filename}
:[N]checkt[ime] [N]
@@ -1488,8 +1495,8 @@ session or with another command (e.g., a filter command). Then you will know
which version of the file you want to keep.
The accuracy of the time check depends on the filesystem. On Unix it is
-usually sub-second. With old file sytems and on MS-Windows it is normally one
-second. Use has('nanotime') check if sub-second time stamp checks are
+usually sub-second. With old file systems and on MS-Windows it is normally one
+second. Use `has('nanotime')` to check if sub-second time stamp checks are
available.
There is one situation where you get the message while there is nothing wrong:
@@ -1568,6 +1575,10 @@ There are three different types of searching:
/u/user_x/work/include
/u/user_x/include
+< Note: If your 'path' setting includes a non-existing directory, Vim will
+ skip the non-existing directory, and also does not search in the parent of
+ the non-existing directory if upwards searching is used.
+
3) Combined up/downward search:
If Vim's current path is /u/user_x/work/release and you do >
set path=**;/u/user_x
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index fa75ead9a3..17af40bdb9 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -119,7 +119,7 @@ You will not get an error if you try to change the type of a variable.
1.2 Function references ~
- *Funcref* *E695* *E718*
+ *Funcref* *E695* *E718*
A Funcref variable is obtained with the |function()| function, the |funcref()|
function or created with the lambda expression |expr-lambda|. It can be used
in an expression in the place of a function name, before the parenthesis
@@ -196,7 +196,7 @@ position in the sequence.
List creation ~
*E696* *E697*
-A List is created with a comma separated list of items in square brackets.
+A List is created with a comma-separated list of items in square brackets.
Examples: >
:let mylist = [1, two, 3, "four"]
:let emptylist = []
@@ -372,8 +372,8 @@ Changing the order of items in a list: >
For loop ~
-The |:for| loop executes commands for each item in a |List| or |Blob|.
-A variable is set to each item in the sequence. Example with a List: >
+The |:for| loop executes commands for each item in a |List|, |String| or |Blob|.
+A variable is set to each item in sequence. Example with a List: >
:for item in mylist
: call Doit(item)
:endfor
@@ -390,7 +390,7 @@ If all you want to do is modify each item in the list then the |map()|
function will be a simpler method than a for loop.
Just like the |:let| command, |:for| also accepts a list of variables. This
-requires the argument to be a list of lists. >
+requires the argument to be a List of Lists. >
:for [lnum, col] in [[1, 3], [2, 8], [3, 0]]
: call Doit(lnum, col)
:endfor
@@ -402,12 +402,18 @@ It is also possible to put remaining items in a List variable: >
:for [i, j; rest] in listlist
: call Doit(i, j)
: if !empty(rest)
- : echo "remainder: " . string(rest)
+ : echo "remainder: " .. string(rest)
: endif
:endfor
For a Blob one byte at a time is used.
+For a String one character, including any composing characters, is used as a
+String. Example: >
+ for c in text
+ echo 'This character is ' .. c
+ endfor
+
List functions ~
*E714*
@@ -424,11 +430,11 @@ Functions that are useful with a List: >
:let list = split("a b c") " create list from items in a string
:let string = join(list, ', ') " create string from list items
:let s = string(list) " String representation of list
- :call map(list, '">> " . v:val') " prepend ">> " to each item
+ :call map(list, '">> " .. v:val') " prepend ">> " to each item
Don't forget that a combination of features can make things simple. For
example, to add up all the numbers in a list: >
- :exe 'let sum = ' . join(nrlist, '+')
+ :exe 'let sum = ' .. join(nrlist, '+')
1.4 Dictionaries ~
@@ -440,7 +446,7 @@ ordering.
Dictionary creation ~
*E720* *E721* *E722* *E723*
-A Dictionary is created with a comma separated list of entries in curly
+A Dictionary is created with a comma-separated list of entries in curly
braces. Each entry has a key and a value, separated by a colon. Each key can
only appear once. Examples: >
:let mydict = {1: 'one', 2: 'two', 3: 'three'}
@@ -449,8 +455,8 @@ only appear once. Examples: >
A key is always a String. You can use a Number, it will be converted to a
String automatically. Thus the String '4' and the number 4 will find the same
entry. Note that the String '04' and the Number 04 are different, since the
-Number will be converted to the String '4'. The empty string can also be used
-as a key.
+Number will be converted to the String '4', leading zeros are dropped. The
+empty string can also be used as a key.
*literal-Dict*
To avoid having to put quotes around every key the #{} form can be used. This
does require the key to consist only of ASCII letters, digits, '-' and '_'.
@@ -490,7 +496,7 @@ turn the Dictionary into a List and pass it to |:for|.
Most often you want to loop over the keys, using the |keys()| function: >
:for key in keys(mydict)
- : echo key . ': ' . mydict[key]
+ : echo key .. ': ' .. mydict[key]
:endfor
The List of keys is unsorted. You may want to sort them first: >
@@ -498,13 +504,13 @@ The List of keys is unsorted. You may want to sort them first: >
To loop over the values use the |values()| function: >
:for v in values(mydict)
- : echo "value: " . v
+ : echo "value: " .. v
:endfor
If you want both the key and the value use the |items()| function. It returns
a List in which each item is a List with two items, the key and the value: >
:for [key, value] in items(mydict)
- : echo key . ': ' . value
+ : echo key .. ': ' .. value
:endfor
@@ -599,7 +605,7 @@ Functions that can be used with a Dictionary: >
:let small = min(dict) " minimum value in dict
:let xs = count(dict, 'x') " count nr of times 'x' appears in dict
:let s = string(dict) " String representation of dict
- :call map(dict, '">> " . v:val') " prepend ">> " to each item
+ :call map(dict, '">> " .. v:val') " prepend ">> " to each item
1.5 Blobs ~
@@ -676,7 +682,7 @@ similar to -1. >
:let otherblob = myblob[:] " make a copy of the Blob
If the first index is beyond the last byte of the Blob or the second byte is
-before the first byte, the result is an empty Blob. There is no error
+before the first index, the result is an empty Blob. There is no error
message.
If the second index is equal to or greater than the length of the Blob the
@@ -834,7 +840,7 @@ Example: >
All expressions within one level are parsed from left to right.
-expr1 *expr1* *trinary* *E109*
+expr1 *expr1* *ternary* *E109*
-----
expr2 ? expr1 : expr1
@@ -1066,7 +1072,7 @@ expr7 *expr7*
For '!' |TRUE| becomes |FALSE|, |FALSE| becomes |TRUE| (one).
For '-' the sign of the number is changed.
-For '+' the number is unchanged.
+For '+' the number is unchanged. Note: "++" has no effect.
A String will be converted to a Number first.
@@ -1117,7 +1123,7 @@ Generally, if a |List| index is equal to or higher than the length of the
error.
-expr8[expr1a : expr1b] substring or sublist *expr-[:]*
+expr8[expr1a : expr1b] substring or |sublist| *expr-[:]* *substring*
If expr8 is a String this results in the substring with the bytes or
characters from expr1a to and including expr1b. expr8 is used as a String,
@@ -1228,8 +1234,8 @@ And NOT: >
number
------
number number constant *expr-number*
- *hex-number* *octal-number* *binary-number*
+ *0x* *hex-number* *0o* *octal-number* *binary-number*
Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B)
and Octal (starting with 0, 0o or 0O).
@@ -1319,6 +1325,9 @@ A string constant accepts these special characters:
To use the double quote character it must be escaped: "<M-\">".
Don't use <Char-xxxx> to get a UTF-8 character, use \uxxxx as
mentioned above.
+\<*xxx> Like \<xxx> but prepends a modifier instead of including it in the
+ character. E.g. "\<C-w>" is one character 0x17 while "\<*C-w>" is four
+ bytes: 3 for the CTRL modifier and then character "W".
Note that "\xff" is stored as the byte 255, which may be invalid in some
encodings. Use "\u00ff" to store character 255 correctly as UTF-8.
@@ -1356,8 +1365,8 @@ option *expr-option* *E112* *E113*
&l:option local option value
Examples: >
- echo "tabstop is " . &tabstop
- if &insertmode
+ echo "tabstop is " .. &tabstop
+ if &expandtab
Any option name can be used here. See |options|. When using the local value
and there is no buffer-local or window-local value, the global value is used
@@ -1451,7 +1460,7 @@ the function returns: >
:let Bar = Foo(4)
:echo Bar(6)
< 5
-Note that the variables must exist in the outer scope before the lamba is
+Note that the variables must exist in the outer scope before the lambda is
defined for this to work. See also |:func-closure|.
Lambda and closure support can be checked with: >
@@ -1486,7 +1495,7 @@ Notice how execute() is used to execute an Ex command. That's ugly though.
Lambda expressions have internal names like '<lambda>42'. If you get an error
for a lambda expression, you can find what it is with the following command: >
- :function {'<lambda>42'}
+ :function <lambda>42
See also: |numbered-function|
==============================================================================
@@ -1631,7 +1640,7 @@ maintain a counter: >
echo "script executed for the first time"
else
let s:counter = s:counter + 1
- echo "script executed " . s:counter . " times now"
+ echo "script executed " .. s:counter .. " times now"
endif
Note that this means that filetype plugins don't get a different set of script
@@ -1645,6 +1654,7 @@ Some variables can be set by the user, but the type cannot be changed.
*v:argv* *argv-variable*
v:argv The command line arguments Vim was invoked with. This is a
list of strings. The first item is the Vim command.
+ See |v:progpath| for the command with full path.
*v:beval_col* *beval_col-variable*
v:beval_col The number of the column, over which the mouse pointer is.
@@ -1730,7 +1740,7 @@ v:completed_item
*v:count* *count-variable*
v:count The count given for the last Normal mode command. Can be used
to get the count before a mapping. Read-only. Example: >
- :map _x :<C-U>echo "the count is " . v:count<CR>
+ :map _x :<C-U>echo "the count is " .. v:count<CR>
< Note: The <C-U> is required to remove the line range that you
get when typing ':' after a count.
When there are two counts, as in "3d2w", they are multiplied,
@@ -1876,6 +1886,11 @@ v:fcs_choice What should happen after a |FileChangedShell| event was
do with the affected buffer:
reload Reload the buffer (does not work if
the file was deleted).
+ edit Reload the buffer and detect the
+ values for options such as
+ 'fileformat', 'fileencoding', 'binary'
+ (does not work if the file was
+ deleted).
ask Ask the user what to do, as if there
was no autocommand. Except that when
only the timestamp changed nothing
@@ -2016,6 +2031,9 @@ v:null Special value used to put "null" in JSON and NIL in msgpack.
used as a String (e.g. in |expr5| with string concatenation
operator) and to zero when used as a Number (e.g. in |expr5|
or |expr7| when used with numeric operators). Read-only.
+ In some places `v:null` can be used for a List, Dict, etc.
+ that is not set. That is slightly different than an empty
+ List, Dict, etc.
*v:numbermax* *numbermax-variable*
v:numbermax Maximum value of a number.
@@ -2120,9 +2138,19 @@ v:scrollstart String describing the script or function that caused the
*v:servername* *servername-variable*
v:servername Primary listen-address of the current Nvim instance, the first
item returned by |serverlist()|. Can be set by |--listen| or
- |$NVIM_LISTEN_ADDRESS| at startup. |serverstart()| |serverstop()|
+ |$NVIM_LISTEN_ADDRESS| (deprecated) at startup.
+ See also |serverstart()| |serverstop()|.
Read-only.
+ *$NVIM*
+ $NVIM is set by |terminal| and |jobstart()|, and is thus
+ a hint that the current environment is a subprocess of Nvim.
+ Example: >
+ if $NVIM
+ echo nvim_get_chan_info(v:parent)
+ endif
+
+< Note the contents of $NVIM may change in the future.
v:searchforward *v:searchforward* *searchforward-variable*
Search direction: 1 after a forward search, 0 after a
@@ -2267,8656 +2295,13 @@ v:windowid Application-specific window "handle" which may be set by any
==============================================================================
4. Builtin Functions *vim-function* *functions*
-The Vimscript subsystem (referred to as "eval" internally) provides the
-following builtin functions. Scripts can also define |user-function|s.
+The Vimscript subsystem (referred to as "eval" internally) provides builtin
+functions. Scripts can also define |user-function|s.
See |function-list| to browse functions by topic.
-(Use CTRL-] on the function name to jump to the full explanation.)
-
-USAGE RESULT DESCRIPTION ~
-
-abs({expr}) Float or Number absolute value of {expr}
-acos({expr}) Float arc cosine of {expr}
-add({object}, {item}) List/Blob append {item} to {object}
-and({expr}, {expr}) Number bitwise AND
-api_info() Dict api metadata
-append({lnum}, {string}) Number append {string} below line {lnum}
-append({lnum}, {list}) Number append lines {list} below line {lnum}
-argc([{winid}]) Number number of files in the argument list
-argidx() Number current index in the argument list
-arglistid([{winnr} [, {tabnr}]]) Number argument list id
-argv({nr} [, {winid}]) String {nr} entry of the argument list
-argv([-1, {winid}]) List the argument list
-asin({expr}) Float arc sine of {expr}
-assert_beeps({cmd}) Number assert {cmd} causes a beep
-assert_equal({exp}, {act} [, {msg}])
- Number assert {exp} is equal to {act}
-assert_equalfile({fname-one}, {fname-two} [, {msg}])
- Number assert file contents are equal
-assert_exception({error} [, {msg}])
- Number assert {error} is in v:exception
-assert_fails({cmd} [, {error}]) Number assert {cmd} fails
-assert_false({actual} [, {msg}])
- Number assert {actual} is false
-assert_inrange({lower}, {upper}, {actual} [, {msg}])
- Number assert {actual} is inside the range
-assert_match({pat}, {text} [, {msg}])
- Number assert {pat} matches {text}
-assert_nobeep({cmd}) Number assert {cmd} does not cause a beep
-assert_notequal({exp}, {act} [, {msg}])
- Number assert {exp} is not equal {act}
-assert_notmatch({pat}, {text} [, {msg}])
- Number assert {pat} not matches {text}
-assert_report({msg}) Number report a test failure
-assert_true({actual} [, {msg}]) Number assert {actual} is true
-atan({expr}) Float arc tangent of {expr}
-atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2}
-browse({save}, {title}, {initdir}, {default})
- String put up a file requester
-browsedir({title}, {initdir}) String put up a directory requester
-bufadd({name}) Number add a buffer to the buffer list
-bufexists({expr}) Number |TRUE| if buffer {expr} exists
-buflisted({expr}) Number |TRUE| if buffer {expr} is listed
-bufload({expr}) Number load buffer {expr} if not loaded yet
-bufloaded({expr}) Number |TRUE| if buffer {expr} is loaded
-bufname([{expr}]) String Name of the buffer {expr}
-bufnr([{expr} [, {create}]]) Number Number of the buffer {expr}
-bufwinid({expr}) Number |window-ID| of buffer {expr}
-bufwinnr({expr}) Number window number of buffer {expr}
-byte2line({byte}) Number line number at byte count {byte}
-byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr}
-byteidxcomp({expr}, {nr}) Number byte index of {nr}'th char in {expr}
-call({func}, {arglist} [, {dict}])
- any call {func} with arguments {arglist}
-ceil({expr}) Float round {expr} up
-changenr() Number current change number
-chanclose({id}[, {stream}]) Number Closes a channel or one of its streams
-chansend({id}, {data}) Number Writes {data} to channel
-char2nr({expr}[, {utf8}]) Number ASCII/UTF-8 value of first char in {expr}
-charidx({string}, {idx} [, {countcc}])
- Number char index of byte {idx} in {string}
-chdir({dir}) String change current working directory
-cindent({lnum}) Number C indent for line {lnum}
-clearmatches([{win}]) none clear all matches
-col({expr}) Number column nr of cursor or mark
-complete({startcol}, {matches}) none set Insert mode completion
-complete_add({expr}) Number add completion match
-complete_check() Number check for key typed during completion
-complete_info([{what}]) Dict get current completion information
-confirm({msg} [, {choices} [, {default} [, {type}]]])
- Number number of choice picked by user
-copy({expr}) any make a shallow copy of {expr}
-cos({expr}) Float cosine of {expr}
-cosh({expr}) Float hyperbolic cosine of {expr}
-count({list}, {expr} [, {ic} [, {start}]])
- Number count how many {expr} are in {list}
-cscope_connection([{num}, {dbpath} [, {prepend}]])
- Number checks existence of cscope connection
-ctxget([{index}]) Dict return the |context| dict at {index}
-ctxpop() none pop and restore |context| from the
- |context-stack|
-ctxpush([{types}]) none push the current |context| to the
- |context-stack|
-ctxset({context}[, {index}]) none set |context| at {index}
-ctxsize() Number return |context-stack| size
-cursor({lnum}, {col} [, {off}])
- Number move cursor to {lnum}, {col}, {off}
-cursor({list}) Number move cursor to position in {list}
-debugbreak({pid}) Number interrupt process being debugged
-deepcopy({expr} [, {noref}]) any make a full copy of {expr}
-delete({fname} [, {flags}]) Number delete the file or directory {fname}
-deletebufline({buf}, {first}[, {last}])
- Number delete lines from buffer {buf}
-dictwatcheradd({dict}, {pattern}, {callback})
- Start watching a dictionary
-dictwatcherdel({dict}, {pattern}, {callback})
- Stop watching a dictionary
-did_filetype() Number |TRUE| if FileType autocommand event used
-diff_filler({lnum}) Number diff filler lines about {lnum}
-diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
-empty({expr}) Number |TRUE| if {expr} is empty
-environ() Dict return environment variables
-escape({string}, {chars}) String escape {chars} in {string} with '\'
-eval({string}) any evaluate {string} into its value
-eventhandler() Number |TRUE| if inside an event handler
-executable({expr}) Number 1 if executable {expr} exists
-execute({command}) String execute and capture output of {command}
-exepath({expr}) String full path of the command {expr}
-exists({expr}) Number |TRUE| if {expr} exists
-extend({expr1}, {expr2} [, {expr3}])
- List/Dict insert items of {expr2} into {expr1}
-exp({expr}) Float exponential of {expr}
-expand({expr} [, {nosuf} [, {list}]])
- any expand special keywords in {expr}
-expandcmd({expr}) String expand {expr} like with `:edit`
-feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer
-filereadable({file}) Number |TRUE| if {file} is a readable file
-filewritable({file}) Number |TRUE| if {file} is a writable file
-filter({expr1}, {expr2}) List/Dict remove items from {expr1} where
- {expr2} is 0
-finddir({name} [, {path} [, {count}]])
- String find directory {name} in {path}
-findfile({name} [, {path} [, {count}]])
- String find file {name} in {path}
-flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels
-float2nr({expr}) Number convert Float {expr} to a Number
-floor({expr}) Float round {expr} down
-fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2}
-fnameescape({fname}) String escape special characters in {fname}
-fnamemodify({fname}, {mods}) String modify file name
-foldclosed({lnum}) Number first line of fold at {lnum} if closed
-foldclosedend({lnum}) Number last line of fold at {lnum} if closed
-foldlevel({lnum}) Number fold level at {lnum}
-foldtext() String line displayed for closed fold
-foldtextresult({lnum}) String text for closed fold at {lnum}
-foreground() Number bring the Vim window to the foreground
-fullcommand({name}) String get full command from {name}
-funcref({name} [, {arglist}] [, {dict}])
- Funcref reference to function {name}
-function({name} [, {arglist}] [, {dict}])
- Funcref named reference to function {name}
-garbagecollect([{atexit}]) none free memory, breaking cyclic references
-get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
-get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
-get({func}, {what}) any get property of funcref/partial {func}
-getbufinfo([{buf}]) List information about buffers
-getbufline({buf}, {lnum} [, {end}])
- List lines {lnum} to {end} of buffer {buf}
-getbufvar({buf}, {varname} [, {def}])
- any variable {varname} in buffer {buf}
-getchangelist([{buf}]) List list of change list items
-getchar([expr]) Number or String
- get one character from the user
-getcharmod() Number modifiers for the last typed character
-getcharsearch() Dict last character search
-getcharstr([expr]) String get one character from the user
-getcmdline() String return the current command-line
-getcmdpos() Number return cursor position in command-line
-getcmdtype() String return current command-line type
-getcmdwintype() String return current command-line window type
-getcompletion({pat}, {type} [, {filtered}])
- List list of cmdline completion matches
-getcurpos() List position of the cursor
-getcwd([{winnr} [, {tabnr}]]) String get the current working directory
-getenv({name}) String return environment variable
-getfontname([{name}]) String name of font being used
-getfperm({fname}) String file permissions of file {fname}
-getfsize({fname}) Number size in bytes of file {fname}
-getftime({fname}) Number last modification time of file
-getftype({fname}) String description of type of file {fname}
-getjumplist([{winnr} [, {tabnr}]])
- List list of jump list items
-getline({lnum}) String line {lnum} of current buffer
-getline({lnum}, {end}) List lines {lnum} to {end} of current buffer
-getloclist({nr}) List list of location list items
-getloclist({nr}, {what}) Dict get specific location list properties
-getmarklist([{buf}]) List list of global/local marks
-getmatches([{win}]) List list of current matches
-getmousepos() Dict last known mouse position
-getpid() Number process ID of Vim
-getpos({expr}) List position of cursor, mark, etc.
-getqflist() List list of quickfix items
-getqflist({what}) Dict get specific quickfix list properties
-getreg([{regname} [, 1 [, {list}]]])
- String or List contents of a register
-getreginfo([{regname}]) Dict information about a register
-getregtype([{regname}]) String type of a register
-gettabinfo([{expr}]) List list of tab pages
-gettabvar({nr}, {varname} [, {def}])
- any variable {varname} in tab {nr} or {def}
-gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
- any {name} in {winnr} in tab page {tabnr}
-gettagstack([{nr}]) Dict get the tag stack of window {nr}
-getwininfo([{winid}]) List list of windows
-getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window
-getwinposx() Number X coord in pixels of Vim window
-getwinposy() Number Y coord in pixels of Vim window
-getwinvar({nr}, {varname} [, {def}])
- any variable {varname} in window {nr}
-glob({expr} [, {nosuf} [, {list} [, {alllinks}]]])
- any expand file wildcards in {expr}
-glob2regpat({expr}) String convert a glob pat into a search pat
-globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]])
- String do glob({expr}) for all dirs in {path}
-has({feature}) Number |TRUE| if feature {feature} supported
-has_key({dict}, {key}) Number |TRUE| if {dict} has entry {key}
-haslocaldir([{winnr} [, {tabnr}]])
- Number |TRUE| if the window executed |:lcd| or
- the tab executed |:tcd|
-hasmapto({what} [, {mode} [, {abbr}]])
- Number |TRUE| if mapping to {what} exists
-histadd({history}, {item}) String add an item to a history
-histdel({history} [, {item}]) String remove an item from a history
-histget({history} [, {index}]) String get the item {index} from a history
-histnr({history}) Number highest index of a history
-hlexists({name}) Number |TRUE| if highlight group {name} exists
-hlID({name}) Number syntax ID of highlight group {name}
-hostname() String name of the machine Vim is running on
-iconv({expr}, {from}, {to}) String convert encoding of {expr}
-indent({lnum}) Number indent of line {lnum}
-index({object}, {expr} [, {start} [, {ic}]])
- Number index in {object} where {expr} appears
-input({prompt} [, {text} [, {completion}]])
- String get input from the user
-inputlist({textlist}) Number let the user pick from a choice list
-inputrestore() Number restore typeahead
-inputsave() Number save and clear typeahead
-inputsecret({prompt} [, {text}])
- String like input() but hiding the text
-insert({object}, {item} [, {idx}])
- List insert {item} in {object} [before {idx}]
-interrupt() none interrupt script execution
-invert({expr}) Number bitwise invert
-isdirectory({directory}) Number |TRUE| if {directory} is a directory
-isinf({expr}) Number determine if {expr} is infinity value
- (positive or negative)
-islocked({expr}) Number |TRUE| if {expr} is locked
-isnan({expr}) Number |TRUE| if {expr} is NaN
-id({expr}) String identifier of the container
-items({dict}) List key-value pairs in {dict}
-jobpid({id}) Number Returns pid of a job.
-jobresize({id}, {width}, {height})
- Number Resize pseudo terminal window of a job
-jobstart({cmd}[, {opts}]) Number Spawns {cmd} as a job
-jobstop({id}) Number Stops a job
-jobwait({ids}[, {timeout}]) Number Wait for a set of jobs
-join({list} [, {sep}]) String join {list} items into one String
-json_decode({expr}) any Convert {expr} from JSON
-json_encode({expr}) String Convert {expr} to JSON
-keys({dict}) List keys in {dict}
-len({expr}) Number the length of {expr}
-libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
-libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
-line({expr} [, {winid}]) Number line nr of cursor, last line or mark
-line2byte({lnum}) Number byte count of line {lnum}
-lispindent({lnum}) Number Lisp indent for line {lnum}
-list2str({list} [, {utf8}]) String turn numbers in {list} into a String
-localtime() Number current time
-log({expr}) Float natural logarithm (base e) of {expr}
-log10({expr}) Float logarithm of Float {expr} to base 10
-luaeval({expr}[, {expr}]) any evaluate Lua expression
-map({expr1}, {expr2}) List/Dict change each item in {expr1} to {expr}
-maparg({name}[, {mode} [, {abbr} [, {dict}]]])
- String or Dict
- rhs of mapping {name} in mode {mode}
-mapcheck({name}[, {mode} [, {abbr}]])
- String check for mappings matching {name}
-match({expr}, {pat}[, {start}[, {count}]])
- Number position where {pat} matches in {expr}
-matchadd({group}, {pattern}[, {priority}[, {id}]])
- Number highlight {pattern} with {group}
-matchaddpos({group}, {list}[, {priority}[, {id}]])
- Number highlight positions with {group}
-matcharg({nr}) List arguments of |:match|
-matchdelete({id} [, {win}]) Number delete match identified by {id}
-matchend({expr}, {pat}[, {start}[, {count}]])
- Number position where {pat} ends in {expr}
-matchlist({expr}, {pat}[, {start}[, {count}]])
- List match and submatches of {pat} in {expr}
-matchstr({expr}, {pat}[, {start}[, {count}]])
- String {count}'th match of {pat} in {expr}
-matchstrpos({expr}, {pat}[, {start}[, {count}]])
- List {count}'th match of {pat} in {expr}
-max({expr}) Number maximum value of items in {expr}
-menu_get({path} [, {modes}]) List description of |menus| matched by {path}
-min({expr}) Number minimum value of items in {expr}
-mkdir({name} [, {path} [, {prot}]])
- Number create directory {name}
-mode([expr]) String current editing mode
-msgpackdump({list} [, {type}]) List/Blob dump objects to msgpack
-msgpackparse({data}) List parse msgpack to a list of objects
-nextnonblank({lnum}) Number line nr of non-blank line >= {lnum}
-nr2char({expr}[, {utf8}]) String single char with ASCII/UTF-8 value {expr}
-nvim_...({args}...) any call nvim |api| functions
-or({expr}, {expr}) Number bitwise OR
-pathshorten({expr}) String shorten directory names in a path
-perleval({expr}) any evaluate |perl| expression
-pow({x}, {y}) Float {x} to the power of {y}
-prevnonblank({lnum}) Number line nr of non-blank line <= {lnum}
-printf({fmt}, {expr1}...) String format text
-prompt_getprompt({buf}) String get prompt text
-prompt_setcallback({buf}, {expr}) none set prompt callback function
-prompt_setinterrupt({buf}, {text}) none set prompt interrupt function
-prompt_setprompt({buf}, {text}) none set prompt text
-pum_getpos() Dict position and size of pum if visible
-pumvisible() Number whether popup menu is visible
-pyeval({expr}) any evaluate |Python| expression
-py3eval({expr}) any evaluate |python3| expression
-pyxeval({expr}) any evaluate |python_x| expression
-range({expr} [, {max} [, {stride}]])
- List items from {expr} to {max}
-readdir({dir} [, {expr}]) List file names in {dir} selected by {expr}
-readfile({fname} [, {type} [, {max}]])
- List get list of lines from file {fname}
-reg_executing() String get the executing register name
-reg_recorded() String get the last recorded register name
-reg_recording() String get the recording register name
-reltime([{start} [, {end}]]) List get time value
-reltimefloat({time}) Float turn the time value into a Float
-reltimestr({time}) String turn time value into a String
-remote_expr({server}, {string} [, {idvar} [, {timeout}]])
- String send expression
-remote_foreground({server}) Number bring Vim server to the foreground
-remote_peek({serverid} [, {retvar}])
- Number check for reply string
-remote_read({serverid} [, {timeout}])
- String read reply string
-remote_send({server}, {string} [, {idvar}])
- String send key sequence
-remote_startserver({name}) none become server {name}
-remove({list}, {idx} [, {end}]) any/List
- remove items {idx}-{end} from {list}
-remove({blob}, {idx} [, {end}]) Number/Blob
- remove bytes {idx}-{end} from {blob}
-remove({dict}, {key}) any remove entry {key} from {dict}
-rename({from}, {to}) Number rename (move) file from {from} to {to}
-repeat({expr}, {count}) String repeat {expr} {count} times
-resolve({filename}) String get filename a shortcut points to
-reverse({list}) List reverse {list} in-place
-round({expr}) Float round off {expr}
-rubyeval({expr}) any evaluate |Ruby| expression
-rpcnotify({channel}, {event}[, {args}...])
- Sends an |RPC| notification to {channel}
-rpcrequest({channel}, {method}[, {args}...])
- Sends an |RPC| request to {channel}
-screenattr({row}, {col}) Number attribute at screen position
-screenchar({row}, {col}) Number character at screen position
-screenchars({row}, {col}) List List of characters at screen position
-screencol() Number current cursor column
-screenpos({winid}, {lnum}, {col}) Dict screen row and col of a text character
-screenrow() Number current cursor row
-screenstring({row}, {col}) String characters at screen position
-search({pattern} [, {flags} [, {stopline} [, {timeout}]]])
- Number search for {pattern}
-searchcount([{options}]) Dict Get or update the last search count
-searchdecl({name} [, {global} [, {thisblock}]])
- Number search for variable declaration
-searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]])
- Number search for other end of start/end pair
-searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]])
- List search for other end of start/end pair
-searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]])
- List search for {pattern}
-server2client({clientid}, {string})
- Number send reply string
-serverlist() String get a list of available servers
-setbufline( {expr}, {lnum}, {line})
- Number set line {lnum} to {line} in buffer
- {expr}
-setbufvar({buf}, {varname}, {val}) set {varname} in buffer {buf} to {val}
-setcharsearch({dict}) Dict set character search from {dict}
-setcmdpos({pos}) Number set cursor position in command-line
-setenv({name}, {val}) none set environment variable
-setfperm({fname}, {mode} Number set {fname} file permissions to {mode}
-setline({lnum}, {line}) Number set line {lnum} to {line}
-setloclist({nr}, {list} [, {action}])
- Number modify location list using {list}
-setloclist({nr}, {list}, {action}, {what})
- Number modify specific location list props
-setmatches({list} [, {win}]) Number restore a list of matches
-setpos({expr}, {list}) Number set the {expr} position to {list}
-setqflist({list} [, {action}]) Number modify quickfix list using {list}
-setqflist({list}, {action}, {what})
- Number modify specific quickfix list props
-setreg({n}, {v}[, {opt}]) Number set register to value and type
-settabvar({nr}, {varname}, {val}) set {varname} in tab page {nr} to {val}
-settabwinvar({tabnr}, {winnr}, {varname}, {val}) set {varname} in window
- {winnr} in tab page {tabnr} to {val}
-settagstack({nr}, {dict} [, {action}])
- Number modify tag stack using {dict}
-setwinvar({nr}, {varname}, {val}) set {varname} in window {nr} to {val}
-sha256({string}) String SHA256 checksum of {string}
-shellescape({string} [, {special}])
- String escape {string} for use as shell
- command argument
-shiftwidth([{col}]) Number effective value of 'shiftwidth'
-sign_define({name} [, {dict}]) Number define or update a sign
-sign_define({list}) List define or update a list of signs
-sign_getdefined([{name}]) List get a list of defined signs
-sign_getplaced([{buf} [, {dict}]])
- List get a list of placed signs
-sign_jump({id}, {group}, {buf})
- Number jump to a sign
-sign_place({id}, {group}, {name}, {buf} [, {dict}])
- Number place a sign
-sign_placelist({list}) List place a list of signs
-sign_undefine([{name}]) Number undefine a sign
-sign_undefine({list}) List undefine a list of signs
-sign_unplace({group} [, {dict}])
- Number unplace a sign
-sign_unplacelist({list}) List unplace a list of signs
-simplify({filename}) String simplify filename as much as possible
-sin({expr}) Float sine of {expr}
-sinh({expr}) Float hyperbolic sine of {expr}
-sockconnect({mode}, {address} [, {opts}])
- Number Connects to socket
-sort({list} [, {func} [, {dict}]])
- List sort {list}, using {func} to compare
-soundfold({word}) String sound-fold {word}
-spellbadword() String badly spelled word at cursor
-spellsuggest({word} [, {max} [, {capital}]])
- List spelling suggestions
-split({expr} [, {pat} [, {keepempty}]])
- List make |List| from {pat} separated {expr}
-sqrt({expr}) Float square root of {expr}
-stdioopen({dict}) Number open stdio in a headless instance.
-stdpath({what}) String/List returns the standard path(s) for {what}
-str2float({expr} [, {quoted}]) Float convert String to Float
-str2list({expr} [, {utf8}]) List convert each character of {expr} to
- ASCII/UTF-8 value
-str2nr({expr} [, {base} [, {quoted}]])
- Number convert String to Number
-strchars({expr} [, {skipcc}]) Number character length of the String {expr}
-strcharpart({str}, {start} [, {len}])
- String {len} characters of {str} at
- character {start}
-strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
-strftime({format} [, {time}]) String format time with a specified format
-strgetchar({str}, {index}) Number get char {index} from {str}
-stridx({haystack}, {needle} [, {start}])
- Number index of {needle} in {haystack}
-string({expr}) String String representation of {expr} value
-strlen({expr}) Number length of the String {expr}
-strpart({str}, {start} [, {len} [, {chars}]])
- String {len} bytes/chars of {str} at
- byte {start}
-strptime({format}, {timestring})
- Number Convert {timestring} to unix timestamp
-strridx({haystack}, {needle} [, {start}])
- Number last index of {needle} in {haystack}
-strtrans({expr}) String translate string to make it printable
-strwidth({expr}) Number display cell length of the String {expr}
-submatch({nr} [, {list}]) String or List
- specific match in ":s" or substitute()
-substitute({expr}, {pat}, {sub}, {flags})
- String all {pat} in {expr} replaced with {sub}
-swapinfo({fname}) Dict information about swap file {fname}
-swapname({buf}) String swap file of buffer {buf}
-synID({lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col}
-synIDattr({synID}, {what} [, {mode}])
- String attribute {what} of syntax ID {synID}
-synIDtrans({synID}) Number translated syntax ID of {synID}
-synconcealed({lnum}, {col}) List info about concealing
-synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and {col}
-system({cmd} [, {input}]) String output of shell command/filter {cmd}
-systemlist({cmd} [, {input}]) List output of shell command/filter {cmd}
-tabpagebuflist([{arg}]) List list of buffer numbers in tab page
-tabpagenr([{arg}]) Number number of current or last tab page
-tabpagewinnr({tabarg}[, {arg}])
- Number number of current window in tab page
-taglist({expr}[, {filename}]) List list of tags matching {expr}
-tagfiles() List tags files used
-tan({expr}) Float tangent of {expr}
-tanh({expr}) Float hyperbolic tangent of {expr}
-tempname() String name for a temporary file
-test_garbagecollect_now() none free memory right now for testing
-timer_info([{id}]) List information about timers
-timer_pause({id}, {pause}) none pause or unpause a timer
-timer_start({time}, {callback} [, {options}])
- Number create a timer
-timer_stop({timer}) none stop a timer
-timer_stopall() none stop all timers
-tolower({expr}) String the String {expr} switched to lowercase
-toupper({expr}) String the String {expr} switched to uppercase
-tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
- to chars in {tostr}
-trim({text} [, {mask} [, {dir}]])
- String trim characters in {mask} from {text}
-trunc({expr}) Float truncate Float {expr}
-type({name}) Number type of variable {name}
-undofile({name}) String undo file name for {name}
-undotree() List undo file tree
-uniq({list} [, {func} [, {dict}]])
- List remove adjacent duplicates from a list
-values({dict}) List values in {dict}
-virtcol({expr}) Number screen column of cursor or mark
-visualmode([expr]) String last visual mode used
-wait({timeout}, {condition}[, {interval}])
- Number Wait until {condition} is satisfied
-wildmenumode() Number whether 'wildmenu' mode is active
-win_execute({id}, {command} [, {silent}])
- String execute {command} in window {id}
-win_findbuf({bufnr}) List find windows containing {bufnr}
-win_getid([{win} [, {tab}]]) Number get |window-ID| for {win} in {tab}
-win_gettype([{nr}]) String type of window {nr}
-win_gotoid({expr}) Number go to |window-ID| {expr}
-win_id2tabwin({expr}) List get tab and window nr from |window-ID|
-win_id2win({expr}) Number get window nr from |window-ID|
-win_screenpos({nr}) List get screen position of window {nr}
-win_splitmove({nr}, {target} [, {options}])
- Number move window {nr} to split of {target}
-winbufnr({nr}) Number buffer number of window {nr}
-wincol() Number window column of the cursor
-windowsversion() String MS-Windows OS version
-winheight({nr}) Number height of window {nr}
-winlayout([{tabnr}]) List layout of windows in tab {tabnr}
-winline() Number window line of the cursor
-winnr([{expr}]) Number number of current window
-winrestcmd() String returns command to restore window sizes
-winrestview({dict}) none restore view of current window
-winsaveview() Dict save view of current window
-winwidth({nr}) Number width of window {nr}
-wordcount() Dict get byte/char/word statistics
-writefile({object}, {fname} [, {flags}])
- Number write |Blob| or |List| of lines to file
-xor({expr}, {expr}) Number bitwise XOR
-
-
-abs({expr}) *abs()*
- Return the absolute value of {expr}. When {expr} evaluates to
- a |Float| abs() returns a |Float|. When {expr} can be
- converted to a |Number| abs() returns a |Number|. Otherwise
- abs() gives an error message and returns -1.
- Examples: >
- echo abs(1.456)
-< 1.456 >
- echo abs(-5.456)
-< 5.456 >
- echo abs(-4)
-< 4
-
- Can also be used as a |method|: >
- Compute()->abs()
-
-acos({expr}) *acos()*
- Return the arc cosine of {expr} measured in radians, as a
- |Float| in the range of [0, pi].
- {expr} must evaluate to a |Float| or a |Number| in the range
- [-1, 1].
- Examples: >
- :echo acos(0)
-< 1.570796 >
- :echo acos(-0.5)
-< 2.094395
-
- Can also be used as a |method|: >
- Compute()->acos()
-
-add({object}, {expr}) *add()*
- Append the item {expr} to |List| or |Blob| {object}. Returns
- the resulting |List| or |Blob|. Examples: >
- :let alist = add([1, 2, 3], item)
- :call add(mylist, "woodstock")
-< Note that when {expr} is a |List| it is appended as a single
- item. Use |extend()| to concatenate |Lists|.
- When {object} is a |Blob| then {expr} must be a number.
- Use |insert()| to add an item at another position.
-
- Can also be used as a |method|: >
- mylist->add(val1)->add(val2)
-
-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.
- Example: >
- :let flag = and(bits, 0x80)
-< Can also be used as a |method|: >
- :let flag = bits->and(0x80)
-
-api_info() *api_info()*
- Returns Dictionary of |api-metadata|.
-
- View it in a nice human-readable format: >
- :lua print(vim.inspect(vim.fn.api_info()))
-
-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.
- Otherwise append {text} as one text line below line {lnum} in
- the current buffer.
- {lnum} can be zero to insert a line before the first one.
- {lnum} is used like with |getline()|.
- Returns 1 for failure ({lnum} out of range or out of memory),
- 0 for success. Example: >
- :let failed = append(line('$'), "# THE END")
- :let failed = append(0, ["Chapter 1", "the beginning"])
-
-< Can also be used as a |method| after a List: >
- mylist->append(lnum)
-
-appendbufline({buf}, {lnum}, {text}) *appendbufline()*
- Like |append()| but append the text in buffer {expr}.
-
- This function works only for loaded buffers. First call
- |bufload()| if needed.
-
- For the use of {buf}, see |bufname()|.
-
- {lnum} is used like with |append()|. Note that using |line()|
- would use the current buffer, not the one appending to.
- Use "$" to append at the end of the buffer.
-
- On success 0 is returned, on failure 1 is returned.
-
- If {buf} is not a valid buffer or {lnum} is not valid, an
- error message is given. Example: >
- :let failed = appendbufline(13, 0, "# THE START")
-<
- Can also be used as a |method| after a List: >
- mylist->appendbufline(buf, lnum)
-
-argc([{winid}]) *argc()*
- The result is the number of files in the argument list. See
- |arglist|.
- If {winid} is not supplied, the argument list of the current
- window is used.
- If {winid} is -1, the global argument list is used.
- Otherwise {winid} specifies the window of which the argument
- list is used: either the window number or the window ID.
- Returns -1 if the {winid} argument is invalid.
-
- *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|.
-
- *arglistid()*
-arglistid([{winnr} [, {tabnr}]])
- Return the argument list ID. This is a number which
- identifies the argument list being used. Zero is used for the
- global argument list. See |arglist|.
- Returns -1 if the arguments are invalid.
-
- Without arguments use the current window.
- With {winnr} only use this window in the current tab page.
- With {winnr} and {tabnr} use the window in the specified tab
- page.
- {winnr} can be the window number or the |window-ID|.
-
- *argv()*
-argv([{nr} [, {winid}]])
- The result is the {nr}th file in the argument list. See
- |arglist|. "argv(0)" is the first one. Example: >
- :let i = 0
- :while i < argc()
- : let f = escape(fnameescape(argv(i)), '.')
- : exe 'amenu Arg.' . f . ' :e ' . f . '<CR>'
- : let i = i + 1
- :endwhile
-< Without the {nr} argument, or when {nr} is -1, a |List| with
- the whole |arglist| is returned.
-
- The {winid} argument specifies the window ID, see |argc()|.
- For the Vim command line arguments see |v:argv|.
-
-asin({expr}) *asin()*
- Return the arc sine of {expr} measured in radians, as a |Float|
- in the range of [-pi/2, pi/2].
- {expr} must evaluate to a |Float| or a |Number| in the range
- [-1, 1].
- Examples: >
- :echo asin(0.8)
-< 0.927295 >
- :echo asin(-0.5)
-< -0.523599
-
- Can also be used as a |method|: >
- Compute()->asin()
-
-
-assert_ functions are documented here: |assert-functions-details|
-
-
-atan({expr}) *atan()*
- Return the principal value of the arc tangent of {expr}, in
- the range [-pi/2, +pi/2] radians, as a |Float|.
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo atan(100)
-< 1.560797 >
- :echo atan(-4.01)
-< -1.326405
-
- Can also be used as a |method|: >
- Compute()->atan()
-
-atan2({expr1}, {expr2}) *atan2()*
- Return the arc tangent of {expr1} / {expr2}, measured in
- radians, as a |Float| in the range [-pi, pi].
- {expr1} and {expr2} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo atan2(-1, 1)
-< -0.785398 >
- :echo atan2(1, -1)
-< 2.356194
-
- Can also be used as a |method|: >
- Compute()->atan2(1)
-
- *browse()*
-browse({save}, {title}, {initdir}, {default})
- Put up a file requester. This only works when "has("browse")"
- returns |TRUE| (only in some GUI versions).
- The input fields are:
- {save} when |TRUE|, select file to write
- {title} title for the requester
- {initdir} directory to start browsing in
- {default} default file name
- An empty string is returned when the "Cancel" button is hit,
- something went wrong, or browsing is not possible.
-
- *browsedir()*
-browsedir({title}, {initdir})
- Put up a directory requester. This only works when
- "has("browse")" returns |TRUE| (only in some GUI versions).
- On systems where a directory browser is not supported a file
- browser is used. In that case: select a file in the directory
- to be used.
- The input fields are:
- {title} title for the requester
- {initdir} directory to start browsing in
- When the "Cancel" button is hit, something went wrong, or
- browsing is not possible, an empty string is returned.
-
-bufadd({name}) *bufadd()*
- Add a buffer to the buffer list with String {name}.
- If a buffer for file {name} already exists, return that buffer
- number. Otherwise return the buffer number of the newly
- created buffer. When {name} is an empty string then a new
- buffer is always created.
- The buffer will not have 'buflisted' set and not be loaded
- yet. To add some text to the buffer use this: >
- let bufnr = bufadd('someName')
- call bufload(bufnr)
- call setbufline(bufnr, 1, ['some', 'text'])
-< Can also be used as a |method|: >
- let bufnr = 'somename'->bufadd()
-
-bufexists({buf}) *bufexists()*
- The result is a Number, which is |TRUE| if a buffer called
- {buf} exists.
- If the {buf} argument is a number, buffer numbers are used.
- Number zero is the alternate buffer for the current window.
-
- If the {buf} argument is a string it must match a buffer name
- exactly. The name can be:
- - Relative to the current directory.
- - A full path.
- - The name of a buffer with 'buftype' set to "nofile".
- - A URL name.
- Unlisted buffers will be found.
- Note that help files are listed by their short name in the
- output of |:buffers|, but bufexists() requires using their
- long name to be able to find them.
- bufexists() may report a buffer exists, but to use the name
- with a |:buffer| command you may need to use |expand()|. Esp
- for MS-Windows 8.3 names in the form "c:\DOCUME~1"
- Use "bufexists(0)" to test for the existence of an alternate
- file name.
-
- Can also be used as a |method|: >
- let exists = 'somename'->bufexists()
-
-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()|.
-
- Can also be used as a |method|: >
- let listed = 'somename'->buflisted()
-
-bufload({buf}) *bufload()*
- Ensure the buffer {buf} is loaded. When the buffer name
- refers to an existing file then the file is read. Otherwise
- the buffer will be empty. If the buffer was already loaded
- then there is no change.
- If there is an existing swap file for the file of the buffer,
- there will be no dialog, the buffer will be loaded anyway.
- The {buf} argument is used like with |bufexists()|.
-
- Can also be used as a |method|: >
- eval 'somename'->bufload()
-
-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()|.
-
- Can also be used as a |method|: >
- let loaded = 'somename'->bufloaded()
-
-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
- "[No Name]".
- If {buf} is omitted the current buffer is used.
- If {buf} is a Number, that buffer number's name is given.
- Number zero is the alternate buffer for the current window.
- If {buf} is a String, it is used as a |file-pattern| to match
- with the buffer names. This is always done like 'magic' is
- set and 'cpoptions' is empty. When there is more than one
- match an empty string is returned.
- "" or "%" can be used for the current buffer, "#" for the
- alternate buffer.
- A full match is preferred, otherwise a match at the start, end
- or middle of the buffer name is accepted. If you only want a
- full match then put "^" at the start and "$" at the end of the
- pattern.
- Listed buffers are found first. If there is a single match
- with a listed buffer, that one is returned. Next unlisted
- buffers are searched for.
- If the {buf} is a String, but you want to use it as a buffer
- number, force it to be a Number by adding zero to it: >
- :echo bufname("3" + 0)
-< Can also be used as a |method|: >
- echo bufnr->bufname()
-
-< If the buffer doesn't exist, or doesn't have a name, an empty
- string is returned. >
- bufname("#") alternate buffer name
- bufname(3) name of buffer 3
- bufname("%") name of current buffer
- bufname("file2") name of buffer where "file2" matches.
-<
- *bufnr()*
-bufnr([{buf} [, {create}]])
- The result is the number of a buffer, as it is displayed by
- the `:ls` command. For the use of {buf}, see |bufname()|
- above.
- If the buffer doesn't exist, -1 is returned. Or, if the
- {create} argument is present and TRUE, a new, unlisted,
- buffer is created and its number is returned.
- bufnr("$") is the last buffer: >
- :let last_buffer = bufnr("$")
-< The result is a Number, which is the highest buffer number
- of existing buffers. Note that not all buffers with a smaller
- number necessarily exist, because ":bwipeout" may have removed
- them. Use bufexists() to test for the existence of a buffer.
-
- Can also be used as a |method|: >
- echo bufref->bufnr()
-
-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},
- see |bufname()| above. If buffer {buf} doesn't exist or
- there is no such window, -1 is returned. Example: >
-
- echo "A window containing buffer 1 is " . (bufwinid(1))
-<
- Only deals with the current tab page.
-
- Can also be used as a |method|: >
- FindBuffer()->bufwinid()
-
-bufwinnr({buf}) *bufwinnr()*
- Like |bufwinid()| but return the window number instead of the
- |window-ID|.
- If buffer {buf} doesn't exist or there is no such window, -1
- is returned. Example: >
-
- echo "A window containing buffer 1 is " . (bufwinnr(1))
-
-< The number can be used with |CTRL-W_w| and ":wincmd w"
- |:wincmd|.
-
- Can also be used as a |method|: >
- FindBuffer()->bufwinnr()
-
-byte2line({byte}) *byte2line()*
- Return the line number that contains the character at byte
- count {byte} in the current buffer. This includes the
- end-of-line character, depending on the 'fileformat' option
- for the current buffer. The first character has byte count
- one.
- Also see |line2byte()|, |go| and |:goto|.
-
- Can also be used as a |method|: >
- GetOffset()->byte2line()
-
-byteidx({expr}, {nr}) *byteidx()*
- Return byte index of the {nr}'th character in the String
- {expr}. Use zero for the first character, it then returns
- zero.
- If there are no multibyte characters the returned value is
- equal to {nr}.
- Composing characters are not counted separately, their byte
- length is added to the preceding base character. See
- |byteidxcomp()| below for counting composing characters
- separately.
- Example : >
- echo matchstr(str, ".", byteidx(str, 3))
-< will display the fourth character. Another way to do the
- same: >
- let s = strpart(str, byteidx(str, 3))
- echo strpart(s, 0, byteidx(s, 1))
-< Also see |strgetchar()| and |strcharpart()|.
-
- If there are less than {nr} characters -1 is returned.
- If there are exactly {nr} characters the length of the string
- in bytes is returned.
-
- Can also be used as a |method|: >
- GetName()->byteidx(idx)
-
-byteidxcomp({expr}, {nr}) *byteidxcomp()*
- Like byteidx(), except that a composing character is counted
- as a separate character. Example: >
- let s = 'e' . nr2char(0x301)
- echo byteidx(s, 1)
- echo byteidxcomp(s, 1)
- echo byteidxcomp(s, 2)
-< The first and third echo result in 3 ('e' plus composing
- character is 3 bytes), the second echo results in 1 ('e' is
- one byte).
- Only works differently from byteidx() when 'encoding' is set to
- a Unicode encoding.
-
- Can also be used as a |method|: >
- GetName()->byteidxcomp(idx)
-
-call({func}, {arglist} [, {dict}]) *call()* *E699*
- Call function {func} with the items in |List| {arglist} as
- arguments.
- {func} can either be a |Funcref| or the name of a function.
- a:firstline and a:lastline are set to the cursor line.
- Returns the return value of the called function.
- {dict} is for functions with the "dict" attribute. It will be
- used to set the local variable "self". |Dictionary-function|
-
- Can also be used as a |method|: >
- GetFunc()->call([arg, arg], dict)
-
-ceil({expr}) *ceil()*
- Return the smallest integral value greater than or equal to
- {expr} as a |Float| (round up).
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- echo ceil(1.456)
-< 2.0 >
- echo ceil(-5.456)
-< -5.0 >
- echo ceil(4.0)
-< 4.0
-
- Can also be used as a |method|: >
- Compute()->ceil()
-
-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
- with the |:undo| command.
- When a change was made it is the number of that change. After
- redo it is the number of the redone change. After undo it is
- one less than the number of the undone change.
-
-chanclose({id}[, {stream}]) *chanclose()*
- Close a channel or a specific stream associated with it.
- For a job, {stream} can be one of "stdin", "stdout",
- "stderr" or "rpc" (closes stdin/stdout for a job started
- with `"rpc":v:true`) If {stream} is omitted, all streams
- are closed. If the channel is a pty, this will then close the
- pty master, sending SIGHUP to the job process.
- For a socket, there is only one stream, and {stream} should be
- ommited.
-
-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|,
- it writes to Nvim's stdout. Returns the number of bytes
- written if the write succeeded, 0 otherwise.
- See |channel-bytes| for more information.
-
- {data} may be a string, string convertible, |Blob|, or a list.
- If {data} is a list, the items will be joined by newlines; any
- newlines in an item will be sent as NUL. To send a final
- newline, include a final empty string. Example: >
- :call chansend(id, ["abc", "123\n456", ""])
-< will send "abc<NL>123<NUL>456<NL>".
-
- chansend() writes raw data, not RPC messages. If the channel
- was created with `"rpc":v:true` then the channel expects RPC
- messages, use |rpcnotify()| and |rpcrequest()| instead.
-
-
-char2nr({string} [, {utf8}]) *char2nr()*
- Return number value of the first char in {string}.
- Examples: >
- char2nr(" ") returns 32
- char2nr("ABC") returns 65
- char2nr("á") returns 225
- char2nr("á"[0]) returns 195
- char2nr("\<M-x>") returns 128
-< Non-ASCII characters are always treated as UTF-8 characters.
- {utf8} is ignored, it exists only for backwards-compatibility.
- A combining character is a separate character.
- |nr2char()| does the opposite.
-
- Can also be used as a |method|: >
- GetChar()->char2nr()
-<
- *charidx()*
-charidx({string}, {idx} [, {countcc}])
- Return the character index of the byte at {idx} in {string}.
- The index of the first character is zero.
- If there are no multibyte characters the returned value is
- equal to {idx}.
- When {countcc} is omitted or |FALSE|, then composing characters
- are not counted separately, their byte length is
- added to the preceding base character.
- When {countcc} is |TRUE|, then composing characters are
- counted as separate characters.
- Returns -1 if the arguments are invalid or if {idx} is greater
- than the index of the last byte in {string}. An error is
- given if the first argument is not a string, the second
- argument is not a number or when the third argument is present
- and is not zero or one.
- See |byteidx()| and |byteidxcomp()| for getting the byte index
- from the character index.
- Examples: >
- echo charidx('áb́ć', 3) returns 1
- echo charidx('áb́ć', 6, 1) returns 4
- echo charidx('áb́ć', 16) returns -1
-<
- Can also be used as a |method|: >
- GetName()->charidx(idx)
-
-chdir({dir}) *chdir()*
- Change the current working directory to {dir}. The scope of
- the directory change depends on the directory of the current
- window:
- - If the current window has a window-local directory
- (|:lcd|), then changes the window local directory.
- - Otherwise, if the current tabpage has a local
- directory (|:tcd|) then changes the tabpage local
- directory.
- - Otherwise, changes the global directory.
- If successful, returns the previous working directory. Pass
- this to another chdir() to restore the directory.
- On failure, returns an empty string.
-
- Example: >
- let save_dir = chdir(newdir)
- if save_dir
- " ... do some work
- call chdir(save_dir)
- endif
-<
-cindent({lnum}) *cindent()*
- Get the amount of indent for line {lnum} according the C
- indenting rules, as with 'cindent'.
- The indent is counted in spaces, the value of 'tabstop' is
- relevant. {lnum} is used just like in |getline()|.
- When {lnum} is invalid -1 is returned.
- See |C-indenting|.
-
- Can also be used as a |method|: >
- GetLnum()->cindent()
-
-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.
-
- Can also be used as a |method|: >
- GetWin()->clearmatches()
-<
- *col()*
-col({expr}) 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.
- 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.
- To get the line number use |line()|. To get both use
- |getpos()|.
- For the screen column position use |virtcol()|.
- Note that only marks in the current file can be used.
- Examples: >
- col(".") column of cursor
- col("$") length of cursor line plus one
- col("'t") column of mark t
- col("'" . markname) column of mark markname
-< The first column is 1. 0 is returned for an error.
- For an uppercase mark the column may actually be in another
- buffer.
- For the cursor position, when 'virtualedit' is active, the
- column is one higher if the cursor is after the end of the
- line. This can be used to obtain the column in Insert mode: >
- :imap <F2> <C-O>:let save_ve = &ve<CR>
- \<C-O>:set ve=all<CR>
- \<C-O>:echo col(".") . "\n" <Bar>
- \let &ve = save_ve<CR>
-
-< Can also be used as a |method|: >
- GetPos()->col()
-<
-
-complete({startcol}, {matches}) *complete()* *E785*
- Set the matches for Insert mode completion.
- Can only be used in Insert mode. You need to use a mapping
- with CTRL-R = (see |i_CTRL-R|). It does not work after CTRL-O
- or with an expression mapping.
- {startcol} is the byte offset in the line where the completed
- text start. The text up to the cursor is the original text
- that will be replaced by the matches. Use col('.') for an
- empty string. "col('.') - 1" will replace one character by a
- match.
- {matches} must be a |List|. Each |List| item is one match.
- See |complete-items| for the kind of items that are possible.
- "longest" in 'completeopt' is ignored.
- Note that the after calling this function you need to avoid
- inserting anything that would cause completion to stop.
- The match can be selected with CTRL-N and CTRL-P as usual with
- Insert mode completion. The popup menu will appear if
- specified, see |ins-completion-menu|.
- Example: >
- inoremap <F5> <C-R>=ListMonths()<CR>
-
- func! ListMonths()
- call complete(col('.'), ['January', 'February', 'March',
- \ 'April', 'May', 'June', 'July', 'August', 'September',
- \ 'October', 'November', 'December'])
- return ''
- endfunc
-< This isn't very useful, but it shows how it works. Note that
- an empty string is returned to avoid a zero being inserted.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetMatches()->complete(col('.'))
-
-complete_add({expr}) *complete_add()*
- Add {expr} to the list of matches. Only to be used by the
- function specified with the 'completefunc' option.
- Returns 0 for failure (empty string or out of memory),
- 1 when the match was added, 2 when the match was already in
- the list.
- See |complete-functions| for an explanation of {expr}. It is
- the same as one item in the list that 'omnifunc' would return.
-
- Can also be used as a |method|: >
- GetMoreMatches()->complete_add()
-
-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.
- Returns |TRUE| when searching for matches is to be aborted,
- zero otherwise.
- Only to be used by the function specified with the
- 'completefunc' option.
-
-
-complete_info([{what}]) *complete_info()*
- Returns a |Dictionary| with information about Insert mode
- completion. See |ins-completion|.
- The items are:
- mode Current completion mode name string.
- See |complete_info_mode| for the values.
- pum_visible |TRUE| if popup menu is visible.
- See |pumvisible()|.
- items List of completion matches. Each item is a
- dictionary containing the entries "word",
- "abbr", "menu", "kind", "info" and "user_data".
- See |complete-items|.
- selected Selected item index. First index is zero.
- Index is -1 if no item is selected (showing
- typed text only, or the last completion after
- no item is selected when using the <Up> or
- <Down> keys)
- inserted Inserted string. [NOT IMPLEMENT YET]
-
- *complete_info_mode*
- mode values are:
- "" Not in completion mode
- "keyword" Keyword completion |i_CTRL-X_CTRL-N|
- "ctrl_x" Just pressed CTRL-X |i_CTRL-X|
- "scroll" Scrolling with |i_CTRL-X_CTRL-E| or
- |i_CTRL-X_CTRL-Y|
- "whole_line" Whole lines |i_CTRL-X_CTRL-L|
- "files" File names |i_CTRL-X_CTRL-F|
- "tags" Tags |i_CTRL-X_CTRL-]|
- "path_defines" Definition completion |i_CTRL-X_CTRL-D|
- "path_patterns" Include completion |i_CTRL-X_CTRL-I|
- "dictionary" Dictionary |i_CTRL-X_CTRL-K|
- "thesaurus" Thesaurus |i_CTRL-X_CTRL-T|
- "cmdline" Vim Command line |i_CTRL-X_CTRL-V|
- "function" User defined completion |i_CTRL-X_CTRL-U|
- "omni" Omni completion |i_CTRL-X_CTRL-O|
- "spell" Spelling suggestions |i_CTRL-X_s|
- "eval" |complete()| completion
- "unknown" Other internal modes
-
- If the optional {what} list argument is supplied, then only
- the items listed in {what} are returned. Unsupported items in
- {what} are silently ignored.
-
- To get the position and size of the popup menu, see
- |pum_getpos()|. It's also available in |v:event| during the
- |CompleteChanged| event.
-
- Examples: >
- " Get all items
- call complete_info()
- " Get only 'mode'
- call complete_info(['mode'])
- " Get only 'mode' and 'pum_visible'
- call complete_info(['mode', 'pum_visible'])
-
-< Can also be used as a |method|: >
- GetItems()->complete_info()
-<
- *confirm()*
-confirm({msg} [, {choices} [, {default} [, {type}]]])
- Confirm() offers the user a dialog, from which a choice can be
- made. It returns the number of the choice. For the first
- choice this is 1.
-
- {msg} is displayed in a dialog with {choices} as the
- alternatives. When {choices} is missing or empty, "&OK" is
- used (and translated).
- {msg} is a String, use '\n' to include a newline. Only on
- some systems the string is wrapped when it doesn't fit.
-
- {choices} is a String, with the individual choices separated
- by '\n', e.g. >
- confirm("Save changes?", "&Yes\n&No\n&Cancel")
-< The letter after the '&' is the shortcut key for that choice.
- Thus you can type 'c' to select "Cancel". The shortcut does
- not need to be the first letter: >
- confirm("file has been modified", "&Save\nSave &All")
-< For the console, the first letter of each choice is used as
- the default shortcut key. Case is ignored.
-
- The optional {type} String argument gives the type of dialog.
- It can be one of these values: "Error", "Question", "Info",
- "Warning" or "Generic". Only the first character is relevant.
- When {type} is omitted, "Generic" is used.
-
- The optional {type} argument gives the type of dialog. This
- is only used for the icon of the Win32 GUI. It can be one of
- these values: "Error", "Question", "Info", "Warning" or
- "Generic". Only the first character is relevant.
- When {type} is omitted, "Generic" is used.
-
- If the user aborts the dialog by pressing <Esc>, CTRL-C,
- or another valid interrupt key, confirm() returns 0.
-
- An example: >
- :let choice = confirm("What do you want?", "&Apples\n&Oranges\n&Bananas", 2)
- :if choice == 0
- : echo "make up your mind!"
- :elseif choice == 3
- : echo "tasteful"
- :else
- : echo "I prefer bananas myself."
- :endif
-< In a GUI dialog, buttons are used. The layout of the buttons
- depends on the 'v' flag in 'guioptions'. If it is included,
- the buttons are always put vertically. Otherwise, confirm()
- tries to put the buttons in one horizontal line. If they
- don't fit, a vertical layout is used anyway. For some systems
- the horizontal layout is always used.
-
- Can also be used as a |method|in: >
- BuildMessage()->confirm("&Yes\n&No")
-<
- *copy()*
-copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
- different from using {expr} directly.
- When {expr} is a |List| a shallow copy is created. This means
- that the original |List| can be changed without changing the
- copy, and vice versa. But the items are identical, thus
- changing an item changes the contents of both |Lists|.
- A |Dictionary| is copied in a similar way as a |List|.
- Also see |deepcopy()|.
- Can also be used as a |method|: >
- mylist->copy()
-
-cos({expr}) *cos()*
- Return the cosine of {expr}, measured in radians, as a |Float|.
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo cos(100)
-< 0.862319 >
- :echo cos(-4.01)
-< -0.646043
-
- Can also be used as a |method|: >
- Compute()->cos()
-
-cosh({expr}) *cosh()*
- Return the hyperbolic cosine of {expr} as a |Float| in the range
- [1, inf].
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo cosh(0.5)
-< 1.127626 >
- :echo cosh(-0.5)
-< -1.127626
-
- Can also be used as a |method|: >
- Compute()->cosh()
-
-count({comp}, {expr} [, {ic} [, {start}]]) *count()*
- Return the number of times an item with value {expr} appears
- in |String|, |List| or |Dictionary| {comp}.
-
- If {start} is given then start with the item with this index.
- {start} can only be used with a |List|.
-
- When {ic} is given and it's |TRUE| then case is ignored.
-
- When {comp} is a string then the number of not overlapping
- occurrences of {expr} is returned. Zero is returned when
- {expr} is an empty string.
-
- Can also be used as a |method|: >
- mylist->count(val)
-<
- *cscope_connection()*
-cscope_connection([{num} , {dbpath} [, {prepend}]])
- Checks for the existence of a |cscope| connection. If no
- parameters are specified, then the function returns:
- 0, if there are no cscope connections;
- 1, if there is at least one cscope connection.
-
- If parameters are specified, then the value of {num}
- determines how existence of a cscope connection is checked:
-
- {num} Description of existence check
- ----- ------------------------------
- 0 Same as no parameters (e.g., "cscope_connection()").
- 1 Ignore {prepend}, and use partial string matches for
- {dbpath}.
- 2 Ignore {prepend}, and use exact string matches for
- {dbpath}.
- 3 Use {prepend}, use partial string matches for both
- {dbpath} and {prepend}.
- 4 Use {prepend}, use exact string matches for both
- {dbpath} and {prepend}.
-
- Note: All string comparisons are case sensitive!
-
- Examples. Suppose we had the following (from ":cs show"): >
-
- # pid database name prepend path
- 0 27664 cscope.out /usr/local
-<
- Invocation Return Val ~
- ---------- ---------- >
- cscope_connection() 1
- cscope_connection(1, "out") 1
- cscope_connection(2, "out") 0
- cscope_connection(3, "out") 0
- cscope_connection(3, "out", "local") 1
- cscope_connection(4, "out") 0
- cscope_connection(4, "out", "local") 0
- cscope_connection(4, "cscope.out", "/usr/local") 1
-<
-
-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).
-
-ctxpop() *ctxpop()*
- Pops and restores the |context| at the top of the
- |context-stack|.
-
-ctxpush([{types}]) *ctxpush()*
- Pushes the current editor state (|context|) on the
- |context-stack|.
- If {types} is given and is a |List| of |String|s, it specifies
- which |context-types| to include in the pushed context.
- Otherwise, all context types are included.
-
-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).
-
-ctxsize() *ctxsize()*
- Returns the size of the |context-stack|.
-
-cursor({lnum}, {col} [, {off}]) *cursor()*
-cursor({list})
- Positions the cursor at the column (byte count) {col} in the
- line {lnum}. The first column is one.
-
- When there is one argument {list} this is used as a |List|
- with two, three or four item:
- [{lnum}, {col}]
- [{lnum}, {col}, {off}]
- [{lnum}, {col}, {off}, {curswant}]
- This is like the return value of |getpos()| or |getcurpos()|,
- but without the first item.
-
- Does not change the jumplist.
- If {lnum} is greater than the number of lines in the buffer,
- the cursor will be positioned at the last line in the buffer.
- If {lnum} is zero, the cursor will stay in the current line.
- If {col} is greater than the number of bytes in the line,
- the cursor will be positioned at the last character in the
- line.
- If {col} is zero, the cursor will stay in the current column.
- If {curswant} is given it is used to set the preferred column
- for vertical movement. Otherwise {col} is used.
-
- When 'virtualedit' is used {off} specifies the offset in
- screen columns from the start of the character. E.g., a
- position within a <Tab> or after the last character.
- Returns 0 when the position could be set, -1 otherwise.
-
- Can also be used as a |method|: >
- GetCursorPos()->cursor()
-
-deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
- Make a copy of {expr}. For Numbers and Strings this isn't
- different from using {expr} directly.
- When {expr} is a |List| a full copy is created. This means
- that the original |List| can be changed without changing the
- copy, and vice versa. When an item is a |List|, a copy for it
- is made, recursively. Thus changing an item in the copy does
- not change the contents of the original |List|.
-
- When {noref} is omitted or zero a contained |List| or
- |Dictionary| is only copied once. All references point to
- this single copy. With {noref} set to 1 every occurrence of a
- |List| or |Dictionary| results in a new copy. This also means
- that a cyclic reference causes deepcopy() to fail.
- *E724*
- Nesting is possible up to 100 levels. When there is an item
- that refers back to a higher level making a deep copy with
- {noref} set to 1 will fail.
- Also see |copy()|.
-
- Can also be used as a |method|: >
- GetObject()->deepcopy()
-
-delete({fname} [, {flags}]) *delete()*
- Without {flags} or with {flags} empty: Deletes the file by the
- name {fname}. This also works when {fname} is a symbolic link.
- A symbolic link itself is deleted, not what it points to.
-
- When {flags} is "d": Deletes the directory by the name
- {fname}. This fails when directory {fname} is not empty.
-
- When {flags} is "rf": Deletes the directory by the name
- {fname} and everything in it, recursively. BE CAREFUL!
- Note: on MS-Windows it is not possible to delete a directory
- that is being used.
-
- The result is a Number, which is 0/false if the delete
- operation was successful and -1/true when the deletion failed
- or partly failed.
-
- Can also be used as a |method|: >
- GetName()->delete()
-
-deletebufline({buf}, {first}[, {last}]) *deletebufline()*
- Delete lines {first} to {last} (inclusive) from buffer {buf}.
- If {last} is omitted then delete line {first} only.
- On success 0 is returned, on failure 1 is returned.
-
- This function works only for loaded buffers. First call
- |bufload()| if needed.
-
- For the use of {buf}, see |bufname()| above.
-
- {first} and {last} are used like with |setline()|. Note that
- when using |line()| this refers to the current buffer. Use "$"
- to refer to the last line in buffer {buf}.
-
- Can also be used as a |method|: >
- GetBuffer()->deletebufline(1)
-<
-dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()*
- Adds a watcher to a dictionary. A dictionary watcher is
- identified by three components:
-
- - A dictionary({dict});
- - A key pattern({pattern}).
- - A function({callback}).
-
- After this is called, every change on {dict} and on keys
- matching {pattern} will result in {callback} being invoked.
-
- For example, to watch all global variables: >
- silent! call dictwatcherdel(g:, '*', 'OnDictChanged')
- function! OnDictChanged(d,k,z)
- echomsg string(a:k) string(a:z)
- endfunction
- call dictwatcheradd(g:, '*', 'OnDictChanged')
-<
- For now {pattern} only accepts very simple patterns that can
- contain a '*' at the end of the string, in which case it will
- match every key that begins with the substring before the '*'.
- That means if '*' is not the last character of {pattern}, only
- keys that are exactly equal as {pattern} will be matched.
-
- The {callback} receives three arguments:
-
- - The dictionary being watched.
- - The key which changed.
- - A dictionary containing the new and old values for the key.
-
- The type of change can be determined by examining the keys
- present on the third argument:
-
- - If contains both `old` and `new`, the key was updated.
- - If it contains only `new`, the key was added.
- - If it contains only `old`, the key was deleted.
-
- This function can be used by plugins to implement options with
- validation and parsing logic.
-
-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.
-
- *did_filetype()*
-did_filetype() Returns |TRUE| when autocommands are being executed and the
- FileType event has been triggered at least once. Can be used
- to avoid triggering the FileType event again in the scripts
- that detect the file type. |FileType|
- Returns |FALSE| when `:setf FALLBACK` was used.
- When editing another file, the counter is reset, thus this
- really checks if the FileType event has been triggered for the
- current buffer. This allows an autocommand that starts
- editing another buffer to set 'filetype' and load a syntax
- file.
-
-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
- another diff'ed window. These filler lines are shown in the
- display but don't exist in the buffer.
- {lnum} is used like with |getline()|. Thus "." is the current
- line, "'m" mark m, etc.
- Returns 0 if the current window is not in diff mode.
-
- Can also be used as a |method|: >
- GetLnum()->diff_filler()
-
-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
- diff change zero is returned.
- {lnum} is used like with |getline()|. Thus "." is the current
- line, "'m" mark m, etc.
- {col} is 1 for the leftmost column, {lnum} is 1 for the first
- line.
- The highlight ID can be used with |synIDattr()| to obtain
- syntax information about the highlighting.
-
- Can also be used as a |method|: >
- GetLnum()->diff_hlID(col)
-
-empty({expr}) *empty()*
- Return the Number 1 if {expr} is empty, zero otherwise.
- - A |List| or |Dictionary| is empty when it does not have any
- items.
- - A |String| is empty when its length is zero.
- - A |Number| and |Float| are empty when their value is zero.
- - |v:false| and |v:null| are empty, |v:true| is not.
- - A |Blob| is empty when its length is zero.
-
- Can also be used as a |method|: >
- mylist->empty()
-
-environ() *environ()*
- Return all of environment variables as dictionary. You can
- check if an environment variable exists like this: >
- :echo has_key(environ(), 'HOME')
-< Note that the variable name may be CamelCase; to ignore case
- use this: >
- :echo index(keys(environ()), 'HOME', 0, 1) != -1
-
-escape({string}, {chars}) *escape()*
- Escape the characters in {chars} that occur in {string} with a
- backslash. Example: >
- :echo escape('c:\program files\vim', ' \')
-< results in: >
- c:\\program\ files\\vim
-< Also see |shellescape()| and |fnameescape()|.
-
- Can also be used as a |method|: >
- GetText()->escape(' \')
-<
- *eval()*
-eval({string}) Evaluate {string} and return the result. Especially useful to
- turn the result of |string()| back into the original value.
- This works for Numbers, Floats, Strings, Blobs and composites
- of them. Also works for |Funcref|s that refer to existing
- functions.
-
- Can also be used as a |method|: >
- argv->join()->eval()
-
-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.
-
-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*
- 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
- 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|).
- The result is a Number:
- 1 exists
- 0 does not exist
- -1 not implemented on this system
- |exepath()| can be used to get the full path of an executable.
-
- Can also be used as a |method|: >
- GetCommand()->executable()
-
-execute({command} [, {silent}]) *execute()*
- Execute {command} and capture its output.
- If {command} is a |String|, returns {command} output.
- If {command} is a |List|, returns concatenated outputs.
- Examples: >
- echo execute('echon "foo"')
-< foo >
- echo execute(['echon "foo"', 'echon "bar"'])
-< foobar
-
- The optional {silent} argument can have these values:
- "" no `:silent` used
- "silent" `:silent` used
- "silent!" `:silent!` used
- The default is "silent". Note that with "silent!", unlike
- `:redir`, error messages are dropped.
-
- To get a list of lines use |split()| on the result: >
- split(execute('args'), "\n")
-
-< This function is not available in the |sandbox|.
- Note: If nested, an outer execute() will not observe output of
- the inner calls.
- Note: Text attributes (highlights) are not captured.
- To execute a command in another window than the current one
- use `win_execute()`.
-
- Can also be used as a |method|: >
- GetCommand()->execute()
-
-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.
-
- Can also be used as a |method|: >
- GetCommand()->exepath()
-<
- *exists()*
-exists({expr}) The result is a Number, which is |TRUE| if {expr} is
- defined, zero otherwise.
-
- For checking for a supported feature use |has()|.
- For checking if a file exists use |filereadable()|.
-
- The {expr} argument is a string, which contains one of these:
- &option-name Vim option (only checks if it exists,
- not if it really works)
- +option-name Vim option that works.
- $ENVNAME environment variable (could also be
- done by comparing with an empty
- string)
- *funcname built-in function (see |functions|)
- or user defined function (see
- |user-function|). Also works for a
- variable that is a Funcref.
- varname internal variable (see
- |internal-variables|). Also works
- for |curly-braces-names|, |Dictionary|
- entries, |List| items, etc. Beware
- that evaluating an index may cause an
- error message for an invalid
- expression. E.g.: >
- :let l = [1, 2, 3]
- :echo exists("l[5]")
-< 0 >
- :echo exists("l[xx]")
-< E121: Undefined variable: xx
- 0
- :cmdname Ex command: built-in command, user
- command or command modifier |:command|.
- Returns:
- 1 for match with start of a command
- 2 full match with a command
- 3 matches several user commands
- To check for a supported command
- always check the return value to be 2.
- :2match The |:2match| command.
- :3match The |:3match| command.
- #event autocommand defined for this event
- #event#pattern autocommand defined for this event and
- pattern (the pattern is taken
- literally and compared to the
- autocommand patterns character by
- character)
- #group autocommand group exists
- #group#event autocommand defined for this group and
- event.
- #group#event#pattern
- autocommand defined for this group,
- event and pattern.
- ##event autocommand for this event is
- supported.
-
- Examples: >
- exists("&mouse")
- exists("$HOSTNAME")
- exists("*strftime")
- exists("*s:MyFunc")
- exists("bufcount")
- exists(":Make")
- exists("#CursorHold")
- exists("#BufReadPre#*.gz")
- exists("#filetypeindent")
- exists("#filetypeindent#FileType")
- exists("#filetypeindent#FileType#*")
- exists("##ColorScheme")
-< There must be no space between the symbol (&/$/*/#) and the
- name.
- There must be no extra characters after the name, although in
- a few cases this is ignored. That may become more strict in
- the future, thus don't count on it!
- Working example: >
- exists(":make")
-< NOT working example: >
- exists(":make install")
-
-< Note that the argument must be a string, not the name of the
- variable itself. For example: >
- exists(bufcount)
-< This doesn't check for existence of the "bufcount" variable,
- but gets the value of "bufcount", and checks if that exists.
-
- Can also be used as a |method|: >
- Varname()->exists()
-
-exp({expr}) *exp()*
- Return the exponential of {expr} as a |Float| in the range
- [0, inf].
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo exp(2)
-< 7.389056 >
- :echo exp(-1)
-< 0.367879
-
- Can also be used as a |method|: >
- Compute()->exp()
-
-debugbreak({pid}) *debugbreak()*
- Specifically used to interrupt a program being debugged. It
- will cause process {pid} to get a SIGTRAP. Behavior for other
- processes is undefined. See |terminal-debugger|.
- {Sends a SIGINT to a process {pid} other than MS-Windows}
-
- Can also be used as a |method|: >
- GetPid()->debugbreak()
-
-expand({string} [, {nosuf} [, {list}]]) *expand()*
- Expand wildcards and the following special keywords in
- {string}. 'wildignorecase' applies.
-
- If {list} is given and it is |TRUE|, a List will be returned.
- Otherwise the result is a String and when there are several
- matches, they are separated by <NL> characters.
-
- If the expansion fails, the result is an empty string. A name
- for a non-existing file is not included, unless {string} does
- not start with '%', '#' or '<', see below.
-
- When {string} starts with '%', '#' or '<', the expansion is
- done like for the |cmdline-special| variables with their
- associated modifiers. Here is a short overview:
-
- % current file name
- # alternate file name
- #n alternate file name n
- <cfile> file name under the cursor
- <afile> autocmd file name
- <abuf> autocmd buffer number (as a String!)
- <amatch> autocmd matched name
- <sfile> sourced script file or function name
- <slnum> sourced script line number or function
- line number
- <sflnum> script file line number, also when in
- a function
- <SID> "<SNR>123_" where "123" is the
- current script ID |<SID>|
- <cword> word under the cursor
- <cWORD> WORD under the cursor
- <client> the {clientid} of the last received
- message |server2client()|
- Modifiers:
- :p expand to full path
- :h head (last path component removed)
- :t tail (last path component only)
- :r root (one extension removed)
- :e extension only
-
- Example: >
- :let &tags = expand("%:p:h") . "/tags"
-< Note that when expanding a string that starts with '%', '#' or
- '<', any following text is ignored. This does NOT work: >
- :let doesntwork = expand("%:h.bak")
-< Use this: >
- :let doeswork = expand("%:h") . ".bak"
-< Also note that expanding "<cfile>" and others only returns the
- referenced file name without further expansion. If "<cfile>"
- is "~/.cshrc", you need to do another expand() to have the
- "~/" expanded into the path of the home directory: >
- :echo expand(expand("<cfile>"))
-<
- There cannot be white space between the variables and the
- following modifier. The |fnamemodify()| function can be used
- to modify normal file names.
-
- When using '%' or '#', and the current or alternate file name
- is not defined, an empty string is used. Using "%:p" in a
- buffer with no name, results in the current directory, with a
- '/' added.
-
- When {string} does not start with '%', '#' or '<', it is
- expanded like a file name is expanded on the command line.
- 'suffixes' and 'wildignore' are used, unless the optional
- {nosuf} argument is given and it is |TRUE|.
- Names for non-existing files are included. The "**" item can
- be used to search in a directory tree. For example, to find
- all "README" files in the current directory and below: >
- :echo expand("**/README")
-<
- expand() can also be used to expand variables and environment
- variables that are only known in a shell. But this can be
- slow, because a shell may be used to do the expansion. See
- |expr-env-expand|.
- The expanded variable is still handled like a list of file
- names. When an environment variable cannot be expanded, it is
- left unchanged. Thus ":echo expand('$FOOBAR')" results in
- "$FOOBAR".
-
- See |glob()| for finding existing files. See |system()| for
- getting the raw output of an external command.
-
- Can also be used as a |method|: >
- Getpattern()->expand()
-
-expandcmd({string}) *expandcmd()*
- Expand special items in String {string} like what is done for
- an Ex command such as `:edit`. This expands special keywords,
- like with |expand()|, and environment variables, anywhere in
- {string}. "~user" and "~/path" are only expanded at the
- start.
- Returns the expanded string. Example: >
- :echo expandcmd('make %<.o')
-
-< Can also be used as a |method|: >
- GetCommand()->expandcmd()
-<
-extend({expr1}, {expr2} [, {expr3}]) *extend()*
- {expr1} and {expr2} must be both |Lists| or both
- |Dictionaries|.
-
- If they are |Lists|: Append {expr2} to {expr1}.
- If {expr3} is given insert the items of {expr2} before the
- item with index {expr3} in {expr1}. When {expr3} is zero
- insert before the first item. When {expr3} is equal to
- len({expr1}) then {expr2} is appended.
- Examples: >
- :echo sort(extend(mylist, [7, 5]))
- :call extend(mylist, [2, 3], 1)
-< When {expr1} is the same List as {expr2} then the number of
- items copied is equal to the original length of the List.
- E.g., when {expr3} is 1 you get N new copies of the first item
- (where N is the original length of the List).
- Use |add()| to concatenate one item to a list. To concatenate
- two lists into a new list use the + operator: >
- :let newlist = [1, 2, 3] + [4, 5]
-<
- If they are |Dictionaries|:
- Add all entries from {expr2} to {expr1}.
- If a key exists in both {expr1} and {expr2} then {expr3} is
- used to decide what to do:
- {expr3} = "keep": keep the value of {expr1}
- {expr3} = "force": use the value of {expr2}
- {expr3} = "error": give an error message *E737*
- When {expr3} is omitted then "force" is assumed.
-
- {expr1} is changed when {expr2} is not empty. If necessary
- make a copy of {expr1} first.
- {expr2} remains unchanged.
- When {expr1} is locked and {expr2} is not empty the operation
- fails.
- Returns {expr1}.
-
- Can also be used as a |method|: >
- mylist->extend(otherlist)
-
-feedkeys({string} [, {mode}]) *feedkeys()*
- Characters in {string} are queued for processing as if they
- come from a mapping or were typed by the user.
-
- By default the string is added to the end of the typeahead
- buffer, thus if a mapping is still being executed the
- characters come after them. Use the 'i' flag to insert before
- other characters, they will be executed next, before any
- characters from a mapping.
-
- The function does not wait for processing of keys contained in
- {string}.
-
- To include special keys into {string}, use double-quotes
- and "\..." notation |expr-quote|. For example,
- feedkeys("\<CR>") simulates pressing of the <Enter> key. But
- feedkeys('\<CR>') pushes 5 characters.
- The |<Ignore>| keycode may be used to exit the
- wait-for-character without doing anything.
-
- {mode} is a String, which can contain these character flags:
- 'm' Remap keys. This is default. If {mode} is absent,
- keys are remapped.
- 'n' Do not remap keys.
- 't' Handle keys as if typed; otherwise they are handled as
- if coming from a mapping. This matters for undo,
- opening folds, etc.
- 'i' Insert the string instead of appending (see above).
- 'x' Execute commands until typeahead is empty. This is
- similar to using ":normal!". You can call feedkeys()
- several times without 'x' and then one time with 'x'
- (possibly with an empty {string}) to execute all the
- typeahead. Note that when Vim ends in Insert mode it
- will behave as if <Esc> is typed, to avoid getting
- stuck, waiting for a character to be typed before the
- script continues.
- Note that if you manage to call feedkeys() while
- executing commands, thus calling it recursively, then
- all typehead will be consumed by the last call.
- '!' When used with 'x' will not end Insert mode. Can be
- used in a test when a timer is set to exit Insert mode
- a little later. Useful for testing CursorHoldI.
-
- Return value is always 0.
-
- Can also be used as a |method|: >
- GetInput()->feedkeys()
-
-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,
- or is a directory, the result is |FALSE|. {file} is any
- expression, which is used as a String.
- If you don't care about the file being readable you can use
- |glob()|.
- {file} is used as-is, you may want to expand wildcards first: >
- echo filereadable('~/.vimrc')
- 0
- echo filereadable(expand('~/.vimrc'))
- 1
-
-< Can also be used as a |method|: >
- GetName()->filereadable()
-
-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.
-
- Can also be used as a |method|: >
- GetName()->filewriteable()
-
-filter({expr1}, {expr2}) *filter()*
- {expr1} must be a |List|, |Blob|, or a |Dictionary|.
- For each item in {expr1} evaluate {expr2} and when the result
- is zero remove the item from the |List| or |Dictionary|. For a
- |Blob| each byte is removed.
-
- {expr2} must be a |string| or |Funcref|.
-
- If {expr2} is a |string|, inside {expr2} |v:val| has the value
- of the current item. For a |Dictionary| |v:key| has the key
- of the current item and for a |List| |v:key| has the index of
- the current item. For a |Blob| |v:key| has the index of the
- current byte.
-
- Examples: >
- call filter(mylist, 'v:val !~ "OLD"')
-< Removes the items where "OLD" appears. >
- call filter(mydict, 'v:key >= 8')
-< Removes the items with a key below 8. >
- call filter(var, 0)
-< Removes all the items, thus clears the |List| or |Dictionary|.
-
- Note that {expr2} is the result of expression and is then
- used as an expression again. Often it is good to use a
- |literal-string| to avoid having to double backslashes.
-
- If {expr2} is a |Funcref| it must take two arguments:
- 1. the key or the index of the current item.
- 2. the value of the current item.
- The function must return |TRUE| if the item should be kept.
- Example that keeps the odd items of a list: >
- func Odd(idx, val)
- return a:idx % 2 == 1
- endfunc
- call filter(mylist, function('Odd'))
-< It is shorter when using a |lambda|: >
- call filter(myList, {idx, val -> idx * val <= 42})
-< If you do not use "val" you can leave it out: >
- call filter(myList, {idx -> idx % 2 == 1})
-<
- The operation is done in-place. If you want a |List| or
- |Dictionary| to remain unmodified make a copy first: >
- :let l = filter(copy(mylist), 'v:val =~ "KEEP"')
-
-< Returns {expr1}, the |List|, |Blob| or |Dictionary| that was
- filtered. When an error is encountered while evaluating
- {expr2} no further items in {expr1} are processed. When
- {expr2} is a Funcref errors inside a function are ignored,
- unless it was defined with the "abort" flag.
-
- Can also be used as a |method|: >
- mylist->filter(expr2)
-
-finddir({name} [, {path} [, {count}]]) *finddir()*
- Find directory {name} in {path}. Supports both downwards and
- upwards recursive directory searches. See |file-searching|
- for the syntax of {path}.
-
- Returns the path of the first found match. When the found
- directory is below the current directory a relative path is
- returned. Otherwise a full path is returned.
- If {path} is omitted or empty then 'path' is used.
-
- If the optional {count} is given, find {count}'s occurrence of
- {name} in {path} instead of the first one.
- When {count} is negative return all the matches in a |List|.
-
- This is quite similar to the ex-command `:find`.
-
- Can also be used as a |method|: >
- GetName()->finddir()
-
-findfile({name} [, {path} [, {count}]]) *findfile()*
- Just like |finddir()|, but find a file instead of a directory.
- Uses 'suffixesadd'.
- Example: >
- :echo findfile("tags.vim", ".;")
-< Searches from the directory of the current file upwards until
- it finds the file "tags.vim".
-
- Can also be used as a |method|: >
- GetName()->findfile()
-
-flatten({list} [, {maxdepth}]) *flatten()*
- Flatten {list} up to {maxdepth} levels. Without {maxdepth}
- the result is a |List| without nesting, as if {maxdepth} is
- a very large number.
- The {list} is changed in place, make a copy first if you do
- not want that.
- *E900*
- {maxdepth} means how deep in nested lists changes are made.
- {list} is not modified when {maxdepth} is 0.
- {maxdepth} must be positive number.
-
- If there is an error the number zero is returned.
-
- Example: >
- :echo flatten([1, [2, [3, 4]], 5])
-< [1, 2, 3, 4, 5] >
- :echo flatten([1, [2, [3, 4]], 5], 1)
-< [1, 2, [3, 4], 5]
-
- Can also be used as a |method|: >
- mylist->flatten()
-<
-float2nr({expr}) *float2nr()*
- Convert {expr} to a Number by omitting the part after the
- decimal point.
- {expr} must evaluate to a |Float| or a Number.
- When the value of {expr} is out of range for a |Number| the
- result is truncated to 0x7fffffff or -0x7fffffff (or when
- 64-bit Number support is enabled, 0x7fffffffffffffff or
- -0x7fffffffffffffff). NaN results in -0x80000000 (or when
- 64-bit Number support is enabled, -0x8000000000000000).
- Examples: >
- echo float2nr(3.95)
-< 3 >
- echo float2nr(-23.45)
-< -23 >
- echo float2nr(1.0e100)
-< 2147483647 (or 9223372036854775807) >
- echo float2nr(-1.0e150)
-< -2147483647 (or -9223372036854775807) >
- echo float2nr(1.0e-100)
-< 0
-
- Can also be used as a |method|: >
- Compute()->float2nr()
-
-floor({expr}) *floor()*
- Return the largest integral value less than or equal to
- {expr} as a |Float| (round down).
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- echo floor(1.856)
-< 1.0 >
- echo floor(-5.456)
-< -6.0 >
- echo floor(4.0)
-< 4.0
-
- Can also be used as a |method|: >
- Compute()->floor()
-
-fmod({expr1}, {expr2}) *fmod()*
- Return the remainder of {expr1} / {expr2}, even if the
- division is not representable. Returns {expr1} - i * {expr2}
- for some integer i such that if {expr2} is non-zero, the
- result has the same sign as {expr1} and magnitude less than
- the magnitude of {expr2}. If {expr2} is zero, the value
- returned is zero. The value returned is a |Float|.
- {expr1} and {expr2} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo fmod(12.33, 1.22)
-< 0.13 >
- :echo fmod(-12.33, 1.22)
-< -0.13
-
- Can also be used as a |method|: >
- Compute()->fmod(1.22)
-
-fnameescape({string}) *fnameescape()*
- Escape {string} for use as file name command argument. All
- characters that have a special meaning, such as '%' and '|'
- are escaped with a backslash.
- For most systems the characters escaped are
- " \t\n*?[{`$\\%#'\"|!<". For systems where a backslash
- appears in a filename, it depends on the value of 'isfname'.
- A leading '+' and '>' is also escaped (special after |:edit|
- and |:write|). And a "-" by itself (special after |:cd|).
- Example: >
- :let fname = '+some str%nge|name'
- :exe "edit " . fnameescape(fname)
-< results in executing: >
- edit \+some\ str\%nge\|name
-<
- Can also be used as a |method|: >
- GetName()->fnameescape()
-
-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
- command line. See |filename-modifiers|.
- Example: >
- :echo fnamemodify("main.c", ":p:h")
-< results in: >
- /home/mool/vim/vim/src
-< If {mods} is empty then {fname} is returned.
- Note: Environment variables don't work in {fname}, use
- |expand()| first then.
-
- Can also be used as a |method|: >
- GetName()->fnamemodify(':p:h')
-
-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.
- If the line {lnum} is not in a closed fold, -1 is returned.
- {lnum} is used like with |getline()|. Thus "." is the current
- line, "'m" mark m, etc.
-
- Can also be used as a |method|: >
- GetLnum()->foldclosed()
-
-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.
- If the line {lnum} is not in a closed fold, -1 is returned.
- {lnum} is used like with |getline()|. Thus "." is the current
- line, "'m" mark m, etc.
-
- Can also be used as a |method|: >
- GetLnum()->foldclosedend()
-
-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
- returned. If there is no fold at line {lnum}, zero is
- returned. It doesn't matter if the folds are open or closed.
- When used while updating folds (from 'foldexpr') -1 is
- returned for lines where folds are still to be updated and the
- foldlevel is unknown. As a special case the level of the
- previous line is usually available.
- {lnum} is used like with |getline()|. Thus "." is the current
- line, "'m" mark m, etc.
-
- Can also be used as a |method|: >
- GetLnum()->foldlevel()
-<
- *foldtext()*
-foldtext() Returns a String, to be displayed for a closed fold. This is
- the default function used for the 'foldtext' option and should
- only be called from evaluating 'foldtext'. It uses the
- |v:foldstart|, |v:foldend| and |v:folddashes| variables.
- The returned string looks like this: >
- +-- 45 lines: abcdef
-< The number of leading dashes depends on the foldlevel. The
- "45" is the number of lines in the fold. "abcdef" is the text
- in the first non-blank line of the fold. Leading white space,
- "//" or "/*" and the text from the 'foldmarker' and
- 'commentstring' options is removed.
- When used to draw the actual foldtext, the rest of the line
- will be filled with the fold char from the 'fillchars'
- setting.
-
-foldtextresult({lnum}) *foldtextresult()*
- Returns the text that is displayed for the closed fold at line
- {lnum}. Evaluates 'foldtext' in the appropriate context.
- When there is no closed fold at {lnum} an empty string is
- returned.
- {lnum} is used like with |getline()|. Thus "." is the current
- line, "'m" mark m, etc.
- Useful when exporting folded text, e.g., to HTML.
-
- Can also be used as a |method|: >
- GetLnum()->foldtextresult()
-<
- *foreground()*
-foreground() Move the Vim window to the foreground. Useful when sent from
- a client to a Vim server. |remote_send()|
- On Win32 systems this might not work, the OS does not always
- allow a window to bring itself to the foreground. Use
- |remote_foreground()| instead.
- {only in the Win32 GUI and console version}
-
-fullcommand({name}) *fullcommand()*
- Get the full command name from a short abbreviated command
- name; see |20.2| for details on command abbreviations.
-
- The string argument {name} may start with a `:` and can
- include a [range], these are skipped and not returned.
- Returns an empty string if a command doesn't exist or if it's
- ambiguous (for user-defined commands).
-
- For example `fullcommand('s')`, `fullcommand('sub')`,
- `fullcommand(':%substitute')` all return "substitute".
-
- Can also be used as a |method|: >
- GetName()->fullcommand()
-<
- *funcref()*
-funcref({name} [, {arglist}] [, {dict}])
- Just like |function()|, but the returned Funcref will lookup
- the function by reference, not by name. This matters when the
- function {name} is redefined later.
-
- Unlike |function()|, {name} must be an existing user function.
- It only works for an autoloaded function if it has already
- been loaded (to avoid mistakenly loading the autoload script
- when only intending to use the function name, use |function()|
- instead). {name} cannot be a builtin function.
-
- Can also be used as a |method|: >
- GetFuncname()->funcref([arg])
-<
- *function()* *E700* *E922* *E923*
-function({name} [, {arglist}] [, {dict}])
- Return a |Funcref| variable that refers to function {name}.
- {name} can be a user defined function or an internal function.
-
- {name} can also be a Funcref or a partial. When it is a
- partial the dict stored in it will be used and the {dict}
- argument is not allowed. E.g.: >
- let FuncWithArg = function(dict.Func, [arg])
- let Broken = function(dict.Func, [arg], dict)
-<
- When using the Funcref the function will be found by {name},
- also when it was redefined later. Use |funcref()| to keep the
- same function.
-
- When {arglist} or {dict} is present this creates a partial.
- That means the argument list and/or the dictionary is stored in
- the Funcref and will be used when the Funcref is called.
-
- The arguments are passed to the function in front of other
- arguments, but after any argument from |method|. Example: >
- func Callback(arg1, arg2, name)
- ...
- let Partial = function('Callback', ['one', 'two'])
- ...
- call Partial('name')
-< Invokes the function as with: >
- call Callback('one', 'two', 'name')
-
-< The Dictionary is only useful when calling a "dict" function.
- In that case the {dict} is passed in as "self". Example: >
- function Callback() dict
- echo "called for " . self.name
- endfunction
- ...
- let context = {"name": "example"}
- let Func = function('Callback', context)
- ...
- call Func() " will echo: called for example
-
-< The argument list and the Dictionary can be combined: >
- function Callback(arg1, count) dict
- ...
- let context = {"name": "example"}
- let Func = function('Callback', ['one'], context)
- ...
- call Func(500)
-< Invokes the function as with: >
- call context.Callback('one', 500)
-<
- Can also be used as a |method|: >
- GetFuncname()->function([arg])
-
-garbagecollect([{atexit}]) *garbagecollect()*
- Cleanup unused |Lists| and |Dictionaries| that have circular
- references.
-
- There is hardly ever a need to invoke this function, as it is
- automatically done when Vim runs out of memory or is waiting
- for the user to press a key after 'updatetime'. Items without
- circular references are always freed when they become unused.
- This is useful if you have deleted a very big |List| and/or
- |Dictionary| with circular references in a script that runs
- for a long time.
-
- When the optional {atexit} argument is one, garbage
- collection will also be done when exiting Vim, if it wasn't
- done before. This is useful when checking for memory leaks.
-
- The garbage collection is not done immediately but only when
- it's safe to perform. This is when waiting for the user to
- type a character.
-
-get({list}, {idx} [, {default}]) *get()*
- Get item {idx} from |List| {list}. When this item is not
- available return {default}. Return zero when {default} is
- omitted.
- Can also be used as a |method|: >
- mylist->get(idx)
-get({blob}, {idx} [, {default}])
- Get byte {idx} from |Blob| {blob}. When this byte is not
- available return {default}. Return -1 when {default} is
- omitted.
-get({dict}, {key} [, {default}])
- Get item with key {key} from |Dictionary| {dict}. When this
- item is not available return {default}. Return zero when
- {default} is omitted. Useful example: >
- let val = get(g:, 'var_name', 'default')
-< This gets the value of g:var_name if it exists, and uses
- 'default' when it does not exist.
-get({func}, {what})
- 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
-
- *getbufinfo()*
-getbufinfo([{buf}])
-getbufinfo([{dict}])
- Get information about buffers as a List of Dictionaries.
-
- Without an argument information about all the buffers is
- returned.
-
- When the argument is a |Dictionary| only the buffers matching
- the specified criteria are returned. The following keys can
- be specified in {dict}:
- buflisted include only listed buffers.
- bufloaded include only loaded buffers.
- bufmodified include only modified buffers.
-
- Otherwise, {buf} specifies a particular buffer to return
- information for. For the use of {buf}, see |bufname()|
- above. If the buffer is found the returned List has one item.
- Otherwise the result is an empty list.
-
- Each returned List item is a dictionary with the following
- entries:
- bufnr Buffer number.
- changed TRUE if the buffer is modified.
- changedtick Number of changes made to the buffer.
- hidden TRUE if the buffer is hidden.
- lastused Timestamp in seconds, like
- |localtime()|, when the buffer was
- last used.
- listed TRUE if the buffer is listed.
- lnum Line number used for the buffer when
- opened in the current window.
- Only valid if the buffer has been
- displayed in the window in the past.
- If you want the line number of the
- last known cursor position in a given
- window, use |line()|: >
- :echo line('.', {winid})
-<
- linecount Number of lines in the buffer (only
- valid when loaded)
- loaded TRUE if the buffer is loaded.
- name Full path to the file in the buffer.
- signs List of signs placed in the buffer.
- Each list item is a dictionary with
- the following fields:
- id sign identifier
- lnum line number
- name sign name
- variables A reference to the dictionary with
- buffer-local variables.
- windows List of |window-ID|s that display this
- buffer
-
- Examples: >
- for buf in getbufinfo()
- echo buf.name
- endfor
- for buf in getbufinfo({'buflisted':1})
- if buf.changed
- ....
- endif
- endfor
-<
- To get buffer-local options use: >
- getbufvar({bufnr}, '&option_name')
-<
- Can also be used as a |method|: >
- GetBufnr()->getbufinfo()
-<
- *getbufline()*
-getbufline({buf}, {lnum} [, {end}])
- Return a |List| with the lines starting from {lnum} to {end}
- (inclusive) in the buffer {buf}. If {end} is omitted, a
- |List| with only the line {lnum} is returned.
-
- For the use of {buf}, see |bufname()| above.
-
- For {lnum} and {end} "$" can be used for the last line of the
- buffer. Otherwise a number must be used.
-
- When {lnum} is smaller than 1 or bigger than the number of
- lines in the buffer, an empty |List| is returned.
-
- When {end} is greater than the number of lines in the buffer,
- it is treated as {end} is set to the number of lines in the
- buffer. When {end} is before {lnum} an empty |List| is
- returned.
-
- This function works only for loaded buffers. For unloaded and
- non-existing buffers, an empty |List| is returned.
-
- Example: >
- :let lines = getbufline(bufnr("myfile"), 1, "$")
-
-< Can also be used as a |method|: >
- GetBufnr()->getbufline(lnum)
-
-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:"
- must be used.
- The {varname} argument is a string.
- When {varname} is empty returns a |Dictionary| with all the
- buffer-local variables.
- When {varname} is equal to "&" returns a |Dictionary| with all
- the buffer-local options.
- Otherwise, when {varname} starts with "&" returns the value of
- a buffer-local option.
- This also works for a global or buffer-local option, but it
- doesn't work for a global variable, window-local variable or
- window-local option.
- For the use of {buf}, see |bufname()| above.
- When the buffer or variable doesn't exist {def} or an empty
- string is returned, there is no error message.
- Examples: >
- :let bufmodified = getbufvar(1, "&mod")
- :echo "todo myvar = " . getbufvar("todo", "myvar")
-
-< Can also be used as a |method|: >
- GetBufnr()->getbufvar(varname)
-<
-getchangelist([{buf}]) *getchangelist()*
- Returns the |changelist| for the buffer {buf}. For the use
- of {buf}, see |bufname()| above. If buffer {buf} doesn't
- exist, an empty list is returned.
-
- The returned list contains two entries: a list with the change
- locations and the current position in the list. Each
- entry in the change list is a dictionary with the following
- entries:
- col column number
- coladd column offset for 'virtualedit'
- lnum line number
- If buffer {buf} is the current buffer, then the current
- position refers to the position in the list. For other
- buffers, it is set to the length of the list.
-
- Can also be used as a |method|: >
- GetBufnr()->getchangelist()
-
-getchar([expr]) *getchar()*
- Get a single character from the user or input stream.
- If [expr] is omitted, wait until a character is available.
- If [expr] is 0, only get a character when one is available.
- Return zero otherwise.
- If [expr] is 1, only check if a character is available, it is
- not consumed. Return zero if no character available.
- If you prefer always getting a string use |getcharstr()|.
-
- Without [expr] and when [expr] is 0 a whole character or
- special key is returned. If it is a single character, the
- result is a number. Use nr2char() to convert it to a String.
- Otherwise a String is returned with the encoded character.
- For a special key it's a String with a sequence of bytes
- starting with 0x80 (decimal: 128). This is the same value as
- the String "\<Key>", e.g., "\<Left>". The returned value is
- also a String when a modifier (shift, control, alt) was used
- that is not included in the character.
-
- When [expr] is 0 and Esc is typed, there will be a short delay
- while Vim waits to see if this is the start of an escape
- sequence.
-
- When [expr] is 1 only the first byte is returned. For a
- one-byte character it is the character itself as a number.
- Use nr2char() to convert it to a String.
-
- Use getcharmod() to obtain any additional modifiers.
-
- When the user clicks a mouse button, the mouse event will be
- returned. The position can then be found in |v:mouse_col|,
- |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|.
- |getmousepos()| can also be used. Mouse move events will be
- ignored.
- This example positions the mouse as it would normally happen: >
- let c = getchar()
- if c == "\<LeftMouse>" && v:mouse_win > 0
- exe v:mouse_win . "wincmd w"
- exe v:mouse_lnum
- exe "normal " . v:mouse_col . "|"
- endif
-<
- There is no prompt, you will somehow have to make clear to the
- user that a character has to be typed. The screen is not
- redrawn, e.g. when resizing the window.
-
- There is no mapping for the character.
- Key codes are replaced, thus when the user presses the <Del>
- key you get the code for the <Del> key, not the raw character
- sequence. Examples: >
- getchar() == "\<Del>"
- getchar() == "\<S-Left>"
-< This example redefines "f" to ignore case: >
- :nmap f :call FindChar()<CR>
- :function FindChar()
- : let c = nr2char(getchar())
- : while col('.') < col('$') - 1
- : normal l
- : if getline('.')[col('.') - 1] ==? c
- : break
- : endif
- : endwhile
- :endfunction
-<
-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.
- These values are added together:
- 2 shift
- 4 control
- 8 alt (meta)
- 16 meta (when it's different from ALT)
- 32 mouse double click
- 64 mouse triple click
- 96 mouse quadruple click (== 32 + 64)
- 128 command (Macintosh only)
- Only the modifiers that have not been included in the
- character itself are obtained. Thus Shift-a results in "A"
- without a modifier.
-
-getcharsearch() *getcharsearch()*
- Return the current character search information as a {dict}
- with the following entries:
-
- char character previously used for a character
- search (|t|, |f|, |T|, or |F|); empty string
- if no character search has been performed
- forward direction of character search; 1 for forward,
- 0 for backward
- until type of character search; 1 for a |t| or |T|
- character search, 0 for an |f| or |F|
- character search
-
- This can be useful to always have |;| and |,| search
- forward/backward regardless of the direction of the previous
- character search: >
- :nnoremap <expr> ; getcharsearch().forward ? ';' : ','
- :nnoremap <expr> , getcharsearch().forward ? ',' : ';'
-< Also see |setcharsearch()|.
-
-
-getcharstr([expr]) *getcharstr()*
- Get a single character from the user or input stream as a
- string.
- If [expr] is omitted, wait until a character is available.
- If [expr] is 0 or false, only get a character when one is
- available. Return an empty string otherwise.
- If [expr] is 1 or true, only check if a character is
- available, it is not consumed. Return an empty string
- if no character is available.
- Otherwise this works like |getchar()|, except that a number
- result is converted to a 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_=|.
- Example: >
- :cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
-< Also see |getcmdtype()|, |getcmdpos()| and |setcmdpos()|.
- Returns an empty string when entering a password or using
- |inputsecret()|.
-
-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()| and |getcmdline()|.
-
-getcmdtype() *getcmdtype()*
- Return the current command-line type. Possible return values
- are:
- : normal Ex command
- > debug mode command |debug-mode|
- / forward search command
- ? backward search command
- @ |input()| command
- - |:insert| or |:append| command
- = |i_CTRL-R_=|
- Only works when editing the command line, thus requires use of
- |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
- Returns an empty string otherwise.
- Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|.
-
-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.
-
-getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
- Return a list of command-line completion matches. The String
- {type} argument specifies what for. The following completion
- types are supported:
-
- arglist file names in argument list
- augroup autocmd groups
- buffer buffer names
- behave :behave suboptions
- cmdline |cmdline-completion| result
- color color schemes
- command Ex command
- compiler compilers
- cscope |:cscope| suboptions
- diff_buffer |:diffget| and |:diffput| completion
- dir directory names
- environment environment variable names
- event autocommand events
- expression Vim expression
- file file and directory names
- file_in_path file and directory names in |'path'|
- filetype filetype names |'filetype'|
- function function name
- help help subjects
- highlight highlight groups
- history :history suboptions
- locale locale names (as output of locale -a)
- mapclear buffer argument
- mapping mapping name
- menu menus
- messages |:messages| suboptions
- option options
- packadd optional package |pack-add| names
- shellcmd Shell command
- sign |:sign| suboptions
- syntax syntax file names |'syntax'|
- syntime |:syntime| suboptions
- tag tags
- tag_listfiles tags, file names
- user user names
- var user variables
-
- If {pat} is an empty string, then all the matches are
- returned. Otherwise only items matching {pat} are returned.
- See |wildcards| for the use of special characters in {pat}.
-
- If the optional {filtered} flag is set to 1, then 'wildignore'
- is applied to filter the results. Otherwise all the matches
- are returned. The 'wildignorecase' option always applies.
-
- If {type} is "cmdline", then the |cmdline-completion| result is
- returned. For example, to complete the possible values after
- a ":call" command: >
- echo getcompletion('call ', 'cmdline')
-<
- If there are no matches, an empty list is returned. An
- invalid value for {type} produces an error.
-
- Can also be used as a |method|: >
- GetPattern()->getcompletion('color')
-<
- *getcurpos()*
-getcurpos() Get the position of the cursor. This is like getpos('.'), but
- includes an extra "curswant" in the list:
- [0, lnum, col, off, curswant] ~
- The "curswant" number is the preferred column when moving the
- cursor vertically. Also see |getpos()|.
- The first "bufnum" item is always zero.
-
- This can be used to save and restore the cursor position: >
- let save_cursor = getcurpos()
- MoveTheCursorAround
- call setpos('.', save_cursor)
-< Note that this only works within the window. See
- |winrestview()| for restoring more state.
-
-getcwd([{winnr}[, {tabnr}]]) *getcwd()*
- With no arguments, returns the name of the effective
- |current-directory|. With {winnr} or {tabnr} the working
- directory of that scope is returned, and 'autochdir' is
- ignored.
- Tabs and windows are identified by their respective numbers,
- 0 means current tab or window. Missing tab number implies 0.
- Thus the following are equivalent: >
- getcwd(0)
- getcwd(0, 0)
-< If {winnr} is -1 it is ignored, only the tab is resolved.
- {winnr} can be the window number or the |window-ID|.
- If both {winnr} and {tabnr} are -1 the global working
- directory is returned.
- Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
-
- Can also be used as a |method|: >
- GetWinnr()->getcwd()
-
-getenv({name}) *getenv()*
- Return the value of environment variable {name}. The {name}
- argument is a string, without a leading '$'. Example: >
- myHome = getenv('HOME')
-
-< When the variable does not exist |v:null| is returned. That
- is different from a variable set to an empty string.
- See also |expr-env|.
-
- Can also be used as a |method|: >
- GetVarname()->getenv()
-
-getfontname([{name}]) *getfontname()*
- Without an argument returns the name of the normal font being
- used. Like what is used for the Normal highlight group
- |hl-Normal|.
- With an argument a check is done whether String {name} is a
- valid font name. If not then an empty string is returned.
- Otherwise the actual font name is returned, or {name} if the
- GUI does not support obtaining the real name.
- Only works when the GUI is running, thus not in your vimrc or
- gvimrc file. Use the |GUIEnter| autocommand to use this
- function just after the GUI has started.
-
-getfperm({fname}) *getfperm()*
- The result is a String, which is the read, write, and execute
- permissions of the given file {fname}.
- If {fname} does not exist or its directory cannot be read, an
- empty string is returned.
- The result is of the form "rwxrwxrwx", where each group of
- "rwx" flags represent, in turn, the permissions of the owner
- of the file, the group the file belongs to, and other users.
- If a user does not have a given permission the flag for this
- is replaced with the string "-". Examples: >
- :echo getfperm("/etc/passwd")
- :echo getfperm(expand("~/.config/nvim/init.vim"))
-< This will hopefully (from a security point of view) display
- the string "rw-r--r--" or even "rw-------".
-
- Can also be used as a |method|: >
- GetFilename()->getfperm()
-<
- For setting permissions use |setfperm()|.
-
-getfsize({fname}) *getfsize()*
- The result is a Number, which is the size in bytes of the
- given file {fname}.
- If {fname} is a directory, 0 is returned.
- If the file {fname} can't be found, -1 is returned.
- If the size of {fname} is too big to fit in a Number then -2
- is returned.
-
- Can also be used as a |method|: >
- GetFilename()->getfsize()
-
-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
- since 1st Jan 1970, and may be passed to strftime(). See also
- |localtime()| and |strftime()|.
- If the file {fname} can't be found -1 is returned.
-
- Can also be used as a |method|: >
- GetFilename()->getftime()
-
-getftype({fname}) *getftype()*
- The result is a String, which is a description of the kind of
- file of the given file {fname}.
- If {fname} does not exist an empty string is returned.
- Here is a table over different kinds of files and their
- results:
- Normal file "file"
- Directory "dir"
- Symbolic link "link"
- Block device "bdev"
- Character device "cdev"
- Socket "socket"
- FIFO "fifo"
- All other "other"
- Example: >
- getftype("/home")
-< Note that a type such as "link" will only be returned on
- systems that support it. On some systems only "dir" and
- "file" are returned.
-
- Can also be used as a |method|: >
- GetFilename()->getftype()
-
-getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
- Returns the |jumplist| for the specified window.
-
- Without arguments use the current window.
- With {winnr} only use this window in the current tab page.
- {winnr} can also be a |window-ID|.
- With {winnr} and {tabnr} use the window in the specified tab
- page.
-
- The returned list contains two entries: a list with the jump
- locations and the last used jump position number in the list.
- Each entry in the jump location list is a dictionary with
- the following entries:
- bufnr buffer number
- col column number
- coladd column offset for 'virtualedit'
- filename filename if available
- lnum line number
-
- Can also be used as a |method|: >
- GetWinnr()->getjumplist()
-
-< *getline()*
-getline({lnum} [, {end}])
- Without {end} the result is a String, which is line {lnum}
- from the current buffer. Example: >
- getline(1)
-< When {lnum} is a String that doesn't start with a
- digit, |line()| is called to translate the String into a Number.
- To get the line under the cursor: >
- getline(".")
-< When {lnum} is a number smaller than 1 or bigger than the
- number of lines in the buffer, an empty string is returned.
-
- When {end} is given the result is a |List| where each item is
- a line from the current buffer in the range {lnum} to {end},
- including line {end}.
- {end} is used in the same way as {lnum}.
- Non-existing lines are silently omitted.
- When {end} is before {lnum} an empty |List| is returned.
- Example: >
- :let start = line('.')
- :let end = search("^$") - 1
- :let lines = getline(start, end)
-
-< Can also be used as a |method|: >
- ComputeLnum()->getline()
-
-< To get lines from another buffer see |getbufline()|
-
-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|.
- When {nr} is zero the current window is used.
-
- For a location list window, the displayed location list is
- returned. For an invalid window number {nr}, an empty list is
- returned. Otherwise, same as |getqflist()|.
-
- If the optional {what} dictionary argument is supplied, then
- returns the items listed in {what} as a dictionary. Refer to
- |getqflist()| for the supported items in {what}.
- If {what} contains 'filewinid', then returns the id of the
- window used to display files from the location list. This
- field is applicable only when called from a location list
- window. See |location-list-file-window| for more details.
-
- Returns a |Dictionary| with default values if there is no
- location list for the window {nr}.
- Returns an empty Dictionary if window {nr} does not exist.
-
- Examples (See also |getqflist-examples|): >
- :echo getloclist(3, {'all': 0})
- :echo getloclist(5, {'filewinid': 0})
-
-
-getmarklist([{buf}]) *getmarklist()*
- Without the {buf} argument returns a |List| with information
- about all the global marks. |mark|
-
- If the optional {buf} argument is specified, returns the
- local marks defined in buffer {buf}. For the use of {buf},
- see |bufname()|.
-
- Each item in the returned List is a |Dict| with the following:
- mark name of the mark prefixed by "'"
- pos a |List| with the position of the mark:
- [bufnum, lnum, col, off]
- Refer to |getpos()| for more information.
- file file name
-
- Refer to |getpos()| for getting information about a specific
- mark.
-
- Can also be used as a |method|: >
- GetBufnr()->getmarklist()
-
-getmatches([{win}]) *getmatches()*
- Returns a |List| with all matches previously defined for the
- current window by |matchadd()| and the |:match| commands.
- |getmatches()| is useful in combination with |setmatches()|,
- as |setmatches()| can restore a list of matches saved by
- |getmatches()|.
- If {win} is specified, use the window with this number or
- window ID instead of the current window.
- Example: >
- :echo getmatches()
-< [{'group': 'MyGroup1', 'pattern': 'TODO',
- 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
- 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
- :let m = getmatches()
- :call clearmatches()
- :echo getmatches()
-< [] >
- :call setmatches(m)
- :echo getmatches()
-< [{'group': 'MyGroup1', 'pattern': 'TODO',
- 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
- 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
- :unlet m
-<
-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
- items are:
- screenrow screen row
- screencol screen column
- winid Window ID of the click
- winrow row inside "winid"
- wincol column inside "winid"
- line text line inside "winid"
- column text column inside "winid"
- All numbers are 1-based.
-
- If not over a window, e.g. when in the command line, then only
- "screenrow" and "screencol" are valid, the others are zero.
-
- When on the status line below a window or the vertical
- separater right of a window, the "line" and "column" values
- are zero.
-
- When the position is after the text then "column" is the
- length of the text in bytes plus one.
-
- If the mouse is over a focusable floating window then that
- window is used.
-
- When using |getchar()| the Vim variables |v:mouse_lnum|,
- |v:mouse_col| and |v:mouse_winid| also provide these values.
-
- *getpid()*
-getpid() Return a Number which is the process ID of the Vim process.
- This is a unique number, until Vim exits.
-
- *getpos()*
-getpos({expr}) Get the position for String {expr}. For possible values of
- {expr} see |line()|. For getting the cursor position see
- |getcurpos()|.
- 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
- is the buffer number of the mark.
- "lnum" and "col" are the position in the buffer. The first
- column is 1.
- The "off" number is zero, unless 'virtualedit' is used. Then
- 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.
- The column number in the returned List is the byte position
- within the line.
- The column number can be very large, e.g. 2147483647, in which
- case it means "after the end of the line".
- This can be used to save and restore the position of a mark: >
- let save_a_mark = getpos("'a")
- ...
- call setpos("'a", save_a_mark)
-< Also see |getcurpos()| and |setpos()|.
-
- Can also be used as a |method|: >
- GetMark()->getpos()
-
-getqflist([{what}]) *getqflist()*
- Returns a |List| with all the current quickfix errors. Each
- list item is a dictionary with these entries:
- bufnr number of buffer that has the file name, use
- bufname() to get the name
- module module name
- lnum line number in the buffer (first line is 1)
- end_lnum
- end of line number if the item is multiline
- col column number (first column is 1)
- end_col end of column number if the item has range
- vcol |TRUE|: "col" is visual column
- |FALSE|: "col" is byte index
- nr error number
- pattern search pattern used to locate the error
- text description of the error
- type type of the error, 'E', '1', etc.
- valid |TRUE|: recognized error message
-
- When there is no error list or it's empty, an empty list is
- returned. Quickfix list entries with a non-existing buffer
- number are returned with "bufnr" set to zero (Note: some
- functions accept buffer number zero for the alternate buffer,
- you may need to explicitly check for zero).
-
- Useful application: Find pattern matches in multiple files and
- do something with them: >
- :vimgrep /theword/jg *.c
- :for d in getqflist()
- : echo bufname(d.bufnr) ':' d.lnum '=' d.text
- :endfor
-<
- If the optional {what} dictionary argument is supplied, then
- returns only the items listed in {what} as a dictionary. The
- following string items are supported in {what}:
- changedtick get the total number of changes made
- to the list |quickfix-changedtick|
- context get the |quickfix-context|
- efm errorformat to use when parsing "lines". If
- not present, then the 'errorformat' option
- value is used.
- id get information for the quickfix list with
- |quickfix-ID|; zero means the id for the
- current list or the list specified by "nr"
- idx get information for the quickfix entry at this
- index in the list specified by 'id' or 'nr'.
- If set to zero, then uses the current entry.
- See |quickfix-index|
- items quickfix list entries
- lines parse a list of lines using 'efm' and return
- the resulting entries. Only a |List| type is
- accepted. The current quickfix list is not
- modified. See |quickfix-parse|.
- nr get information for this quickfix list; zero
- means the current quickfix list and "$" means
- the last quickfix list
- size number of entries in the quickfix list
- title get the list title |quickfix-title|
- winid get the quickfix |window-ID|
- all all of the above quickfix properties
- Non-string items in {what} are ignored. To get the value of a
- particular item, set it to zero.
- If "nr" is not present then the current quickfix list is used.
- If both "nr" and a non-zero "id" are specified, then the list
- specified by "id" is used.
- To get the number of lists in the quickfix stack, set "nr" to
- "$" in {what}. The "nr" value in the returned dictionary
- contains the quickfix stack size.
- When "lines" is specified, all the other items except "efm"
- are ignored. The returned dictionary contains the entry
- "items" with the list of entries.
-
- The returned dictionary contains the following entries:
- changedtick total number of changes made to the
- list |quickfix-changedtick|
- context quickfix list context. See |quickfix-context|
- If not present, set to "".
- id quickfix list ID |quickfix-ID|. If not
- present, set to 0.
- idx index of the quickfix entry in the list. If not
- present, set to 0.
- items quickfix list entries. If not present, set to
- an empty list.
- nr quickfix list number. If not present, set to 0
- size number of entries in the quickfix list. If not
- present, set to 0.
- title quickfix list title text. If not present, set
- to "".
- winid quickfix |window-ID|. If not present, set to 0
-
- Examples (See also |getqflist-examples|): >
- :echo getqflist({'all': 1})
- :echo getqflist({'nr': 2, 'title': 1})
- :echo getqflist({'lines' : ["F1:10:L10"]})
-<
-getreg([{regname} [, 1 [, {list}]]]) *getreg()*
- The result is a String, which is the contents of register
- {regname}. Example: >
- :let cliptext = getreg('*')
-< When register {regname} was not set the result is an empty
- string.
- The {regname} argument must be a string.
-
- getreg('=') returns the last evaluated value of the expression
- register. (For use in maps.)
- getreg('=', 1) returns the expression itself, so that it can
- be restored with |setreg()|. For other registers the extra
- argument is ignored, thus you can always give it.
-
- If {list} is present and |TRUE|, the result type is changed
- to |List|. Each list item is one text line. Use it if you care
- about zero bytes possibly present inside register: without
- third argument both NLs and zero bytes are represented as NLs
- (see |NL-used-for-Nul|).
- When the register was not set an empty list is returned.
-
- If {regname} is not specified, |v:register| is used.
-
- Can also be used as a |method|: >
- GetRegname()->getreg()
-
-getreginfo([{regname}]) *getreginfo()*
- Returns detailed information about register {regname} as a
- Dictionary with the following entries:
- regcontents List of lines contained in register
- {regname}, like
- |getreg|({regname}, 1, 1).
- regtype the type of register {regname}, as in
- |getregtype()|.
- isunnamed Boolean flag, v:true if this register
- is currently pointed to by the unnamed
- register.
- points_to for the unnamed register, gives the
- single letter name of the register
- currently pointed to (see |quotequote|).
- For example, after deleting a line
- with `dd`, this field will be "1",
- which is the register that got the
- deleted text.
-
- The {regname} argument is a string. If {regname} is invalid
- or not set, an empty Dictionary will be returned.
- If {regname} is not specified, |v:register| is used.
- The returned Dictionary can be passed to |setreg()|.
-
- Can also be used as a |method|: >
- GetRegname()->getreginfo()
-
-getregtype([{regname}]) *getregtype()*
- The result is a String, which is type of register {regname}.
- The value will be one of:
- "v" for |charwise| text
- "V" for |linewise| text
- "<CTRL-V>{width}" for |blockwise-visual| text
- "" for an empty or unknown register
- <CTRL-V> is one character with value 0x16.
- The {regname} argument is a string. If {regname} is not
- specified, |v:register| is used.
-
- Can also be used as a |method|: >
- GetRegname()->getregtype()
-
-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
- |Dictionary|. Otherwise, {tabnr} specifies the tab page
- number and information about that one is returned. If the tab
- page does not exist an empty List is returned.
-
- Each List item is a |Dictionary| with the following entries:
- tabnr tab page number.
- variables a reference to the dictionary with
- tabpage-local variables
- windows List of |window-ID|s in the tab page.
-
- Can also be used as a |method|: >
- GetTabnr()->gettabinfo()
-
-gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
- Get the value of a tab-local variable {varname} in tab page
- {tabnr}. |t:var|
- Tabs are numbered starting with one.
- The {varname} argument is a string. When {varname} is empty a
- dictionary with all tab-local variables is returned.
- Note that the name without "t:" must be used.
- When the tab or variable doesn't exist {def} or an empty
- string is returned, there is no error message.
-
- Can also be used as a |method|: >
- GetTabnr()->gettabvar(varname)
-
-gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
- Get the value of window-local variable {varname} in window
- {winnr} in tab page {tabnr}.
- The {varname} argument is a string. When {varname} is empty a
- dictionary with all window-local variables is returned.
- When {varname} is equal to "&" get the values of all
- window-local options in a |Dictionary|.
- Otherwise, when {varname} starts with "&" get the value of a
- window-local option.
- Note that {varname} must be the name without "w:".
- Tabs are numbered starting with one. For the current tabpage
- use |getwinvar()|.
- {winnr} can be the window number or the |window-ID|.
- When {winnr} is zero the current window is used.
- This also works for a global option, buffer-local option and
- window-local option, but it doesn't work for a global variable
- or buffer-local variable.
- When the tab, window or variable doesn't exist {def} or an
- empty string is returned, there is no error message.
- Examples: >
- :let list_is_on = gettabwinvar(1, 2, '&list')
- :echo "myvar = " . gettabwinvar(3, 1, 'myvar')
-<
- To obtain all window-local variables use: >
- gettabwinvar({tabnr}, {winnr}, '&')
-
-< Can also be used as a |method|: >
- GetTabnr()->gettabwinvar(winnr, varname)
-
-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|.
- When {winnr} is not specified, the current window is used.
- When window {winnr} doesn't exist, an empty Dict is returned.
-
- The returned dictionary contains the following entries:
- curidx Current index in the stack. When at
- top of the stack, set to (length + 1).
- Index of bottom of the stack is 1.
- items List of items in the stack. Each item
- is a dictionary containing the
- entries described below.
- length Number of entries in the stack.
-
- Each item in the stack is a dictionary with the following
- entries:
- bufnr buffer number of the current jump
- from cursor position before the tag jump.
- See |getpos()| for the format of the
- returned list.
- matchnr current matching tag number. Used when
- multiple matching tags are found for a
- name.
- tagname name of the tag
-
- See |tagstack| for more information about the tag stack.
-
- Can also be used as a |method|: >
- GetWinnr()->gettagstack()
-
-getwininfo([{winid}]) *getwininfo()*
- Returns information about windows as a |List| with Dictionaries.
-
- If {winid} is given Information about the window with that ID
- is returned, as a |List| with one item. If the window does not
- exist the result is an empty list.
-
- Without {winid} information about all the windows in all the
- tab pages is returned.
-
- Each List item is a |Dictionary| with the following entries:
- botline last complete displayed buffer line
- bufnr number of buffer in the window
- height window height (excluding winbar)
- loclist 1 if showing a location list
- quickfix 1 if quickfix or location list window
- terminal 1 if a terminal window
- tabnr tab page number
- topline first displayed buffer line
- variables a reference to the dictionary with
- window-local variables
- width window width
- winbar 1 if the window has a toolbar, 0
- otherwise
- wincol leftmost screen column of the window;
- "col" from |win_screenpos()|
- textoff number of columns occupied by any
- 'foldcolumn', 'signcolumn' and line
- number in front of the text
- winid |window-ID|
- winnr window number
- winrow topmost screen line of the window;
- "row" from |win_screenpos()|
-
- Can also be used as a |method|: >
- GetWinnr()->getwininfo()
-
-getwinpos([{timeout}]) *getwinpos()*
- The result is a |List| with two numbers, the result of
- |getwinposx()| and |getwinposy()| combined:
- [x-pos, y-pos]
- {timeout} can be used to specify how long to wait in msec for
- a response from the terminal. When omitted 100 msec is used.
-
- Use a longer time for a remote terminal.
- When using a value less than 10 and no response is received
- within that time, a previously reported position is returned,
- if available. This can be used to poll for the position and
- do some work in the meantime: >
- while 1
- let res = getwinpos(1)
- if res[0] >= 0
- break
- endif
- " Do some work here
- endwhile
-<
- Can also be used as a |method|: >
- GetTimeout()->getwinpos()
-<
- *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`.
-
- *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`.
-
-getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
- Like |gettabwinvar()| for the current tabpage.
- Examples: >
- :let list_is_on = getwinvar(2, '&list')
- :echo "myvar = " . getwinvar(1, 'myvar')
-
-< Can also be used as a |method|: >
- GetWinnr()->getwinvar(varname)
-<
-glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()*
- Expand the file wildcards in {expr}. See |wildcards| for the
- use of special characters.
-
- Unless the optional {nosuf} argument is given and is |TRUE|,
- the 'suffixes' and 'wildignore' options apply: Names matching
- one of the patterns in 'wildignore' will be skipped and
- 'suffixes' affect the ordering of matches.
- 'wildignorecase' always applies.
-
- When {list} is present and it is |TRUE| the result is a |List|
- with all matching files. The advantage of using a List is,
- you also get filenames containing newlines correctly.
- Otherwise the result is a String and when there are several
- matches, they are separated by <NL> characters.
-
- If the expansion fails, the result is an empty String or List.
-
- You can also use |readdir()| if you need to do complicated
- things, such as limiting the number of matches.
-
- A name for a non-existing file is not included. A symbolic
- link is only included if it points to an existing file.
- However, when the {alllinks} argument is present and it is
- |TRUE| then all symbolic links are included.
-
- For most systems backticks can be used to get files names from
- any external command. Example: >
- :let tagfiles = glob("`find . -name tags -print`")
- :let &tags = substitute(tagfiles, "\n", ",", "g")
-< The result of the program inside the backticks should be one
- item per line. Spaces inside an item are allowed.
-
- See |expand()| for expanding special Vim variables. See
- |system()| for getting the raw output of an external command.
-
- Can also be used as a |method|: >
- GetExpr()->glob()
-
-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
- is a file name. E.g. >
- if filename =~ glob2regpat('Make*.mak')
-< This is equivalent to: >
- if filename =~ '^Make.*\.mak$'
-< When {string} is an empty string the result is "^$", match an
- empty string.
- Note that the result depends on the system. On MS-Windows
- a backslash usually means a path separator.
-
- Can also be used as a |method|: >
- GetExpr()->glob2regpat()
-< *globpath()*
-globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]])
- Perform glob() for String {expr} on all directories in {path}
- and concatenate the results. Example: >
- :echo globpath(&rtp, "syntax/c.vim")
-<
- {path} is a comma-separated list of directory names. Each
- directory name is prepended to {expr} and expanded like with
- |glob()|. A path separator is inserted when needed.
- To add a comma inside a directory name escape it with a
- backslash. Note that on MS-Windows a directory may have a
- trailing backslash, remove it if you put a comma after it.
- If the expansion fails for one of the directories, there is no
- error message.
-
- Unless the optional {nosuf} argument is given and is |TRUE|,
- the 'suffixes' and 'wildignore' options apply: Names matching
- one of the patterns in 'wildignore' will be skipped and
- 'suffixes' affect the ordering of matches.
-
- When {list} is present and it is |TRUE| the result is a |List|
- with all matching files. The advantage of using a List is, you
- also get filenames containing newlines correctly. Otherwise
- the result is a String and when there are several matches,
- they are separated by <NL> characters. Example: >
- :echo globpath(&rtp, "syntax/c.vim", 0, 1)
-<
- {allinks} is used as with |glob()|.
-
- The "**" item can be used to search in a directory tree.
- For example, to find all "README.txt" files in the directories
- in 'runtimepath' and below: >
- :echo globpath(&rtp, "**/README.txt")
-< Upwards search and limiting the depth of "**" is not
- supported, thus using 'path' will not always work properly.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetExpr()->globpath(&rtp)
-<
- *has()*
-has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
- {feature} argument is a feature name like "nvim-0.2.1" or
- "win32", see below. See also |exists()|.
-
- If the code has a syntax error, then Nvim may skip the rest
- of the line and miss |:endif|. >
- if has('feature') | let x = this->breaks->without->the->feature | endif
-<
- Put |:if| and |:endif| on separate lines to avoid the
- syntax error. >
- if has('feature')
- let x = this->breaks->without->the->feature
- endif
-<
- Vim's compile-time feature-names (prefixed with "+") are not
- recognized because Nvim is always compiled with all possible
- features. |feature-compile|
-
- Feature names can be:
- 1. Nvim version. For example the "nvim-0.2.1" feature means
- that Nvim is version 0.2.1 or later: >
- :if has("nvim-0.2.1")
-
-< 2. Runtime condition or other pseudo-feature. For example the
- "win32" feature checks if the current system is Windows: >
- :if has("win32")
-< *feature-list*
- List of supported pseudo-feature names:
- acl |ACL| support
- bsd BSD system (not macOS, use "mac" for that).
- iconv Can use |iconv()| for conversion.
- +shellslash Can use backslashes in filenames (Windows)
- clipboard |clipboard| provider is available.
- fname_case Case in file names matters (for Darwin and MS-Windows
- this is not present).
- mac MacOS system.
- nvim This is Nvim.
- python2 Legacy Vim |python2| interface. |has-python|
- python3 Legacy Vim |python3| interface. |has-python|
- pythonx Legacy Vim |python_x| interface. |has-pythonx|
- ttyin input is a terminal (tty)
- ttyout output is a terminal (tty)
- unix Unix system.
- *vim_starting* True during |startup|.
- win32 Windows system (32 or 64 bit).
- win64 Windows system (64 bit).
- wsl WSL (Windows Subsystem for Linux) system
-
- *has-patch*
- 3. Vim patch. For example the "patch123" feature means that
- Vim patch 123 at the current |v:version| was included: >
- :if v:version > 602 || v:version == 602 && has("patch148")
-
-< 4. Vim version. For example the "patch-7.4.237" feature means
- that Nvim is Vim-compatible to version 7.4.237 or later. >
- :if has("patch-7.4.237")
-
-
-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.
-
- Can also be used as a |method|: >
- mydict->has_key(key)
-
-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
- has set a local path via |:tcd|, otherwise 0.
-
- Tabs and windows are identified by their respective numbers,
- 0 means current tab or window. Missing argument implies 0.
- Thus the following are equivalent: >
- haslocaldir()
- haslocaldir(0)
- haslocaldir(0, 0)
-< With {winnr} use that window in the current tabpage.
- With {winnr} and {tabnr} use the window in that tabpage.
- {winnr} can be the window number or the |window-ID|.
- If {winnr} is -1 it is ignored, only the tab is resolved.
- Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
-
- Can also be used as a |method|: >
- GetWinnr()->haslocaldir()
-
-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
- mapped to) and this mapping exists in one of the modes
- indicated by {mode}.
- The arguments {what} and {mode} are strings.
- When {abbr} is there and it is |TRUE| use abbreviations
- instead of mappings. Don't forget to specify Insert and/or
- Command-line mode.
- Both the global mappings and the mappings local to the current
- buffer are checked for a match.
- If no matching mapping is found FALSE is returned.
- The following characters are recognized in {mode}:
- n Normal mode
- v Visual and Select mode
- x Visual mode
- s Select mode
- o Operator-pending mode
- i Insert mode
- l Language-Argument ("r", "f", "t", etc.)
- c Command-line mode
- When {mode} is omitted, "nvo" is used.
-
- This function is useful to check if a mapping already exists
- to a function in a Vim script. Example: >
- :if !hasmapto('\ABCdoit')
- : map <Leader>d \ABCdoit
- :endif
-< This installs the mapping to "\ABCdoit" only if there isn't
- already a mapping to "\ABCdoit".
-
- Can also be used as a |method|: >
- GetRHS()->hasmapto()
-
-histadd({history}, {item}) *histadd()*
- Add the String {item} to the history {history} which can be
- one of: *hist-names*
- "cmd" or ":" command line history
- "search" or "/" search pattern history
- "expr" or "=" typed expression history
- "input" or "@" input line history
- "debug" or ">" debug command history
- empty the current or last used history
- The {history} string does not need to be the whole name, one
- character is sufficient.
- If {item} does already exist in the history, it will be
- shifted to become the newest entry.
- The result is a Number: TRUE if the operation was successful,
- otherwise FALSE is returned.
-
- Example: >
- :call histadd("input", strftime("%Y %b %d"))
- :let date=input("Enter date: ")
-< This function is not available in the |sandbox|.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetHistory()->histadd('search')
-
-histdel({history} [, {item}]) *histdel()*
- Clear {history}, i.e. delete all its entries. See |hist-names|
- for the possible values of {history}.
-
- If the parameter {item} evaluates to a String, it is used as a
- regular expression. All entries matching that expression will
- be removed from the history (if there are any).
- Upper/lowercase must match, unless "\c" is used |/\c|.
- If {item} evaluates to a Number, it will be interpreted as
- an index, see |:history-indexing|. The respective entry will
- be removed if it exists.
-
- The result is TRUE for a successful operation, otherwise FALSE
- is returned.
-
- Examples:
- Clear expression register history: >
- :call histdel("expr")
-<
- Remove all entries starting with "*" from the search history: >
- :call histdel("/", '^\*')
-<
- The following three are equivalent: >
- :call histdel("search", histnr("search"))
- :call histdel("search", -1)
- :call histdel("search", '^'.histget("search", -1).'$')
-<
- To delete the last search pattern and use the last-but-one for
- the "n" command and 'hlsearch': >
- :call histdel("search", -1)
- :let @/ = histget("search", -1)
-<
- Can also be used as a |method|: >
- GetHistory()->histdel()
-
-histget({history} [, {index}]) *histget()*
- The result is a String, the entry with Number {index} from
- {history}. See |hist-names| for the possible values of
- {history}, and |:history-indexing| for {index}. If there is
- no such entry, an empty String is returned. When {index} is
- omitted, the most recent item from the history is used.
-
- Examples:
- Redo the second last search from history. >
- :execute '/' . histget("search", -2)
-
-< Define an Ex command ":H {num}" that supports re-execution of
- the {num}th entry from the output of |:history|. >
- :command -nargs=1 H execute histget("cmd", 0+<args>)
-<
- Can also be used as a |method|: >
- GetHistory()->histget()
-
-histnr({history}) *histnr()*
- The result is the Number of the current entry in {history}.
- See |hist-names| for the possible values of {history}.
- If an error occurred, -1 is returned.
-
- Example: >
- :let inp_index = histnr("expr")
-
-< Can also be used as a |method|: >
- GetHistory()->histnr()
-<
-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
- defined in some way. Not necessarily when highlighting has
- been defined for it, it may also have been used for a syntax
- item.
-
- Can also be used as a |method|: >
- GetName()->hlexists()
-<
- *hlID()*
-hlID({name}) The result is a Number, which is the ID of the highlight group
- with name {name}. When the highlight group doesn't exist,
- zero is returned.
- This can be used to retrieve information about the highlight
- group. For example, to get the background color of the
- "Comment" group: >
- :echo synIDattr(synIDtrans(hlID("Comment")), "bg")
-<
- Can also be used as a |method|: >
- GetName()->hlID()
-
-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.
-
-iconv({string}, {from}, {to}) *iconv()*
- The result is a String, which is the text {string} converted
- from encoding {from} to encoding {to}.
- When the conversion completely fails an empty string is
- returned. When some characters could not be converted they
- are replaced with "?".
- The encoding names are whatever the iconv() library function
- can accept, see ":!man 3 iconv".
- Note that Vim uses UTF-8 for all Unicode encodings, conversion
- 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.
-
- Can also be used as a |method|: >
- GetText()->iconv('latin1', 'utf-8')
-<
- *indent()*
-indent({lnum}) The result is a Number, which is indent of line {lnum} in the
- current buffer. The indent is counted in spaces, the value
- of 'tabstop' is relevant. {lnum} is used just like in
- |getline()|.
- When {lnum} is invalid -1 is returned.
-
- Can also be used as a |method|: >
- GetLnum()->indent()
-
-index({object}, {expr} [, {start} [, {ic}]]) *index()*
- If {object} is a |List| return the lowest index where the item
- has a value equal to {expr}. There is no automatic
- conversion, so 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.
-
- If {object} is a |Blob| return the lowest index where the byte
- value is equal to {expr}.
-
- If {start} is given then start looking at the item with index
- {start} (may be negative for an item relative to the end).
- When {ic} is given and it is |TRUE|, ignore case. Otherwise
- case must match.
- -1 is returned when {expr} is not found in {object}.
- Example: >
- :let idx = index(words, "the")
- :if index(numbers, 123) >= 0
-
-< Can also be used as a |method|: >
- GetObject()->index(what)
-
-input({prompt} [, {text} [, {completion}]]) *input()*
-input({opts})
- The result is a String, which is whatever the user typed on
- the command-line. The {prompt} argument is either a prompt
- string, or a blank string (for no prompt). A '\n' can be used
- in the prompt to start a new line.
-
- In the second form it accepts a single dictionary with the
- following keys, any of which may be omitted:
-
- Key Default Description ~
- prompt "" Same as {prompt} in the first form.
- default "" Same as {text} in the first form.
- completion nothing Same as {completion} in the first form.
- cancelreturn "" The value returned when the dialog is
- cancelled.
- highlight nothing Highlight handler: |Funcref|.
-
- The highlighting set with |:echohl| is used for the prompt.
- The input is entered just like a command-line, with the same
- editing commands and mappings. There is a separate history
- for lines typed for input().
- Example: >
- :if input("Coffee or beer? ") == "beer"
- : echo "Cheers!"
- :endif
-<
- If the optional {text} argument is present and not empty, this
- is used for the default reply, as if the user typed this.
- Example: >
- :let color = input("Color? ", "white")
-
-< The optional {completion} argument specifies the type of
- completion supported for the input. Without it completion is
- not performed. The supported completion types are the same as
- that can be supplied to a user-defined command using the
- "-complete=" argument. Refer to |:command-completion| for
- more information. Example: >
- let fname = input("File: ", "", "file")
-
-< *input()-highlight* *E5400* *E5402*
- The optional `highlight` key allows specifying function which
- will be used for highlighting user input. This function
- receives user input as its only argument and must return
- a list of 3-tuples [hl_start_col, hl_end_col + 1, hl_group]
- where
- hl_start_col is the first highlighted column,
- hl_end_col is the last highlighted column (+ 1!),
- hl_group is |:hi| group used for highlighting.
- *E5403* *E5404* *E5405* *E5406*
- Both hl_start_col and hl_end_col + 1 must point to the start
- of the multibyte character (highlighting must not break
- multibyte characters), hl_end_col + 1 may be equal to the
- input length. Start column must be in range [0, len(input)),
- end column must be in range (hl_start_col, len(input)],
- sections must be ordered so that next hl_start_col is greater
- then or equal to previous hl_end_col.
-
- Example (try some input with parentheses): >
- highlight RBP1 guibg=Red ctermbg=red
- highlight RBP2 guibg=Yellow ctermbg=yellow
- highlight RBP3 guibg=Green ctermbg=green
- highlight RBP4 guibg=Blue ctermbg=blue
- let g:rainbow_levels = 4
- function! RainbowParens(cmdline)
- let ret = []
- let i = 0
- let lvl = 0
- while i < len(a:cmdline)
- if a:cmdline[i] is# '('
- call add(ret, [i, i + 1, 'RBP' . ((lvl % g:rainbow_levels) + 1)])
- let lvl += 1
- elseif a:cmdline[i] is# ')'
- let lvl -= 1
- call add(ret, [i, i + 1, 'RBP' . ((lvl % g:rainbow_levels) + 1)])
- endif
- let i += 1
- endwhile
- return ret
- endfunction
- call input({'prompt':'>','highlight':'RainbowParens'})
-<
- Highlight function is called at least once for each new
- displayed input string, before command-line is redrawn. It is
- expected that function is pure for the duration of one input()
- call, i.e. it produces the same output for the same input, so
- output may be memoized. Function is run like under |:silent|
- modifier. If the function causes any errors, it will be
- skipped for the duration of the current input() call.
-
- Highlighting is disabled if command-line contains arabic
- characters.
-
- NOTE: This function must not be used in a startup file, for
- the versions that only run in GUI mode (e.g., the Win32 GUI).
- Note: When input() is called from within a mapping it will
- consume remaining characters from that mapping, because a
- mapping is handled like the characters were typed.
- Use |inputsave()| before input() and |inputrestore()|
- after input() to avoid that. Another solution is to avoid
- that further characters follow in the mapping, e.g., by using
- |:execute| or |:normal|.
-
- Example with a mapping: >
- :nmap \x :call GetFoo()<CR>:exe "/" . Foo<CR>
- :function GetFoo()
- : call inputsave()
- : let g:Foo = input("enter search pattern: ")
- : call inputrestore()
- :endfunction
-
-< Can also be used as a |method|: >
- GetPrompt()->input()
-
-inputlist({textlist}) *inputlist()*
- {textlist} must be a |List| of strings. This |List| is
- displayed, one string per line. The user will be prompted to
- enter a number, which is returned.
- The user can also select an item by clicking on it with the
- mouse, if the mouse is enabled in the command line ('mouse' is
- "a" or includes "c"). For the first string 0 is returned.
- When clicking above the first item a negative number is
- returned. When clicking on the prompt one more than the
- length of {textlist} is returned.
- Make sure {textlist} has less than 'lines' entries, otherwise
- it won't work. It's a good idea to put the entry number at
- the start of the string. And put a prompt in the first item.
- Example: >
- let color = inputlist(['Select color:', '1. red',
- \ '2. green', '3. blue'])
-
-< Can also be used as a |method|: >
- GetChoices()->inputlist()
-
-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.
-
-inputsave() *inputsave()*
- Preserve typeahead (also from mappings) and clear it, so that
- a following prompt gets input from the user. Should be
- followed by a matching inputrestore() after the prompt. Can
- be used several times, in which case there must be just as
- many inputrestore() calls.
- Returns TRUE when out of memory, FALSE otherwise.
-
-inputsecret({prompt} [, {text}]) *inputsecret()*
- This function acts much like the |input()| function with but
- two exceptions:
- a) the user's response will be displayed as a sequence of
- asterisks ("*") thereby keeping the entry secret, and
- b) the user's response will not be recorded on the input
- |history| stack.
- The result is a String, which is whatever the user actually
- typed on the command-line in response to the issued prompt.
- NOTE: Command-line completion is not supported.
-
- Can also be used as a |method|: >
- GetPrompt()->inputsecret()
-
-insert({object}, {item} [, {idx}]) *insert()*
- When {object} is a |List| or a |Blob| insert {item} at the start
- of it.
-
- If {idx} is specified insert {item} before the item with index
- {idx}. If {idx} is zero it goes before the first item, just
- like omitting {idx}. A negative {idx} is also possible, see
- |list-index|. -1 inserts just before the last item.
-
- Returns the resulting |List| or |Blob|. Examples: >
- :let mylist = insert([2, 3, 5], 1)
- :call insert(mylist, 4, -1)
- :call insert(mylist, 6, len(mylist))
-< The last example can be done simpler with |add()|.
- Note that when {item} is a |List| it is inserted as a single
- item. Use |extend()| to concatenate |Lists|.
-
- Can also be used as a |method|: >
- mylist->insert(item)
-
-interrupt() *interrupt()*
- Interrupt script execution. It works more or less like the
- user typing CTRL-C, most commands won't execute and control
- returns to the user. This is useful to abort execution
- from lower down, e.g. in an autocommand. Example: >
- :function s:check_typoname(file)
- : if fnamemodify(a:file, ':t') == '['
- : echomsg 'Maybe typo'
- : call interrupt()
- : endif
- :endfunction
- :au BufWritePre * call s:check_typoname(expand('<amatch>'))
-
-invert({expr}) *invert()*
- Bitwise invert. The argument is converted to a number. A
- List, Dict or Float argument causes an error. Example: >
- :let bits = invert(bits)
-< Can also be used as a |method|: >
- :let bits = bits->invert()
-
-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.
-
- Can also be used as a |method|: >
- GetName()->isdirectory()
-
-isinf({expr}) *isinf()*
- Return 1 if {expr} is a positive infinity, or -1 a negative
- infinity, otherwise 0. >
- :echo isinf(1.0 / 0.0)
-< 1 >
- :echo isinf(-1.0 / 0.0)
-< -1
-
- Can also be used as a |method|: >
- Compute()->isinf()
-
-islocked({expr}) *islocked()* *E786*
- The result is a Number, which is |TRUE| when {expr} is the
- name of a locked variable.
- The string argument {expr} must be the name of a variable,
- |List| item or |Dictionary| entry, not the variable itself!
- Example: >
- :let alist = [0, ['a', 'b'], 2, 3]
- :lockvar 1 alist
- :echo islocked('alist') " 1
- :echo islocked('alist[1]') " 0
-
-< When {expr} is a variable that does not exist you get an error
- message. Use |exists()| to check for existence.
-
- Can also be used as a |method|: >
- GetName()->islocked()
-
-id({expr}) *id()*
- Returns a |String| which is a unique identifier of the
- container type (|List|, |Dict|, |Blob| and |Partial|). It is
- guaranteed that for the mentioned types `id(v1) ==# id(v2)`
- returns true iff `type(v1) == type(v2) && v1 is v2`.
- 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
- 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.
-
- It is not guaranteed that `id(no_longer_existing_container)`
- will not be equal to some other `id()`: new containers may
- reuse identifiers of the garbage-collected ones.
-
-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}
- entry and the value of this entry. The |List| is in arbitrary
- order. Also see |keys()| and |values()|.
- Example: >
- for [key, value] in items(mydict)
- echo key . ': ' . value
- endfor
-
-< Can also be used as a |method|: >
- mydict->items()
-
-isnan({expr}) *isnan()*
- Return |TRUE| if {expr} is a float with value NaN. >
- echo isnan(0.0 / 0.0)
-< 1
-
- Can also be used as a |method|: >
- Compute()->isnan()
-
-jobpid({job}) *jobpid()*
- Return the PID (process id) of |job-id| {job}.
-
-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`.
-
-jobstart({cmd}[, {opts}]) *jobstart()*
- Spawns {cmd} as a job.
- If {cmd} is a List it runs directly (no 'shell').
- If {cmd} is a String it runs in the 'shell', like this: >
- :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
-< (See |shell-unquoting| for details.)
-
- Example: >
- :call jobstart('nvim -h', {'on_stdout':{j,d,e->append(line('.'),d)}})
-<
- Returns |job-id| on success, 0 on invalid arguments (or job
- table is full), -1 if {cmd}[0] or 'shell' is not executable.
- The returned job-id is a valid |channel-id| representing the
- job's stdio streams. Use |chansend()| (or |rpcnotify()| and
- |rpcrequest()| if "rpc" was enabled) to send data to stdin and
- |chanclose()| to close the streams without stopping the job.
-
- See |job-control| and |RPC|.
-
- NOTE: on Windows if {cmd} is a List:
- - cmd[0] must be an executable (not a "built-in"). If it is
- in $PATH it can be called by name, without an extension: >
- :call jobstart(['ping', 'neovim.io'])
-< If it is a full or partial path, extension is required: >
- :call jobstart(['System32\ping.exe', 'neovim.io'])
-< - {cmd} is collapsed to a string of quoted args as expected
- by CommandLineToArgvW https://msdn.microsoft.com/bb776391
- unless cmd[0] is some form of "cmd.exe".
-
- *jobstart-options*
- {opts} is a dictionary with these keys:
- clear_env: (boolean) `env` defines the job environment
- exactly, instead of merging current environment.
- cwd: (string, default=|current-directory|) Working
- directory of the job.
- detach: (boolean) Detach the job process: it will not be
- killed when Nvim exits. If the process exits
- before Nvim, `on_exit` will be invoked.
- env: (dict) Map of environment variable name:value
- pairs extending (or replacing if |clear_env|)
- the current environment.
- height: (number) Height of the `pty` terminal.
- |on_exit|: (function) Callback invoked when the job exits.
- |on_stdout|: (function) Callback invoked when the job emits
- stdout data.
- |on_stderr|: (function) Callback invoked when the job emits
- stderr data.
- overlapped: (boolean) Set FILE_FLAG_OVERLAPPED for the
- standard input/output passed to the child process.
- Normally you do not need to set this.
- (Only available on MS-Windows, On other
- platforms, this option is silently ignored.)
- pty: (boolean) Connect the job to a new pseudo
- terminal, and its streams to the master file
- descriptor. Then `on_stderr` is ignored,
- `on_stdout` receives all output.
- rpc: (boolean) Use |msgpack-rpc| to communicate with
- the job over stdio. Then `on_stdout` is ignored,
- but `on_stderr` can still be used.
- stderr_buffered: (boolean) Collect data until EOF (stream closed)
- before invoking `on_stderr`. |channel-buffered|
- stdout_buffered: (boolean) Collect data until EOF (stream
- closed) before invoking `on_stdout`. |channel-buffered|
- stdin: (string) Either "pipe" (default) to connect the
- job's stdin to a channel or "null" to disconnect
- stdin.
- width: (number) Width of the `pty` terminal.
-
- {opts} is passed as |self| dictionary to the callback; the
- caller may set other keys to pass application-specific data.
-
- Returns:
- - |channel-id| on success
- - 0 on invalid arguments
- - -1 if {cmd}[0] is not executable.
- See also |job-control|, |channel|, |msgpack-rpc|.
-
-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
- will be sent. When the job terminates its |on_exit| handler
- (if any) will be invoked.
- See |job-control|.
-
- Returns 1 for valid job id, 0 for invalid id, including jobs have
- exited or stopped.
-
-jobwait({jobs}[, {timeout}]) *jobwait()*
- Waits for jobs and their |on_exit| handlers to complete.
-
- {jobs} is a List of |job-id|s to wait for.
- {timeout} is the maximum waiting time in milliseconds. If
- omitted or -1, wait forever.
-
- Timeout of 0 can be used to check the status of a job: >
- let running = jobwait([{job-id}], 0)[0] == -1
-<
- During jobwait() callbacks for jobs not in the {jobs} list may
- be invoked. The screen will not redraw unless |:redraw| is
- invoked by a callback.
-
- Returns a list of len({jobs}) integers, where each integer is
- the status of the corresponding job:
- Exit-code, if the job exited
- -1 if the timeout was exceeded
- -2 if the job was interrupted (by |CTRL-C|)
- -3 if the job-id is invalid
-
-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
- {sep} is omitted a single space is used.
- Note that {sep} is not added at the end. You might want to
- add it there too: >
- let lines = join(mylist, "\n") . "\n"
-< String items are used as-is. |Lists| and |Dictionaries| are
- converted into a string like with |string()|.
- The opposite function is |split()|.
-
- Can also be used as a |method|: >
- mylist->join()
-
-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
- Vim value. In the following cases it will output
- |msgpack-special-dict|:
- 1. Dictionary contains duplicate key.
- 2. Dictionary contains empty key.
- 3. String contains NUL byte. Two special dictionaries: for
- dictionary and for string will be emitted in case string
- with NUL byte was a dictionary key.
-
- Note: function treats its input as UTF-8 always. The JSON
- standard allows only a few encodings, of which UTF-8 is
- recommended and the only one required to be supported.
- Non-UTF-8 characters are an error.
-
- Can also be used as a |method|: >
- ReadObject()->json_decode()
-
-json_encode({expr}) *json_encode()*
- Convert {expr} into a JSON string. Accepts
- |msgpack-special-dict| as the input. Will not convert
- |Funcref|s, mappings with non-string keys (can be created as
- |msgpack-special-dict|), values with self-referencing
- containers, strings which contain non-UTF-8 characters,
- pseudo-UTF-8 strings which contain codepoints reserved for
- surrogate pairs (such strings are not valid UTF-8 strings).
- Non-printable characters are converted into "\u1234" escapes
- or special escapes like "\t", other are dumped as-is.
- |Blob|s are converted to arrays of the individual bytes.
-
- Can also be used as a |method|: >
- GetObject()->json_encode()
-
-keys({dict}) *keys()*
- Return a |List| with all the keys of {dict}. The |List| is in
- arbitrary order. Also see |items()| and |values()|.
-
- Can also be used as a |method|: >
- mydict->keys()
-
-< *len()* *E701*
-len({expr}) 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
- used, as with |strlen()|.
- When {expr} is a |List| the number of items in the |List| is
- returned.
- When {expr} is a |Blob| the number of bytes is returned.
- When {expr} is a |Dictionary| the number of entries in the
- |Dictionary| is returned.
- Otherwise an error is given.
-
- Can also be used as a |method|: >
- mylist->len()
-
-< *libcall()* *E364* *E368*
-libcall({libname}, {funcname}, {argument})
- Call function {funcname} in the run-time library {libname}
- with single argument {argument}.
- This is useful to call functions in a library that you
- especially made to be used with Vim. Since only one argument
- is possible, calling standard library functions is rather
- limited.
- The result is the String returned by the function. If the
- function returns NULL, this will appear as an empty string ""
- to Vim.
- If the function returns a number, use libcallnr()!
- If {argument} is a number, it is passed to the function as an
- int; if {argument} is a string, it is passed as a
- null-terminated string.
-
- libcall() allows you to write your own 'plug-in' extensions to
- Vim without having to recompile the program. It is NOT a
- means to call system functions! If you try to do so Vim will
- very probably crash.
-
- For Win32, the functions you write must be placed in a DLL
- and use the normal C calling convention (NOT Pascal which is
- used in Windows System DLLs). The function must take exactly
- one parameter, either a character pointer or a long integer,
- and must return a character pointer or NULL. The character
- pointer returned must point to memory that will remain valid
- after the function has returned (e.g. in static data in the
- DLL). If it points to allocated memory, that memory will
- leak away. Using a static buffer in the function should work,
- it's then freed when the DLL is unloaded.
-
- WARNING: If the function returns a non-valid pointer, Vim may
- crash! This also happens if the function returns a number,
- because Vim thinks it's a pointer.
- For Win32 systems, {libname} should be the filename of the DLL
- without the ".DLL" suffix. A full path is only required if
- the DLL is not in the usual places.
- For Unix: When compiling your own plugins, remember that the
- object code must be compiled as position-independent ('PIC').
- Examples: >
- :echo libcall("libc.so", "getenv", "HOME")
-
-< Can also be used as a |method|, the base is passed as the
- third argument: >
- GetValue()->libcall("libc.so", "getenv")
-<
- *libcallnr()*
-libcallnr({libname}, {funcname}, {argument})
- Just like |libcall()|, but used for a function that returns an
- int instead of a string.
- Examples: >
- :echo libcallnr("/usr/lib/libc.so", "getpid", "")
- :call libcallnr("libc.so", "printf", "Hello World!\n")
- :call libcallnr("libc.so", "sleep", 10)
-<
- Can also be used as a |method|, the base is passed as the
- third argument: >
- GetValue()->libcallnr("libc.so", "printf")
-<
-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.
- 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.
- Examples: >
- line(".") line number of the cursor
- line(".", winid) idem, in window "winid"
- line("'t") line number of mark t
- line("'" . marker) line number of mark marker
-<
- Can also be used as a |method|: >
- GetValue()->line()
-
-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
- the 'fileformat' option for the current buffer. The first
- line returns 1. UTF-8 encoding is used, 'fileencoding' is
- ignored. This can also be used to get the byte count for the
- line just below the last line: >
- line2byte(line("$") + 1)
-< This is the buffer size plus one. If 'fileencoding' is empty
- it is the file size plus one. {lnum} is used like with
- |getline()|. When {lnum} is invalid -1 is returned.
- Also see |byte2line()|, |go| and |:goto|.
-
- Can also be used as a |method|: >
- GetLnum()->line2byte()
-
-lispindent({lnum}) *lispindent()*
- Get the amount of indent for line {lnum} according the lisp
- indenting rules, as with 'lisp'.
- The indent is counted in spaces, the value of 'tabstop' is
- relevant. {lnum} is used just like in |getline()|.
- When {lnum} is invalid, -1 is returned.
-
- Can also be used as a |method|: >
- GetLnum()->lispindent()
-
-list2str({list} [, {utf8}]) *list2str()*
- Convert each number in {list} to a character string can
- concatenate them all. Examples: >
- list2str([32]) returns " "
- list2str([65, 66, 67]) returns "ABC"
-< The same can be done (slowly) with: >
- join(map(list, {nr, val -> nr2char(val)}), '')
-< |str2list()| does the opposite.
-
- UTF-8 encoding is always used, {utf8} option has no effect,
- and exists only for backwards-compatibility.
- With UTF-8 composing characters work as expected: >
- list2str([97, 769]) returns "á"
-<
- Can also be used as a |method|: >
- GetList()->list2str()
-
-localtime() *localtime()*
- Return the current time, measured as seconds since 1st Jan
- 1970. See also |strftime()|, |strptime()| and |getftime()|.
-
-
-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
- (0, inf].
- Examples: >
- :echo log(10)
-< 2.302585 >
- :echo log(exp(5))
-< 5.0
-
- Can also be used as a |method|: >
- Compute()->log()
-
-log10({expr}) *log10()*
- Return the logarithm of Float {expr} to base 10 as a |Float|.
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo log10(1000)
-< 3.0 >
- :echo log10(0.01)
-< -2.0
-
- Can also be used as a |method|: >
- Compute()->log10()
-
-luaeval({expr}[, {expr}])
- Evaluate Lua expression {expr} and return its result converted
- to Vim data structures. See |lua-eval| for more details.
-
- Can also be used as a |method|: >
- GetExpr()->luaeval()
-
-map({expr1}, {expr2}) *map()*
- {expr1} must be a |List|, |Blob| or |Dictionary|.
- Replace each item in {expr1} with the result of evaluating
- {expr2}. For a |Blob| each byte is replaced.
-
- {expr2} must be a |string| or |Funcref|.
-
- If {expr2} is a |string|, inside {expr2} |v:val| has the value
- of the current item. For a |Dictionary| |v:key| has the key
- of the current item and for a |List| |v:key| has the index of
- the current item. For a |Blob| |v:key| has the index of the
- current byte.
- Example: >
- :call map(mylist, '"> " . v:val . " <"')
-< This puts "> " before and " <" after each item in "mylist".
-
- Note that {expr2} is the result of an expression and is then
- used as an expression again. Often it is good to use a
- |literal-string| to avoid having to double backslashes. You
- still have to double ' quotes
-
- If {expr2} is a |Funcref| it is called with two arguments:
- 1. The key or the index of the current item.
- 2. the value of the current item.
- The function must return the new value of the item. Example
- that changes each value by "key-value": >
- func KeyValue(key, val)
- return a:key . '-' . a:val
- endfunc
- call map(myDict, function('KeyValue'))
-< It is shorter when using a |lambda|: >
- call map(myDict, {key, val -> key . '-' . val})
-< If you do not use "val" you can leave it out: >
- call map(myDict, {key -> 'item: ' . key})
-< If you do not use "key" you can use a short name: >
- call map(myDict, {_, val -> 'item: ' . val})
-<
- The operation is done in-place. If you want a |List| or
- |Dictionary| to remain unmodified make a copy first: >
- :let tlist = map(copy(mylist), ' v:val . "\t"')
-
-< Returns {expr1}, the |List|, |Blob| or |Dictionary| that was
- filtered. When an error is encountered while evaluating
- {expr2} no further items in {expr1} are processed. When
- {expr2} is a Funcref errors inside a function are ignored,
- unless it was defined with the "abort" flag.
-
- Can also be used as a |method|: >
- mylist->map(expr2)
-
-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
- characters translated like in the output of the ":map" command
- listing.
-
- When there is no mapping for {name}, an empty String is
- returned. When the mapping for {name} is empty, then "<Nop>"
- is returned.
-
- The {name} can have special key names, like in the ":map"
- command.
-
- {mode} can be one of these strings:
- "n" Normal
- "v" Visual (including Select)
- "o" Operator-pending
- "i" Insert
- "c" Cmd-line
- "s" Select
- "x" Visual
- "l" langmap |language-mapping|
- "t" Terminal
- "" Normal, Visual and Operator-pending
- When {mode} is omitted, the modes for "" are used.
-
- When {abbr} is there and it is |TRUE| use abbreviations
- instead of mappings.
-
- When {dict} is there and it is |TRUE| return a dictionary
- containing all the information of the mapping with the
- following items:
- "lhs" The {lhs} of the mapping.
- "rhs" The {rhs} of the mapping as typed.
- "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>.
- "expr" 1 for an expression mapping (|:map-<expr>|).
- "buffer" 1 for a buffer local mapping (|:map-local|).
- "mode" Modes for which the mapping is defined. In
- addition to the modes mentioned above, these
- characters will be used:
- " " Normal, Visual and Operator-pending
- "!" Insert and Commandline mode
- (|mapmode-ic|)
- "sid" The script local ID, used for <sid> mappings
- (|<SID>|).
- "lnum" The line number in "sid", zero if unknown.
- "nowait" Do not wait for other, longer mappings.
- (|:map-<nowait>|).
-
- The mappings local to the current buffer are checked first,
- then the global mappings.
- This function can be used to map a key even when it's already
- mapped, and have it do the original mapping too. Sketch: >
- exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
-
-< Can also be used as a |method|: >
- GetKey()->maparg('n')
-
-mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
- Check if there is a mapping that matches with {name} in mode
- {mode}. See |maparg()| for {mode} and special names in
- {name}.
- When {abbr} is there and it is non-zero use abbreviations
- instead of mappings.
- A match happens with a mapping that starts with {name} and
- with a mapping which is equal to the start of {name}.
-
- matches mapping "a" "ab" "abc" ~
- mapcheck("a") yes yes yes
- mapcheck("abc") yes yes yes
- mapcheck("ax") yes no no
- mapcheck("b") no no no
-
- The difference with maparg() is that mapcheck() finds a
- mapping that matches with {name}, while maparg() only finds a
- mapping for {name} exactly.
- When there is no mapping that starts with {name}, an empty
- String is returned. If there is one, the RHS of that mapping
- is returned. If there are several mappings that start with
- {name}, the RHS of one of them is returned. This will be
- "<Nop>" if the RHS is empty.
- The mappings local to the current buffer are checked first,
- then the global mappings.
- This function can be used to check if a mapping can be added
- without being ambiguous. Example: >
- :if mapcheck("_vv") == ""
- : map _vv :set guifont=7x13<CR>
- :endif
-< This avoids adding the "_vv" mapping when there already is a
- mapping for "_v" or for "_vvv".
-
- Can also be used as a |method|: >
- GetKey()->mapcheck('n')
-
-match({expr}, {pat} [, {start} [, {count}]]) *match()*
- When {expr} is a |List| then this returns the index of the
- first item where {pat} matches. Each item is used as a
- String, |Lists| and |Dictionaries| are used as echoed.
-
- Otherwise, {expr} is used as a String. The result is a
- Number, which gives the index (byte offset) in {expr} where
- {pat} matches.
-
- A match at the first character or |List| item returns zero.
- If there is no match -1 is returned.
-
- For getting submatches see |matchlist()|.
- Example: >
- :echo match("testing", "ing") " results in 4
- :echo match([1, 'x'], '\a') " results in 1
-< See |string-match| for how {pat} is used.
- *strpbrk()*
- Vim doesn't have a strpbrk() function. But you can do: >
- :let sepidx = match(line, '[.,;: \t]')
-< *strcasestr()*
- Vim doesn't have a strcasestr() function. But you can add
- "\c" to the pattern to ignore case: >
- :let idx = match(haystack, '\cneedle')
-<
- If {start} is given, the search starts from byte index
- {start} in a String or item {start} in a |List|.
- The result, however, is still the index counted from the
- first character/item. Example: >
- :echo match("testing", "ing", 2)
-< result is again "4". >
- :echo match("testing", "ing", 4)
-< result is again "4". >
- :echo match("testing", "t", 2)
-< result is "3".
- For a String, if {start} > 0 then it is like the string starts
- {start} bytes later, thus "^" will match at {start}. Except
- when {count} is given, then it's like matches before the
- {start} byte are ignored (this is a bit complicated to keep it
- backwards compatible).
- For a String, if {start} < 0, it will be set to 0. For a list
- the index is counted from the end.
- If {start} is out of range ({start} > strlen({expr}) for a
- String or {start} > len({expr}) for a |List|) -1 is returned.
-
- When {count} is given use the {count}'th match. When a match
- is found in a String the search for the next one starts one
- character further. Thus this example results in 1: >
- echo match("testing", "..", 0, 2)
-< In a |List| the search continues in the next item.
- Note that when {count} is added the way {start} works changes,
- see above.
-
- See |pattern| for the patterns that are accepted.
- The 'ignorecase' option is used to set the ignore-caseness of
- the pattern. 'smartcase' is NOT used. The matching is always
- done like 'magic' is set and 'cpoptions' is empty.
- Note that a match at the start is preferred, thus when the
- pattern is using "*" (any number of matches) it tends to find
- zero matches at the start instead of a number of matches
- further down in the text.
-
- Can also be used as a |method|: >
- GetText()->match('word')
- GetList()->match('word')
-<
- *matchadd()* *E798* *E799* *E801* *E957*
-matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
- Defines a pattern to be highlighted in the current window (a
- "match"). It will be highlighted with {group}. Returns an
- identification number (ID), which can be used to delete the
- match using |matchdelete()|. The ID is bound to the window.
- Matching is case sensitive and magic, unless case sensitivity
- or magicness are explicitly overridden in {pattern}. The
- 'magic', 'smartcase' and 'ignorecase' options are not used.
- The "Conceal" value is special, it causes the match to be
- concealed.
-
- The optional {priority} argument assigns a priority to the
- match. A match with a high priority will have its
- highlighting overrule that of a match with a lower priority.
- A priority is specified as an integer (negative numbers are no
- exception). If the {priority} argument is not specified, the
- default priority is 10. The priority of 'hlsearch' is zero,
- hence all matches with a priority greater than zero will
- overrule it. Syntax highlighting (see 'syntax') is a separate
- mechanism, and regardless of the chosen priority a match will
- always overrule syntax highlighting.
-
- The optional {id} argument allows the request for a specific
- match ID. If a specified ID is already taken, an error
- message will appear and the match will not be added. An ID
- is specified as a positive integer (zero excluded). IDs 1, 2
- and 3 are reserved for |:match|, |:2match| and |:3match|,
- respectively. If the {id} argument is not specified or -1,
- |matchadd()| automatically chooses a free ID.
-
- The optional {dict} argument allows for further custom
- values. Currently this is used to specify a match specific
- conceal character that will be shown for |hl-Conceal|
- highlighted matches. The dict can have the following members:
-
- conceal Special character to show instead of the
- match (only for |hl-Conceal| highlighed
- matches, see |:syn-cchar|)
- window Instead of the current window use the
- window with this number or window ID.
-
- The number of matches is not limited, as it is the case with
- the |:match| commands.
-
- Example: >
- :highlight MyGroup ctermbg=green guibg=green
- :let m = matchadd("MyGroup", "TODO")
-< Deletion of the pattern: >
- :call matchdelete(m)
-
-< A list of matches defined by |matchadd()| and |:match| are
- available from |getmatches()|. All matches can be deleted in
- one operation by |clearmatches()|.
-
- Can also be used as a |method|: >
- GetGroup()->matchadd('TODO')
-<
- *matchaddpos()*
-matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
- 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.
- *E5030* *E5031*
- {pos} is a list of positions. Each position can be one of
- these:
- - A number. This whole line will be highlighted. The first
- line has number 1.
- - A list with one number, e.g., [23]. The whole line with this
- number will be highlighted.
- - A list with two numbers, e.g., [23, 11]. The first number is
- the line number, the second one is the column number (first
- column is 1, the value must correspond to the byte index as
- |col()| would return). The character at this position will
- be highlighted.
- - A list with three numbers, e.g., [23, 11, 3]. As above, but
- the third number gives the length of the highlight in bytes.
-
- Entries with zero and negative line numbers are silently
- ignored, as well as entries with negative column numbers and
- lengths.
-
- The maximum number of positions in {pos} is 8.
-
- Example: >
- :highlight MyGroup ctermbg=green guibg=green
- :let m = matchaddpos("MyGroup", [[23, 24], 34])
-< Deletion of the pattern: >
- :call matchdelete(m)
-
-< Matches added by |matchaddpos()| are returned by
- |getmatches()|.
-
- Can also be used as a |method|: >
- GetGroup()->matchaddpos([23, 11])
-
-matcharg({nr}) *matcharg()*
- Selects the {nr} match item, as set with a |:match|,
- |:2match| or |:3match| command.
- Return a |List| with two elements:
- The name of the highlight group used
- The pattern used.
- When {nr} is not 1, 2 or 3 returns an empty |List|.
- When there is no match item set returns ['', ''].
- This is useful to save and restore a |:match|.
- Highlighting matches using the |:match| commands are limited
- to three matches. |matchadd()| does not have this limitation.
-
- Can also be used as a |method|: >
- GetMatch()->matcharg()
-
-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,
- otherwise -1. See example for |matchadd()|. All matches can
- be deleted in one operation by |clearmatches()|.
- If {win} is specified, use the window with this number or
- window ID instead of the current window.
-
- Can also be used as a |method|: >
- GetMatch()->matchdelete()
-
-matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
- Same as |match()|, but return the index of first character
- after the match. Example: >
- :echo matchend("testing", "ing")
-< results in "7".
- *strspn()* *strcspn()*
- Vim doesn't have a strspn() or strcspn() function, but you can
- do it with matchend(): >
- :let span = matchend(line, '[a-zA-Z]')
- :let span = matchend(line, '[^a-zA-Z]')
-< Except that -1 is returned when there are no matches.
-
- The {start}, if given, has the same meaning as for |match()|. >
- :echo matchend("testing", "ing", 2)
-< results in "7". >
- :echo matchend("testing", "ing", 5)
-< result is "-1".
- When {expr} is a |List| the result is equal to |match()|.
-
- Can also be used as a |method|: >
- GetText()->matchend('word')
-
-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
- return. Following items are submatches, like "\1", "\2", etc.
- in |:substitute|. When an optional submatch didn't match an
- empty string is used. Example: >
- echo matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')
-< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
- When there is no match an empty list is returned.
-
- You can pass in a List, but that is not very useful.
-
- Can also be used as a |method|: >
- GetText()->matchlist('word')
-
-matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
- Same as |match()|, but return the matched string. Example: >
- :echo matchstr("testing", "ing")
-< results in "ing".
- When there is no match "" is returned.
- The {start}, if given, has the same meaning as for |match()|. >
- :echo matchstr("testing", "ing", 2)
-< results in "ing". >
- :echo matchstr("testing", "ing", 5)
-< result is "".
- When {expr} is a |List| then the matching item is returned.
- The type isn't changed, it's not necessarily a String.
-
- Can also be used as a |method|: >
- GetText()->matchstr('word')
-
-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: >
- :echo matchstrpos("testing", "ing")
-< results in ["ing", 4, 7].
- When there is no match ["", -1, -1] is returned.
- The {start}, if given, has the same meaning as for |match()|. >
- :echo matchstrpos("testing", "ing", 2)
-< results in ["ing", 4, 7]. >
- :echo matchstrpos("testing", "ing", 5)
-< result is ["", -1, -1].
- When {expr} is a |List| then the matching item, the index
- of first item where {pat} matches, the start position and the
- end position of the match are returned. >
- :echo matchstrpos([1, '__x'], '\a')
-< result is ["x", 1, 2, 3].
- The type isn't changed, it's not necessarily a String.
-
- Can also be used as a |method|: >
- GetText()->matchstrpos('word')
-<
- *max()*
-max({expr}) Return the maximum value of all items in {expr}.
- {expr} can be a |List| or a |Dictionary|. For a Dictionary,
- it returns the maximum of all values in the Dictionary.
- If {expr} is neither a List nor a Dictionary, or one of the
- items in {expr} cannot be used as a Number this results in
- an error. An empty |List| or |Dictionary| results in zero.
-
- Can also be used as a |method|: >
- mylist->max()
-
-menu_get({path} [, {modes}]) *menu_get()*
- Returns a |List| of |Dictionaries| describing |menus| (defined
- by |:menu|, |:amenu|, …), including |hidden-menus|.
-
- {path} matches a menu by name, or all menus if {path} is an
- empty string. Example: >
- :echo menu_get('File','')
- :echo menu_get('')
-<
- {modes} is a string of zero or more modes (see |maparg()| or
- |creating-menus| for the list of modes). "a" means "all".
-
- Example: >
- nnoremenu &Test.Test inormal
- inoremenu Test.Test insert
- vnoremenu Test.Test x
- echo menu_get("")
-
-< returns something like this: >
-
- [ {
- "hidden": 0,
- "name": "Test",
- "priority": 500,
- "shortcut": 84,
- "submenus": [ {
- "hidden": 0,
- "mappings": {
- i": {
- "enabled": 1,
- "noremap": 1,
- "rhs": "insert",
- "sid": 1,
- "silent": 0
- },
- n": { ... },
- s": { ... },
- v": { ... }
- },
- "name": "Test",
- "priority": 500,
- "shortcut": 0
- } ]
- } ]
-<
-
- *min()*
-min({expr}) Return the minimum value of all items in {expr}.
- {expr} can be a |List| or a |Dictionary|. For a Dictionary,
- it returns the minimum of all values in the Dictionary.
- If {expr} is neither a List nor a Dictionary, or one of the
- items in {expr} cannot be used as a Number this results in
- an error. An empty |List| or |Dictionary| results in zero.
-
- Can also be used as a |method|: >
- mylist->min()
-
-< *mkdir()* *E739*
-mkdir({name} [, {path} [, {prot}]])
- Create directory {name}.
- If {path} is "p" then intermediate directories are created as
- necessary. Otherwise it must be "".
- If {prot} is given it is used to set the protection bits of
- the new directory. The default is 0o755 (rwxr-xr-x: r/w for
- the user, readable for others). Use 0o700 to make it
- unreadable for others.
-
- {prot} is applied for all parts of {name}. Thus if you create
- /tmp/foo/bar then /tmp/foo will be created with 0700. Example: >
- :call mkdir($HOME . "/tmp/foo/bar", "p", 0700)
-< This function is not available in the |sandbox|.
-
- If you try to create an existing directory with {path} set to
- "p" mkdir() will silently exit.
-
- The function result is a Number, which is TRUE if the call was
- successful or FALSE if the directory creation failed or partly
- failed.
-
- Can also be used as a |method|: >
- GetName()->mkdir()
-<
- *mode()*
-mode([expr]) Return a string that indicates the current mode.
- If [expr] is supplied and it evaluates to a non-zero Number or
- a non-empty String (|non-zero-arg|), then the full mode is
- returned, otherwise only the first letter is returned.
-
- n Normal
- no Operator-pending
- nov Operator-pending (forced charwise |o_v|)
- noV Operator-pending (forced linewise |o_V|)
- noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|)
- CTRL-V is one character
- niI Normal using |i_CTRL-O| in |Insert-mode|
- niR Normal using |i_CTRL-O| in |Replace-mode|
- niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
- nt Normal in |terminal-emulator| (insert goes to
- Terminal mode)
- v Visual by character
- vs Visual by character using |v_CTRL-O| in Select mode
- V Visual by line
- Vs Visual by line using |v_CTRL-O| in Select mode
- CTRL-V Visual blockwise
- CTRL-Vs Visual blockwise using |v_CTRL-O| in Select mode
- s Select by character
- S Select by line
- CTRL-S Select blockwise
- i Insert
- ic Insert mode completion |compl-generic|
- ix Insert mode |i_CTRL-X| completion
- R Replace |R|
- Rc Replace mode completion |compl-generic|
- Rx Replace mode |i_CTRL-X| completion
- Rv Virtual Replace |gR|
- Rvc Virtual Replace mode completion |compl-generic|
- Rvx Virtual Replace mode |i_CTRL-X| completion
- c Command-line editing
- cv Vim Ex mode |gQ|
- r Hit-enter prompt
- rm The -- more -- prompt
- r? A |:confirm| query of some sort
- ! Shell or external command is executing
- t Terminal mode: keys go to the job
-
- This is useful in the 'statusline' option or when used
- with |remote_expr()| In most other places it always returns
- "c" or "n".
- Note that in the future more modes and more specific modes may
- be added. It's better not to compare the whole string but only
- the leading character(s).
- Also see |visualmode()|.
-
- Can also be used as a |method|: >
- DoFull()->mode()
-
-msgpackdump({list} [, {type}]) *msgpackdump()*
- Convert a list of VimL objects to msgpack. Returned value is a
- |readfile()|-style list. When {type} contains "B", a |Blob| is
- returned instead. Example: >
- call writefile(msgpackdump([{}]), 'fname.mpack', 'b')
-< or, using a |Blob|: >
- call writefile(msgpackdump([{}], 'B'), 'fname.mpack')
-<
- This will write the single 0x80 byte to a `fname.mpack` file
- (dictionary with zero items is represented by 0x80 byte in
- messagepack).
-
- Limitations: *E5004* *E5005*
- 1. |Funcref|s cannot be dumped.
- 2. Containers that reference themselves cannot be dumped.
- 3. Dictionary keys are always dumped as STR strings.
- 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.
-
-msgpackparse({data}) *msgpackparse()*
- Convert a |readfile()|-style list or a |Blob| to a list of
- VimL objects.
- Example: >
- let fname = expand('~/.config/nvim/shada/main.shada')
- let mpack = readfile(fname, 'b')
- let shada_objects = msgpackparse(mpack)
-< This will read ~/.config/nvim/shada/main.shada file to
- `shada_objects` list.
-
- Limitations:
- 1. Mapping ordering is not preserved unless messagepack
- mapping is dumped using generic mapping
- (|msgpack-special-map|).
- 2. Since the parser aims to preserve all data untouched
- (except for 1.) some strings are parsed to
- |msgpack-special-dict| format which is not convenient to
- use.
- *msgpack-special-dict*
- Some messagepack strings may be parsed to special
- dictionaries. Special dictionaries are dictionaries which
-
- 1. Contain exactly two keys: `_TYPE` and `_VAL`.
- 2. `_TYPE` key is one of the types found in |v:msgpack_types|
- variable.
- 3. Value for `_VAL` has the following format (Key column
- contains name of the key from |v:msgpack_types|):
-
- Key Value ~
- nil Zero, ignored when dumping. Not returned by
- |msgpackparse()| since |v:null| was introduced.
- boolean One or zero. When dumping it is only checked that
- value is a |Number|. Not returned by |msgpackparse()|
- since |v:true| and |v:false| were introduced.
- integer |List| with four numbers: sign (-1 or 1), highest two
- bits, number with bits from 62nd to 31st, lowest 31
- bits. I.e. to get actual number one will need to use
- code like >
- _VAL[0] * ((_VAL[1] << 62)
- & (_VAL[2] << 31)
- & _VAL[3])
-< Special dictionary with this type will appear in
- |msgpackparse()| output under one of the following
- circumstances:
- 1. |Number| is 32-bit and value is either above
- INT32_MAX or below INT32_MIN.
- 2. |Number| is 64-bit and value is above INT64_MAX. It
- cannot possibly be below INT64_MIN because msgpack
- 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
- byte. This value cannot appear in |msgpackparse()|
- output since blobs were introduced.
- array |List|. This value cannot appear in |msgpackparse()|
- output.
- *msgpack-special-map*
- map |List| of |List|s with two items (key and value) each.
- This value will appear in |msgpackparse()| output if
- parsed mapping contains one of the following keys:
- 1. Any key that is not a string (including keys which
- are binary strings).
- 2. String with NUL byte inside.
- 3. Duplicate key.
- 4. Empty key.
- ext |List| with two values: first is a signed integer
- representing extension type. Second is
- |readfile()|-style list of strings.
-
-nextnonblank({lnum}) *nextnonblank()*
- Return the line number of the first line at or below {lnum}
- that is not blank. Example: >
- if getline(nextnonblank(1)) =~ "Java"
-< When {lnum} is invalid or there is no non-blank line at or
- below it, zero is returned.
- {lnum} is used like with |getline()|.
- See also |prevnonblank()|.
-
- Can also be used as a |method|: >
- GetLnum()->nextnonblank()
-
-nr2char({expr} [, {utf8}]) *nr2char()*
- Return a string with a single character, which has the number
- value {expr}. Examples: >
- nr2char(64) returns "@"
- nr2char(32) returns " "
-< Example for "utf-8": >
- nr2char(300) returns I with bow character
-< UTF-8 encoding is always used, {utf8} option has no effect,
- and exists only for backwards-compatibility.
- Note that a NUL character in the file is specified with
- nr2char(10), because NULs are represented with newline
- characters. nr2char(0) is a real NUL and terminates the
- string, thus results in an empty string.
-
- Can also be used as a |method|: >
- GetNumber()->nr2char()
-
-nvim_...({...}) *E5555* *nvim_...()* *eval-api*
- Call nvim |api| functions. The type checking of arguments will
- be stricter than for most other builtins. For instance,
- if Integer is expected, a |Number| must be passed in, a
- |String| will not be autoconverted.
- Buffer numbers, as returned by |bufnr()| could be used as
- first argument to nvim_buf_... functions. All functions
- expecting an object (buffer, window or tabpage) can
- also take the numerical value 0 to indicate the current
- (focused) object.
-
-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.
- Example: >
- :let bits = or(bits, 0x80)
-< Can also be used as a |method|: >
- :let bits = bits->or(0x80)
-
-pathshorten({path}) *pathshorten()*
- Shorten directory names in the path {path} and return the
- result. The tail, the file name, is kept as-is. The other
- components in the path are reduced to single letters. Leading
- '~' and '.' characters are kept. Example: >
- :echo pathshorten('~/.config/nvim/autoload/file1.vim')
-< ~/.c/n/a/file1.vim ~
- It doesn't matter if the path exists or not.
-
- Can also be used as a |method|: >
- GetDirectories()->pathshorten()
-
-perleval({expr}) *perleval()*
- Evaluate |perl| expression {expr} and return its result
- converted to Vim data structures.
- Numbers and strings are returned as they are (strings are
- copied though).
- Lists are represented as Vim |List| type.
- Dictionaries are represented as Vim |Dictionary| type,
- non-string keys result in error.
-
- Note: If you want an array or hash, {expr} must return a
- reference to it.
- Example: >
- :echo perleval('[1 .. 4]')
-< [1, 2, 3, 4]
-
- Can also be used as a |method|: >
- GetExpr()->perleval()
-
-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|.
- Examples: >
- :echo pow(3, 3)
-< 27.0 >
- :echo pow(2, 16)
-< 65536.0 >
- :echo pow(32, 0.20)
-< 2.0
-
- Can also be used as a |method|: >
- Compute()->pow(3)
-
-prevnonblank({lnum}) *prevnonblank()*
- Return the line number of the first line at or above {lnum}
- that is not blank. Example: >
- let ind = indent(prevnonblank(v:lnum - 1))
-< When {lnum} is invalid or there is no non-blank line at or
- above it, zero is returned.
- {lnum} is used like with |getline()|.
- Also see |nextnonblank()|.
-
- Can also be used as a |method|: >
- GetLnum()->prevnonblank()
-
-printf({fmt}, {expr1} ...) *printf()*
- Return a String with {fmt}, where "%" items are replaced by
- the formatted form of their respective arguments. Example: >
- printf("%4d: E%d %.30s", lnum, errno, msg)
-< May result in:
- " 99: E42 asdfasdfasdfasdfasdfasdfasdfas" ~
-
- When used as a |method| the base is passed as the second
- argument: >
- Compute()->printf("result: %d")
-
-< Often used items are:
- %s string
- %6S string right-aligned in 6 display cells
- %6s string right-aligned in 6 bytes
- %.9s string truncated to 9 bytes
- %c single byte
- %d decimal number
- %5d decimal number padded with spaces to 5 characters
- %b binary number
- %08b binary number padded with zeros to at least 8 characters
- %B binary number using upper case letters
- %x hex number
- %04x hex number padded with zeros to at least 4 characters
- %X hex number using upper case letters
- %o octal number
- %f floating point number as 12.23, inf, -inf or nan
- %F floating point number as 12.23, INF, -INF or NAN
- %e floating point number as 1.23e3, inf, -inf or nan
- %E floating point number as 1.23E3, INF, -INF or NAN
- %g floating point number, as %f or %e depending on value
- %G floating point number, as %F or %E depending on value
- %% the % character itself
- %p representation of the pointer to the container
-
- Conversion specifications start with '%' and end with the
- conversion type. All other characters are copied unchanged to
- the result.
-
- The "%" starts a conversion specification. The following
- arguments appear in sequence:
-
- % [flags] [field-width] [.precision] type
-
- flags
- Zero or more of the following flags:
-
- # The value should be converted to an "alternate
- form". For c, d, and s conversions, this option
- has no effect. For o conversions, the precision
- of the number is increased to force the first
- character of the output string to a zero (except
- if a zero value is printed with an explicit
- precision of zero).
- For x and X conversions, a non-zero result has
- the string "0x" (or "0X" for X conversions)
- prepended to it.
-
- 0 (zero) Zero padding. For all conversions the converted
- value is padded on the left with zeros rather
- than blanks. If a precision is given with a
- numeric conversion (d, o, x, and X), the 0 flag
- is ignored.
-
- - A negative field width flag; the converted value
- is to be left adjusted on the field boundary.
- The converted value is padded on the right with
- blanks, rather than on the left with blanks or
- zeros. A - overrides a 0 if both are given.
-
- ' ' (space) A blank should be left before a positive
- number produced by a signed conversion (d).
-
- + A sign must always be placed before a number
- produced by a signed conversion. A + overrides
- a space if both are used.
-
- field-width
- An optional decimal digit string specifying a minimum
- field width. If the converted value has fewer bytes
- than the field width, it will be padded with spaces on
- the left (or right, if the left-adjustment flag has
- been given) to fill out the field width. For the S
- conversion the count is in cells.
-
- .precision
- An optional precision, in the form of a period '.'
- followed by an optional digit string. If the digit
- string is omitted, the precision is taken as zero.
- This gives the minimum number of digits to appear for
- d, o, x, and X conversions, the maximum number of
- bytes to be printed from a string for s conversions,
- or the maximum number of cells to be printed from a
- string for S conversions.
- For floating point it is the number of digits after
- the decimal point.
-
- type
- A character that specifies the type of conversion to
- be applied, see below.
-
- A field width or precision, or both, may be indicated by an
- asterisk '*' instead of a digit string. In this case, a
- Number argument supplies the field width or precision. A
- negative field width is treated as a left adjustment flag
- followed by a positive field width; a negative precision is
- treated as though it were missing. Example: >
- :echo printf("%d: %.*s", nr, width, line)
-< This limits the length of the text used from "line" to
- "width" bytes.
-
- The conversion specifiers and their meanings are:
-
- *printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X*
- dbBoxX The Number argument is converted to signed decimal (d),
- unsigned binary (b and B), unsigned octal (o), or
- unsigned hexadecimal (x and X) notation. The letters
- "abcdef" are used for x conversions; the letters
- "ABCDEF" are used for X conversions. The precision, if
- any, gives the minimum number of digits that must
- appear; if the converted value requires fewer digits, it
- is padded on the left with zeros. In no case does a
- non-existent or small field width cause truncation of a
- numeric field; if the result of a conversion is wider
- than the field width, the field is expanded to contain
- the conversion result.
- The 'h' modifier indicates the argument is 16 bits.
- The 'l' modifier indicates the argument is 32 bits.
- The 'L' modifier indicates the argument is 64 bits.
- Generally, these modifiers are not useful. They are
- ignored when type is known from the argument.
-
- i alias for d
- D alias for ld
- U alias for lu
- O alias for lo
-
- *printf-c*
- c The Number argument is converted to a byte, and the
- resulting character is written.
-
- *printf-s*
- s The text of the String argument is used. If a
- precision is specified, no more bytes than the number
- specified are used.
- If the argument is not a String type, it is
- automatically converted to text with the same format
- as ":echo".
- *printf-S*
- S The text of the String argument is used. If a
- precision is specified, no more display cells than the
- number specified are used.
-
- *printf-f* *E807*
- f F The Float argument is converted into a string of the
- form 123.456. The precision specifies the number of
- digits after the decimal point. When the precision is
- zero the decimal point is omitted. When the precision
- is not specified 6 is used. A really big number
- (out of range or dividing by zero) results in "inf"
- or "-inf" with %f (INF or -INF with %F).
- "0.0 / 0.0" results in "nan" with %f (NAN with %F).
- Example: >
- echo printf("%.2f", 12.115)
-< 12.12
- Note that roundoff depends on the system libraries.
- Use |round()| when in doubt.
-
- *printf-e* *printf-E*
- e E The Float argument is converted into a string of the
- form 1.234e+03 or 1.234E+03 when using 'E'. The
- precision specifies the number of digits after the
- decimal point, like with 'f'.
-
- *printf-g* *printf-G*
- g G The Float argument is converted like with 'f' if the
- value is between 0.001 (inclusive) and 10000000.0
- (exclusive). Otherwise 'e' is used for 'g' and 'E'
- for 'G'. When no precision is specified superfluous
- zeroes and '+' signs are removed, except for the zero
- immediately after the decimal point. Thus 10000000.0
- results in 1.0e7.
-
- *printf-%*
- % A '%' is written. No argument is converted. The
- complete conversion specification is "%%".
-
- When a Number argument is expected a String argument is also
- accepted and automatically converted.
- When a Float or String argument is expected a Number argument
- is also accepted and automatically converted.
- Any other argument type results in an error message.
-
- *E766* *E767*
- The number of {exprN} arguments must exactly match the number
- of "%" items. If there are not sufficient or too many
- arguments an error is given. Up to 18 arguments can be used.
-
-prompt_getprompt({buf}) *prompt_getprompt()*
- Returns the effective prompt text for buffer {buf}. {buf} can
- be a buffer name or number. See |prompt-buffer|.
-
- If the buffer doesn't exist or isn't a prompt buffer, an empty
- string is returned.
-
- Can also be used as a |method|: >
- GetBuffer()->prompt_getprompt()
-
-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
- effect if {buf} has 'buftype' set to "prompt".
-
- The callback is invoked when pressing Enter. The current
- buffer will always be the prompt buffer. A new line for a
- prompt is added before invoking the callback, thus the prompt
- for which the callback was invoked will be in the last but one
- line.
- If the callback wants to add text to the buffer, it must
- insert it above the last line, since that is where the current
- prompt is. This can also be done asynchronously.
- The callback is invoked with one argument, which is the text
- that was entered at the prompt. This can be an empty string
- if the user only typed Enter.
- Example: >
- call prompt_setcallback(bufnr(''), function('s:TextEntered'))
- func s:TextEntered(text)
- if a:text == 'exit' || a:text == 'quit'
- stopinsert
- close
- else
- call append(line('$') - 1, 'Entered: "' . a:text . '"')
- " Reset 'modified' to allow the buffer to be closed.
- set nomodified
- endif
- endfunc
-
-< Can also be used as a |method|: >
- GetBuffer()->prompt_setcallback(callback)
-
-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
- {buf} has 'buftype' set to "prompt".
-
- This callback will be invoked when pressing CTRL-C in Insert
- mode. Without setting a callback Vim will exit Insert mode,
- as in any buffer.
-
- Can also be used as a |method|: >
- GetBuffer()->prompt_setinterrupt(callback)
-
-prompt_setprompt({buf}, {text}) *prompt_setprompt()*
- Set prompt for buffer {buf} to {text}. You most likely want
- {text} to end in a space.
- The result is only visible if {buf} has 'buftype' set to
- "prompt". Example: >
- call prompt_setprompt(bufnr(''), 'command: ')
-<
- Can also be used as a |method|: >
- GetBuffer()->prompt_setprompt('command: ')
-
-pum_getpos() *pum_getpos()*
- If the popup menu (see |ins-completion-menu|) is not visible,
- returns an empty |Dictionary|, otherwise, returns a
- |Dictionary| with the following keys:
- height nr of items visible
- width screen cells
- row top screen row (0 first row)
- col leftmost screen column (0 first col)
- size total nr of items
- scrollbar |TRUE| if scrollbar is visible
-
- The values are the same as in |v:event| during |CompleteChanged|.
-
-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.
-
-py3eval({expr}) *py3eval()*
- Evaluate Python expression {expr} and return its result
- converted to Vim data structures.
- Numbers and strings are returned as they are (strings are
- copied though, Unicode strings are additionally converted to
- UTF-8).
- Lists are represented as Vim |List| type.
- Dictionaries are represented as Vim |Dictionary| type with
- keys converted to strings.
-
- Can also be used as a |method|: >
- GetExpr()->py3eval()
-<
- *E858* *E859*
-pyeval({expr}) *pyeval()*
- Evaluate Python expression {expr} and return its result
- converted to Vim data structures.
- Numbers and strings are returned as they are (strings are
- copied though).
- Lists are represented as Vim |List| type.
- Dictionaries are represented as Vim |Dictionary| type,
- non-string keys result in error.
-
- Can also be used as a |method|: >
- GetExpr()->pyeval()
-
-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()|
-
- Can also be used as a |method|: >
- GetExpr()->pyxeval()
-<
- *E726* *E727*
-range({expr} [, {max} [, {stride}]]) *range()*
- Returns a |List| with Numbers:
- - If only {expr} is specified: [0, 1, ..., {expr} - 1]
- - If {max} is specified: [{expr}, {expr} + 1, ..., {max}]
- - If {stride} is specified: [{expr}, {expr} + {stride}, ...,
- {max}] (increasing {expr} with {stride} each time, not
- producing a value past {max}).
- When the maximum is one before the start the result is an
- empty list. When the maximum is more than one before the
- start this is an error.
- Examples: >
- range(4) " [0, 1, 2, 3]
- range(2, 4) " [2, 3, 4]
- range(2, 9, 3) " [2, 5, 8]
- range(2, -2, -1) " [2, 1, 0, -1, -2]
- range(0) " []
- range(2, 0) " error!
-<
- Can also be used as a |method|: >
- GetExpr()->range()
-<
- *readdir()*
-readdir({directory} [, {expr}])
- Return a list with file and directory names in {directory}.
-
- When {expr} is omitted all entries are included.
- When {expr} is given, it is evaluated to check what to do:
- If {expr} results in -1 then no further entries will
- be handled.
- If {expr} results in 0 then this entry will not be
- added to the list.
- If {expr} results in 1 then this entry will be added
- to the list.
- Each time {expr} is evaluated |v:val| is set to the entry name.
- When {expr} is a function the name is passed as the argument.
- For example, to get a list of files ending in ".txt": >
- readdir(dirname, {n -> n =~ '.txt$'})
-< To skip hidden and backup files: >
- readdir(dirname, {n -> n !~ '^\.\|\~$'})
-
-< If you want to get a directory tree: >
- function! s:tree(dir)
- return {a:dir : map(readdir(a:dir),
- \ {_, x -> isdirectory(x) ?
- \ {x : s:tree(a:dir . '/' . x)} : x})}
- endfunction
- echo s:tree(".")
-<
- Can also be used as a |method|: >
- GetDirName()->readdir()
-<
- *readfile()*
-readfile({fname} [, {type} [, {max}]])
- Read file {fname} and return a |List|, each line of the file
- as an item. Lines are broken at NL characters. Macintosh
- files separated with CR will result in a single long line
- (unless a NL appears somewhere).
- All NUL characters are replaced with a NL character.
- When {type} contains "b" binary mode is used:
- - When the last line ends in a NL an extra empty list item is
- added.
- - No CR characters are removed.
- When {type} contains "B" a |Blob| is returned with the binary
- data of the file unmodified.
- Otherwise:
- - CR characters that appear before a NL are removed.
- - Whether the last line ends in a NL or not does not matter.
- - Any UTF-8 byte order mark is removed from the text.
- When {max} is given this specifies the maximum number of lines
- to be read. Useful if you only want to check the first ten
- lines of a file: >
- :for line in readfile(fname, '', 10)
- : if line =~ 'Date' | echo line | endif
- :endfor
-< When {max} is negative -{max} lines from the end of the file
- are returned, or as many as there are.
- When {max} is zero the result is an empty list.
- Note that without {max} the whole file is read into memory.
- Also note that there is no recognition of encoding. Read a
- file into a buffer if you need to.
- When the file can't be opened an error message is given and
- the result is an empty list.
- Also see |writefile()|.
-
- Can also be used as a |method|: >
- GetFileName()->readfile()
-
-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 |@|.
-
-reg_recorded() *reg_recorded()*
- Returns the single letter name of the last recorded register.
- Returns an empty string string when nothing was recorded yet.
- See |q| and |Q|.
-
-reg_recording() *reg_recording()*
- Returns the single letter name of the register being recorded.
- Returns an empty string string when not recording. See |q|.
-
-reltime([{start} [, {end}]]) *reltime()*
- Return an item that represents a time value. The item is a
- list with items that depend on the system.
- The item can be passed to |reltimestr()| to convert it to a
- string or |reltimefloat()| to convert to a Float.
-
- Without an argument it returns the current "relative time", an
- implementation-defined value meaningful only when used as an
- argument to |reltime()|, |reltimestr()| and |reltimefloat()|.
-
- With one argument it returns the time passed since the time
- specified in the argument.
- With two arguments it returns the time passed between {start}
- and {end}.
-
- The {start} and {end} arguments must be values returned by
- reltime().
-
- Can also be used as a |method|: >
- GetStart()->reltime()
-<
- Note: |localtime()| returns the current (non-relative) time.
-
-reltimefloat({time}) *reltimefloat()*
- Return a Float that represents the time value of {time}.
- Unit of time is seconds.
- Example:
- let start = reltime()
- call MyFunction()
- let seconds = reltimefloat(reltime(start))
- See the note of reltimestr() about overhead.
- Also see |profiling|.
- If there is an error an empty string is returned
-
- Can also be used as a |method|: >
- reltime(start)->reltimefloat()
-
-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
- microseconds. Example: >
- let start = reltime()
- call MyFunction()
- echo reltimestr(reltime(start))
-< Note that overhead for the commands will be added to the time.
- Leading spaces are used to make the string align nicely. You
- can use split() to remove it. >
- echo split(reltimestr(reltime(start)))[0]
-< Also see |profiling|.
- If there is an error an empty string is returned
-
- Can also be used as a |method|: >
- reltime(start)->reltimestr()
-<
- *remote_expr()* *E449*
-remote_expr({server}, {string} [, {idvar} [, {timeout}]])
- Send the {string} to {server}. The string is sent as an
- expression and the result is returned after evaluation.
- The result must be a String or a |List|. A |List| is turned
- into a String by joining the items with a line break in
- between (not at the end), like with join(expr, "\n").
- If {idvar} is present and not empty, it is taken as the name
- of a variable and a {serverid} for later use with
- |remote_read()| is stored there.
- If {timeout} is given the read times out after this many
- seconds. Otherwise a timeout of 600 seconds is used.
- See also |clientserver| |RemoteReply|.
- This function is not available in the |sandbox|.
- Note: Any errors will cause a local error message to be issued
- and the result will be the empty string.
-
- Variables will be evaluated in the global namespace,
- independent of a function currently being active. Except
- when in debug mode, then local function variables and
- arguments can be evaluated.
-
- Examples: >
- :echo remote_expr("gvim", "2+2")
- :echo remote_expr("gvim1", "b:current_syntax")
-<
-
-remote_foreground({server}) *remote_foreground()*
- Move the Vim server with the name {server} to the foreground.
- The {server} argument is a string.
- This works like: >
- remote_expr({server}, "foreground()")
-< Except that on Win32 systems the client does the work, to work
- around the problem that the OS doesn't always allow the server
- to bring itself to the foreground.
- Note: This does not restore the window if it was minimized,
- like foreground() does.
- This function is not available in the |sandbox|.
- {only in the Win32 GUI and the Win32 console version}
-
-
-remote_peek({serverid} [, {retvar}]) *remote_peek()*
- Returns a positive number if there are available strings
- from {serverid}. Copies any reply string into the variable
- {retvar} if specified. {retvar} must be a string with the
- name of a variable.
- Returns zero if none are available.
- Returns -1 if something is wrong.
- See also |clientserver|.
- This function is not available in the |sandbox|.
- Examples: >
- :let repl = ""
- :echo "PEEK: ".remote_peek(id, "repl").": ".repl
-
-remote_read({serverid}, [{timeout}]) *remote_read()*
- Return the oldest available reply from {serverid} and consume
- it. Unless a {timeout} in seconds is given, it blocks until a
- reply is available.
- See also |clientserver|.
- This function is not available in the |sandbox|.
- Example: >
- :echo remote_read(id)
-<
- *remote_send()* *E241*
-remote_send({server}, {string} [, {idvar}])
- Send the {string} to {server}. The string is sent as input
- keys and the function returns immediately. At the Vim server
- the keys are not mapped |:map|.
- If {idvar} is present, it is taken as the name of a variable
- and a {serverid} for later use with remote_read() is stored
- there.
- See also |clientserver| |RemoteReply|.
- This function is not available in the |sandbox|.
-
- Note: Any errors will be reported in the server and may mess
- up the display.
- Examples: >
- :echo remote_send("gvim", ":DropAndReply ".file, "serverid").
- \ remote_read(serverid)
-
- :autocmd NONE RemoteReply *
- \ echo remote_read(expand("<amatch>"))
- :echo remote_send("gvim", ":sleep 10 | echo ".
- \ 'server2client(expand("<client>"), "HELLO")<CR>')
-<
- *remote_startserver()* *E941* *E942*
-remote_startserver({name})
- Become the server {name}. This fails if already running as a
- server, when |v:servername| is not empty.
-
-remove({list}, {idx} [, {end}]) *remove()*
- Without {end}: Remove the item at {idx} from |List| {list} and
- return the item.
- With {end}: Remove items from {idx} to {end} (inclusive) and
- return a |List| with these items. When {idx} points to the same
- item as {end} a list with one item is returned. When {end}
- points to an item before {idx} this is an error.
- See |list-index| for possible values of {idx} and {end}.
- Example: >
- :echo "last item: " . remove(mylist, -1)
- :call remove(mylist, 0, 9)
-
-< Can also be used as a |method|: >
- mylist->remove(idx)
-
-remove({blob}, {idx} [, {end}])
- Without {end}: Remove the byte at {idx} from |Blob| {blob} and
- return the byte.
- With {end}: Remove bytes from {idx} to {end} (inclusive) and
- return a |Blob| with these bytes. When {idx} points to the same
- byte as {end} a |Blob| with one byte is returned. When {end}
- points to a byte before {idx} this is an error.
- Example: >
- :echo "last byte: " . remove(myblob, -1)
- :call remove(mylist, 0, 9)
-
-remove({dict}, {key})
- Remove the entry from {dict} with key {key} and return it.
- Example: >
- :echo "removed " . remove(dict, "one")
-< If there is no {key} in {dict} this is an error.
-
- Use |delete()| to remove a file.
-
-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
- result is a Number, which is 0 if the file was renamed
- successfully, and non-zero when the renaming failed.
- NOTE: If {to} exists it is overwritten without warning.
- This function is not available in the |sandbox|.
-
- Can also be used as a |method|: >
- GetOldName()->rename(newname)
-
-repeat({expr}, {count}) *repeat()*
- Repeat {expr} {count} times and return the concatenated
- result. Example: >
- :let separator = repeat('-', 80)
-< When {count} is zero or negative the result is empty.
- When {expr} is a |List| the result is {expr} concatenated
- {count} times. Example: >
- :let longlist = repeat(['a', 'b'], 3)
-< Results in ['a', 'b', 'a', 'b', 'a', 'b'].
-
- Can also be used as a |method|: >
- mylist->repeat(count)
-
-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.
- On Unix, repeat resolving symbolic links in all path
- components of {filename} and return the simplified result.
- To cope with link cycles, resolving of symbolic links is
- stopped after 100 iterations.
- On other systems, return the simplified {filename}.
- The simplification step is done as by |simplify()|.
- resolve() keeps a leading path component specifying the
- current directory (provided the result is still a relative
- path name) and also keeps a trailing path separator.
-
- Can also be used as a |method|: >
- GetName()->resolve()
-<
- *reverse()*
-reverse({object})
- Reverse the order of items in {object} in-place.
- {object} can be a |List| or a |Blob|.
- Returns {object}.
- If you want an object to remain unmodified make a copy first: >
- :let revlist = reverse(copy(mylist))
-< Can also be used as a |method|: >
- mylist->reverse()
-
-round({expr}) *round()*
- Round off {expr} to the nearest integral value and return it
- as a |Float|. If {expr} lies halfway between two integral
- values, then use the larger one (away from zero).
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- echo round(0.456)
-< 0.0 >
- echo round(4.5)
-< 5.0 >
- echo round(-4.5)
-< -5.0
-
- Can also be used as a |method|: >
- Compute()->round()
-
-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.
- Example: >
- :au VimLeave call rpcnotify(0, "leaving")
-
-rpcrequest({channel}, {method}[, {args}...]) *rpcrequest()*
- Sends a request to {channel} to invoke {method} via
- |RPC| and blocks until a response is received.
- Example: >
- :let result = rpcrequest(rpc_chan, "func", 1, 2, 3)
-
-rpcstart({prog}[, {argv}]) *rpcstart()*
- Deprecated. Replace >
- :let id = rpcstart('prog', ['arg1', 'arg2'])
-< with >
- :let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
-
-rubyeval({expr}) *rubyeval()*
- Evaluate Ruby expression {expr} and return its result
- converted to Vim data structures.
- Numbers, floats and strings are returned as they are (strings
- are copied though).
- Arrays are represented as Vim |List| type.
- Hashes are represented as Vim |Dictionary| type.
- Other objects are represented as strings resulted from their
- "Object#to_s" method.
-
- Can also be used as a |method|: >
- GetRubyExpr()->rubyeval()
-
-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.
-
- Can also be used as a |method|: >
- GetRow()->screenattr(col)
-
-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
- screen position, also status lines, window separators and the
- command line. The top left position is row one, column one
- The character excludes composing characters. For double-byte
- encodings it may only be the first byte.
- This is mainly to be used for testing.
- Returns -1 when row or col is out of range.
-
- Can also be used as a |method|: >
- GetRow()->screenchar(col)
-
-screenchars({row}, {col}) *screenchars()*
- The result is a List of Numbers. The first number is the same
- as what |screenchar()| returns. Further numbers are
- composing characters on top of the base character.
- This is mainly to be used for testing.
- Returns an empty List when row or col is out of range.
-
- Can also be used as a |method|: >
- GetRow()->screenchars(col)
-
-screencol() *screencol()*
- The result is a Number, which is the current screen column of
- the cursor. The leftmost column has number 1.
- This function is mainly used for testing.
-
- Note: Always returns the current screen column, thus if used
- in a command (e.g. ":echo screencol()") it will return the
- column inside the command line, which is 1 when the command is
- executed. To get the cursor position in the file use one of
- the following mappings: >
- nnoremap <expr> GG ":echom ".screencol()."\n"
- nnoremap <silent> GG :echom screencol()<CR>
- noremap GG <Cmd>echom screencol()<Cr>
-<
-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
- {col}. {col} is a one-based byte index.
- The Dict has these members:
- row screen row
- col first screen column
- endcol last screen column
- curscol cursor screen column
- If the specified position is not visible, all values are zero.
- The "endcol" value differs from "col" when the character
- occupies more than one screen cell. E.g. for a Tab "col" can
- be 1 and "endcol" can be 8.
- The "curscol" value is where the cursor would be placed. For
- a Tab it would be the same as "endcol", while for a double
- width character it would be the same as "col".
- The |conceal| feature is ignored here, the column numbers are
- as if 'conceallevel' is zero. You can set the cursor to the
- right position and use |screencol()| to get the value with
- |conceal| taken into account.
-
- Can also be used as a |method|: >
- GetWinid()->screenpos(lnum, col)
-
-screenrow() *screenrow()*
- The result is a Number, which is the current screen row of the
- cursor. The top line has number one.
- This function is mainly used for testing.
- Alternatively you can use |winline()|.
-
- Note: Same restrictions as with |screencol()|.
-
-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.
- This is like |screenchars()| but returning a String with the
- characters.
- This is mainly to be used for testing.
- Returns an empty String when row or col is out of range.
-
- Can also be used as a |method|: >
- GetRow()->screenstring(col)
-
-search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
- Search for regexp pattern {pattern}. The search starts at the
- cursor position (you can use |cursor()| to set it).
-
- When a match has been found its line number is returned.
- If there is no match a 0 is returned and the cursor doesn't
- move. No error message is given.
-
- {flags} is a String, which can contain these character flags:
- 'b' search Backward instead of forward
- 'c' accept a match at the Cursor position
- 'e' move to the End of the match
- 'n' do Not move the cursor
- 'p' return number of matching sub-Pattern (see below)
- 's' Set the ' mark at the previous location of the cursor
- 'w' Wrap around the end of the file
- 'W' don't Wrap around the end of the file
- 'z' start searching at the cursor column instead of Zero
- If neither 'w' or 'W' is given, the 'wrapscan' option applies.
-
- If the 's' flag is supplied, the ' mark is set, only if the
- cursor is moved. The 's' flag cannot be combined with the 'n'
- flag.
-
- 'ignorecase', 'smartcase' and 'magic' are used.
-
- When the 'z' flag is not given, forward searching always
- starts in column zero and then matches before the cursor are
- skipped. When the 'c' flag is present in 'cpo' the next
- search starts after the match. Without the 'c' flag the next
- search starts one column further. This matters for
- overlapping matches.
- When searching backwards and the 'z' flag is given then the
- search starts in column zero, thus no match in the current
- line will be found (unless wrapping around the end of the
- file).
-
- When the {stopline} argument is given then the search stops
- after searching this line. This is useful to restrict the
- search to a range of lines. Examples: >
- let match = search('(', 'b', line("w0"))
- let end = search('END', '', line("w$"))
-< When {stopline} is used and it is not zero this also implies
- that the search does not wrap around the end of the file.
- A zero value is equal to not giving the argument.
-
- When the {timeout} argument is given the search stops when
- more than this many milliseconds have passed. Thus when
- {timeout} is 500 the search stops after half a second.
- The value must not be negative. A zero value is like not
- giving the argument.
-
- *search()-sub-match*
- With the 'p' flag the returned value is one more than the
- first sub-match in \(\). One if none of them matched but the
- whole pattern did match.
- To get the column number too use |searchpos()|.
-
- The cursor will be positioned at the match, unless the 'n'
- flag is used.
-
- Example (goes over all files in the argument list): >
- :let n = 1
- :while n <= argc() " loop over all files in arglist
- : exe "argument " . n
- : " start at the last char in the file and wrap for the
- : " first search to find match at start of file
- : normal G$
- : let flags = "w"
- : while search("foo", flags) > 0
- : s/foo/bar/g
- : let flags = "W"
- : endwhile
- : update " write the file if modified
- : let n = n + 1
- :endwhile
-<
- Example for using some flags: >
- :echo search('\<if\|\(else\)\|\(endif\)', 'ncpe')
-< This will search for the keywords "if", "else", and "endif"
- under or after the cursor. Because of the 'p' flag, it
- returns 1, 2, or 3 depending on which keyword is found, or 0
- if the search fails. With the cursor on the first word of the
- line:
- if (foo == 0) | let foo = foo + 1 | endif ~
- the function returns 1. Without the 'c' flag, the function
- finds the "endif" and returns 3. The same thing happens
- without the 'e' flag if the cursor is on the "f" of "if".
- The 'n' flag tells the function not to move the cursor.
-
- Can also be used as a |method|: >
- GetPattern()->search()
-
-searchcount([{options}]) *searchcount()*
- Get or update the last search count, like what is displayed
- without the "S" flag in 'shortmess'. This works even if
- 'shortmess' does contain the "S" flag.
-
- This returns a Dictionary. The dictionary is empty if the
- previous pattern was not set and "pattern" was not specified.
-
- key type meaning ~
- current |Number| current position of match;
- 0 if the cursor position is
- before the first match
- exact_match |Boolean| 1 if "current" is matched on
- "pos", otherwise 0
- total |Number| total count of matches found
- incomplete |Number| 0: search was fully completed
- 1: recomputing was timed out
- 2: max count exceeded
-
- For {options} see further down.
-
- To get the last search count when |n| or |N| was pressed, call
- this function with `recompute: 0` . This sometimes returns
- wrong information because |n| and |N|'s maximum count is 99.
- If it exceeded 99 the result must be max count + 1 (100). If
- you want to get correct information, specify `recompute: 1`: >
-
- " result == maxcount + 1 (100) when many matches
- let result = searchcount(#{recompute: 0})
-
- " Below returns correct result (recompute defaults
- " to 1)
- let result = searchcount()
-<
- The function is useful to add the count to |statusline|: >
- function! LastSearchCount() abort
- let result = searchcount(#{recompute: 0})
- if empty(result)
- return ''
- endif
- if result.incomplete ==# 1 " timed out
- return printf(' /%s [?/??]', @/)
- elseif result.incomplete ==# 2 " max count exceeded
- if result.total > result.maxcount &&
- \ result.current > result.maxcount
- return printf(' /%s [>%d/>%d]', @/,
- \ result.current, result.total)
- elseif result.total > result.maxcount
- return printf(' /%s [%d/>%d]', @/,
- \ result.current, result.total)
- endif
- endif
- return printf(' /%s [%d/%d]', @/,
- \ result.current, result.total)
- endfunction
- let &statusline .= '%{LastSearchCount()}'
-
- " Or if you want to show the count only when
- " 'hlsearch' was on
- " let &statusline .=
- " \ '%{v:hlsearch ? LastSearchCount() : ""}'
-<
- You can also update the search count, which can be useful in a
- |CursorMoved| or |CursorMovedI| autocommand: >
-
- autocmd CursorMoved,CursorMovedI *
- \ let s:searchcount_timer = timer_start(
- \ 200, function('s:update_searchcount'))
- function! s:update_searchcount(timer) abort
- if a:timer ==# s:searchcount_timer
- call searchcount(#{
- \ recompute: 1, maxcount: 0, timeout: 100})
- redrawstatus
- endif
- endfunction
-<
- This can also be used to count matched texts with specified
- pattern in the current buffer using "pattern": >
-
- " Count '\<foo\>' in this buffer
- " (Note that it also updates search count)
- let result = searchcount(#{pattern: '\<foo\>'})
-
- " To restore old search count by old pattern,
- " search again
- call searchcount()
-<
- {options} must be a Dictionary. It can contain:
- key type meaning ~
- recompute |Boolean| if |TRUE|, recompute the count
- like |n| or |N| was executed.
- otherwise returns the last
- result by |n|, |N|, or this
- function is returned.
- (default: |TRUE|)
- pattern |String| recompute if this was given
- and different with |@/|.
- this works as same as the
- below command is executed
- before calling this function >
- let @/ = pattern
-< (default: |@/|)
- timeout |Number| 0 or negative number is no
- timeout. timeout milliseconds
- for recomputing the result
- (default: 0)
- maxcount |Number| 0 or negative number is no
- limit. max count of matched
- text while recomputing the
- result. if search exceeded
- total count, "total" value
- becomes `maxcount + 1`
- (default: 0)
- pos |List| `[lnum, col, off]` value
- when recomputing the result.
- this changes "current" result
- value. see |cursor()|, |getpos()
- (default: cursor's position)
-
- Can also be used as a |method|: >
- GetSearchOpts()->searchcount()
-<
-searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()*
- Search for the declaration of {name}.
-
- With a non-zero {global} argument it works like |gD|, find
- first match in the file. Otherwise it works like |gd|, find
- first match in the function.
-
- With a non-zero {thisblock} argument matches in a {} block
- that ends before the cursor position are ignored. Avoids
- finding variable declarations only valid in another scope.
-
- Moves the cursor to the found match.
- Returns zero for success, non-zero for failure.
- Example: >
- if searchdecl('myvar') == 0
- echo getline('.')
- endif
-<
- Can also be used as a |method|: >
- GetName()->searchdecl()
-<
- *searchpair()*
-searchpair({start}, {middle}, {end} [, {flags} [, {skip}
- [, {stopline} [, {timeout}]]]])
- Search for the match of a nested start-end pair. This can be
- used to find the "endif" that matches an "if", while other
- if/endif pairs in between are ignored.
- The search starts at the cursor. The default is to search
- forward, include 'b' in {flags} to search backward.
- If a match is found, the cursor is positioned at it and the
- line number is returned. If no match is found 0 or -1 is
- returned and the cursor doesn't move. No error message is
- given.
-
- {start}, {middle} and {end} are patterns, see |pattern|. They
- must not contain \( \) pairs. Use of \%( \) is allowed. When
- {middle} is not empty, it is found when searching from either
- direction, but only when not in a nested start-end pair. A
- typical use is: >
- searchpair('\<if\>', '\<else\>', '\<endif\>')
-< By leaving {middle} empty the "else" is skipped.
-
- {flags} 'b', 'c', 'n', 's', 'w' and 'W' are used like with
- |search()|. Additionally:
- 'r' Repeat until no more matches found; will find the
- outer pair. Implies the 'W' flag.
- 'm' Return number of matches instead of line number with
- the match; will be > 1 when 'r' is used.
- Note: it's nearly always a good idea to use the 'W' flag, to
- avoid wrapping around the end of the file.
-
- When a match for {start}, {middle} or {end} is found, the
- {skip} expression is evaluated with the cursor positioned on
- the start of the match. It should return non-zero if this
- match is to be skipped. E.g., because it is inside a comment
- or a string.
- When {skip} is omitted or empty, every match is accepted.
- When evaluating {skip} causes an error the search is aborted
- and -1 returned.
- {skip} can be a string, a lambda, a funcref or a partial.
- Anything else makes the function fail.
-
- For {stopline} and {timeout} see |search()|.
-
- The value of 'ignorecase' is used. 'magic' is ignored, the
- patterns are used like it's on.
-
- The search starts exactly at the cursor. A match with
- {start}, {middle} or {end} at the next character, in the
- direction of searching, is the first one found. Example: >
- if 1
- if 2
- endif 2
- endif 1
-< When starting at the "if 2", with the cursor on the "i", and
- searching forwards, the "endif 2" is found. When starting on
- the character just before the "if 2", the "endif 1" will be
- found. That's because the "if 2" will be found first, and
- then this is considered to be a nested if/endif from "if 2" to
- "endif 2".
- When searching backwards and {end} is more than one character,
- it may be useful to put "\zs" at the end of the pattern, so
- that when the cursor is inside a match with the end it finds
- the matching start.
-
- Example, to find the "endif" command in a Vim script: >
-
- :echo searchpair('\<if\>', '\<el\%[seif]\>', '\<en\%[dif]\>', 'W',
- \ 'getline(".") =~ "^\\s*\""')
-
-< The cursor must be at or after the "if" for which a match is
- to be found. Note that single-quote strings are used to avoid
- having to double the backslashes. The skip expression only
- catches comments at the start of a line, not after a command.
- Also, a word "en" or "if" halfway through a line is considered
- a match.
- Another example, to search for the matching "{" of a "}": >
-
- :echo searchpair('{', '', '}', 'bW')
-
-< This works when the cursor is at or before the "}" for which a
- match is to be found. To reject matches that syntax
- highlighting recognized as strings: >
-
- :echo searchpair('{', '', '}', 'bW',
- \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')
-<
- *searchpairpos()*
-searchpairpos({start}, {middle}, {end} [, {flags} [, {skip}
- [, {stopline} [, {timeout}]]]])
- Same as |searchpair()|, but returns a |List| with the line and
- column position of the match. The first element of the |List|
- is the line number and the second element is the byte index of
- the column position of the match. If no match is found,
- returns [0, 0]. >
-
- :let [lnum,col] = searchpairpos('{', '', '}', 'n')
-<
- See |match-parens| for a bigger and more useful example.
-
-searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()*
- Same as |search()|, but returns a |List| with the line and
- column position of the match. The first element of the |List|
- is the line number and the second element is the byte index of
- the column position of the match. If no match is found,
- returns [0, 0].
- Example: >
- :let [lnum, col] = searchpos('mypattern', 'n')
-
-< When the 'p' flag is given then there is an extra item with
- the sub-pattern match number |search()-sub-match|. Example: >
- :let [lnum, col, submatch] = searchpos('\(\l\)\|\(\u\)', 'np')
-< In this example "submatch" is 2 when a lowercase letter is
- found |/\l|, 3 when an uppercase letter is found |/\u|.
-
- Can also be used as a |method|: >
- GetPattern()->searchpos()
-
-server2client({clientid}, {string}) *server2client()*
- Send a reply string to {clientid}. The most recent {clientid}
- that sent a string can be retrieved with expand("<client>").
- Note:
- Returns zero for success, -1 for failure.
- This id has to be stored before the next command can be
- received. I.e. before returning from the received command and
- before calling any commands that waits for input.
- See also |clientserver|.
- Example: >
- :echo server2client(expand("<client>"), "HELLO")
-
-< Can also be used as a |method|: >
- GetClientId()->server2client(string)
-<
-serverlist() *serverlist()*
- Returns a list of server addresses, or empty if all servers
- were stopped. |serverstart()| |serverstop()|
- Example: >
- :echo serverlist()
-
-serverstart([{address}]) *serverstart()*
- Opens a socket or named pipe at {address} and listens for
- |RPC| messages. Clients can send |API| commands to the address
- to control Nvim. Returns the address string.
-
- If {address} does not contain a colon ":" it is interpreted as
- a named pipe or Unix domain socket path.
-
- Example: >
- if has('win32')
- call serverstart('\\.\pipe\nvim-pipe-1234')
- else
- call serverstart('nvim.sock')
- endif
-<
- If {address} contains a colon ":" it is interpreted as a TCP
- address where the last ":" separates the host and port.
- Assigns a random port if it is empty or 0. Supports IPv4/IPv6.
-
- Example: >
- :call serverstart('::1:12345')
-<
- If no address is given, it is equivalent to: >
- :call serverstart(tempname())
-
-< |$NVIM_LISTEN_ADDRESS| is set to {address} if not already set.
-
-serverstop({address}) *serverstop()*
- Closes the pipe or socket at {address}.
- Returns TRUE if {address} is valid, else FALSE.
- If |$NVIM_LISTEN_ADDRESS| is stopped it is unset.
- If |v:servername| is stopped it is set to the next available
- address returned by |serverlist()|.
-
-setbufline({buf}, {lnum}, {text}) *setbufline()*
- Set line {lnum} to {text} in buffer {buf}. This works like
- |setline()| for the specified buffer.
-
- This function works only for loaded buffers. First call
- |bufload()| if needed.
-
- To insert lines use |appendbufline()|.
- Any text properties in {lnum} are cleared.
-
- {text} can be a string to set one line, or a list of strings
- to set multiple lines. If the list extends below the last
- line then those lines are added.
-
- For the use of {buf}, see |bufname()| above.
-
- {lnum} is used like with |setline()|.
- Use "$" to refer to the last line in buffer {buf}.
- When {lnum} is just below the last line the {text} will be
- added below the last line.
- On success 0 is returned, on failure 1 is returned.
-
- If {buf} is not a valid buffer or {lnum} is not valid, an
- error message is given.
-
- Can also be used as a |method|, the base is passed as the
- third argument: >
- GetText()->setbufline(buf, lnum)
-
-setbufvar({buf}, {varname}, {val}) *setbufvar()*
- Set option or local variable {varname} in buffer {buf} to
- {val}.
- This also works for a global or local window option, but it
- doesn't work for a global or local window variable.
- For a local window option the global value is unchanged.
- For the use of {buf}, see |bufname()| above.
- The {varname} argument is a string.
- Note that the variable name without "b:" must be used.
- Examples: >
- :call setbufvar(1, "&mod", 1)
- :call setbufvar("todo", "myvar", "foobar")
-< This function is not available in the |sandbox|.
-
- Can also be used as a |method|, the base is passed as the
- third argument: >
- GetValue()->setbufvar(buf, varname)
-
-setcharsearch({dict}) *setcharsearch()*
- Set the current character search information to {dict},
- which contains one or more of the following entries:
-
- char character which will be used for a subsequent
- |,| or |;| command; an empty string clears the
- character search
- forward direction of character search; 1 for forward,
- 0 for backward
- until type of character search; 1 for a |t| or |T|
- character search, 0 for an |f| or |F|
- character search
-
- This can be useful to save/restore a user's character search
- from a script: >
- :let prevsearch = getcharsearch()
- :" Perform a command which clobbers user's search
- :call setcharsearch(prevsearch)
-< Also see |getcharsearch()|.
-
- Can also be used as a |method|: >
- SavedSearch()->setcharsearch()
-
-setcmdpos({pos}) *setcmdpos()*
- Set the cursor position in the command line to byte position
- {pos}. The first position is 1.
- Use |getcmdpos()| to obtain the current position.
- Only works while editing the command line, thus you must use
- |c_CTRL-\_e|, |c_CTRL-R_=| or |c_CTRL-R_CTRL-R| with '='. For
- |c_CTRL-\_e| and |c_CTRL-R_CTRL-R| with '=' the position is
- set after the command line is set to the expression. For
- |c_CTRL-R_=| it is set after evaluating the expression but
- before inserting the resulting text.
- When the number is too big the cursor is put at the end of the
- line. A number smaller than one has undefined results.
- Returns FALSE when successful, TRUE when not editing the
- command line.
-
- Can also be used as a |method|: >
- GetPos()->setcmdpos()
-
-setenv({name}, {val}) *setenv()*
- Set environment variable {name} to {val}. Example: >
- call setenv('HOME', '/home/myhome')
-
-< When {val} is |v:null| the environment variable is deleted.
- See also |expr-env|.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetPath()->setenv('PATH')
-
-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
- "rwxrwxrwx", where each group of "rwx" flags represent, in
- turn, the permissions of the owner of the file, the group the
- file belongs to, and other users. A '-' character means the
- permission is off, any other character means on. Multi-byte
- characters are not supported.
-
- For example "rw-r-----" means read-write for the user,
- readable by the group, not accessible by others. "xx-x-----"
- would do the same thing.
-
- Returns non-zero for success, zero for failure.
-
- Can also be used as a |method|: >
- GetFilename()->setfperm(mode)
-<
- To read permissions see |getfperm()|.
-
-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
- |setbufline()|.
-
- {lnum} is used like with |getline()|.
- When {lnum} is just below the last line the {text} will be
- added below the last line.
-
- If this succeeds, FALSE is returned. If this fails (most likely
- because {lnum} is invalid) TRUE is returned.
-
- Example: >
- :call setline(5, strftime("%c"))
-
-< When {text} is a |List| then line {lnum} and following lines
- will be set to the items in the list. Example: >
- :call setline(5, ['aaa', 'bbb', 'ccc'])
-< This is equivalent to: >
- :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']]
- : call setline(n, l)
- :endfor
-
-< Note: The '[ and '] marks are not set.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetText()->setline(lnum)
-
-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|.
- When {nr} is zero the current window is used.
-
- For a location list window, the displayed location list is
- modified. For an invalid window number {nr}, -1 is returned.
- Otherwise, same as |setqflist()|.
- Also see |location-list|.
-
- For {action} see |setqflist-action|.
-
- If the optional {what} dictionary argument is supplied, then
- only the items listed in {what} are set. Refer to |setqflist()|
- for the list of supported keys in {what}.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetLoclist()->setloclist(winnr)
-
-setmatches({list} [, {win}]) *setmatches()*
- Restores a list of matches saved by |getmatches() for the
- current window|. Returns 0 if successful, otherwise -1. All
- current matches are cleared before the list is restored. See
- example for |getmatches()|.
- If {win} is specified, use the window with this number or
- window ID instead of the current window.
-
- Can also be used as a |method|: >
- GetMatches()->setmatches()
-<
- *setpos()*
-setpos({expr}, {list})
- Set the position for String {expr}. Possible values:
- . the cursor
- 'x mark x
-
- {list} must be a |List| with four or five numbers:
- [bufnum, lnum, col, off]
- [bufnum, lnum, col, off, curswant]
-
- "bufnum" is the buffer number. Zero can be used for the
- current buffer. When setting an uppercase mark "bufnum" is
- used for the mark position. For other marks it specifies the
- buffer to set the mark in. You can use the |bufnr()| function
- to turn a file name into a buffer number.
- For setting the cursor and the ' mark "bufnum" is ignored,
- since these are associated with a window, not a buffer.
- Does not change the jumplist.
-
- "lnum" and "col" are the position in the buffer. The first
- column is 1. Use a zero "lnum" to delete a mark. If "col" is
- smaller than 1 then 1 is used.
-
- The "off" number is only used when 'virtualedit' is set. Then
- 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.
-
- The "curswant" number is only used when setting the cursor
- position. It sets the preferred column for when moving the
- cursor vertically. When the "curswant" number is missing the
- preferred column is not set. When it is present and setting a
- mark position it is not used.
-
- Note that for '< and '> changing the line number may result in
- the marks to be effectively be swapped, so that '< is always
- before '>.
-
- Returns 0 when the position could be set, -1 otherwise.
- An error message is given if {expr} is invalid.
-
- Also see |getpos()| and |getcurpos()|.
-
- This does not restore the preferred column for moving
- vertically; if you set the cursor position with this, |j| and
- |k| motions will jump to previous columns! Use |cursor()| to
- also set the preferred column. Also see the "curswant" key in
- |winrestview()|.
-
- Can also be used as a |method|: >
- GetPosition()->setpos('.')
-
-setqflist({list} [, {action} [, {what}]]) *setqflist()*
- Create or replace or add to the quickfix list.
-
- If the optional {what} dictionary argument is supplied, then
- only the items listed in {what} are set. The first {list}
- argument is ignored. See below for the supported items in
- {what}.
- *setqflist-what*
- When {what} is not present, the items in {list} are used. Each
- item must be a dictionary. Non-dictionary items in {list} are
- ignored. Each dictionary item can contain the following
- entries:
-
- bufnr buffer number; must be the number of a valid
- buffer
- filename name of a file; only used when "bufnr" is not
- present or it is invalid.
- module name of a module; if given it will be used in
- quickfix error window instead of the filename
- lnum line number in the file
- pattern search pattern used to locate the error
- col column number
- vcol when non-zero: "col" is visual column
- when zero: "col" is byte index
- nr error number
- text description of the error
- type single-character error type, 'E', 'W', etc.
- valid recognized error message
-
- The "col", "vcol", "nr", "type" and "text" entries are
- optional. Either "lnum" or "pattern" entry can be used to
- locate a matching error line.
- If the "filename" and "bufnr" entries are not present or
- neither the "lnum" or "pattern" entries are present, then the
- item will not be handled as an error line.
- If both "pattern" and "lnum" are present then "pattern" will
- be used.
- If the "valid" entry is not supplied, then the valid flag is
- set when "bufnr" is a valid buffer or "filename" exists.
- If you supply an empty {list}, the quickfix list will be
- cleared.
- Note that the list is not exactly the same as what
- |getqflist()| returns.
-
- {action} values: *setqflist-action* *E927*
- 'a' The items from {list} are added to the existing
- quickfix list. If there is no existing list, then a
- new list is created.
-
- 'r' The items from the current quickfix list are replaced
- with the items from {list}. This can also be used to
- clear the list: >
- :call setqflist([], 'r')
-<
- 'f' All the quickfix lists in the quickfix stack are
- freed.
-
- If {action} is not present or is set to ' ', then a new list
- is created. The new quickfix list is added after the current
- quickfix list in the stack and all the following lists are
- freed. To add a new quickfix list at the end of the stack,
- set "nr" in {what} to "$".
-
- The following items can be specified in dictionary {what}:
- context quickfix list context. See |quickfix-context|
- efm errorformat to use when parsing text from
- "lines". If this is not present, then the
- 'errorformat' option value is used.
- See |quickfix-parse|
- id quickfix list identifier |quickfix-ID|
- idx index of the current entry in the quickfix
- list specified by 'id' or 'nr'. If set to '$',
- then the last entry in the list is set as the
- current entry. See |quickfix-index|
- items list of quickfix entries. Same as the {list}
- argument.
- lines use 'errorformat' to parse a list of lines and
- add the resulting entries to the quickfix list
- {nr} or {id}. Only a |List| value is supported.
- See |quickfix-parse|
- nr list number in the quickfix stack; zero
- means the current quickfix list and "$" means
- the last quickfix list.
- quickfixtextfunc
- function to get the text to display in the
- quickfix window. The value can be the name of
- a function or a funcref or a lambda. Refer to
- |quickfix-window-function| for an explanation
- of how to write the function and an example.
- title quickfix list title text. See |quickfix-title|
- Unsupported keys in {what} are ignored.
- If the "nr" item is not present, then the current quickfix list
- is modified. When creating a new quickfix list, "nr" can be
- set to a value one greater than the quickfix stack size.
- When modifying a quickfix list, to guarantee that the correct
- list is modified, "id" should be used instead of "nr" to
- specify the list.
-
- Examples (See also |setqflist-examples|): >
- :call setqflist([], 'r', {'title': 'My search'})
- :call setqflist([], 'r', {'nr': 2, 'title': 'Errors'})
- :call setqflist([], 'a', {'id':qfid, 'lines':["F1:10:L10"]})
-<
- Returns zero for success, -1 for failure.
-
- This function can be used to create a quickfix list
- independent of the 'errorformat' setting. Use a command like
- `:cc 1` to jump to the first position.
-
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetErrorlist()->setqflist()
-<
- *setreg()*
-setreg({regname}, {value} [, {options}])
- Set the register {regname} to {value}.
- The {regname} argument is a string.
-
- {value} may be any value returned by |getreg()| or
- |getreginfo()|, including a |List| or |Dict|.
- If {options} contains "a" or {regname} is upper case,
- then the value is appended.
-
- {options} can also contain a register type specification:
- "c" or "v" |charwise| mode
- "l" or "V" |linewise| mode
- "b" or "<CTRL-V>" |blockwise-visual| mode
- If a number immediately follows "b" or "<CTRL-V>" then this is
- used as the width of the selection - if it is not specified
- then the width of the block is set to the number of characters
- in the longest line (counting a <Tab> as 1 character).
- If {options} contains "u" or '"', then the unnamed register is
- set to point to register {regname}.
-
- If {options} contains no register settings, then the default
- is to use character mode unless {value} ends in a <NL> for
- string {value} and linewise mode for list {value}. Blockwise
- mode is never selected automatically.
- Returns zero for success, non-zero for failure.
-
- *E883*
- Note: you may not use |List| containing more than one item to
- set search and expression registers. Lists containing no
- items act like empty strings.
-
- Examples: >
- :call setreg(v:register, @*)
- :call setreg('*', @%, 'ac')
- :call setreg('a', "1\n2\n3", 'b5')
- :call setreg('"', { 'points_to': 'a'})
-
-< This example shows using the functions to save and restore a
- register: >
- :let var_a = getreginfo()
- :call setreg('a', var_a)
-< or: >
- :let var_a = getreg('a', 1, 1)
- :let var_amode = getregtype('a')
- ....
- :call setreg('a', var_a, var_amode)
-< Note: you may not reliably restore register value
- without using the third argument to |getreg()| as without it
- newlines are represented as newlines AND Nul bytes are
- represented as newlines as well, see |NL-used-for-Nul|.
-
- You can also change the type of a register by appending
- nothing: >
- :call setreg('a', '', 'al')
-
-< Can also be used as a |method|, the base is passed as the
- second argument: >
- GetText()->setreg('a')
-
-settabvar({tabnr}, {varname}, {val}) *settabvar()*
- Set tab-local variable {varname} to {val} in tab page {tabnr}.
- |t:var|
- The {varname} argument is a string.
- Note that the variable name without "t:" must be used.
- Tabs are numbered starting with one.
- This function is not available in the |sandbox|.
-
- Can also be used as a |method|, the base is passed as the
- third argument: >
- GetValue()->settabvar(tab, name)
-
-settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
- Set option or local variable {varname} in window {winnr} to
- {val}.
- Tabs are numbered starting with one. For the current tabpage
- use |setwinvar()|.
- {winnr} can be the window number or the |window-ID|.
- When {winnr} is zero the current window is used.
- This also works for a global or local buffer option, but it
- doesn't work for a global or local buffer variable.
- For a local buffer option the global value is unchanged.
- Note that the variable name without "w:" must be used.
- Examples: >
- :call settabwinvar(1, 1, "&list", 0)
- :call settabwinvar(3, 2, "myvar", "foobar")
-< This function is not available in the |sandbox|.
-
- Can also be used as a |method|, the base is passed as the
- fourth argument: >
- GetValue()->settabwinvar(tab, winnr, name)
-
-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|.
-
- For a list of supported items in {dict}, refer to
- |gettagstack()|. "curidx" takes effect before changing the tag
- stack.
- *E962*
- How the tag stack is modified depends on the {action}
- argument:
- - If {action} is not present or is set to 'r', then the tag
- stack is replaced.
- - If {action} is set to 'a', then new entries from {dict} are
- pushed (added) onto the tag stack.
- - If {action} is set to 't', then all the entries from the
- current entry in the tag stack or "curidx" in {dict} are
- removed and then new entries are pushed to the stack.
-
- The current index is set to one after the length of the tag
- stack after the modification.
-
- Returns zero for success, -1 for failure.
-
- Examples (for more examples see |tagstack-examples|):
- Empty the tag stack of window 3: >
- call settagstack(3, {'items' : []})
-
-< Save and restore the tag stack: >
- let stack = gettagstack(1003)
- " do something else
- call settagstack(1003, stack)
- unlet stack
-<
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetStack()->settagstack(winnr)
-
-setwinvar({nr}, {varname}, {val}) *setwinvar()*
- Like |settabwinvar()| for the current tab page.
- Examples: >
- :call setwinvar(1, "&list", 0)
- :call setwinvar(2, "myvar", "foobar")
-
-< Can also be used as a |method|, the base is passed as the
- third argument: >
- GetValue()->setwinvar(winnr, name)
-
-sha256({string}) *sha256()*
- Returns a String with 64 hex characters, which is the SHA256
- checksum of {string}.
-
- Can also be used as a |method|: >
- GetText()->sha256()
-
-shellescape({string} [, {special}]) *shellescape()*
- Escape {string} for use as a shell command argument.
-
- On Windows when 'shellslash' is not set, encloses {string} in
- double-quotes and doubles all double-quotes within {string}.
- Otherwise encloses {string} in single-quotes and replaces all
- "'" with "'\''".
-
- If {special} is a |non-zero-arg|:
- - Special items such as "!", "%", "#" and "<cword>" will be
- preceded by a backslash. The backslash will be removed again
- by the |:!| command.
- - The <NL> character is escaped.
-
- If 'shell' contains "csh" in the tail:
- - The "!" character will be escaped. This is because csh and
- tcsh use "!" for history replacement even in single-quotes.
- - The <NL> character is escaped (twice if {special} is
- a |non-zero-arg|).
-
- If 'shell' contains "fish" in the tail, the "\" character will
- be escaped because in fish it is used as an escape character
- inside single quotes.
-
- Example of use with a |:!| command: >
- :exe '!dir ' . shellescape(expand('<cfile>'), 1)
-< This results in a directory listing for the file under the
- cursor. Example of use with |system()|: >
- :call system("chmod +w -- " . shellescape(expand("%")))
-< See also |::S|.
-
- Can also be used as a |method|: >
- GetCommand()->shellescape()
-
-shiftwidth([{col}]) *shiftwidth()*
- Returns the effective value of 'shiftwidth'. This is the
- 'shiftwidth' value unless it is zero, in which case it is the
- 'tabstop' value. To be backwards compatible in indent
- plugins, use this: >
- if exists('*shiftwidth')
- func s:sw()
- return shiftwidth()
- endfunc
- else
- func s:sw()
- return &sw
- endfunc
- endif
-< And then use s:sw() instead of &sw.
-
- When there is one argument {col} this is used as column number
- for which to return the 'shiftwidth' value. This matters for the
- 'vartabstop' feature. If no {col} argument is given, column 1
- will be assumed.
-
- Can also be used as a |method|: >
- GetColumn()->shiftwidth()
-
-sign_ functions are documented here: |sign-functions-details|
-
-simplify({filename}) *simplify()*
- Simplify the file name as much as possible without changing
- the meaning. Shortcuts (on MS-Windows) or symbolic links (on
- Unix) are not resolved. If the first path component in
- {filename} designates the current directory, this will be
- valid for the result as well. A trailing path separator is
- not removed either. On Unix "//path" is unchanged, but
- "///path" is simplified to "/path" (this follows the Posix
- standard).
- Example: >
- simplify("./dir/.././/file/") == "./file/"
-< Note: The combination "dir/.." is only removed if "dir" is
- a searchable directory or does not exist. On Unix, it is also
- removed when "dir" is a symbolic link within the same
- directory. In order to resolve all the involved symbolic
- links before simplifying the path name, use |resolve()|.
-
- Can also be used as a |method|: >
- GetName()->simplify()
-
-sin({expr}) *sin()*
- Return the sine of {expr}, measured in radians, as a |Float|.
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo sin(100)
-< -0.506366 >
- :echo sin(-4.01)
-< 0.763301
-
- Can also be used as a |method|: >
- Compute()->sin()
-
-sinh({expr}) *sinh()*
- Return the hyperbolic sine of {expr} as a |Float| in the range
- [-inf, inf].
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo sinh(0.5)
-< 0.521095 >
- :echo sinh(-0.9)
-< -1.026517
-
- Can also be used as a |method|: >
- Compute()->sinh()
-
-sockconnect({mode}, {address} [, {opts}]) *sockconnect()*
- Connect a socket to an address. If {mode} is "pipe" then
- {address} should be the path of a named pipe. If {mode} is
- "tcp" then {address} should be of the form "host:port" where
- the host should be an ip adderess or host name, and port the
- port number.
-
- Returns a |channel| ID. Close the socket with |chanclose()|.
- Use |chansend()| to send data over a bytes socket, and
- |rpcrequest()| and |rpcnotify()| to communicate with a RPC
- socket.
-
- {opts} is an optional dictionary with these keys:
- |on_data| : callback invoked when data was read from socket
- data_buffered : read socket data in |channel-buffered| mode.
- rpc : If set, |msgpack-rpc| will be used to communicate
- over the socket.
- Returns:
- - The channel ID on success (greater than zero)
- - 0 on invalid arguments or connection failure.
-
-sort({list} [, {func} [, {dict}]]) *sort()* *E702*
- Sort the items in {list} in-place. Returns {list}.
-
- If you want a list to remain unmodified make a copy first: >
- :let sortedlist = sort(copy(mylist))
-
-< When {func} is omitted, is empty or zero, then sort() uses the
- string representation of each item to sort on. Numbers sort
- after Strings, |Lists| after Numbers. For sorting text in the
- current buffer use |:sort|.
-
- When {func} is given and it is '1' or 'i' then case is
- ignored.
-
- When {func} is given and it is 'l' then the current collation
- locale is used for ordering. Implementation details: strcoll()
- is used to compare strings. See |:language| check or set the
- collation locale. |v:collate| can also be used to check the
- current locale. Sorting using the locale typically ignores
- case. Example: >
- " ö is sorted similarly to o with English locale.
- :language collate en_US.UTF8
- :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l')
-< ['n', 'o', 'O', 'ö', 'p', 'z'] ~
->
- " ö is sorted after z with Swedish locale.
- :language collate sv_SE.UTF8
- :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l')
-< ['n', 'o', 'O', 'p', 'z', 'ö'] ~
- This does not work properly on Mac.
-
- When {func} is given and it is 'n' then all items will be
- sorted numerical (Implementation detail: this uses the
- strtod() function to parse numbers, Strings, Lists, Dicts and
- Funcrefs will be considered as being 0).
-
- When {func} is given and it is 'N' then all items will be
- sorted numerical. This is like 'n' but a string containing
- digits will be used as the number they represent.
-
- When {func} is given and it is 'f' then all items will be
- sorted numerical. All values must be a Number or a Float.
-
- When {func} is a |Funcref| or a function name, this function
- is called to compare items. The function is invoked with two
- items as argument and must return zero if they are equal, 1 or
- bigger if the first one sorts after the second one, -1 or
- smaller if the first one sorts before the second one.
-
- {dict} is for functions with the "dict" attribute. It will be
- used to set the local variable "self". |Dictionary-function|
-
- The sort is stable, items which compare equal (as number or as
- string) will keep their relative position. E.g., when sorting
- on numbers, text strings will sort next to each other, in the
- same order as they were originally.
-
- Can also be used as a |method|: >
- mylist->sort()
-
-< Also see |uniq()|.
-
- Example: >
- func MyCompare(i1, i2)
- return a:i1 == a:i2 ? 0 : a:i1 > a:i2 ? 1 : -1
- endfunc
- eval mylist->sort("MyCompare")
-< A shorter compare version for this specific simple case, which
- ignores overflow: >
- func MyCompare(i1, i2)
- return a:i1 - a:i2
- endfunc
-< For a simple expression you can use a lambda: >
- eval mylist->sort({i1, i2 -> i1 - i2})
-<
- *soundfold()*
-soundfold({word})
- Return the sound-folded equivalent of {word}. Uses the first
- language in 'spelllang' for the current window that supports
- soundfolding. 'spell' must be set. When no sound folding is
- possible the {word} is returned unmodified.
- This can be used for making spelling suggestions. Note that
- the method can be quite slow.
-
- Can also be used as a |method|: >
- GetWord()->soundfold()
-<
- *spellbadword()*
-spellbadword([{sentence}])
- Without argument: The result is the badly spelled word under
- or after the cursor. The cursor is moved to the start of the
- bad word. When no bad word is found in the cursor line the
- result is an empty string and the cursor doesn't move.
-
- With argument: The result is the first word in {sentence} that
- is badly spelled. If there are no spelling mistakes the
- result is an empty string.
-
- The return value is a list with two items:
- - The badly spelled word or an empty string.
- - The type of the spelling error:
- "bad" spelling mistake
- "rare" rare word
- "local" word only valid in another region
- "caps" word should start with Capital
- Example: >
- echo spellbadword("the quik brown fox")
-< ['quik', 'bad'] ~
-
- The spelling information for the current window and the value
- of 'spelllang' are used.
-
- Can also be used as a |method|: >
- GetText()->spellbadword()
-<
- *spellsuggest()*
-spellsuggest({word} [, {max} [, {capital}]])
- Return a |List| with spelling suggestions to replace {word}.
- When {max} is given up to this number of suggestions are
- returned. Otherwise up to 25 suggestions are returned.
-
- When the {capital} argument is given and it's non-zero only
- suggestions with a leading capital will be given. Use this
- after a match with 'spellcapcheck'.
-
- {word} can be a badly spelled word followed by other text.
- This allows for joining two words that were split. The
- suggestions also include the following text, thus you can
- replace a line.
-
- {word} may also be a good word. Similar words will then be
- returned. {word} itself is not included in the suggestions,
- although it may appear capitalized.
-
- The spelling information for the current window is used. The
- values of 'spelllang' and 'spellsuggest' are used.
-
- Can also be used as a |method|: >
- GetWord()->spellsuggest()
-
-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.
- Otherwise the string is split where {pattern} matches,
- removing the matched characters. 'ignorecase' is not used
- here, add \c to ignore case. |/\c|
- When the first or last item is empty it is omitted, unless the
- {keepempty} argument is given and it's non-zero.
- Other empty items are kept when {pattern} matches at least one
- character or when {keepempty} is non-zero.
- Example: >
- :let words = split(getline('.'), '\W\+')
-< To split a string in individual characters: >
- :for c in split(mystring, '\zs')
-< If you want to keep the separator you can also use '\zs' at
- the end of the pattern: >
- :echo split('abc:def:ghi', ':\zs')
-< ['abc:', 'def:', 'ghi'] ~
- Splitting a table where the first element can be empty: >
- :let items = split(line, ':', 1)
-< The opposite function is |join()|.
-
- Can also be used as a |method|: >
- GetString()->split()
-
-sqrt({expr}) *sqrt()*
- Return the non-negative square root of Float {expr} as a
- |Float|.
- {expr} must evaluate to a |Float| or a |Number|. When {expr}
- is negative the result is NaN (Not a Number).
- Examples: >
- :echo sqrt(100)
-< 10.0 >
- :echo sqrt(-4.01)
-< nan
- "nan" may be different, it depends on system libraries.
-
- Can also be used as a |method|: >
- Compute()->sqrt()
-
-stdioopen({opts}) *stdioopen()*
- With |--headless| this opens stdin and stdout as a |channel|.
- May be called only once. See |channel-stdio|. stderr is not
- handled by this function, see |v:stderr|.
-
- Close the stdio handles with |chanclose()|. Use |chansend()|
- to send data to stdout, and |rpcrequest()| and |rpcnotify()|
- to communicate over RPC.
-
- {opts} is a dictionary with these keys:
- |on_stdin| : callback invoked when stdin is written to.
- stdin_buffered : read stdin in |channel-buffered| mode.
- rpc : If set, |msgpack-rpc| will be used to communicate
- over stdio
- Returns:
- - |channel-id| on success (value is always 1)
- - 0 on invalid arguments
-
-
-stdpath({what}) *stdpath()* *E6100*
- Returns |standard-path| locations of various default files and
- directories.
-
- {what} Type Description ~
- cache String Cache directory. Arbitrary temporary
- storage for plugins, etc.
- config String User configuration directory. The
- |init.vim| is stored here.
- config_dirs List Additional configuration directories.
- data String User data directory. The |shada-file|
- is stored here.
- data_dirs List Additional data directories.
-
- Example: >
- :echo stdpath("config")
-
-
-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,
- see |floating-point-format|. But it's a bit more permissive.
- E.g., "1e40" is accepted, while in an expression you need to
- write "1.0e40". The hexadecimal form "0x123" is also
- accepted, but not others, like binary or octal.
- When {quoted} is present and non-zero then embedded single
- quotes before the dot are ignored, thus "1'000.0" is a
- thousand.
- Text after the number is silently ignored.
- The decimal point is always '.', no matter what the locale is
- set to. A comma ends the number: "12,345.67" is converted to
- 12.0. You can strip out thousands separators with
- |substitute()|: >
- let f = str2float(substitute(text, ',', '', 'g'))
-<
- Can also be used as a |method|: >
- let f = text->substitute(',', '', 'g')->str2float()
-
-str2list({string} [, {utf8}]) *str2list()*
- Return a list containing the number values which represent
- each character in String {string}. Examples: >
- str2list(" ") returns [32]
- str2list("ABC") returns [65, 66, 67]
-< |list2str()| does the opposite.
-
- UTF-8 encoding is always used, {utf8} option has no effect,
- and exists only for backwards-compatibility.
- With UTF-8 composing characters are handled properly: >
- str2list("á") returns [97, 769]
-
-< Can also be used as a |method|: >
- GetString()->str2list()
-
-str2nr({string} [, {base}]) *str2nr()*
- Convert string {string} to a number.
- {base} is the conversion base, it can be 2, 8, 10 or 16.
- When {quoted} is present and non-zero then embedded single
- quotes are ignored, thus "1'000'000" is a million.
-
- When {base} is omitted base 10 is used. This also means that
- a leading zero doesn't cause octal conversion to be used, as
- with the default String to Number conversion. Example: >
- let nr = str2nr('0123')
-<
- When {base} is 16 a leading "0x" or "0X" is ignored. With a
- different base the result will be zero. Similarly, when
- {base} is 8 a leading "0", "0o" or "0O" is ignored, and when
- {base} is 2 a leading "0b" or "0B" is ignored.
- Text after the number is silently ignored.
-
- Can also be used as a |method|: >
- GetText()->str2nr()
-
-strcharpart({src}, {start} [, {len}]) *strcharpart()*
- Like |strpart()| but using character index and length instead
- of byte index and length. Composing characters are counted
- separately.
- When a character index is used where a character does not
- exist it is assumed to be one character. For example: >
- strcharpart('abc', -1, 2)
-< results in 'a'.
-
- Can also be used as a |method|: >
- GetText()->strcharpart(5)
-
-strchars({string} [, {skipcc}]) *strchars()*
- The result is a Number, which is the number of characters
- in String {string}.
- When {skipcc} is omitted or zero, composing characters are
- counted separately.
- When {skipcc} set to 1, Composing characters are ignored.
- Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
-
- {skipcc} is only available after 7.4.755. For backward
- compatibility, you can define a wrapper function: >
- if has("patch-7.4.755")
- function s:strchars(str, skipcc)
- return strchars(a:str, a:skipcc)
- endfunction
- else
- function s:strchars(str, skipcc)
- if a:skipcc
- return strlen(substitute(a:str, ".", "x", "g"))
- else
- return strchars(a:str)
- endif
- endfunction
- endif
-<
- Can also be used as a |method|: >
- GetText()->strchars()
-
-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}
- (first column is zero). When {col} is omitted zero is used.
- Otherwise it is the screen column where to start. This
- matters for Tab characters.
- The option settings of the current window are used. This
- matters for anything that's displayed differently, such as
- 'tabstop' and 'display'.
- When {string} contains characters with East Asian Width Class
- Ambiguous, this function's return value depends on 'ambiwidth'.
- Also see |strlen()|, |strwidth()| and |strchars()|.
-
- Can also be used as a |method|: >
- GetText()->strdisplaywidth()
-
-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,
- or the current time if no time is given. The accepted
- {format} depends on your system, thus this is not portable!
- See the manual page of the C function strftime() for the
- format. The maximum length of the result is 80 characters.
- See also |localtime()|, |getftime()| and |strptime()|.
- The language can be changed with the |:language| command.
- Examples: >
- :echo strftime("%c") Sun Apr 27 11:49:23 1997
- :echo strftime("%Y %b %d %X") 1997 Apr 27 11:53:25
- :echo strftime("%y%m%d %T") 970427 11:53:55
- :echo strftime("%H:%M") 11:55
- :echo strftime("%c", getftime("file.c"))
- Show mod time of file.c.
-
-< Can also be used as a |method|: >
- GetFormat()->strftime()
-
-strgetchar({str}, {index}) *strgetchar()*
- Get character {index} from {str}. This uses a character
- index, not a byte index. Composing characters are considered
- separate characters here.
- Also see |strcharpart()| and |strchars()|.
-
- Can also be used as a |method|: >
- GetText()->strgetchar(5)
-
-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}.
- If {start} is specified, the search starts at index {start}.
- This can be used to find a second match: >
- :let colon1 = stridx(line, ":")
- :let colon2 = stridx(line, ":", colon1 + 1)
-< The search is done case-sensitive.
- For pattern searches use |match()|.
- -1 is returned if the {needle} does not occur in {haystack}.
- See also |strridx()|.
- Examples: >
- :echo stridx("An Example", "Example") 3
- :echo stridx("Starting point", "Start") 0
- :echo stridx("Starting point", "start") -1
-< *strstr()* *strchr()*
- stridx() works similar to the C function strstr(). When used
- with a single character it works similar to strchr().
-
- Can also be used as a |method|: >
- GetHaystack()->stridx(needle)
-
- *string()*
-string({expr}) Return {expr} converted to a String. If {expr} is a Number,
- Float, String, Blob or a composition of them, then the result
- can be parsed back with |eval()|.
- {expr} type result ~
- String 'string'
- Number 123
- Float 123.123456 or 1.123456e8 or
- `str2float('inf')`
- Funcref `function('name')`
- Blob 0z00112233.44556677.8899
- List [item, item]
- Dictionary {key: value, key: value}
- Note that in String values the ' character is doubled.
- Also see |strtrans()|.
- Note 2: Output format is mostly compatible with YAML, except
- for infinite and NaN floating-point values representations
- which use |str2float()|. Strings are also dumped literally,
- only single quote is escaped, which does not allow using YAML
- for parsing back binary strings. |eval()| should always work for
- strings and floats though and this is the only official
- method, use |msgpackdump()| or |json_encode()| if you need to
- share data with other application.
-
- Can also be used as a |method|: >
- mylist->string()
-
-strlen({string}) *strlen()*
- The result is a Number, which is the length of the String
- {string} in bytes.
- If the argument is a Number it is first converted to a String.
- For other types an error is given.
- If you want to count the number of multibyte characters use
- |strchars()|.
- Also see |len()|, |strdisplaywidth()| and |strwidth()|.
-
- Can also be used as a |method|: >
- GetString()->strlen()
-
-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}.
- When {chars} is present and TRUE then {len} is the number of
- characters positions (composing characters are not counted
- separately, thus "1" means one base character and any
- following composing characters).
- To count {start} as characters instead of bytes use
- |strcharpart()|.
-
- When bytes are selected which do not exist, this doesn't
- result in an error, the bytes are simply omitted.
- If {len} is missing, the copy continues from {start} till the
- end of the {src}. >
- strpart("abcdefg", 3, 2) == "de"
- strpart("abcdefg", -2, 4) == "ab"
- strpart("abcdefg", 5, 4) == "fg"
- strpart("abcdefg", 3) == "defg"
-
-< Note: To get the first character, {start} must be 0. For
- example, to get the character under the cursor: >
- strpart(getline("."), col(".") - 1, 1, v:true)
-<
- Can also be used as a |method|: >
- GetText()->strpart(5)
-
-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
- the format specified in {format}.
-
- The accepted {format} depends on your system, thus this is not
- portable! See the manual page of the C function strptime()
- for the format. Especially avoid "%c". The value of $TZ also
- matters.
-
- If the {timestring} cannot be parsed with {format} zero is
- returned. If you do not know the format of {timestring} you
- can try different {format} values until you get a non-zero
- result.
-
- See also |strftime()|.
- Examples: >
- :echo strptime("%Y %b %d %X", "1997 Apr 27 11:49:23")
-< 862156163 >
- :echo strftime("%c", strptime("%y%m%d %T", "970427 11:53:55"))
-< Sun Apr 27 11:53:55 1997 >
- :echo strftime("%c", strptime("%Y%m%d%H%M%S", "19970427115355") + 3600)
-< Sun Apr 27 12:53:55 1997
-
- Can also be used as a |method|: >
- GetFormat()->strptime(timestring)
-<
-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}.
- When {start} is specified, matches beyond this index are
- ignored. This can be used to find a match before a previous
- match: >
- :let lastcomma = strridx(line, ",")
- :let comma2 = strridx(line, ",", lastcomma - 1)
-< The search is done case-sensitive.
- For pattern searches use |match()|.
- -1 is returned if the {needle} does not occur in {haystack}.
- If the {needle} is empty the length of {haystack} is returned.
- See also |stridx()|. Examples: >
- :echo strridx("an angry armadillo", "an") 3
-< *strrchr()*
- When used with a single character it works similar to the C
- function strrchr().
-
- Can also be used as a |method|: >
- GetHaystack()->strridx(needle)
-
-strtrans({string}) *strtrans()*
- The result is a String, which is {string} with all unprintable
- characters translated into printable characters |'isprint'|.
- Like they are shown in a window. Example: >
- echo strtrans(@a)
-< This displays a newline in register a as "^@" instead of
- starting a new line.
-
- Can also be used as a |method|: >
- GetString()->strtrans()
-
-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
- cell, alternatively use |strdisplaywidth()|.
- When {string} contains characters with East Asian Width Class
- Ambiguous, this function's return value depends on 'ambiwidth'.
- Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
-
- Can also be used as a |method|: >
- GetString()->strwidth()
-
-submatch({nr} [, {list}]) *submatch()* *E935*
- Only for an expression in a |:substitute| command or
- substitute() function.
- Returns the {nr}'th submatch of the matched text. When {nr}
- is 0 the whole matched text is returned.
- Note that a NL in the string can stand for a line break of a
- multi-line match or a NUL character in the text.
- Also see |sub-replace-expression|.
-
- If {list} is present and non-zero then submatch() returns
- a list of strings, similar to |getline()| with two arguments.
- NL characters in the text represent NUL characters in the
- text.
- Only returns more than one item for |:substitute|, inside
- |substitute()| this list will always contain one or zero
- items, since there are no real line breaks.
-
- When substitute() is used recursively only the submatches in
- the current (deepest) call can be obtained.
-
- Examples: >
- :s/\d\+/\=submatch(0) + 1/
- :echo substitute(text, '\d\+', '\=submatch(0) + 1', '')
-< This finds the first number in the line and adds one to it.
- A line break is included as a newline character.
-
- Can also be used as a |method|: >
- GetNr()->submatch()
-
-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}.
- When {flags} is "g", all matches of {pat} in {string} are
- replaced. Otherwise {flags} should be "".
-
- This works like the ":substitute" command (without any flags).
- But the matching with {pat} is always done like the 'magic'
- option is set and 'cpoptions' is empty (to make scripts
- portable). 'ignorecase' is still relevant, use |/\c| or |/\C|
- if you want to ignore or match case and ignore 'ignorecase'.
- 'smartcase' is not used. See |string-match| for how {pat} is
- used.
-
- A "~" in {sub} is not replaced with the previous {sub}.
- Note that some codes in {sub} have a special meaning
- |sub-replace-special|. For example, to replace something with
- "\n" (two characters), use "\\\\n" or '\\n'.
-
- When {pat} does not match in {string}, {string} is returned
- unmodified.
-
- Example: >
- :let &path = substitute(&path, ",\\=[^,]*$", "", "")
-< This removes the last component of the 'path' option. >
- :echo substitute("testing", ".*", "\\U\\0", "")
-< results in "TESTING".
-
- When {sub} starts with "\=", the remainder is interpreted as
- an expression. See |sub-replace-expression|. Example: >
- :echo substitute(s, '%\(\x\x\)',
- \ '\=nr2char("0x" . submatch(1))', 'g')
-
-< When {sub} is a Funcref that function is called, with one
- optional argument. Example: >
- :echo substitute(s, '%\(\x\x\)', SubNr, 'g')
-< The optional argument is a list which contains the whole
- matched string and up to nine submatches, like what
- |submatch()| returns. Example: >
- :echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g')
-
-< Can also be used as a |method|: >
- GetString()->substitute(pat, sub, flags)
-
-swapinfo({fname}) *swapinfo()*
- The result is a dictionary, which holds information about the
- swapfile {fname}. The available fields are:
- version VIM version
- user user name
- host host name
- fname original file name
- pid PID of the VIM process that created the swap
- file
- mtime last modification time in seconds
- inode Optional: INODE number of the file
- dirty 1 if file was modified, 0 if not
- In case of failure an "error" item is added with the reason:
- Cannot open file: file not found or in accessible
- Cannot read file: cannot read first block
- Not a swap file: does not contain correct block ID
- Magic number mismatch: Info in first block is invalid
-
- Can also be used as a |method|: >
- GetFilename()->swapinfo()
-
-swapname({buf}) *swapname()*
- The result is the swap file path of the buffer {buf}.
- For the use of {buf}, see |bufname()| above.
- If buffer {buf} is the current buffer, the result is equal to
- |:swapname| (unless there is no swap file).
- If buffer {buf} has no swap file, returns an empty string.
-
- Can also be used as a |method|: >
- GetBufname()->swapname()
-
-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.
- The syntax ID can be used with |synIDattr()| and
- |synIDtrans()| to obtain syntax information about text.
-
- {col} is 1 for the leftmost column, {lnum} is 1 for the first
- line. 'synmaxcol' applies, in a longer line zero is returned.
- Note that when the position is after the last character,
- that's where the cursor can be in Insert mode, synID() returns
- zero. {lnum} is used like with |getline()|.
-
- When {trans} is |TRUE|, transparent items are reduced to the
- item that they reveal. This is useful when wanting to know
- the effective color. When {trans} is |FALSE|, the transparent
- item is returned. This is useful when wanting to know which
- syntax item is effective (e.g. inside parens).
- Warning: This function can be very slow. Best speed is
- obtained by going through the file in forward direction.
-
- Example (echoes the name of the syntax item under the cursor): >
- :echo synIDattr(synID(line("."), col("."), 1), "name")
-<
-
-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
- about a syntax item.
- {mode} can be "gui", "cterm" or "term", to get the attributes
- for that mode. When {mode} is omitted, or an invalid value is
- used, the attributes for the currently active highlighting are
- used (GUI, cterm or term).
- Use synIDtrans() to follow linked highlight groups.
- {what} result
- "name" the name of the syntax item
- "fg" foreground color (GUI: color name used to set
- the color, cterm: color number as a string,
- term: empty string)
- "bg" background color (as with "fg")
- "font" font name (only available in the GUI)
- |highlight-font|
- "sp" special color (as with "fg") |highlight-guisp|
- "fg#" like "fg", but for the GUI and the GUI is
- running the name in "#RRGGBB" form
- "bg#" like "fg#" for "bg"
- "sp#" like "fg#" for "sp"
- "bold" "1" if bold
- "italic" "1" if italic
- "reverse" "1" if reverse
- "inverse" "1" if inverse (= reverse)
- "standout" "1" if standout
- "underline" "1" if underlined
- "undercurl" "1" if undercurled
- "strikethrough" "1" if struckthrough
-
- Example (echoes the color of the syntax item under the
- cursor): >
- :echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg")
-<
- Can also be used as a |method|: >
- :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
-
-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
- highlight the character. Highlight links given with
- ":highlight link" are followed.
-
- Can also be used as a |method|: >
- :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
-
-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
- position {lnum} and {col} is not part of a concealable
- region, 1 if it is. {lnum} is used like with |getline()|.
- 2. The second item in the list is a string. If the first item
- is 1, the second item contains the text which will be
- displayed in place of the concealed text, depending on the
- current setting of 'conceallevel' and 'listchars'.
- 3. The third and final item in the list is a number
- representing the specific syntax region matched in the
- line. When the character is not concealed the value is
- zero. This allows detection of the beginning of a new
- concealable region if there are two consecutive regions
- with the same replacement character. For an example, if
- the text is "123456" and both "23" and "45" are concealed
- and replaced by the character "X", then:
- call returns ~
- synconcealed(lnum, 1) [0, '', 0]
- synconcealed(lnum, 2) [1, 'X', 1]
- synconcealed(lnum, 3) [1, 'X', 1]
- synconcealed(lnum, 4) [1, 'X', 2]
- synconcealed(lnum, 5) [1, 'X', 2]
- synconcealed(lnum, 6) [0, '', 0]
-
-
-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
- used like with |getline()|. Each item in the List is an ID
- like what |synID()| returns.
- The first item in the List is the outer region, following are
- items contained in that one. The last one is what |synID()|
- returns, unless not the whole item is highlighted or it is a
- transparent item.
- This function is useful for debugging a syntax file.
- Example that shows the syntax stack under the cursor: >
- for id in synstack(line("."), col("."))
- echo synIDattr(id, "name")
- endfor
-< When the position specified with {lnum} and {col} is invalid
- nothing is returned. The position just after the last
- character in a line and the first column in an empty line are
- valid positions.
-
-system({cmd} [, {input}]) *system()* *E677*
- Gets the output of {cmd} as a |string| (|systemlist()| returns
- a |List|) and sets |v:shell_error| to the error code.
- {cmd} is treated as in |jobstart()|:
- If {cmd} is a List it runs directly (no 'shell').
- If {cmd} is a String it runs in the 'shell', like this: >
- :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
-
-< Not to be used for interactive commands.
-
- Result is a String, filtered to avoid platform-specific quirks:
- - <CR><NL> is replaced with <NL>
- - NUL characters are replaced with SOH (0x01)
-
- Example: >
- :echo system(['ls', expand('%:h')])
-
-< If {input} is a string it is written to a pipe and passed as
- stdin to the command. The string is written as-is, line
- separators are not changed.
- If {input} is a |List| it is written to the pipe as
- |writefile()| does with {binary} set to "b" (i.e. with
- a newline between each list item, and newlines inside list
- items converted to NULs).
- When {input} is given and is a valid buffer id, the content of
- the buffer is written to the file line by line, each line
- terminated by NL (and NUL where the text has NL).
- *E5677*
- Note: system() cannot write to or read from backgrounded ("&")
- shell commands, e.g.: >
- :echo system("cat - &", "foo")
-< which is equivalent to: >
- $ echo foo | bash -c 'cat - &'
-< The pipes are disconnected (unless overridden by shell
- redirection syntax) before input can reach it. Use
- |jobstart()| instead.
-
- Note: Use |shellescape()| or |::S| with |expand()| or
- |fnamemodify()| to escape special characters in a command
- argument. 'shellquote' and 'shellxquote' must be properly
- configured. Example: >
- :echo system('ls '..shellescape(expand('%:h')))
- :echo system('ls '..expand('%:h:S'))
-
-< Unlike ":!cmd" there is no automatic check for changed files.
- Use |:checktime| to force a check.
-
- Can also be used as a |method|: >
- :echo GetCmd()->system()
-
-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
- is the same as |readfile()| will output with {binary} argument
- set to "b", except that a final newline is not preserved,
- unless {keepempty} is non-zero.
- Note that on MS-Windows you may get trailing CR characters.
-
- To see the difference between "echo hello" and "echo -n hello"
- use |system()| and |split()|: >
- echo split(system('echo hello'), '\n', 1)
-<
- Returns an empty string on error.
-
- Can also be used as a |method|: >
- :echo GetCmd()->systemlist()
-
-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.
- {arg} specifies the number of the tab page to be used. When
- omitted the current tab page is used.
- When {arg} is invalid the number zero is returned.
- To get a list of all buffers in all tabs use this: >
- let buflist = []
- for i in range(tabpagenr('$'))
- call extend(buflist, tabpagebuflist(i + 1))
- endfor
-< Note that a buffer may appear in more than one window.
-
- Can also be used as a |method|: >
- GetTabpage()->tabpagebuflist()
-
-tabpagenr([{arg}]) *tabpagenr()*
- The result is a Number, which is the number of the current
- tab page. The first tab page has number 1.
- The optional argument {arg} supports the following values:
- $ the number of the last tab page (the tab page
- count).
- # the number of the last accessed tab page (where
- |g<Tab>| goes to). If there is no previous
- tab page, 0 is returned.
- The number can be used with the |:tab| command.
-
-
-tabpagewinnr({tabarg} [, {arg}]) *tabpagewinnr()*
- Like |winnr()| but for tab page {tabarg}.
- {tabarg} specifies the number of tab page to be used.
- {arg} is used like with |winnr()|:
- - When omitted the current window number is returned. This is
- the window which will be used when going to this tab page.
- - When "$" the number of windows is returned.
- - When "#" the previous window nr is returned.
- Useful examples: >
- tabpagewinnr(1) " current window of tab page 1
- tabpagewinnr(4, '$') " number of windows in tab page 4
-< When {tabarg} is invalid zero is returned.
-
- Can also be used as a |method|: >
- GetTabpage()->tabpagewinnr()
-<
- *tagfiles()*
-tagfiles() Returns a |List| with the file names used to search for tags
- for the current buffer. This is the 'tags' option expanded.
-
-
-taglist({expr} [, {filename}]) *taglist()*
- Returns a |List| of tags matching the regular expression {expr}.
-
- If {filename} is passed it is used to prioritize the results
- in the same way that |:tselect| does. See |tag-priority|.
- {filename} should be the full path of the file.
-
- Each list item is a dictionary with at least the following
- entries:
- name Name of the tag.
- filename Name of the file where the tag is
- defined. It is either relative to the
- current directory or a full path.
- cmd Ex command used to locate the tag in
- the file.
- kind Type of the tag. The value for this
- entry depends on the language specific
- kind values. Only available when
- using a tags file generated by
- Exuberant ctags or hdrtag.
- static A file specific tag. Refer to
- |static-tag| for more information.
- More entries may be present, depending on the content of the
- tags file: access, implementation, inherits and signature.
- Refer to the ctags documentation for information about these
- fields. For C code the fields "struct", "class" and "enum"
- may appear, they give the name of the entity the tag is
- contained in.
-
- The ex-command "cmd" can be either an ex search pattern, a
- line number or a line number followed by a byte number.
-
- If there are no matching tags, then an empty list is returned.
-
- To get an exact tag match, the anchors '^' and '$' should be
- used in {expr}. This also make the function work faster.
- Refer to |tag-regexp| for more information about the tag
- search regular expression pattern.
-
- Refer to |'tags'| for information about how the tags file is
- located by Vim. Refer to |tags-file-format| for the format of
- the tags file generated by the different ctags tools.
-
- Can also be used as a |method|: >
- GetTagpattern()->taglist()
-
-tempname() *tempname()* *temp-file-name*
- The result is a String, which is the name of a file that
- doesn't exist. It can be used for a temporary file. Example: >
- :let tmpfile = tempname()
- :exe "redir > " . tmpfile
-< For Unix, the file will be in a private directory |tempfile|.
- For MS-Windows forward slashes are used when the 'shellslash'
- option is set or when 'shellcmdflag' starts with '-'.
-
-termopen({cmd}[, {opts}]) *termopen()*
- Spawns {cmd} in a new pseudo-terminal session connected
- to the current buffer. {cmd} is the same as the one passed to
- |jobstart()|. This function fails if the current buffer is
- modified (all buffer contents are destroyed).
-
- The {opts} dict is similar to the one passed to |jobstart()|,
- but the `pty`, `width`, `height`, and `TERM` fields are
- ignored: `height`/`width` are taken from the current window
- and `$TERM` is set to "xterm-256color".
- Returns the same values as |jobstart()|.
-
- See |terminal| for more information.
-
-test_ functions are documented here: |test-functions-details|
-
-tan({expr}) *tan()*
- Return the tangent of {expr}, measured in radians, as a |Float|
- in the range [-inf, inf].
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo tan(10)
-< 0.648361 >
- :echo tan(-4.01)
-< -1.181502
-
- Can also be used as a |method|: >
- Compute()->tan()
-
-tanh({expr}) *tanh()*
- Return the hyperbolic tangent of {expr} as a |Float| in the
- range [-1, 1].
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- :echo tanh(0.5)
-< 0.462117 >
- :echo tanh(-1)
-< -0.761594
-
- Can also be used as a |method|: >
- Compute()->tanh()
-<
- *timer_info()*
-timer_info([{id}])
- Return a list with information about timers.
- When {id} is given only information about this timer is
- returned. When timer {id} does not exist an empty list is
- returned.
- When {id} is omitted information about all timers is returned.
-
- For each timer the information is stored in a |Dictionary| with
- these items:
- "id" the timer ID
- "time" time the timer was started with
- "repeat" number of times the timer will still fire;
- -1 means forever
- "callback" the callback
-
- Can also be used as a |method|: >
- GetTimer()->timer_info()
-<
-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
- the callback to be invoked almost immediately if enough time
- has passed.
-
- Pausing a timer is useful to avoid the callback to be called
- for a short time.
-
- If {paused} evaluates to a non-zero Number or a non-empty
- String, then the timer is paused, otherwise it is unpaused.
- See |non-zero-arg|.
-
- Can also be used as a |method|: >
- GetTimer()->timer_pause(1)
-<
- *timer_start()* *timer* *timers*
-timer_start({time}, {callback} [, {options}])
- Create a timer and return the timer ID.
-
- {time} is the waiting time in milliseconds. This is the
- minimum time before invoking the callback. When the system is
- busy or Vim is not waiting for input the time will be longer.
-
- {callback} is the function to call. It can be the name of a
- function or a |Funcref|. It is called with one argument, which
- is the timer ID. The callback is only invoked when Vim is
- waiting for input.
-
- {options} is a dictionary. Supported entries:
- "repeat" Number of times to repeat the callback.
- -1 means forever. Default is 1.
- If the timer causes an error three times in a
- row the repeat is cancelled.
-
- Example: >
- func MyHandler(timer)
- echo 'Handler called'
- endfunc
- let timer = timer_start(500, 'MyHandler',
- \ {'repeat': 3})
-< This invokes MyHandler() three times at 500 msec intervals.
-
- Can also be used as a |method|: >
- GetMsec()->timer_start(callback)
-
-< Not available in the |sandbox|.
-
-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.
-
- Can also be used as a |method|: >
- GetTimer()->timer_stop()
-<
-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.
-
-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).
-
- Can also be used as a |method|: >
- GetText()->tolower()
-
-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).
-
- Can also be used as a |method|: >
- GetText()->toupper()
-
-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
- position in the {tostr} string. Thus the first character in
- {fromstr} is translated into the first character in {tostr}
- and so on. Exactly like the unix "tr" command.
- This code also deals with multibyte characters properly.
-
- Examples: >
- echo tr("hello there", "ht", "HT")
-< returns "Hello THere" >
- echo tr("<blob>", "<>", "{}")
-< returns "{blob}"
-
- Can also be used as a |method|: >
- GetText()->tr(from, to)
-
-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}.
- If {mask} is not given, {mask} is all characters up to 0x20,
- which includes Tab, space, NL and CR, plus the non-breaking
- space character 0xa0.
- The optional {dir} argument specifies where to remove the
- characters:
- 0 remove from the beginning and end of {text}
- 1 remove only at the beginning of {text}
- 2 remove only at the end of {text}
- When omitted both ends are trimmed.
- This function deals with multibyte characters properly.
- Examples: >
- echo trim(" some text ")
-< returns "some text" >
- echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL"
-< returns "RESERVE_TAIL" >
- echo trim("rm<Xrm<>X>rrm", "rm<>")
-< returns "Xrm<>X" (characters in the middle are not removed) >
- echo trim(" vim ", " ", 2)
-< returns " vim"
-
- Can also be used as a |method|: >
- GetText()->trim()
-
-trunc({expr}) *trunc()*
- Return the largest integral value with magnitude less than or
- equal to {expr} as a |Float| (truncate towards zero).
- {expr} must evaluate to a |Float| or a |Number|.
- Examples: >
- echo trunc(1.456)
-< 1.0 >
- echo trunc(-5.456)
-< -5.0 >
- echo trunc(4.0)
-< 4.0
-
- Can also be used as a |method|: >
- Compute()->trunc()
-
-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
- v:t_ variable that has the value:
- Number: 0 (|v:t_number|)
- String: 1 (|v:t_string|)
- Funcref: 2 (|v:t_func|)
- List: 3 (|v:t_list|)
- Dictionary: 4 (|v:t_dict|)
- Float: 5 (|v:t_float|)
- Boolean: 6 (|v:true| and |v:false|)
- Null: 7 (|v:null|)
- Blob: 10 (|v:t_blob|)
- For backward compatibility, this method can be used: >
- :if type(myvar) == type(0)
- :if type(myvar) == type("")
- :if type(myvar) == type(function("tr"))
- :if type(myvar) == type([])
- :if type(myvar) == type({})
- :if type(myvar) == type(0.0)
- :if type(myvar) == type(v:true)
-< In place of checking for |v:null| type it is better to check
- for |v:null| directly as it is the only value of this type: >
- :if myvar is v:null
-< To check if the v:t_ variables exist use this: >
- :if exists('v:t_number')
-
-< Can also be used as a |method|: >
- mylist->type()
-
-undofile({name}) *undofile()*
- Return the name of the undo file that would be used for a file
- with name {name} when writing. This uses the 'undodir'
- option, finding directories that exist. It does not check if
- the undo file exists.
- {name} is always expanded to the full path, since that is what
- is used internally.
- If {name} is empty undofile() returns an empty string, since a
- buffer without a file name will not write an undo file.
- Useful in combination with |:wundo| and |:rundo|.
-
- Can also be used as a |method|: >
- GetFilename()->undofile()
-
-undotree() *undotree()*
- Return the current state of the undo tree in a dictionary with
- the following items:
- "seq_last" The highest undo sequence number used.
- "seq_cur" The sequence number of the current position in
- the undo tree. This differs from "seq_last"
- when some changes were undone.
- "time_cur" Time last used for |:earlier| and related
- commands. Use |strftime()| to convert to
- something readable.
- "save_last" Number of the last file write. Zero when no
- write yet.
- "save_cur" Number of the current position in the undo
- tree.
- "synced" Non-zero when the last undo block was synced.
- This happens when waiting from input from the
- user. See |undo-blocks|.
- "entries" A list of dictionaries with information about
- undo blocks.
-
- The first item in the "entries" list is the oldest undo item.
- Each List item is a |Dictionary| with these items:
- "seq" Undo sequence number. Same as what appears in
- |:undolist|.
- "time" Timestamp when the change happened. Use
- |strftime()| to convert to something readable.
- "newhead" 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.
- "curhead" 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.
- "save" 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.
- "alt" Alternate entry. This is again a List of undo
- blocks. Each item may again have an "alt"
- item.
-
-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
- to remain unmodified make a copy first: >
- :let newlist = uniq(copy(mylist))
-< The default compare function uses the string representation of
- each item. For the use of {func} and {dict} see |sort()|.
-
- Can also be used as a |method|: >
- mylist->uniq()
-
-values({dict}) *values()*
- Return a |List| with all the values of {dict}. The |List| is
- in arbitrary order. Also see |items()| and |keys()|.
-
- Can also be used as a |method|: >
- mydict->values()
-
-virtcol({expr}) *virtcol()*
- The result is a Number, which is the screen column of the file
- position given with {expr}. That is, the last screen position
- occupied by the character at that position, when the screen
- would be of unlimited width. When there is a <Tab> at the
- position, the returned Number will be the column at the end of
- the <Tab>. For example, for a <Tab> in column 1, with 'ts'
- set to 8, it returns 8. |conceal| is ignored.
- For the byte position use |col()|.
- For the use of {expr} see |col()|.
- When 'virtualedit' is used {expr} can be [lnum, col, off], where
- "off" is the offset in screen columns from the start of the
- character. E.g., a position within a <Tab> or after the last
- character. When "off" is omitted zero is used.
- When Virtual editing is active in the current mode, a position
- beyond the end of the line can be returned. |'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.
- Note that only marks in the current file can be used.
- Examples: >
- virtcol(".") with text "foo^Lbar", with cursor on the "^L", returns 5
- virtcol("$") with text "foo^Lbar", returns 9
- virtcol("'t") with text " there", with 't at 'h', returns 6
-< The first column is 1. 0 is returned for an error.
- A more advanced example that echoes the maximum length of
- all lines: >
- echo max(map(range(1, line('$')), "virtcol([v:val, '$'])"))
-
-< Can also be used as a |method|: >
- GetPos()->virtcol()
-
-visualmode([{expr}]) *visualmode()*
- The result is a String, which describes the last Visual mode
- used in the current buffer. Initially it returns an empty
- string, but once Visual mode has been used, it returns "v",
- "V", or "<CTRL-V>" (a single CTRL-V character) for
- character-wise, line-wise, or block-wise Visual mode
- respectively.
- Example: >
- :exe "normal " . visualmode()
-< This enters the same Visual mode as before. It is also useful
- in scripts if you wish to act differently depending on the
- Visual mode that was used.
- If Visual mode is active, use |mode()| to get the Visual mode
- (e.g., in a |:vmap|).
- If {expr} is supplied and it evaluates to a non-zero Number or
- a non-empty String, then the Visual mode will be cleared and
- the old value is returned. See |non-zero-arg|.
-
-wait({timeout}, {condition}[, {interval}]) *wait()*
- Waits until {condition} evaluates to |TRUE|, where {condition}
- is a |Funcref| or |string| containing an expression.
-
- {timeout} is the maximum waiting time in milliseconds, -1
- means forever.
-
- Condition is evaluated on user events, internal events, and
- every {interval} milliseconds (default: 200).
-
- Returns a status integer:
- 0 if the condition was satisfied before timeout
- -1 if the timeout was exceeded
- -2 if the function was interrupted (by |CTRL-C|)
- -3 if an error occurred
-
-wildmenumode() *wildmenumode()*
- Returns |TRUE| when the wildmenu is active and |FALSE|
- otherwise. See 'wildmenu' and 'wildmode'.
- This can be used in mappings to handle the 'wildcharm' option
- gracefully. (Makes only sense with |mapmode-c| mappings).
-
- For example to make <c-j> work like <down> in wildmode, use: >
- :cnoremap <expr> <C-j> wildmenumode() ? "\<Down>\<Tab>" : "\<c-j>"
-<
- (Note, this needs the 'wildcharm' option set appropriately).
-
-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,
- without triggering autocommands or changing directory. When
- executing {command} autocommands will be triggered, this may
- have unexpected side effects. Use |:noautocmd| if needed.
- Example: >
- call win_execute(winid, 'syntax enable')
-<
- Can also be used as a |method|, the base is passed as the
- second argument: >
- GetCommand()->win_execute(winid)
-
-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.
-
- Can also be used as a |method|: >
- GetBufnr()->win_findbuf()
-
-win_getid([{win} [, {tab}]]) *win_getid()*
- Get the |window-ID| for the specified window.
- When {win} is missing use the current window.
- With {win} this is the window number. The top window has
- number 1.
- Without {tab} use the current tab, otherwise the tab with
- number {tab}. The first tab has number one.
- Return zero if the window cannot be found.
-
- Can also be used as a |method|: >
- GetWinnr()->win_getid()
-
-win_gettype([{nr}]) *win_gettype()*
- Return the type of the window:
- "autocmd" autocommand window. Temporary window
- used to execute autocommands.
- "command" command-line window |cmdwin|
- (empty) normal window
- "loclist" |location-list-window|
- "popup" popup window |popup|
- "preview" preview window |preview-window|
- "quickfix" |quickfix-window|
- "unknown" window {nr} not found
-
- When {nr} is omitted return the type of the current window.
- When {nr} is given return the type of this window by number or
- |window-ID|.
-
- Also see the 'buftype' option. When running a terminal in a
- popup window then 'buftype' is "terminal" and win_gettype()
- returns "popup".
-
- Can also be used as a |method|: >
- GetWinid()->win_gettype()
-<
-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.
-
- Can also be used as a |method|: >
- GetWinid()->win_gotoid()
-
-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.
-
- Can also be used as a |method|: >
- GetWinid()->win_id2tabwin()
-
-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.
-
- Can also be used as a |method|: >
- GetWinid()->win_id2win()
-
-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
- [1, 1], unless there is a tabline, then it is [2, 1].
- {nr} can be the window number or the |window-ID|. Use zero
- for the current window.
- Returns [0, 0] if the window cannot be found in the current
- tabpage.
-
- Can also be used as a |method|: >
- GetWinid()->win_screenpos()
-<
-win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
- Move the window {nr} to a new split of the window {target}.
- This is similar to moving to {target}, creating a new window
- using |:split| but having the same contents as window {nr}, and
- then closing {nr}.
-
- Both {nr} and {target} can be window numbers or |window-ID|s.
- Both must be in the current tab page.
-
- Returns zero for success, non-zero for failure.
-
- {options} is a |Dictionary| with the following optional entries:
- "vertical" When TRUE, the split is created vertically,
- like with |:vsplit|.
- "rightbelow" When TRUE, the split is made below or to the
- right (if vertical). When FALSE, it is done
- above or to the left (if vertical). When not
- present, the values of 'splitbelow' and
- 'splitright' are used.
-
- Can also be used as a |method|: >
- GetWinid()->win_splitmove(target)
-<
- *winbufnr()*
-winbufnr({nr}) The result is a Number, which is the number of the buffer
- associated with window {nr}. {nr} can be the window number or
- the |window-ID|.
- When {nr} is zero, the number of the buffer in the current
- window is returned.
- When window {nr} doesn't exist, -1 is returned.
- Example: >
- :echo "The file in the current window is " . bufname(winbufnr(0))
-<
- Can also be used as a |method|: >
- FindWindow()->winbufnr()->bufname()
-<
- *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.
-
- *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.
-
-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|.
- When {nr} is zero, the height of the current window is
- returned. When window {nr} doesn't exist, -1 is returned.
- An existing window always has a height of zero or more.
- This excludes any window toolbar line.
- Examples: >
- :echo "The current window has " . winheight(0) . " lines."
-
-< Can also be used as a |method|: >
- GetWinid()->winheight()
-<
-winlayout([{tabnr}]) *winlayout()*
- The result is a nested List containing the layout of windows
- in a tabpage.
-
- Without {tabnr} use the current tabpage, otherwise the tabpage
- with number {tabnr}. If the tabpage {tabnr} is not found,
- returns an empty list.
-
- For a leaf window, it returns:
- ['leaf', {winid}]
- For horizontally split windows, which form a column, it
- returns:
- ['col', [{nested list of windows}]]
- For vertically split windows, which form a row, it returns:
- ['row', [{nested list of windows}]]
-
- Example: >
- " Only one window in the tab page
- :echo winlayout()
- ['leaf', 1000]
- " Two horizontally split windows
- :echo winlayout()
- ['col', [['leaf', 1000], ['leaf', 1001]]]
- " The second tab page, with three horizontally split
- " windows, with two vertically split windows in the
- " middle window
- :echo winlayout(2)
- ['col', [['leaf', 1002], ['row', [['leaf', 1003],
- ['leaf', 1001]]], ['leaf', 1000]]]
-<
- Can also be used as a |method|: >
- GetTabnr()->winlayout()
-<
- *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
- the window. The first line is one.
- If the cursor was moved the view on the file will be updated
- first, this may cause a scroll.
-
- *winnr()*
-winnr([{arg}]) The result is a Number, which is the number of the current
- window. The top window has number 1.
- Returns zero for a popup window.
-
- The optional argument {arg} supports the following values:
- $ the number of the last window (the window
- count).
- # the number of the last accessed window (where
- |CTRL-W_p| goes to). If there is no previous
- window or it is in another tab page 0 is
- returned.
- {N}j the number of the Nth window below the
- current window (where |CTRL-W_j| goes to).
- {N}k the number of the Nth window above the current
- window (where |CTRL-W_k| goes to).
- {N}h the number of the Nth window left of the
- current window (where |CTRL-W_h| goes to).
- {N}l the number of the Nth window right of the
- current window (where |CTRL-W_l| goes to).
- The number can be used with |CTRL-W_w| and ":wincmd w"
- |:wincmd|.
- Also see |tabpagewinnr()| and |win_getid()|.
- Examples: >
- let window_count = winnr('$')
- let prev_window = winnr('#')
- let wnum = winnr('3k')
-
-< Can also be used as a |method|: >
- GetWinval()->winnr()
-<
- *winrestcmd()*
-winrestcmd() Returns a sequence of |:resize| commands that should restore
- the current window sizes. Only works properly when no windows
- are opened or closed and the current window and tab page is
- unchanged.
- Example: >
- :let cmd = winrestcmd()
- :call MessWithWindowSizes()
- :exe cmd
-<
- *winrestview()*
-winrestview({dict})
- Uses the |Dictionary| returned by |winsaveview()| to restore
- the view of the current window.
- Note: The {dict} does not have to contain all values, that are
- returned by |winsaveview()|. If values are missing, those
- settings won't be restored. So you can use: >
- :call winrestview({'curswant': 4})
-<
- This will only set the curswant value (the column the cursor
- wants to move on vertical movements) of the cursor to column 5
- (yes, that is 5), while all other settings will remain the
- same. This is useful, if you set the cursor position manually.
-
- If you have changed the values the result is unpredictable.
- If the window size changed the result won't be the same.
-
- Can also be used as a |method|: >
- GetView()->winrestview()
-<
- *winsaveview()*
-winsaveview() Returns a |Dictionary| that contains information to restore
- the view of the current window. Use |winrestview()| to
- restore the view.
- This is useful if you have a mapping that jumps around in the
- buffer and you want to go back to the original view.
- This does not save fold information. Use the 'foldenable'
- option to temporarily switch off folding, so that folds are
- not opened when moving around. This may have side effects.
- The return value includes:
- lnum cursor line number
- col cursor column (Note: the first column
- zero, as opposed to what getpos()
- returns)
- coladd cursor column offset for 'virtualedit'
- curswant column for vertical movement
- topline first line in the window
- topfill filler lines, only in diff mode
- leftcol first column displayed; only used when
- 'wrap' is off
- skipcol columns skipped
- Note that no option values are saved.
-
-
-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|.
- When {nr} is zero, the width of the current window is
- returned. When window {nr} doesn't exist, -1 is returned.
- An existing window always has a width of zero or more.
- Examples: >
- :echo "The current window has " . winwidth(0) . " columns."
- :if winwidth(0) <= 50
- : 50 wincmd |
- :endif
-< For getting the terminal or screen size, see the 'columns'
- option.
-
- Can also be used as a |method|: >
- GetWinid()->winwidth()
-
-wordcount() *wordcount()*
- The result is a dictionary of byte/chars/word statistics for
- the current buffer. This is the same info as provided by
- |g_CTRL-G|
- The return value includes:
- bytes Number of bytes in the buffer
- chars Number of chars in the buffer
- words Number of words in the buffer
- cursor_bytes Number of bytes before cursor position
- (not in Visual mode)
- cursor_chars Number of chars before cursor position
- (not in Visual mode)
- cursor_words Number of words before cursor position
- (not in Visual mode)
- visual_bytes Number of bytes visually selected
- (only in Visual mode)
- visual_chars Number of chars visually selected
- (only in Visual mode)
- visual_words Number of words visually selected
- (only in Visual mode)
-
-
- *writefile()*
-writefile({object}, {fname} [, {flags}])
- 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
- or Number.
- When {flags} contains "b" then binary mode is used: There will
- not be a NL after the last list item. An empty item at the
- end does cause the last line in the file to end in a NL.
-
- When {object} is a |Blob| write the bytes to file {fname}
- unmodified.
-
- When {flags} contains "a" then append mode is used, lines are
- appended to the file: >
- :call writefile(["foo"], "event.log", "a")
- :call writefile(["bar"], "event.log", "a")
-<
- When {flags} contains "S" fsync() call is not used, with "s"
- it is used, 'fsync' option applies by default. No fsync()
- means that writefile() will finish faster, but writes may be
- left in OS buffers and not yet written to disk. Such changes
- will disappear if system crashes before OS does writing.
-
- All NL characters are replaced with a NUL character.
- Inserting CR characters needs to be done before passing {list}
- to writefile().
- An existing file is overwritten, if possible.
- When the write fails -1 is returned, otherwise 0. There is an
- error message if the file can't be created or when writing
- fails.
- Also see |readfile()|.
- To copy a file byte for byte: >
- :let fl = readfile("foo", "b")
- :call writefile(fl, "foocopy", "b")
-
-< Can also be used as a |method|: >
- GetText()->writefile("thefile")
-
-xor({expr}, {expr}) *xor()*
- Bitwise XOR on the two arguments. The arguments are converted
- to a number. A List, Dict or Float argument causes an error.
- Example: >
- :let bits = xor(bits, 0x80)
-<
- Can also be used as a |method|: >
- :let bits = bits->xor(0x80)
-<
-
- *string-match*
-Matching a pattern in a String
-
-A regexp pattern as explained at |pattern| is normally used to find a match in
-the buffer lines. When a pattern is used to find a match in a String, almost
-everything works in the same way. The difference is that a String is handled
-like it is one line. When it contains a "\n" character, this is not seen as a
-line break for the pattern. It can be matched with a "\n" in the pattern, or
-with ".". Example: >
- :let a = "aaaa\nxxxx"
- :echo matchstr(a, "..\n..")
- aa
- xx
- :echo matchstr(a, "a.x")
- a
- x
-
-Don't forget that "^" will only match at the first character of the String and
-"$" at the last character of the string. They don't match after or before a
-"\n".
+The alphabetic list of all builtin functions and details are in a separate
+help file: |builtin-functions|.
==============================================================================
5. Defining functions *user-function*
@@ -11163,9 +2548,9 @@ Example: >
: echohl Title
: echo a:title
: echohl None
- : echo a:0 . " items:"
+ : echo a:0 .. " items:"
: for s in a:000
- : echon ' ' . s
+ : echon ' ' .. s
: endfor
:endfunction
@@ -11204,7 +2589,7 @@ This function can then be called with: >
this works:
*function-range-example* >
:function Mynumber(arg)
- : echo line(".") . " " . a:arg
+ : echo line(".") .. " " .. a:arg
:endfunction
:1,5call Mynumber(getline("."))
<
@@ -11215,7 +2600,7 @@ This function can then be called with: >
Example of a function that handles the range itself: >
:function Cont() range
- : execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ '
+ : execute (a:firstline + 1) .. "," .. a:lastline .. 's/^/\t\\ '
:endfunction
:4,8call Cont()
<
@@ -11377,7 +2762,7 @@ This does NOT work: >
This cannot be used to add an item to a |List|.
This cannot be used to set a byte in a String. You
can do that like this: >
- :let var = var[0:2] . 'X' . var[4:]
+ :let var = var[0:2] .. 'X' .. var[4:]
< When {var-name} is a |Blob| then {idx} can be the
length of the blob, in which case one byte is
appended.
@@ -11439,7 +2824,7 @@ This does NOT work: >
is just like using the |:set| command: both the local
value and the global value are changed.
Example: >
- :let &path = &path . ',/usr/local/include'
+ :let &path = &path .. ',/usr/local/include'
:let &{option-name} .= {expr1}
For a string option: Append {expr1} to the value.
@@ -11694,14 +3079,17 @@ text...
opposite of |:lockvar|.
:if {expr1} *:if* *:end* *:endif* *:en* *E171* *E579* *E580*
-:en[dif] Execute the commands until the next matching ":else"
- or ":endif" if {expr1} evaluates to non-zero.
+:en[dif] Execute the commands until the next matching `:else`
+ or `:endif` if {expr1} evaluates to non-zero.
+ Although the short forms work, it is recommended to
+ always use `:endif` to avoid confusion and to make
+ auto-indenting work properly.
From Vim version 4.5 until 5.0, every Ex command in
- between the ":if" and ":endif" is ignored. These two
+ between the `:if` and `:endif` is ignored. These two
commands were just to allow for future expansions in a
backward compatible way. Nesting was allowed. Note
- that any ":else" or ":elseif" was ignored, the "else"
+ that any `:else` or `:elseif` was ignored, the `else`
part was not executed either.
You can use this to remain compatible with older
@@ -11710,32 +3098,32 @@ text...
: version-5-specific-commands
:endif
< The commands still need to be parsed to find the
- "endif". Sometimes an older Vim has a problem with a
- new command. For example, ":silent" is recognized as
- a ":substitute" command. In that case ":execute" can
+ `endif`. Sometimes an older Vim has a problem with a
+ new command. For example, `:silent` is recognized as
+ a `:substitute` command. In that case `:execute` can
avoid problems: >
:if version >= 600
: execute "silent 1,$delete"
:endif
<
- NOTE: The ":append" and ":insert" commands don't work
- properly in between ":if" and ":endif".
+ NOTE: The `:append` and `:insert` commands don't work
+ properly in between `:if` and `:endif`.
*:else* *:el* *E581* *E583*
-:el[se] Execute the commands until the next matching ":else"
- or ":endif" if they previously were not being
+:el[se] Execute the commands until the next matching `:else`
+ or `:endif` if they previously were not being
executed.
*:elseif* *:elsei* *E582* *E584*
-:elsei[f] {expr1} Short for ":else" ":if", with the addition that there
- is no extra ":endif".
+:elsei[f] {expr1} Short for `:else` `:if`, with the addition that there
+ is no extra `:endif`.
:wh[ile] {expr1} *:while* *:endwhile* *:wh* *:endw*
*E170* *E585* *E588* *E733*
-:endw[hile] Repeat the commands between ":while" and ":endwhile",
+:endw[hile] Repeat the commands between `:while` and `:endwhile`,
as long as {expr1} evaluates to non-zero.
When an error is detected from a command inside the
- loop, execution continues after the "endwhile".
+ loop, execution continues after the `endwhile`.
Example: >
:let lnum = 1
:while lnum <= line("$")
@@ -11743,16 +3131,19 @@ text...
:let lnum = lnum + 1
:endwhile
<
- NOTE: The ":append" and ":insert" commands don't work
- properly inside a ":while" and ":for" loop.
+ NOTE: The `:append` and `:insert` commands don't work
+ properly inside a `:while` and `:for` loop.
:for {var} in {object} *:for* *E690* *E732*
:endfo[r] *:endfo* *:endfor*
- Repeat the commands between ":for" and ":endfor" for
- each item in {object}. {object} can be a |List| or
- a |Blob|. Variable {var} is set to the value of each
- item. When an error is detected for a command inside
- the loop, execution continues after the "endfor".
+ Repeat the commands between `:for` and `:endfor` for
+ each item in {object}. {object} can be a |List|,
+ a |Blob| or a |String|.
+
+ Variable {var} is set to the value of each item.
+
+ When an error is detected for a command inside the
+ loop, execution continues after the `endfor`.
Changing {object} inside the loop affects what items
are used. Make a copy if this is unwanted: >
:for item in copy(mylist)
@@ -11776,7 +3167,7 @@ text...
:for [{var1}, {var2}, ...] in {listlist}
:endfo[r]
- Like ":for" above, but each item in {listlist} must be
+ Like `:for` above, but each item in {listlist} must be
a list, of which each item is assigned to {var1},
{var2}, etc. Example: >
:for [lnum, col] in [[1, 3], [2, 5], [3, 8]]
@@ -11784,38 +3175,39 @@ text...
:endfor
<
*:continue* *:con* *E586*
-:con[tinue] When used inside a ":while" or ":for" loop, jumps back
+:con[tinue] When used inside a `:while` or `:for` loop, jumps back
to the start of the loop.
- If it is used after a |:try| inside the loop but
- before the matching |:finally| (if present), the
- commands following the ":finally" up to the matching
- |:endtry| are executed first. This process applies to
- all nested ":try"s inside the loop. The outermost
- ":endtry" then jumps back to the start of the loop.
+
+ If it is used after a `:try` inside the loop but
+ before the matching `:finally` (if present), the
+ commands following the `:finally` up to the matching
+ `:endtry` are executed first. This process applies to
+ all nested `:try`s inside the loop. The outermost
+ `:endtry` then jumps back to the start of the loop.
*:break* *:brea* *E587*
-:brea[k] When used inside a ":while" or ":for" loop, skips to
- the command after the matching ":endwhile" or
- ":endfor".
- If it is used after a |:try| inside the loop but
- before the matching |:finally| (if present), the
- commands following the ":finally" up to the matching
- |:endtry| are executed first. This process applies to
- all nested ":try"s inside the loop. The outermost
- ":endtry" then jumps to the command after the loop.
+:brea[k] When used inside a `:while` or `:for` loop, skips to
+ the command after the matching `:endwhile` or
+ `:endfor`.
+ If it is used after a `:try` inside the loop but
+ before the matching `:finally` (if present), the
+ commands following the `:finally` up to the matching
+ `:endtry` are executed first. This process applies to
+ all nested `:try`s inside the loop. The outermost
+ `:endtry` then jumps to the command after the loop.
:try *:try* *:endt* *:endtry* *E600* *E601* *E602*
:endt[ry] Change the error handling for the commands between
- ":try" and ":endtry" including everything being
- executed across ":source" commands, function calls,
+ `:try` and `:endtry` including everything being
+ executed across `:source` commands, function calls,
or autocommand invocations.
When an error or interrupt is detected and there is
- a |:finally| command following, execution continues
- after the ":finally". Otherwise, or when the
- ":endtry" is reached thereafter, the next
- (dynamically) surrounding ":try" is checked for
- a corresponding ":finally" etc. Then the script
+ a `:finally` command following, execution continues
+ after the `:finally`. Otherwise, or when the
+ `:endtry` is reached thereafter, the next
+ (dynamically) surrounding `:try` is checked for
+ a corresponding `:finally` etc. Then the script
processing is terminated. Whether a function
definition has an "abort" argument does not matter.
Example: >
@@ -11823,9 +3215,9 @@ text...
echomsg "not reached"
<
Moreover, an error or interrupt (dynamically) inside
- ":try" and ":endtry" is converted to an exception. It
- can be caught as if it were thrown by a |:throw|
- command (see |:catch|). In this case, the script
+ `:try` and `:endtry` is converted to an exception. It
+ can be caught as if it were thrown by a `:throw`
+ command (see `:catch`). In this case, the script
processing is not terminated.
The value "Vim:Interrupt" is used for an interrupt
@@ -11841,22 +3233,22 @@ text...
try | edit | catch /^Vim(edit):E\d\+/ | echo "error" | endtry
<
*:cat* *:catch* *E603* *E604* *E605*
-:cat[ch] /{pattern}/ The following commands until the next |:catch|,
- |:finally|, or |:endtry| that belongs to the same
- |:try| as the ":catch" are executed when an exception
+:cat[ch] /{pattern}/ The following commands until the next `:catch`,
+ `:finally`, or `:endtry` that belongs to the same
+ `:try` as the `:catch` are executed when an exception
matching {pattern} is being thrown and has not yet
- been caught by a previous ":catch". Otherwise, these
+ been caught by a previous `:catch`. Otherwise, these
commands are skipped.
When {pattern} is omitted all errors are caught.
Examples: >
- :catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
- :catch /^Vim\%((\a\+)\)\=:E/ " catch all Vim errors
- :catch /^Vim\%((\a\+)\)\=:/ " catch errors and interrupts
- :catch /^Vim(write):/ " catch all errors in :write
- :catch /^Vim\%((\a\+)\)\=:E123/ " catch error E123
- :catch /my-exception/ " catch user exception
- :catch /.*/ " catch everything
- :catch " same as /.*/
+ :catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
+ :catch /^Vim\%((\a\+)\)\=:E/ " catch all Vim errors
+ :catch /^Vim\%((\a\+)\)\=:/ " catch errors and interrupts
+ :catch /^Vim(write):/ " catch all errors in :write
+ :catch /^Vim\%((\a\+)\)\=:E123:/ " catch error E123
+ :catch /my-exception/ " catch user exception
+ :catch /.*/ " catch everything
+ :catch " same as /.*/
<
Another character can be used instead of / around the
{pattern}, so long as it does not have a special
@@ -11869,27 +3261,27 @@ text...
locales.
*:fina* *:finally* *E606* *E607*
-:fina[lly] The following commands until the matching |:endtry|
+:fina[lly] The following commands until the matching `:endtry`
are executed whenever the part between the matching
- |:try| and the ":finally" is left: either by falling
- through to the ":finally" or by a |:continue|,
- |:break|, |:finish|, or |:return|, or by an error or
- interrupt or exception (see |:throw|).
+ `:try` and the `:finally` is left: either by falling
+ through to the `:finally` or by a `:continue`,
+ `:break`, `:finish`, or `:return`, or by an error or
+ interrupt or exception (see `:throw`).
*:th* *:throw* *E608*
:th[row] {expr1} The {expr1} is evaluated and thrown as an exception.
- If the ":throw" is used after a |:try| but before the
- first corresponding |:catch|, commands are skipped
- until the first ":catch" matching {expr1} is reached.
- If there is no such ":catch" or if the ":throw" is
- used after a ":catch" but before the |:finally|, the
- commands following the ":finally" (if present) up to
- the matching |:endtry| are executed. If the ":throw"
- is after the ":finally", commands up to the ":endtry"
- are skipped. At the ":endtry", this process applies
- again for the next dynamically surrounding ":try"
+ If the `:throw` is used after a `:try` but before the
+ first corresponding `:catch`, commands are skipped
+ until the first `:catch` matching {expr1} is reached.
+ If there is no such `:catch` or if the `:throw` is
+ used after a `:catch` but before the `:finally`, the
+ commands following the `:finally` (if present) up to
+ the matching `:endtry` are executed. If the `:throw`
+ is after the `:finally`, commands up to the `:endtry`
+ are skipped. At the `:endtry`, this process applies
+ again for the next dynamically surrounding `:try`
(which may be found in a calling function or sourcing
- script), until a matching ":catch" has been found.
+ script), until a matching `:catch` has been found.
If the exception is not caught, the command processing
is terminated.
Example: >
@@ -11904,7 +3296,7 @@ text...
Also see |:comment|.
Use "\n" to start a new line. Use "\r" to move the
cursor to the first column.
- Uses the highlighting set by the |:echohl| command.
+ Uses the highlighting set by the `:echohl` command.
Cannot be followed by a comment.
Example: >
:echo "the value of 'shell' is" &shell
@@ -11913,9 +3305,9 @@ text...
And since Vim mostly postpones redrawing until it's
finished with a sequence of commands this happens
quite often. To avoid that a command from before the
- ":echo" causes a redraw afterwards (redraws are often
+ `:echo` causes a redraw afterwards (redraws are often
postponed until you type something), force a redraw
- with the |:redraw| command. Example: >
+ with the `:redraw` command. Example: >
:new | redraw | echo "there is a new window"
< *:echo-self-refer*
When printing nested containers echo prints second
@@ -11934,13 +3326,13 @@ text...
*:echon*
:echon {expr1} .. Echoes each {expr1}, without anything added. Also see
|:comment|.
- Uses the highlighting set by the |:echohl| command.
+ Uses the highlighting set by the `:echohl` command.
Cannot be followed by a comment.
Example: >
:echon "the value of 'shell' is " &shell
<
- Note the difference between using ":echo", which is a
- Vim command, and ":!echo", which is an external shell
+ Note the difference between using `:echo`, which is a
+ Vim command, and `:!echo`, which is an external shell
command: >
:!echo % --> filename
< The arguments of ":!" are expanded, see |:_%|. >
@@ -11956,8 +3348,8 @@ text...
*:echoh* *:echohl*
:echoh[l] {name} Use the highlight group {name} for the following
- |:echo|, |:echon| and |:echomsg| commands. Also used
- for the |input()| prompt. Example: >
+ `:echo`, `:echon` and `:echomsg` commands. Also used
+ for the `input()` prompt. Example: >
:echohl WarningMsg | echo "Don't panic!" | echohl None
< Don't forget to set the group back to "None",
otherwise all following echo's will be highlighted.
@@ -11966,14 +3358,14 @@ text...
:echom[sg] {expr1} .. Echo the expression(s) as a true message, saving the
message in the |message-history|.
Spaces are placed between the arguments as with the
- |:echo| command. But unprintable characters are
+ `:echo` command. But unprintable characters are
displayed, not interpreted.
- The parsing works slightly different from |:echo|,
- more like |:execute|. All the expressions are first
+ The parsing works slightly different from `:echo`,
+ more like `:execute`. All the expressions are first
evaluated and concatenated before echoing anything.
If expressions does not evaluate to a Number or
String, string() is used to turn it into a string.
- Uses the highlighting set by the |:echohl| command.
+ Uses the highlighting set by the `:echohl` command.
Example: >
:echomsg "It's a Zizzer Zazzer Zuzz, as you can plainly see."
< See |:echo-redraw| to avoid the message disappearing
@@ -11983,12 +3375,12 @@ text...
message in the |message-history|. When used in a
script or function the line number will be added.
Spaces are placed between the arguments as with the
- |:echomsg| command. When used inside a try conditional,
+ `:echomsg` command. When used inside a try conditional,
the message is raised as an error exception instead
(see |try-echoerr|).
Example: >
:echoerr "This script just failed!"
-< If you just want a highlighted message use |:echohl|.
+< If you just want a highlighted message use `:echohl`.
And to get a beep: >
:exe "normal \<Esc>"
<
@@ -12293,7 +3685,7 @@ exception most recently caught as long it is not finished.
:function! Caught()
: if v:exception != ""
- : echo 'Caught "' . v:exception . '" in ' . v:throwpoint
+ : echo 'Caught "' .. v:exception .. '" in ' .. v:throwpoint
: else
: echo 'Nothing caught'
: endif
@@ -12696,8 +4088,8 @@ a script in order to catch unexpected things.
:catch /^Vim:Interrupt$/
: echo "Script interrupted"
:catch /.*/
- : echo "Internal error (" . v:exception . ")"
- : echo " - occurred at " . v:throwpoint
+ : echo "Internal error (" .. v:exception .. ")"
+ : echo " - occurred at " .. v:throwpoint
:endtry
:" end of script
@@ -12893,7 +4285,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
:function! CheckRange(a, func)
: if a:a < 0
- : throw "EXCEPT:MATHERR:RANGE(" . a:func . ")"
+ : throw "EXCEPT:MATHERR:RANGE(" .. a:func .. ")"
: endif
:endfunction
:
@@ -12920,13 +4312,13 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
: try
: execute "write" fnameescape(a:file)
: catch /^Vim(write):/
- : throw "EXCEPT:IO(" . getcwd() . ", " . a:file . "):WRITEERR"
+ : throw "EXCEPT:IO(" .. getcwd() .. ", " .. a:file .. "):WRITEERR"
: endtry
:endfunction
:
:try
:
- : " something with arithmetics and I/O
+ : " something with arithmetic and I/O
:
:catch /^EXCEPT:MATHERR:RANGE/
: let function = substitute(v:exception, '.*(\(\a\+\)).*', '\1', "")
@@ -12939,9 +4331,9 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
: let dir = substitute(v:exception, '.*(\(.\+\),\s*.\+).*', '\1', "")
: let file = substitute(v:exception, '.*(.\+,\s*\(.\+\)).*', '\1', "")
: if file !~ '^/'
- : let file = dir . "/" . file
+ : let file = dir .. "/" .. file
: endif
- : echo 'I/O error for "' . file . '"'
+ : echo 'I/O error for "' .. file .. '"'
:
:catch /^EXCEPT/
: echo "Unspecified error"
@@ -13009,7 +4401,7 @@ clauses, however, is executed.
: echo "inner finally"
: endtry
:catch
- : echo 'outer catch-all caught "' . v:exception . '"'
+ : echo 'outer catch-all caught "' .. v:exception .. '"'
: finally
: echo "outer finally"
:endtry
@@ -13071,7 +4463,7 @@ Printing in Binary ~
: let n = a:nr
: let r = ""
: while n
- : let r = '01'[n % 2] . r
+ : let r = '01'[n % 2] .. r
: let n = n / 2
: endwhile
: return r
@@ -13082,7 +4474,7 @@ Printing in Binary ~
:func String2Bin(str)
: let out = ''
: for ix in range(strlen(a:str))
- : let out = out . '-' . Nr2Bin(char2nr(a:str[ix]))
+ : let out = out .. '-' .. Nr2Bin(char2nr(a:str[ix]))
: endfor
: return out[1:]
:endfunc
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index fdd9c8c12e..7fff74a963 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -131,26 +131,42 @@ shell script: "#!/bin/csh".
argument was used.
*filetype-overrule*
-When the same extension is used for two filetypes, Vim tries to guess what
-kind of file it is. This doesn't always work. A number of global variables
-can be used to overrule the filetype used for certain extensions:
+When the same extension is used for multiple filetypes, Vim tries to guess
+what kind of file it is. This doesn't always work. A number of global
+variables can be used to overrule the filetype used for certain extensions:
file name variable ~
*.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.asm g:asmsyntax |ft-asm-syntax|
*.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax|
- *.fs g:filetype_fs |ft-forth-syntax|
+ *.bas g:filetype_bas |ft-basic-syntax|
+ *.cfg g:filetype_cfg
+ *.cls g:filetype_cls
+ *.csh g:filetype_csh |ft-csh-syntax|
+ *.dat g:filetype_dat
+ *.frm g:filetype_frm |ft-form-syntax|
+ *.fs g:filetype_fs |ft-forth-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.inc g:filetype_inc
*.m g:filetype_m |ft-mathematica-syntax|
+ *.mod g:filetype_mod
*.p g:filetype_p |ft-pascal-syntax|
*.pl g:filetype_pl
*.pp g:filetype_pp |ft-pascal-syntax|
*.prg g:filetype_prg
+ *.r g:filetype_r
+ *.sig g:filetype_sig
+ *.sql g:filetype_sql |ft-sql-syntax|
+ *.src g:filetype_src
+ *.sys g:filetype_sys
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|
*.w g:filetype_w |ft-cweb-syntax|
+For a few filetypes the global variable is used only when the filetype could
+not be detected:
+ *.r g:filetype_r |ft-rexx-syntax|
+
*filetype-ignore*
To avoid that certain files are being inspected, the g:ft_ignore_pat variable
is used. The default value is set like this: >
@@ -161,7 +177,9 @@ This means that the contents of compressed files are not inspected.
If a file type that you want to use is not detected yet, there are a few ways
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.lua
or $VIMRUNTIME/filetype.vim files. They will be overwritten when installing a
-new version of Nvim.
+new version of Nvim. The following explains the legacy Vim mechanism (enabled
+if |do_legacy_filetype| is set). For Nvim's default mechanism, see
+|vim.filetype.add()|.
A. If you want to overrule all default file type checks.
This works by writing one file for each filetype. The disadvantage is that
@@ -220,36 +238,8 @@ C. If your file type can be detected by the file name or extension.
Write this file as "filetype.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.config/nvim/filetype.vim
-<
- Alternatively, create a file called "filetype.lua" that adds new
- filetypes.
- Example: >
- vim.filetype.add({
- extension = {
- foo = "fooscript",
- },
- filename = {
- [".foorc"] = "foorc",
- },
- pattern = {
- [".*/etc/foo/.*%.conf"] = "foorc",
- },
- })
-<
- See |vim.filetype.add()|.
- *g:do_filetype_lua*
- For now, Lua filetype detection is opt-in. You can enable it by adding
- the following to your |init.vim|: >
- let g:do_filetype_lua = 1
-< *g:did_load_filetypes*
- In either case, the builtin filetype detection provided by Nvim can be
- disabled by setting the did_load_filetypes global variable. If this
- variable exists, $VIMRUNTIME/filetype.vim will not run.
- Example: >
- " Disable filetype.vim
- let g:did_load_filetypes = 1
-< 3. To use the new filetype detection you must restart Vim.
+< 3. To use the new filetype detection you must restart Vim.
Your filetype.vim will be sourced before the default FileType autocommands
have been installed. Your autocommands will match first, and the
@@ -296,6 +286,16 @@ the 'runtimepath' for a directory to use. If there isn't one, set
'runtimepath' in the |system-vimrc|. Be careful to keep the default
directories!
+ *g:do_legacy_filetype*
+To disable Nvim's default filetype detection and revert to Vim's legacy
+filetype detection, add the following to your |init.vim|: >
+ let g:do_legacy_filetype = 1
+< *g:did_load_filetypes*
+The builtin filetype detection provided by Nvim can be disabled by setting
+the `did_load_filetypes` global variable. If this variable exists, neither
+the default `$VIMRUNTIME/filetype.lua` nor the legacy `$VIMRUNTIME/filetype.vim`
+will run.
+
*plugin-details*
The "plugin" directory can be in any of the directories in the 'runtimepath'
option. All of these directories will be searched for plugins and they are
@@ -534,12 +534,31 @@ Options:
For further discussion of fortran_have_tabs and the method used for the
detection of source format see |ft-fortran-syntax|.
+
+FREEBASIC *ft-freebasic-plugin*
+
+This plugin aims to treat the four FreeBASIC dialects, "fb", "qb", "fblite"
+and "deprecated", as distinct languages.
+
+The dialect will be set to the first name found in g:freebasic_forcelang, any
+#lang directive or $lang metacommand in the file being edited, or finally
+g:freebasic_lang. These global variables conceptually map to the fbc options
+-forcelang and -lang. If no dialect is explicitly specified "fb" will be
+used.
+
+For example, to set the dialect to a default of "fblite" but still allow for
+any #lang directive overrides, use the following command: >
+
+ let g:freebasic_lang = "fblite"
+
+
GIT COMMIT *ft-gitcommit-plugin*
One command, :DiffGitCached, is provided to show a diff of the current commit
in the preview window. It is equivalent to calling "git diff --cached" plus
any arguments given to the command.
+
GPROF *ft-gprof-plugin*
The gprof filetype plugin defines a mapping <C-]> to jump from a function
@@ -549,6 +568,7 @@ to the details of that function in the call graph.
The mapping can be disabled with: >
let g:no_gprof_maps = 1
+
MAIL *ft-mail-plugin*
Options:
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
index 80c934d13b..9e3d78faff 100644
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -497,11 +497,13 @@ Note the use of backslashes to avoid some characters to be interpreted by the
:function MyFoldText()
: let line = getline(v:foldstart)
: let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
- : return v:folddashes . sub
+ : return v:folddashes .. sub
:endfunction
Evaluating 'foldtext' is done in the |sandbox|. The current window is set to
-the window that displays the line. Errors are ignored.
+the window that displays the line.
+
+Errors are ignored. For debugging set the 'debug' option to "throw".
The default value is |foldtext()|. This returns a reasonable text for most
types of folding. If you don't like it, you can specify your own 'foldtext'
diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt
index 771ccc3302..f6dfa708fb 100644
--- a/runtime/doc/ft_ada.txt
+++ b/runtime/doc/ft_ada.txt
@@ -89,9 +89,9 @@ file is opened and adds Ada related entries to the main and pop-up menu.
*ft-ada-omni*
The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either
-by "gnat xref -v" or the "exuberant Ctags (http://ctags.sourceforge.net). The
-complete function will automatically detect which tool was used to create the
-tags file.
+by "gnat xref -v" or the "Universal Ctags" (https://ctags.io). The complete
+function will automatically detect which tool was used to create the tags
+file.
------------------------------------------------------------------------------
3.1 Omni Completion with "gnat xref" ~
@@ -125,18 +125,18 @@ NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic
3.2 Omni Completion with "ctags"~
*ada-ctags*
-Exuberant Ctags uses its own multi-language code parser. The parser is quite
-fast, produces a lot of extra information (hence the name "Exuberant Ctags")
-and can run on files which currently do not compile.
+Universal/Exuberant Ctags use their own multi-language code parser. The
+parser is quite fast, produces a lot of extra information and can run on files
+which currently do not compile.
-There are also lots of other Vim-tools which use exuberant Ctags.
+There are also lots of other Vim-tools which use Universal/Exuberant Ctags.
+Universal Ctags is preferred, Exuberant Ctags is no longer being developed.
-You will need to install a version of the Exuberant Ctags which has Ada
-support patched in. Such a version is available from the GNU Ada Project
-(http://gnuada.sourceforge.net).
+You will need to install Universal Ctags which is available from
+https://ctags.io
-The Ada parser for Exuberant Ctags is fairly new - don't expect complete
-support yet.
+The Ada parser for Universal/Exuberant Ctags is fairly new - don't expect
+complete support yet.
==============================================================================
4. Compiler Support ~
diff --git a/runtime/doc/ft_raku.txt b/runtime/doc/ft_raku.txt
index 00b140ee9c..3d1179ed4e 100644
--- a/runtime/doc/ft_raku.txt
+++ b/runtime/doc/ft_raku.txt
@@ -47,20 +47,20 @@ Numbers, subscripts and superscripts are available with 's' and 'S':
But some don't come defined by default. Those are digraph definitions you can
add in your ~/.vimrc file. >
- exec 'digraph \\ '.char2nr('∖')
- exec 'digraph \< '.char2nr('≼')
- exec 'digraph \> '.char2nr('≽')
- exec 'digraph (L '.char2nr('⊈')
- exec 'digraph )L '.char2nr('⊉')
- exec 'digraph (/ '.char2nr('⊄')
- exec 'digraph )/ '.char2nr('⊅')
- exec 'digraph )/ '.char2nr('⊅')
- exec 'digraph U+ '.char2nr('⊎')
- exec 'digraph 0- '.char2nr('⊖')
+ exec 'digraph \\ ' .. char2nr('∖')
+ exec 'digraph \< ' .. char2nr('≼')
+ exec 'digraph \> ' .. char2nr('≽')
+ exec 'digraph (L ' .. char2nr('⊈')
+ exec 'digraph )L ' .. char2nr('⊉')
+ exec 'digraph (/ ' .. char2nr('⊄')
+ exec 'digraph )/ ' .. char2nr('⊅')
+ exec 'digraph )/ ' .. char2nr('⊅')
+ exec 'digraph U+ ' .. char2nr('⊎')
+ exec 'digraph 0- ' .. char2nr('⊖')
" Euler's constant
- exec 'digraph ne '.char2nr('𝑒')
+ exec 'digraph ne ' .. char2nr('𝑒')
" Raku's atomic operations marker
- exec 'digraph @@ '.char2nr('⚛')
+ exec 'digraph @@ ' .. char2nr('⚛')
Alternatively, you can write Insert mode abbreviations that convert ASCII-
based operators into their single-character Unicode equivalent. >
diff --git a/runtime/doc/ft_rust.txt b/runtime/doc/ft_rust.txt
index ff2e0ca56f..5c8782ec7a 100644
--- a/runtime/doc/ft_rust.txt
+++ b/runtime/doc/ft_rust.txt
@@ -26,7 +26,7 @@ behavior of the plugin.
g:rustc_path~
Set this option to the path to rustc for use in the |:RustRun| and
|:RustExpand| commands. If unset, "rustc" will be located in $PATH: >
- let g:rustc_path = $HOME."/bin/rustc"
+ let g:rustc_path = $HOME .. "/bin/rustc"
<
*g:rustc_makeprg_no_percent*
@@ -87,7 +87,7 @@ g:rust_bang_comment_leader~
g:ftplugin_rust_source_path~
Set this option to a path that should be prepended to 'path' for Rust
source files: >
- let g:ftplugin_rust_source_path = $HOME.'/dev/rust'
+ let g:ftplugin_rust_source_path = $HOME .. '/dev/rust'
<
*g:rustfmt_command*
diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt
index 53a99a9e1d..6972fe0768 100644
--- a/runtime/doc/ft_sql.txt
+++ b/runtime/doc/ft_sql.txt
@@ -109,8 +109,8 @@ must be configurable. The filetype plugin attempts to define many of the
standard objects, plus many additional ones. In order to make this as
flexible as possible, you can override the list of objects from within your
|vimrc| with the following: >
- let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' .
- \ ',schema,service,publication,database,datatype,domain' .
+ let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' ..
+ \ ',schema,service,publication,database,datatype,domain' ..
\ ',index,subscription,synchronization,view,variable'
The following |Normal| mode and |Visual| mode maps have been created which use
@@ -131,10 +131,10 @@ Repeatedly pressing ]} will cycle through each of these create statements: >
create index i1 on t1 (c1);
The default setting for g:ftplugin_sql_objects is: >
- let g:ftplugin_sql_objects = 'function,procedure,event,' .
- \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' .
- \ 'table,trigger' .
- \ ',schema,service,publication,database,datatype,domain' .
+ let g:ftplugin_sql_objects = 'function,procedure,event,' ..
+ \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' ..
+ \ 'table,trigger' ..
+ \ ',schema,service,publication,database,datatype,domain' ..
\ ',index,subscription,synchronization,view,variable'
The above will also handle these cases: >
@@ -555,7 +555,7 @@ the SQL completion plugin. >
< 1. After typing SELECT press <C-C>t to display a list of tables.
2. Highlight the table you need the column list for.
3. Press <Enter> to choose the table from the list.
- 4. Press <C-C>l to request a comma separated list of all columns
+ 4. Press <C-C>l to request a comma-separated list of all columns
for this table.
5. Based on the table name chosen in step 3, the plugin attempts to
decide on a reasonable table alias. You are then prompted to
@@ -609,7 +609,7 @@ your |init.vim|: >
>
omni_sql_use_tbl_alias
< - Default: a
- - This setting is only used when generating a comma separated
+ - This setting is only used when generating a comma-separated
column list. By default the map is <C-C>l. When generating
a column list, an alias can be prepended to the beginning of each
column, for example: e.emp_id, e.emp_name. This option has three
@@ -693,9 +693,9 @@ plugin. >
<C-C>c
< - Displays a list of columns for a specific table. >
<C-C>l
-< - Displays a comma separated list of columns for a specific table. >
+< - Displays a comma-separated list of columns for a specific table. >
<C-C>L
-< - Displays a comma separated list of columns for a specific table.
+< - Displays a comma-separated list of columns for a specific table.
This should only be used when the completion window is active. >
<Right>
< - Displays a list of columns for the table currently highlighted in
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index 812259741f..776ff228d6 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -195,6 +195,10 @@ the mouse button down on this will pop up a menu containing the item
"Big Changes", which is a sub-menu containing the item "Delete All Spaces",
which when selected, performs the operation.
+To create a menu for terminal mode, use |:tlmenu| instead of |:tmenu| unlike
+key mapping (|:tmap|). This is because |:tmenu| is already used for defining
+tooltips for menus. See |terminal-input|.
+
Special characters in a menu name:
& The next character is the shortcut key. Make sure each
@@ -214,9 +218,9 @@ this menu can be used. The second part is shown as "Open :e". The ":e"
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.
-To make the command work correctly, a character is automatically inserted for
-some modes:
+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
+automatically inserted for some modes:
mode inserted appended ~
Normal nothing nothing
Visual <C-C> <C-\><C-G>
@@ -224,9 +228,6 @@ some modes:
Cmdline <C-C> <C-\><C-G>
Op-pending <C-C> <C-\><C-G>
-Appending CTRL-\ CTRL-G is for going back to insert mode when 'insertmode' is
-set. |CTRL-\_CTRL-G|
-
Example: >
:amenu File.Next :next^M
@@ -440,6 +441,19 @@ You can define the special menu "PopUp". This is the menu that is displayed
when the right mouse button is pressed, if 'mousemodel' is set to popup or
popup_setpos.
+The default "PopUp" menu is: >
+ aunmenu PopUp
+ vnoremenu PopUp.Cut "+x
+ vnoremenu PopUp.Copy "+y
+ anoremenu PopUp.Paste "+gP
+ vnoremenu PopUp.Paste "+P
+ vnoremenu PopUp.Delete "_x
+ nnoremenu PopUp.Select\ All> ggVG
+ vnoremenu PopUp.Select\ All> gg0oG$
+ inoremenu PopUp.Select\ All <C-Home><C-O>VG
+ anoremenu PopUp.-1- <Nop>
+ anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
+<
Showing What Menus Are Mapped To *showing-menus*
@@ -472,6 +486,16 @@ Executing Menus *execute-menus*
insert-mode menu Eg: >
:emenu File.Exit
+:[range]em[enu] {mode} {menu} Like above, but execute the menu for {mode}:
+ 'n': |:nmenu| Normal mode
+ 'v': |:vmenu| Visual mode
+ 's': |:smenu| Select mode
+ 'o': |:omenu| Operator-pending mode
+ 't': |:tlmenu| Terminal mode
+ 'i': |:imenu| Insert mode
+ 'c': |:cmenu| Cmdline mode
+
+
You can use :emenu to access useful menu items you may have got used to from
GUI mode. See 'wildmenu' for an option that works well with this. See
|console-menus| for an example.
@@ -497,7 +521,9 @@ may be used to complete the name of the menu item for the appropriate mode.
To remove all menus use: *:unmenu-all* >
:unmenu * " remove all menus in Normal and visual mode
:unmenu! * " remove all menus in Insert and Command-line mode
- :aunmenu * " remove all menus in all modes
+ :aunmenu * " remove all menus in all modes, except for Terminal
+ " mode
+ :tlunmenu * " remove all menus in Terminal mode
If you want to get rid of the menu bar: >
:set guioptions-=m
@@ -550,6 +576,8 @@ See section |42.4| in the user manual.
:tu[nmenu] {menupath} Remove a tip for a menu or tool.
{only in X11 and Win32 GUI}
+Note: To create menus for terminal mode, use |:tlmenu| instead.
+
When a tip is defined for a menu item, it appears in the command-line area
when the mouse is over that item, much like a standard Windows menu hint in
the status bar. (Except when Vim is in Command-line mode, when of course
@@ -580,8 +608,8 @@ a menu item - you don't need to do a :tunmenu as well.
5.9 Popup Menus
-In the Win32 GUI, 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.
+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.
@@ -590,7 +618,6 @@ it behaves in a strange way.
:popu[p] {name} Popup the menu {name}. The menu named must
have at least one subentry, but need not
appear on the menu-bar (see |hidden-menus|).
- {only available for Win32 GUI}
:popu[p]! {name} Like above, but use the position of the mouse
pointer instead of the cursor.
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 173d3c0cdf..b97c9a2e3f 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -129,6 +129,7 @@ Advanced editing ~
|diff.txt| working with two to eight versions of the same file
|autocmd.txt| automatically executing commands on an event
|eval.txt| expression evaluation, conditional commands
+|builtin.txt| builtin functions
|fold.txt| hide (fold) ranges of lines
|lua.txt| Lua API
|api.txt| Nvim API via RPC, Lua and VimL
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index 03ec8966d4..569995d319 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -358,7 +358,7 @@ When referring to a Vim option in the help file, place the option name between
two single quotes, eg. 'statusline'
When referring to any other technical term, such as a filename or function
-parameter, surround it in backticks (`), eg. `~/.path/to/init.vim`.
+parameter, surround it in backticks, eg. `~/.path/to/init.vim`.
HIGHLIGHTING
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index fea47de220..9b434e61d7 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -1,10 +1,10 @@
*if_pyth.txt* Nvim
- VIM REFERENCE MANUAL by Paul Moore
+ NVIM REFERENCE MANUAL
-The Python Interface to Vim *if_pyth* *python* *Python*
+The Python Interface to NVim *if_pyth* *python* *Python*
See |provider-python| for more information.
@@ -134,7 +134,7 @@ Instead, put the Python command in a function and call that function:
Note that "EOF" must be at the start of the line.
==============================================================================
-The vim module *python-vim* *python2*
+The vim module *python-vim*
Python code gets all of its access to vim (with one exception - see
|python-output| below) via the "vim" module. The vim module implements two
@@ -322,14 +322,13 @@ Output from Python *python-output*
supported, and may cause the program to crash. This should probably be
fixed.
- *python2-directory* *python3-directory* *pythonx-directory*
+ *python3-directory* *pythonx-directory*
Python 'runtimepath' handling *python-special-path*
In python vim.VIM_SPECIAL_PATH special directory is used as a replacement for
the list of paths found in 'runtimepath': with this directory in sys.path and
vim.path_hooks in sys.path_hooks python will try to load module from
-{rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
-each {rtp} found in 'runtimepath'.
+{rtp}/python3 and {rtp}/pythonx for each {rtp} found in 'runtimepath'.
Implementation is similar to the following, but written in C: >
@@ -401,8 +400,8 @@ vim._get_paths *python-_get_paths*
hook. You should not rely on this method being present in future
versions, but can use it for debugging.
- It returns a list of {rtp}/python2 (or {rtp}/python3) and
- {rtp}/pythonx directories for each {rtp} in 'runtimepath'.
+ It returns a list of {rtp}/python3 and {rtp}/pythonx
+ directories for each {rtp} in 'runtimepath'.
==============================================================================
Buffer objects *python-buffer*
@@ -590,6 +589,11 @@ functions to evaluate Python expressions and pass their values to Vim script.
==============================================================================
Python 3 *python3*
+As Python 3 is the only supported version in Nvim, "python" is synonymous
+with "python3" in the current version. However, code that aims to support older
+versions of Neovim, as well as Vim, should prefer to use "python3"
+variants explicitly if Python 3 is required.
+
*:py3* *:python3*
:[range]py3 {stmt}
:[range]py3 << [endmarker]
@@ -619,31 +623,26 @@ Raising SystemExit exception in python isn't endorsed way to quit vim, use: >
:py vim.command("qall!")
<
*has-python*
-You can test what Python version is available with: >
- if has('python')
- echo 'there is Python 2.x'
+You can test if Python is available with: >
+ if has('pythonx')
+ echo 'there is Python'
endif
if has('python3')
echo 'there is Python 3.x'
endif
+Python 2 is no longer supported. Thus `has('python')` always returns
+zero for backwards compatibility reasons.
+
==============================================================================
Python X *python_x* *pythonx*
-Because most python code can be written so that it works with Python 2.6+ and
-Python 3, the pyx* functions and commands have been written. They work the
-same as the Python 2 and 3 variants, but select the Python version using the
-'pyxversion' setting.
-
-Set 'pyxversion' in your |vimrc| to prefer Python 2 or Python 3 for Python
-commands. Changing this setting at runtime risks losing the state of plugins
-(such as initialization).
-
-If you want to use a module, you can put it in the {rtp}/pythonx directory.
-See |pythonx-directory|.
+The "pythonx" and "pyx" prefixes were introduced for python code which
+works with Python 2.6+ and Python 3. As Nvim only supports Python 3,
+all these commands are now synonymous to their "python3" equivalents.
*:pyx* *:pythonx*
-`:pyx` and `:pythonx` work similar to `:python`. To check if `:pyx` works: >
+`:pyx` and `:pythonx` work the same as `:python3`. To check if `:pyx` works: >
:pyx print("Hello")
To see what version of Python is being used: >
@@ -651,33 +650,15 @@ To see what version of Python is being used: >
:pyx print(sys.version)
<
*:pyxfile* *python_x-special-comments*
-`:pyxfile` works similar to `:pyfile`. But you can add a "shebang" comment to
-force Vim to use `:pyfile` or `:py3file`: >
- #!/any string/python2 " Shebang. Must be the first line of the file.
- #!/any string/python3 " Shebang. Must be the first line of the file.
- # requires python 2.x " Maximum lines depend on 'modelines'.
- # requires python 3.x " Maximum lines depend on 'modelines'.
-Unlike normal modelines, the bottom of the file is not checked.
-If none of them are found, the 'pyxversion' option is used.
- *W20* *W21*
-If Vim does not support the selected Python version a silent message will be
-printed. Use `:messages` to read them.
+`:pyxfile` works the same as `:py3file`.
*:pyxdo*
-`:pyxdo` works similar to `:pydo`.
+`:pyxdo` works the same as `:py3do`.
*has-pythonx*
-To check if pyx* functions and commands are available: >
+To check if `pyx*` functions and commands are available: >
if has('pythonx')
- echo 'pyx* commands are available. (Python ' . &pyx . ')'
- endif
-
-If you prefer Python 2 and want to fallback to Python 3, set 'pyxversion'
-explicitly in your |.vimrc|. Example: >
- if has('python')
- set pyx=2
- elseif has('python3')
- set pyx=3
+ echo 'pyx* commands are available. (Python ' .. &pyx .. ')'
endif
==============================================================================
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index a76f8636f8..1a1d8e30b0 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -38,11 +38,12 @@ is not a C compiler: it does not recognize all syntax. One requirement is
that toplevel functions have a '{' in the first column. Otherwise they are
easily confused with declarations.
-These four options control C program indenting:
+These five options control C program indenting:
'cindent' Enables Vim to perform C program indenting automatically.
'cinkeys' Specifies which keys trigger reindenting in insert mode.
'cinoptions' Sets your preferred indent style.
'cinwords' Defines keywords that start an extra indent in the next line.
+'cinscopedecls' Defines strings that are recognized as a C++ scope declaration.
If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
Vim's built-in algorithm rather than calling an external program.
@@ -289,8 +290,9 @@ The examples below assume a 'shiftwidth' of 4.
<
*cino-g*
gN Place C++ scope declarations N characters from the indent of the
- block they are in. (default 'shiftwidth'). A scope declaration
- can be "public:", "protected:" or "private:".
+ block they are in. (default 'shiftwidth'). By default, a scope
+ declaration is "public:", "protected:" or "private:". This can
+ be adjusted with the 'cinscopedecls' option.
cino= cino=g0 >
{ {
@@ -771,6 +773,15 @@ You can set the indent for the first line after <script> and <style>
"auto" auto indent (same indent as the blocktag)
"inc" auto indent + one indent step
+You can set the indent for attributes after an open <tag line: >
+
+ :let g:html_indent_attribute = 1
+<
+ VALUE MEANING ~
+ 1 auto indent, one indent step more than <tag
+ 2 auto indent, two indent steps (default)
+ > 2 auto indent, more indent steps
+
Many tags increase the indent for what follows per default (see "Add Indent
Tags" in the script). You can add further tags with: >
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index d8689e2c65..25b98ae4ab 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -26,7 +26,7 @@ tag char action in Insert mode ~
insert
|i_CTRL-A| CTRL-A insert previously inserted text
|i_CTRL-C| CTRL-C quit insert mode, without checking for
- abbreviation, unless 'insertmode' set.
+ abbreviation
|i_CTRL-D| CTRL-D delete one shiftwidth of indent in the current
line
|i_CTRL-E| CTRL-E insert the character which is below the cursor
@@ -50,7 +50,6 @@ tag char action in Insert mode ~
|i_CTRL-J| CTRL-J same as <CR>
|i_CTRL-K| CTRL-K {char1} {char2}
enter digraph
-|i_CTRL-L| CTRL-L when 'insertmode' set: Leave Insert mode
|i_<CR>| <CR> begin new line
|i_CTRL-M| CTRL-M same as <CR>
|i_CTRL-N| CTRL-N find next match for keyword in front of the
@@ -86,11 +85,10 @@ tag char action in Insert mode ~
|i_CTRL-W| CTRL-W delete word before the cursor
|i_CTRL-X| CTRL-X {mode} enter CTRL-X sub mode, see |i_CTRL-X_index|
|i_CTRL-Y| CTRL-Y insert the character which is above the cursor
-|i_CTRL-Z| CTRL-Z when 'insertmode' set: suspend Vim
-|i_<Esc>| <Esc> end insert mode (unless 'insertmode' set)
+|i_<Esc>| <Esc> end insert mode
|i_CTRL-[| CTRL-[ same as <Esc>
|i_CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode
-|i_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode'
+|i_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode
CTRL-\ a - z reserved for extensions
CTRL-\ others not used
|i_CTRL-]| CTRL-] trigger abbreviation
@@ -221,7 +219,7 @@ tag char note action in Normal mode ~
|CTRL-Z| CTRL-Z suspend program (or start new shell)
CTRL-[ <Esc> not used
|CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode (no-op)
-|CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode'
+|CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode (no-op)
CTRL-\ a - z reserved for extensions
CTRL-\ others not used
|CTRL-]| CTRL-] :ta to ident under cursor
@@ -284,7 +282,7 @@ tag char note action in Normal mode ~
|/| /{pattern}<CR> 1 search forward for the Nth occurrence of
{pattern}
|/<CR>| /<CR> 1 search forward for {pattern} of last search
-|count| 0 1 cursor to the first char of the line
+|0| 0 1 cursor to the first char of the line
|count| 1 prepend to command to give a count
|count| 2 "
|count| 3 "
@@ -353,6 +351,7 @@ tag char note action in Normal mode ~
register x]
|Y| ["x]Y yank N lines [into register x]; synonym for
"yy"
+ Note: Mapped to "y$" by default. |default-mappings|
|ZZ| ZZ write if buffer changed and close window
|ZQ| ZQ close window without writing
|[| [{char} square bracket command (see |[| below)
@@ -430,6 +429,7 @@ tag char note action in Normal mode ~
|<C-LeftMouse>| <C-LeftMouse> ":ta" to the keyword at the mouse click
|<C-Right>| <C-Right> 1 same as "w"
|<C-RightMouse>| <C-RightMouse> same as "CTRL-T"
+|<C-Tab>| <C-Tab> same as "g<Tab>"
|<Del>| ["x]<Del> 2 same as "x"
|N<Del>| {count}<Del> remove the last digit from {count}
|<Down>| <Down> 1 same as "j"
@@ -576,7 +576,7 @@ tag command action in Normal mode ~
following the file name.
|CTRL-W_gt| CTRL-W g t same as `gt`: go to next tab page
|CTRL-W_gT| CTRL-W g T same as `gT`: go to previous tab page
-|CTRL-W_g<Tab>| CTRL-W g <Tab> same as `g<Tab>` : go to last accessed tab
+|CTRL-W_g<Tab>| CTRL-W g <Tab> same as |g<Tab>|: go to last accessed tab
page
|CTRL-W_h| CTRL-W h go to Nth left window (stop at first window)
|CTRL-W_i| CTRL-W i split window and jump to declaration of
@@ -890,7 +890,7 @@ here are those that are different.
tag command note action in Visual mode ~
------------------------------------------------------------------------------
|v_CTRL-\_CTRL-N| CTRL-\ CTRL-N stop Visual mode
-|v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode'
+|v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode
|v_CTRL-A| CTRL-A 2 add N to number in highlighted text
|v_CTRL-C| CTRL-C stop Visual mode
|v_CTRL-G| CTRL-G toggle between Visual mode and Select mode
@@ -923,7 +923,9 @@ tag command note action in Visual mode ~
before the highlighted area
|v_J| J 2 join the highlighted lines
|v_K| K run 'keywordprg' on the highlighted area
-|v_O| O Move horizontally to other corner of area.
+|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
@@ -986,6 +988,8 @@ tag command note action in Visual mode ~
|v_i{| i{ same as iB
|v_i}| i} same as iB
|v_o| o move cursor to other corner of area
+|v_p| p replace highlighted area with register
+ contents; deleted text in unnamed register
|v_r| r 2 replace highlighted area with a character
|v_s| s 2 delete highlighted area and start insert
|v_u| u 2 make highlighted area lowercase
@@ -1062,8 +1066,7 @@ tag command action in Command-line editing mode ~
|c_<Esc>| <Esc> abandon command-line without executing it
|c_CTRL-[| CTRL-[ same as <Esc>
|c_CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode, abandon command-line
-|c_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode',
- abandon command-line
+|c_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode, abandon command-line
CTRL-\ a - d reserved for extensions
|c_CTRL-\_e| CTRL-\ e {expr} replace the command line with the result of
{expr}
@@ -1495,8 +1498,9 @@ tag command action ~
|:recover| :rec[over] recover a file from a swap file
|:redo| :red[o] redo one undone change
|:redir| :redi[r] redirect messages to a file or register
-|:redraw| :redr[aw] force a redraw of the display
-|:redrawstatus| :redraws[tatus] force a redraw of the status line(s)
+|:redraw| :redr[aw] force a redraw of the display
+|:redrawstatus| :redraws[tatus] force a redraw of the status line(s) and
+ window bar(s)
|:redrawtabline| :redrawt[abline] force a redraw of the tabline
|:registers| :reg[isters] display the contents of registers
|:resize| :res[ize] change current window height
@@ -1618,17 +1622,20 @@ tag command action ~
|:tjump| :tj[ump] like ":tselect", but jump directly when there
is only one match
|:tlast| :tl[ast] jump to last matching tag
-|:tmapclear| :tmapc[lear] remove all mappings for Terminal-Job mode
-|:tmap| :tma[p] like ":map" but for Terminal-Job mode
+|:tlmenu| :tlm[enu] add menu for |Terminal-mode|
+|:tlnoremenu| :tln[oremenu] like ":noremenu" but for |Terminal-mode|
+|:tlunmenu| :tlu[nmenu] remove menu for |Terminal-mode|
+|:tmapclear| :tmapc[lear] remove all mappings for |Terminal-mode|
+|:tmap| :tma[p] like ":map" but for |Terminal-mode|
|:tmenu| :tm[enu] define menu tooltip
|:tnext| :tn[ext] jump to next matching tag
-|:tnoremap| :tno[remap] like ":noremap" but for Terminal-Job mode
+|:tnoremap| :tno[remap] like ":noremap" but for |Terminal-mode|
|:topleft| :to[pleft] make split window appear at top or far left
|:tprevious| :tp[revious] jump to previous matching tag
|:trewind| :tr[ewind] jump to first matching tag
|:try| :try execute commands, abort on error or exception
|:tselect| :ts[elect] list matching tags and select one
-|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode
+|:tunmap| :tunma[p] like ":unmap" but for |Terminal-mode|
|:tunmenu| :tu[nmenu] remove menu tooltip
|:undo| :u[ndo] undo last change(s)
|:undojoin| :undoj[oin] join next change with previous undo block
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index ae2b9c4418..a16d88b4e9 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -32,9 +32,6 @@ If you are working in a special language mode when inserting text, see the
'langmap' option, |'langmap'|, on how to avoid switching this mode on and off
all the time.
-If you have 'insertmode' set, <Esc> and a few other keys get another meaning.
-See |'insertmode'|.
-
char action ~
-----------------------------------------------------------------------
*i_CTRL-[* *i_<Esc>*
@@ -192,12 +189,14 @@ CTRL-D Delete one shiftwidth of indent at the start of the current
label.
*i_CTRL-V*
-CTRL-V Insert next non-digit literally. For special keys, the
- terminal code is inserted. It's also possible to enter the
- decimal, octal or hexadecimal value of a character
+CTRL-V Insert next non-digit literally. It's also possible to enter
+ the decimal, octal or hexadecimal value of a character
|i_CTRL-V_digit|.
The characters typed right after CTRL-V are not considered for
mapping.
+ For special keys, the CTRL modifier may be included into the
+ key to produce a control character. If there is no control
+ character for the key then its |key-notation| is inserted.
Note: When CTRL-V is mapped (e.g., to paste text) you can
often use CTRL-Q instead |i_CTRL-Q|.
@@ -206,6 +205,10 @@ CTRL-Q Same as CTRL-V.
Note: Some terminal connections may eat CTRL-Q, it doesn't
work then. It does work in the GUI.
+CTRL-SHIFT-V *i_CTRL-SHIFT-V* *i_CTRL-SHIFT-Q*
+CTRL-SHIFT-Q Works just like CTRL-V, but do not try to include the CTRL
+ modifier into the key.
+
CTRL-X Enter CTRL-X mode. This is a sub-mode where commands can
be given to complete words or scroll the window. See
|i_CTRL-X| and |ins-completion|.
@@ -258,7 +261,7 @@ CTRL-] Trigger abbreviation, without inserting a character.
*i_backspacing*
The effect of the <BS>, CTRL-W, and CTRL-U depend on the 'backspace' option
-(unless 'revins' is set). This is a comma separated list of items:
+(unless 'revins' is set). This is a comma-separated list of items:
item action ~
indent allow backspacing over autoindent
@@ -269,8 +272,8 @@ start allow backspacing over the start position of insert; CTRL-W and
When 'backspace' is empty, Vi compatible backspacing is used. You cannot
backspace over autoindent, before column 1 or before where insert started.
-For backwards compatibility the values "0", "1" and "2" are also allowed, see
-|'backspace'|.
+For backwards compatibility the values "0", "1", "2" and "3" are also allowed,
+see |'backspace'|.
If the 'backspace' option does contain "eol" and the cursor is in column 1
when one of the three keys is used, the current line is joined with the
@@ -329,9 +332,8 @@ that key is interpreted as in Insert mode.
The following keys are special. They stop the current insert, do something,
and then restart insertion. This means you can do something without getting
out of Insert mode. This is very handy if you prefer to use the Insert mode
-all the time, just like editors that don't have a separate Normal mode. You
-may also want to set the 'insertmode' option. You can use CTRL-O if you want
-to map a function key to a command.
+all the time, just like editors that don't have a separate Normal mode. You
+can use CTRL-O if you want to map a function key to a command.
The changes (inserted or deleted characters) before and after these keys can
be undone separately. Only the last change can be redone and always behaves
@@ -372,7 +374,6 @@ CTRL-G CTRL-J cursor one line down, insert start column *i_CTRL-G_CTRL-J*
<S-ScrollWheelRight> move window one page right *i_<S-ScrollWheelRight>*
CTRL-O execute one command, return to Insert mode *i_CTRL-O*
CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O*
-CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L*
CTRL-G u break undo sequence, start new change *i_CTRL-G_u*
CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U*
movement, if the cursor stays within the
@@ -653,8 +654,10 @@ Note: The keys that are valid in CTRL-X mode are not mapped. This allows for
ends CTRL-X mode (any key that is not a valid CTRL-X mode command) is mapped.
Also, when doing completion with 'complete' mappings apply as usual.
-Note: While completion is active Insert mode can't be used recursively.
-Mappings that somehow invoke ":normal i.." will generate an E523 error.
+ *E565*
+Note: While completion is active Insert mode can't be used recursively and
+buffer text cannot be changed. Mappings that somehow invoke ":normal i.."
+will generate an E565 error.
The following mappings are suggested to make typing the completion commands
a bit easier (although they will hide other commands): >
@@ -780,7 +783,7 @@ If the previous expansion was split, because it got longer than 'textwidth',
then just the text in the current line will be used.
If the match found is at the end of a line, then the first word in the next
-line will be inserted and the message "word from next line" displayed, if
+line will be inserted and the message "Word from other line" displayed, if
this word is accepted the next CTRL-X CTRL-P or CTRL-X CTRL-N will search
for those lines starting with this word.
@@ -798,6 +801,7 @@ CTRL-X CTRL-K Search the files given with the 'dictionary' option
the 'dictionary' option is empty.
For suggestions where to find a list of words, see the
'dictionary' option.
+ 'ignorecase', 'smartcase' and 'infercase' apply.
CTRL-K or
CTRL-N Search forward for next matching keyword. This
@@ -864,7 +868,7 @@ Groß): >
else
let res = []
let h = ''
- for l in split(system('aiksaurus '.shellescape(a:base)), '\n')
+ for l in split(system('aiksaurus ' .. shellescape(a:base)), '\n')
if l[:3] == '=== '
let h = substitute(l[4:], ' =*$', '', '')
elseif l[0] =~ '\a'
@@ -1199,7 +1203,7 @@ An example that completes the names of the months: >
" find months matching with "a:base"
let res = []
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
- if m =~ '^' . a:base
+ if m =~ '^' .. a:base
call add(res, m)
endif
endfor
@@ -1221,7 +1225,7 @@ The same, but now pretending searching for matches is slow: >
else
" find months matching with "a:base"
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
- if m =~ '^' . a:base
+ if m =~ '^' .. a:base
call complete_add(m)
endif
sleep 300m " simulate searching for next match
@@ -1341,11 +1345,16 @@ in 'runtimepath'. Thus for "java" it is autoload/javacomplete.vim.
C *ft-c-omni*
-Completion of C code requires a tags file. You should use Exuberant ctags,
-because it adds extra information that is needed for completion. You can find
-it here: http://ctags.sourceforge.net/ Version 5.6 or later is recommended.
+Completion of C code requires a tags file. You should use Universal/
+Exuberant ctags, because it adds extra information that is needed for
+completion. You can find it here:
+ Universal Ctags: https://ctags.io
+ Exuberant Ctags: http://ctags.sourceforge.net
-For version 5.5.4 you should add a patch that adds the "typename:" field:
+Universal Ctags is preferred, Exuberant Ctags is no longer being developed.
+
+For Exuberant ctags, version 5.6 or later is recommended. For version 5.5.4
+you should add a patch that adds the "typename:" field:
ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch
A compiled .exe for MS-Windows can be found at:
http://ctags.sourceforge.net/
@@ -1466,8 +1475,11 @@ will be suggested. All other elements are not placed in suggestion list.
PHP *ft-php-omni*
Completion of PHP code requires a tags file for completion of data from
-external files and for class aware completion. You should use Exuberant ctags
-version 5.5.4 or newer. You can find it here: http://ctags.sourceforge.net/
+external files and for class aware completion. You should use Universal/
+Exuberant ctags version 5.5.4 or newer. You can find it here:
+
+ Universal Ctags: https://ctags.io
+ Exuberant Ctags: http://ctags.sourceforge.net
Script completes:
@@ -1863,14 +1875,10 @@ gi Insert text in the same position as where Insert mode
*o*
o Begin a new line below the cursor and insert text,
repeat [count] times.
- When the '#' flag is in 'cpoptions' the count is
- ignored.
*O*
O Begin a new line above the cursor and insert text,
repeat [count] times.
- When the '#' flag is in 'cpoptions' the count is
- ignored.
These commands are used to start inserting text. You can end insert mode with
<Esc>. See |mode-ins-repl| for the other special characters in Insert mode.
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index 0e0156ac6b..51e823b75f 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -120,7 +120,7 @@ Vim would never have become what it is now, without the help of these people!
Daniel Elstner GTK+ 2 port
Eric Fischer Mac port, 'cindent', and other improvements
Benji Fisher Answering lots of user questions
- Bill Foster Athena GUI port
+ Bill Foster Athena GUI port (later removed)
Google Lets me work on Vim one day a week
Loic Grenie xvim (ideas for multi windows version)
Sven Guckes Vim promoter and previous WWW page maintainer
@@ -286,10 +286,12 @@ and <> are part of what you type, the context should make this clear.
*CTRL-{char}*
CTRL-{char} {char} typed as a control character; that is, typing {char}
- while holding the CTRL key down. The case of {char} does not
- matter; thus CTRL-A and CTRL-a are equivalent. But on some
- terminals, using the SHIFT key will produce another code,
- don't use it then.
+ while holding the CTRL key down. The case of {char} is
+ ignored; thus CTRL-A and CTRL-a are equivalent. But in
+ some terminals and environments, using the SHIFT key will
+ produce a distinct code (e.g. CTRL-SHIFT-a); in these
+ environments using the SHIFT key will not trigger commands
+ such as CTRL-A.
*'option'*
'option' An option, or parameter, that can be set to a value, is
@@ -322,7 +324,6 @@ notation meaning equivalent decimal value(s) ~
<Bar> vertical bar | 124 *<Bar>*
<Del> delete 127
<CSI> command sequence intro ALT-Esc 155 *<CSI>*
-<xCSI> CSI when typed in the GUI *<xCSI>*
<EOL> end-of-line (can be <CR>, <NL> or <CR><NL>,
depends on system and 'fileformat') *<EOL>*
@@ -384,6 +385,8 @@ Note:
combinations actually work depends on the the UI or host terminal.
- When a key is pressed using a meta or alt modifier and no mapping exists
for that keypress, Nvim behaves as though <Esc> was pressed before the key.
+- It is possible to notate combined modifiers (e.g. <C-A-T> for CTRL-ALT-T),
+ but your terminal must encode the input for that to work. |tui-input|
*<>*
Examples are often given in the <> notation. Sometimes this is just to make
@@ -421,8 +424,7 @@ Vim has seven BASIC modes:
*Normal* *Normal-mode* *command-mode*
Normal mode In Normal mode you can enter all the normal editor
commands. If you start the editor you are in this
- mode (unless you have set the 'insertmode' option,
- see below). This is also known as command mode.
+ mode. This is also known as command mode.
Visual mode This is like Normal mode, but the movement commands
extend a highlighted area. When a non-movement
@@ -548,8 +550,6 @@ Ex :vi -- -- -- -- --
*6 Go from Select mode to Insert mode by typing a printable character. The
selection is deleted and the character is inserted.
-If the 'insertmode' option is on, editing a file will start in Insert mode.
-
*CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*
Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
Normal mode from any other mode. This can be used to make sure Vim is in
@@ -558,17 +558,14 @@ work in Ex mode. When used after a command that takes an argument, such as
|f| or |m|, the timeout set with 'ttimeoutlen' applies.
*CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G*
-The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when
-'insertmode' is set. Otherwise it goes to Normal mode. This can be used to
-make sure Vim is in the mode indicated by 'insertmode', without knowing in
-what mode Vim currently is.
+CTRL-\ CTRL-G works the same as |CTRL-\_CTRL-N| for backward compatibility.
*gQ* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
gQ Switch to Ex mode. This is like typing ":" commands
one after another, except:
- You don't have to keep pressing ":".
- The screen doesn't get updated after each command.
- Use the ":vi" command |:visual| to exit this mode.
+ Use the `:vi` command (|:visual|) to exit this mode.
==============================================================================
Window contents *window-contents*
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index bb42a87034..78100d5277 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -24,88 +24,81 @@ QUICKSTART *lsp-quickstart*
Nvim provides an LSP client, but the servers are provided by third parties.
Follow these steps to get LSP features:
- 1. Install the nvim-lspconfig plugin. It provides common configuration for
- various servers so you can get started quickly.
- https://github.com/neovim/nvim-lspconfig
- 2. Install a language server. A list of language servers can be found here:
+ 1. Install language servers using your package manager or by
+ following the upstream installation instruction.
+
+ A list of language servers is available at:
+
https://microsoft.github.io/language-server-protocol/implementors/servers/
- See individual server documentation for installation instructions.
- 3. Add `lua require('lspconfig').xx.setup{…}` to your init.vim, where "xx" is
- the name of the relevant config. See the nvim-lspconfig README for details.
- NOTE: Make sure to restart nvim after installing and configuring.
- 4. Check that an LSP client has attached to the current buffer: >
- :lua print(vim.inspect(vim.lsp.buf_get_clients()))
+ 2. Configure the LSP client per language server.
+ A minimal example:
+>
+ vim.lsp.start({
+ name = 'my-server-name',
+ cmd = {'name-of-language-server-executable'},
+ root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]),
+ })
+<
+ See |vim.lsp.start| for details.
+
+ 3. Configure keymaps and autocmds to utilize LSP features.
+ See |lsp-config|.
<
*lsp-config*
-Inline diagnostics are enabled automatically, e.g. syntax errors will be
-annotated in the buffer. But you probably also want to use other features
-like go-to-definition, hover, etc.
-
-While Nvim does not provide an "auto-completion" framework by default, it is
-still possible to get completions from the LSP server. To incorporate these
-completions, it is recommended to use |vim.lsp.omnifunc|, which is an 'omnifunc'
-handler. When 'omnifunc' is set to `v:lua.vim.lsp.omnifunc`, |i_CTRL-X_CTRL-O|
-will provide completions from the language server.
-
-Example config (in init.vim): >
-
- lua << EOF
- local custom_lsp_attach = function(client)
- -- See `:help nvim_buf_set_keymap()` for more information
- vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true})
- vim.api.nvim_buf_set_keymap(0, 'n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', {noremap = true})
- -- ... and other keymappings for LSP
-
- -- Use LSP as the handler for omnifunc.
- -- See `:help omnifunc` and `:help ins-completion` for more information.
- vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-
- -- Use LSP as the handler for formatexpr.
- -- See `:help formatexpr` for more information.
- vim.api.nvim_buf_set_option(0, 'formatexpr', 'v:lua.vim.lsp.formatexpr()')
-
- -- For plugins with an `on_attach` callback, call them here. For example:
- -- require('completion').on_attach()
- end
-
- -- An example of configuring for `sumneko_lua`,
- -- a language server for Lua.
-
- -- set the path to the sumneko installation
- local system_name = "Linux" -- (Linux, macOS, or Windows)
- local sumneko_root_path = '/path/to/lua-language-server'
- local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server"
-
- require('lspconfig').sumneko_lua.setup({
- cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
- -- An example of settings for an LSP server.
- -- For more options, see nvim-lspconfig
- settings = {
- Lua = {
- runtime = {
- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
- version = 'LuaJIT',
- -- Setup your lua path
- path = vim.split(package.path, ';'),
- },
- diagnostics = {
- -- Get the language server to recognize the `vim` global
- globals = {'vim'},
- },
- workspace = {
- -- Make the server aware of Neovim runtime files
- library = {
- [vim.fn.expand('$VIMRUNTIME/lua')] = true,
- [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
- },
- },
- }
- },
-
- on_attach = custom_lsp_attach
+
+Starting a LSP client will automatically report diagnostics via
+|vim.diagnostic|. Read |vim.diagnostic.config| to learn how to customize the
+display.
+
+It also sets some buffer options if the options are otherwise empty and if the
+language server supports the functionality.
+
+- |omnifunc| is set to |vim.lsp.omnifunc|. This allows to trigger completion
+ using |i_CTRL-X_CTRL-o|
+- |tagfunc| is set to |vim.lsp.tagfunc|. This enables features like
+ go-to-definition, |:tjump|, and keymaps like |CTRL-]|, |CTRL-W_]|,
+ |CTRL-W_}| to utilize the language server.
+
+To use other LSP features like hover, rename, etc. you can setup some
+additional keymaps. It's recommended to setup them in a |LspAttach| autocmd to
+ensure they're only active if there is a LSP client running. An example:
+>
+ vim.api.nvim_create_autocmd('LspAttach', {
+ callback = function(args)
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = args.buf })
+ end,
})
- EOF
+
+<
+The most used functions are:
+
+- |vim.lsp.buf.hover()|
+- |vim.lsp.buf.format()|
+- |vim.lsp.buf.references()|
+- |vim.lsp.buf.implementation()|
+- |vim.lsp.buf.code_action()|
+
+
+Not all language servers provide the same capabilities. To ensure you only set
+keymaps if the language server supports a feature, you can guard the keymap
+calls behind capability checks:
+>
+ vim.api.nvim_create_autocmd('LspAttach', {
+ callback = function(args)
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+ if client.server_capabilities.hoverProvider then
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = args.buf })
+ end
+ end,
+ })
+<
+
+To learn what capabilities are available you can run the following command in
+a buffer with a started LSP client:
+
+>
+ :lua =vim.lsp.get_active_clients()[1].server_capabilities
<
Full list of features provided by default can be found in |lsp-buf|.
@@ -355,8 +348,8 @@ To configure the behavior of a builtin |lsp-handler|, the convenient method
*lsp-handler-resolution*
Handlers can be set by:
-- Setting a field in |vim.lsp.handlers|. *vim.lsp.handlers*
- |vim.lsp.handlers| is a global table that contains the default mapping of
+- Setting a field in vim.lsp.handlers. *vim.lsp.handlers*
+ vim.lsp.handlers is a global table that contains the default mapping of
|lsp-method| names to |lsp-handlers|.
To override the handler for the `"textDocument/definition"` method: >
@@ -461,6 +454,39 @@ LspSignatureActiveParameter
==============================================================================
EVENTS *lsp-events*
+ *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: >
+
+ 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,
+ })
+<
+ *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: >
+
+ vim.api.nvim_create_autocmd("LspDetach", {
+ callback = function(args)
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+ -- Do something with the client
+ vim.cmd("setlocal tagfunc< omnifunc<")
+ end,
+ })
+<
+In addition, the following |User| |autocommands| are provided:
+
LspProgressUpdate *LspProgressUpdate*
Upon receipt of a progress notification from the server. See
|vim.lsp.util.get_progress_messages()|.
@@ -495,16 +521,8 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
notification.
Parameters: ~
- {bufnr} number Buffer handle, or 0 for current
- {client_id} number Client id
-
-buf_get_clients({bufnr}) *vim.lsp.buf_get_clients()*
- Gets a map of client_id:client pairs for the given buffer,
- where each value is a |vim.lsp.client| object.
-
- Parameters: ~
- {bufnr} (optional, number): Buffer handle, or 0 for
- current
+ {bufnr} (number) Buffer handle, or 0 for current
+ {client_id} (number) Client id
buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()*
Checks if a buffer is attached for a particular client.
@@ -563,7 +581,7 @@ buf_request_all({bufnr}, {method}, {params}, {callback})
Return: ~
(function) A function that will cancel all requests which
- is the same as the one returned from `buf_request` .
+ is the same as the one returned from `buf_request`.
*vim.lsp.buf_request_sync()*
buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
@@ -600,9 +618,9 @@ client() *vim.lsp.client*
{handler} is not specified, If one is not found there,
then an error will occur. Returns: {status},
{[client_id]}. {status} is a boolean indicating if the
- notification was successful. If it is `false` , then it
+ notification was successful. If it is `false`, then it
will always be `false` (the client has shutdown). If
- {status} is `true` , the function returns {request_id} as
+ {status} is `true`, the function returns {request_id} as
the second result. You can use this with
`client.cancel_request(request_id)` to cancel the request.
• request_sync(method, params, timeout_ms, bufnr) Sends a
@@ -612,13 +630,13 @@ client() *vim.lsp.client*
`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` .
+ was unsuccessful returns `nil`.
• notify(method, params) Sends a notification to an LSP
server. Returns: a boolean to indicate if the notification
was successful. If it is false, then it will always be
false (the client has shutdown).
• cancel_request(id) Cancels a request with a given request
- id. Returns: same as `notify()` .
+ id. Returns: same as `notify()`.
• stop([force]) Stops a client, optionally with force. By
default, it will just ask the server to shutdown without
force. If you request to stop a client which has
@@ -639,23 +657,20 @@ client() *vim.lsp.client*
interaction with the client. See |vim.lsp.rpc.start()|.
• {offset_encoding} (string): The encoding used for
communicating with the server. You can modify this in the
- `config` 's `on_init` method before text is sent to the
+ `config`'s `on_init` method before text is sent to the
server.
• {handlers} (table): The handlers used by the client as
described in |lsp-handler|.
• {requests} (table): The current pending requests in flight
to the server. Entries are key-value pairs with the key
being the request ID while the value is a table with
- `type` , `bufnr` , and `method` key-value pairs. `type` is
+ `type`, `bufnr`, and `method` key-value pairs. `type` is
either "pending" for an active request, or "cancel" for a
cancel request.
• {config} (table): copy of the table that was passed by the
user to |vim.lsp.start_client()|.
• {server_capabilities} (table): Response from the server
sent on `initialize` describing the server's capabilities.
- • {resolved_capabilities} (table): Normalized table of
- capabilities that we have detected based on the initialize
- response from the server in `server_capabilities` .
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Checks whether a client is stopped.
@@ -671,11 +686,11 @@ for_each_buffer_client({bufnr}, {fn})
Invokes a function for each LSP client attached to a buffer.
Parameters: ~
- {bufnr} number Buffer number
- {fn} function Function to run on each client attached
- to buffer {bufnr}. The function takes the client,
- client ID, and buffer number as arguments.
- Example: >
+ {bufnr} (number) Buffer number
+ {fn} (function) Function to run on each client
+ attached to buffer {bufnr}. The function takes
+ the client, client ID, and buffer number as
+ arguments. Example: >
vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr)
print(vim.inspect(client))
@@ -686,27 +701,42 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
Provides an interface between the built-in client and a
`formatexpr` function.
- Currently only supports a single client. This can be set via `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in `on_attach` via vim.api.nvim_buf_set_option(bufnr, 'formatexpr , 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
+ Currently only supports a single client. This can be set via
+ `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will
+ typically or in `on_attach` via
+ `vim.api.nvim_buf_set_option(bufnr, 'formatexpr',
+ 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
Parameters: ~
- {opts} table options for customizing the formatting
+ {opts} (table) options for customizing the formatting
expression which takes the following optional
keys:
• timeout_ms (default 500ms). The timeout period
for the formatting request.
-get_active_clients() *vim.lsp.get_active_clients()*
- Gets all active clients.
+get_active_clients({filter}) *vim.lsp.get_active_clients()*
+ Get active clients.
+
+ Parameters: ~
+ {filter} (table|nil) A table with key-value pairs used to
+ filter the returned clients. The available keys
+ are:
+ • id (number): Only return clients with the
+ given id
+ • bufnr (number): Only return clients attached
+ to this buffer
+ • name (string): Only return clients with the
+ given name
Return: ~
- Table of |vim.lsp.client| objects
+ (table) List of |vim.lsp.client| objects
*vim.lsp.get_buffers_by_client_id()*
get_buffers_by_client_id({client_id})
Returns list of buffers attached to client_id.
Parameters: ~
- {client_id} number client id
+ {client_id} (number) client id
Return: ~
list of buffer ids
@@ -716,7 +746,7 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
client may not yet be fully initialized.
Parameters: ~
- {client_id} number client id
+ {client_id} (number) client id
Return: ~
|vim.lsp.client| object, or nil
@@ -749,8 +779,10 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
set_log_level({level}) *vim.lsp.set_log_level()*
Sets the global log level for LSP logging.
- Levels by name: "trace", "debug", "info", "warn", "error"
- Level numbers begin with "trace" at 0
+ Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR",
+ "OFF"
+
+ Level numbers begin with "TRACE" at 0
Use `lsp.log_levels` for reverse lookup.
@@ -761,6 +793,66 @@ set_log_level({level}) *vim.lsp.set_log_level()*
See also: ~
|vim.lsp.log_levels|
+start({config}, {opts}) *vim.lsp.start()*
+ Create a new LSP client and start a language server or reuses
+ an already running client if one is found matching `name` and
+ `root_dir`. Attaches the current buffer to the client.
+
+ Example:
+>
+
+ vim.lsp.start({
+ name = 'my-server-name',
+ cmd = {'name-of-language-server-executable'},
+ root_dir = vim.fs.dirname(vim.fs.find({'pyproject.toml', 'setup.py'}, { upward = true })[1]),
+ })
+<
+
+ See |lsp.start_client| for all available options. The most
+ important are:
+
+ `name` is an arbitrary name for the LSP client. It should be
+ unique per language server.
+
+ `cmd` the command as list - used to start the language server. The
+ command must be present in the `$PATH` environment variable or an absolute path to the executable.
+ Shell constructs like `~` are NOT expanded.
+
+ `root_dir` path to the project root. By default this is used
+ to decide if an existing client should be re-used. The example
+ above uses |vim.fs.find| and |vim.fs.dirname| to detect the
+ root by traversing the file system upwards starting from the
+ current directory until either a `pyproject.toml` or
+ `setup.py` file is found.
+
+ `workspace_folders` a list of { uri:string, name: string }
+ tables. The project root folders used by the language server.
+ If `nil` the property is derived from the `root_dir` for
+ convenience.
+
+ Language servers use this information to discover metadata
+ like the dependencies of your project and they tend to index
+ the contents within the project folder.
+
+ To ensure a language server is only started for languages it
+ can handle, make sure to call |vim.lsp.start| within a
+ |FileType| autocmd. Either use |:au|, |nvim_create_autocmd()|
+ or put the call in a `ftplugin/<filetype_name>.lua` (See
+ |ftplugin-name|)
+
+ Parameters: ~
+ {config} (table) Same configuration as documented in
+ |lsp.start_client()|
+ {opts} nil|table Optional keyword arguments:
+ • reuse_client (fun(client: client, config:
+ table): boolean) Predicate used to decide if a
+ client should be re-used. Used on all running
+ clients. The default implementation re-uses a
+ client if name and root_dir matches.
+
+ Return: ~
+ (number) client_id
+
start_client({config}) *vim.lsp.start_client()*
Starts and initializes a client with the given configuration.
@@ -775,7 +867,7 @@ start_client({config}) *vim.lsp.start_client()*
initiates the LSP client.
{cmd_cwd} (string, default=|getcwd()|)
Directory to launch the `cmd`
- process. Not related to `root_dir` .
+ process. Not related to `root_dir`.
{cmd_env} (table) Environment flags to pass to
the LSP on spawn. Can be specified
using keys like a map or as a list
@@ -784,6 +876,13 @@ start_client({config}) *vim.lsp.start_client()*
{ "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; }
<
+ {detached} (boolean, default true) Daemonize the
+ server process so that it runs in a
+ separate process group from Nvim.
+ Nvim will shutdown the process on
+ exit, but if Nvim fails to exit
+ cleanly this could leave behind
+ orphaned server processes.
{workspace_folders} (table) List of workspace folders
passed to the language server. For
backwards compatibility rootUri and
@@ -800,17 +899,17 @@ start_client({config}) *vim.lsp.start_client()*
its result.
• Note: To send an empty dictionary
use
- `{[vim.type_idx]=vim.types.dictionary}`
- , else it will be encoded as an
+ `{[vim.type_idx]=vim.types.dictionary}`,
+ else it will be encoded as an
array.
{handlers} Map of language server method names
to |lsp-handler|
{settings} Map with language server specific
settings. These are returned to the
language server if requested via
- `workspace/configuration` . Keys are
+ `workspace/configuration`. Keys are
case-sensitive.
- {commands} table Table that maps string of
+ {commands} (table) Table that maps string of
clientside commands to user-defined
functions. Commands passed to
start_client take precedence over the
@@ -821,7 +920,7 @@ start_client({config}) *vim.lsp.start_client()*
action, code lenses, ...) triggers
the command.
{init_options} Values to pass in the initialization
- request as `initializationOptions` .
+ request as `initializationOptions`.
See `initialize` in the LSP spec.
{name} (string, default=client-id) Name in
log messages.
@@ -890,7 +989,7 @@ start_client({config}) *vim.lsp.start_client()*
default 150): Debounce didChange
notifications to the server by the
given number in milliseconds. No
- debounce occurs if set to 0.
+ debounce occurs if nil
• exit_timeout (number, default 500):
Milliseconds to wait for server to
exit cleanly after sending the
@@ -898,10 +997,10 @@ start_client({config}) *vim.lsp.start_client()*
kill -15. If set to false, nvim
exits immediately after sending the
'shutdown' request to the server.
- {root_dir} string Directory where the LSP server
- will base its workspaceFolders,
- rootUri, and rootPath on
- initialization.
+ {root_dir} (string) Directory where the LSP
+ server will base its
+ workspaceFolders, rootUri, and
+ rootPath on initialization.
Return: ~
Client id. |vim.lsp.get_client_by_id()| Note: client may
@@ -925,7 +1024,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
Parameters: ~
{client_id} client id or |vim.lsp.client| object, or list
thereof
- {force} boolean (optional) shutdown forcefully
+ {force} (boolean) (optional) shutdown forcefully
tagfunc({...}) *vim.lsp.tagfunc()*
Provides an interface between the built-in client and
@@ -965,18 +1064,28 @@ add_workspace_folder({workspace_folder})
clear_references() *vim.lsp.buf.clear_references()*
Removes document highlights from current buffer.
-code_action({context}) *vim.lsp.buf.code_action()*
+code_action({options}) *vim.lsp.buf.code_action()*
Selects a code action available at the current cursor
position.
Parameters: ~
- {context} table|nil `CodeActionContext` of the LSP specification:
- • diagnostics: (table|nil) LSP`Diagnostic[]` . Inferred from the current position if not
- provided.
- • only: (string|nil) LSP `CodeActionKind` used
- to filter the code actions. Most language
- servers support values like `refactor` or
- `quickfix` .
+ {options} (table|nil) Optional table which holds the
+ following optional fields:
+ • context (table|nil): Corresponds to `CodeActionContext` of the LSP specification:
+ • diagnostics (table|nil): LSP`Diagnostic[]` . Inferred from the current position if not
+ provided.
+ • only (table|nil): List of LSP
+ `CodeActionKind`s used to filter the code
+ actions. Most language servers support
+ values like `refactor` or `quickfix`.
+
+ • filter (function|nil): Predicate function
+ taking an `CodeAction` and returning a
+ boolean.
+ • apply (boolean|nil): When set to `true`, and
+ there is just one remaining action (after
+ filtering), the action is applied without
+ user query.
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
@@ -995,20 +1104,30 @@ completion({context}) *vim.lsp.buf.completion()*
See also: ~
|vim.lsp.protocol.constants.CompletionTriggerKind|
-declaration() *vim.lsp.buf.declaration()*
+declaration({options}) *vim.lsp.buf.declaration()*
Jumps to the declaration of the symbol under the cursor.
Note:
Many servers do not implement this method. Generally, see
|vim.lsp.buf.definition()| instead.
-definition() *vim.lsp.buf.definition()*
+ Parameters: ~
+ {options} (table|nil) additional options
+ • reuse_win: (boolean) Jump to existing window
+ if buffer is already open.
+
+definition({options}) *vim.lsp.buf.definition()*
Jumps to the definition of the symbol under the cursor.
+ Parameters: ~
+ {options} (table|nil) additional options
+ • reuse_win: (boolean) Jump to existing window
+ if buffer is already open.
+
document_highlight() *vim.lsp.buf.document_highlight()*
Send request to the server to resolve document highlights for
the current text document position. This request can be
- triggered by a key mapping or by events such as `CursorHold` ,
- eg:
+ triggered by a key mapping or by events such as `CursorHold`,
+ e.g.:
>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
@@ -1024,20 +1143,58 @@ document_symbol() *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix
window.
-execute_command({command}) *vim.lsp.buf.execute_command()*
+execute_command({command_params}) *vim.lsp.buf.execute_command()*
Executes an LSP server command.
Parameters: ~
- {command} A valid `ExecuteCommandParams` object
+ {command_params} (table) A valid `ExecuteCommandParams`
+ object
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
+format({options}) *vim.lsp.buf.format()*
+ Formats a buffer using the attached (and optionally filtered)
+ language server clients.
+
+ Parameters: ~
+ {options} table|nil Optional table which holds the
+ following optional fields:
+ • formatting_options (table|nil): Can be used
+ to specify FormattingOptions. Some
+ unspecified options will be automatically
+ derived from the current Neovim options.
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
+ • timeout_ms (integer|nil, default 1000): Time in
+ milliseconds to block for formatting requests. No effect
+ if async=true
+ • bufnr (number|nil): Restrict formatting to the clients
+ attached to the given buffer, defaults to the current
+ buffer (0).
+ • filter (function|nil): Predicate used to filter clients.
+ Receives a client as argument and must return a boolean.
+ Clients matching the predicate are included. Example: • >
+
+ -- Never request typescript-language-server for formatting
+ vim.lsp.buf.format {
+ filter = function(client) return client.name ~= "tsserver" end
+ }
+<
+ • async boolean|nil If true the method won't block.
+ Defaults to false. Editing the buffer while formatting
+ asynchronous can lead to unexpected changes.
+ • id (number|nil): Restrict formatting to the client with
+ ID (client.id) matching this field.
+ • name (string|nil): Restrict formatting to the client
+ with name (client.name) matching this field.
+
formatting({options}) *vim.lsp.buf.formatting()*
Formats the current buffer.
Parameters: ~
- {options} (optional, table) Can be used to specify
+ {options} (table|nil) Can be used to specify
FormattingOptions. Some unspecified options
will be automatically derived from the current
Neovim options.
@@ -1061,15 +1218,13 @@ formatting_seq_sync({options}, {timeout_ms}, {order})
<
Parameters: ~
- {options} (optional, table) `FormattingOptions`
- entries
- {timeout_ms} (optional, number) Request timeout
- {order} (optional, table) List of client names.
- Formatting is requested from clients in the
- following order: first all clients that are
- not in the `order` list, then the remaining
- clients in the order as they occur in the
- `order` list.
+ {options} (table|nil) `FormattingOptions` entries
+ {timeout_ms} (number|nil) Request timeout
+ {order} (table|nil) List of client names. Formatting
+ is requested from clients in the following
+ order: first all clients that are not in the
+ `order` list, then the remaining clients in
+ the order as they occur in the `order` list.
*vim.lsp.buf.formatting_sync()*
formatting_sync({options}, {timeout_ms})
@@ -1084,7 +1239,8 @@ formatting_sync({options}, {timeout_ms})
<
Parameters: ~
- {options} Table with valid `FormattingOptions` entries
+ {options} (table|nil) with valid `FormattingOptions`
+ entries
{timeout_ms} (number) Request timeout
See also: ~
@@ -1117,13 +1273,13 @@ range_code_action({context}, {start_pos}, {end_pos})
Performs |vim.lsp.buf.code_action()| for a given range.
Parameters: ~
- {context} table|nil `CodeActionContext` of the LSP specification:
+ {context} (table|nil) `CodeActionContext` of the LSP specification:
• diagnostics: (table|nil) LSP`Diagnostic[]` . Inferred from the current position if not
provided.
- • only: (string|nil) LSP `CodeActionKind`
- used to filter the code actions. Most
- language servers support values like
- `refactor` or `quickfix` .
+ • only: (table|nil) List of LSP
+ `CodeActionKind`s used to filter the code
+ actions. Most language servers support
+ values like `refactor` or `quickfix`.
{start_pos} ({number, number}, optional) mark-indexed
position. Defaults to the start of the last
visual selection.
@@ -1160,13 +1316,21 @@ remove_workspace_folder({workspace_folder})
{path} is not provided, the user will be prompted for a path
using |input()|.
-rename({new_name}) *vim.lsp.buf.rename()*
+rename({new_name}, {options}) *vim.lsp.buf.rename()*
Renames all references to the symbol under the cursor.
Parameters: ~
- {new_name} (string) If not provided, the user will be
+ {new_name} (string|nil) If not provided, the user will be
prompted for a new name using
|vim.ui.input()|.
+ {options} (table|nil) additional options
+ • filter (function|nil): Predicate used to
+ filter clients. Receives a client as
+ argument and must return a boolean. Clients
+ matching the predicate are included.
+ • name (string|nil): Restrict clients used for
+ rename to ones where client.name matches
+ this field.
server_ready() *vim.lsp.buf.server_ready()*
Checks whether the language servers attached to the current
@@ -1179,10 +1343,15 @@ signature_help() *vim.lsp.buf.signature_help()*
Displays signature information about the symbol under the
cursor in a floating window.
-type_definition() *vim.lsp.buf.type_definition()*
+type_definition({options}) *vim.lsp.buf.type_definition()*
Jumps to the definition of the type of the symbol under the
cursor.
+ Parameters: ~
+ {options} (table|nil) additional options
+ • reuse_win: (boolean) Jump to existing window
+ if buffer is already open.
+
workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()*
Lists all symbols in the current workspace in the quickfix
window.
@@ -1204,7 +1373,7 @@ get_namespace({client_id}) *vim.lsp.diagnostic.get_namespace()*
|vim.diagnostic|.
Parameters: ~
- {client_id} number The id of the LSP client
+ {client_id} (number) The id of the LSP client
*vim.lsp.diagnostic.on_publish_diagnostics()*
on_publish_diagnostics({_}, {result}, {ctx}, {config})
@@ -1224,8 +1393,8 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config})
},
-- Use a function to dynamically turn signs off
-- and on, using buffer local variables
- signs = function(bufnr, client_id)
- return vim.bo[bufnr].show_signs == false
+ signs = function(namespace, bufnr)
+ return vim.b[bufnr].show_signs == true
end,
-- Disable a feature
update_in_insert = false,
@@ -1234,7 +1403,7 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config})
<
Parameters: ~
- {config} table Configuration table (see
+ {config} (table) Configuration table (see
|vim.diagnostic.config()|).
@@ -1245,20 +1414,20 @@ display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()*
Display the lenses using virtual text
Parameters: ~
- {lenses} table of lenses to display ( `CodeLens[] |
- null` )
- {bufnr} number
- {client_id} number
+ {lenses} (table) of lenses to display (`CodeLens[] |
+ null`)
+ {bufnr} (number)
+ {client_id} (number)
get({bufnr}) *vim.lsp.codelens.get()*
Return all lenses for the given buffer
Parameters: ~
- {bufnr} number Buffer number. 0 can be used for the
+ {bufnr} (number) Buffer number. 0 can be used for the
current buffer.
Return: ~
- table ( `CodeLens[]` )
+ (table) (`CodeLens[]`)
*vim.lsp.codelens.on_codelens()*
on_codelens({err}, {result}, {ctx}, {_})
@@ -1280,10 +1449,10 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
Store lenses for a specific buffer and client
Parameters: ~
- {lenses} table of lenses to store ( `CodeLens[] |
- null` )
- {bufnr} number
- {client_id} number
+ {lenses} (table) of lenses to store (`CodeLens[] |
+ null`)
+ {bufnr} (number)
+ {client_id} (number)
==============================================================================
@@ -1301,7 +1470,7 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
<
Parameters: ~
- {config} table Configuration table.
+ {config} (table) Configuration table.
• border: (default=nil)
• Add borders to the floating window
• See |nvim_open_win()|
@@ -1321,7 +1490,7 @@ signature_help({_}, {result}, {ctx}, {config})
<
Parameters: ~
- {config} table Configuration table.
+ {config} (table) Configuration table.
• border: (default=nil)
• Add borders to the floating window
• See |vim.api.nvim_open_win()|
@@ -1331,8 +1500,8 @@ signature_help({_}, {result}, {ctx}, {config})
Lua module: vim.lsp.util *lsp-util*
*vim.lsp.util.apply_text_document_edit()*
-apply_text_document_edit({text_document_edit}, {index})
- Applies a `TextDocumentEdit` , which is a list of changes to a
+apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
+ Applies a `TextDocumentEdit`, which is a list of changes to a
single document.
Parameters: ~
@@ -1349,39 +1518,37 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Applies a list of text edits to a buffer.
Parameters: ~
- {text_edits} table list of `TextEdit` objects
- {bufnr} number Buffer id
- {offset_encoding} string utf-8|utf-16|utf-32|nil defaults
- to encoding of first client of `bufnr`
+ {text_edits} (table) list of `TextEdit` objects
+ {bufnr} (number) Buffer id
+ {offset_encoding} (string) utf-8|utf-16|utf-32
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
*vim.lsp.util.apply_workspace_edit()*
-apply_workspace_edit({workspace_edit})
- Applies a `WorkspaceEdit` .
+apply_workspace_edit({workspace_edit}, {offset_encoding})
+ Applies a `WorkspaceEdit`.
Parameters: ~
- {workspace_edit} (table) `WorkspaceEdit`
+ {workspace_edit} (table) `WorkspaceEdit`
+ {offset_encoding} (string) utf-8|utf-16|utf-32 (required)
buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer.
Parameters: ~
- {bufnr} number Buffer id
+ {bufnr} (number) Buffer id
*vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {offset_encoding})
Shows a list of document highlights for a certain buffer.
Parameters: ~
- {bufnr} number Buffer id
- {references} table List of `DocumentHighlight`
+ {bufnr} (number) Buffer id
+ {references} (table) List of `DocumentHighlight`
objects to highlight
- {offset_encoding} string One of "utf-8", "utf-16",
- "utf-32", or nil. Defaults to
- `offset_encoding` of first client of
- `bufnr`
+ {offset_encoding} (string) One of "utf-8", "utf-16",
+ "utf-32".
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight
@@ -1395,9 +1562,9 @@ character_offset({buf}, {row}, {col}, {offset_encoding})
{buf} buffer id (0 for current)
{row} 0-indexed line
{col} 0-indexed byte offset in line
- {offset_encoding} string utf-8|utf-16|utf-32|nil defaults
- to `offset_encoding` of first client of
- `buf`
+ {offset_encoding} (string) utf-8|utf-16|utf-32|nil
+ defaults to `offset_encoding` of first
+ client of `buf`
Return: ~
(number, number) `offset_encoding` index of the character
@@ -1408,13 +1575,13 @@ convert_input_to_markdown_lines({input}, {contents})
Converts any of `MarkedString` | `MarkedString[]` |
`MarkupContent` into a list of lines containing valid
markdown. Useful to populate the hover window for
- `textDocument/hover` , for parsing the result of
- `textDocument/signatureHelp` , and potentially others.
+ `textDocument/hover`, for parsing the result of
+ `textDocument/signatureHelp`, and potentially others.
Parameters: ~
- {input} ( `MarkedString` | `MarkedString[]` |
- `MarkupContent` )
- {contents} (table, optional, default `{}` ) List of
+ {input} (`MarkedString` | `MarkedString[]` |
+ `MarkupContent`)
+ {contents} (table, optional, default `{}`) List of
strings to extend with converted lines
Return: ~
@@ -1458,28 +1625,32 @@ extract_completion_items({result})
https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
- Returns visual width of tabstop.
+ Returns indentation size.
Parameters: ~
- {bufnr} (optional, number): Buffer handle, defaults to
- current
+ {bufnr} (number|nil): Buffer handle, defaults to current
Return: ~
- (number) tabstop visual width
+ (number) indentation size
See also: ~
- |softtabstop|
+ |shiftwidth|
-jump_to_location({location}) *vim.lsp.util.jump_to_location()*
+ *vim.lsp.util.jump_to_location()*
+jump_to_location({location}, {offset_encoding}, {reuse_win})
Jumps to a location.
Parameters: ~
- {location} ( `Location` | `LocationLink` )
+ {location} (table) (`Location`|`LocationLink`)
+ {offset_encoding} (string) utf-8|utf-16|utf-32 (required)
+ {reuse_win} (boolean) Jump to existing window if
+ buffer is already opened.
Return: ~
`true` if the jump succeeded
-locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
+ *vim.lsp.util.locations_to_items()*
+locations_to_items({locations}, {offset_encoding})
Returns the items with the byte position calculated correctly
and in sorted order, for display in quickfix and location
lists.
@@ -1488,8 +1659,10 @@ locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
|setqflist()| or |setloclist()|.
Parameters: ~
- {locations} (table) list of `Location` s or
- `LocationLink` s
+ {locations} (table) list of `Location`s or
+ `LocationLink`s
+ {offset_encoding} (string) offset_encoding for locations
+ utf-8|utf-16|utf-32
Return: ~
(table) list of items
@@ -1521,7 +1694,7 @@ make_floating_popup_options({width}, {height}, {opts})
• border (string or table) override `border`
• focusable (string or table) override
`focusable`
- • zindex (string or table) override `zindex` ,
+ • zindex (string or table) override `zindex`,
defaults to 50
Return: ~
@@ -1533,7 +1706,8 @@ make_formatting_params({options})
buffer and cursor position.
Parameters: ~
- {options} Table with valid `FormattingOptions` entries
+ {options} (table|nil) with valid `FormattingOptions`
+ entries
Return: ~
`DocumentFormattingParams` object
@@ -1555,13 +1729,13 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
end of the last visual selection.
{bufnr} (optional, number): buffer handle or 0
for current, defaults to current
- {offset_encoding} string utf-8|utf-16|utf-32|nil defaults
- to `offset_encoding` of first client of
- `bufnr`
+ {offset_encoding} (string) utf-8|utf-16|utf-32|nil
+ defaults to `offset_encoding` of first
+ client of `bufnr`
Return: ~
{ textDocument = { uri = `current_file_uri` }, range = {
- start = `start_position` , end = `end_position` } }
+ start = `start_position`, end = `end_position` } }
*vim.lsp.util.make_position_params()*
make_position_params({window}, {offset_encoding})
@@ -1571,9 +1745,9 @@ make_position_params({window}, {offset_encoding})
Parameters: ~
{window} (optional, number): window handle or 0
for current, defaults to current
- {offset_encoding} string utf-8|utf-16|utf-32|nil defaults
- to `offset_encoding` of first client of
- buffer of `window`
+ {offset_encoding} (string) utf-8|utf-16|utf-32|nil
+ defaults to `offset_encoding` of first
+ client of buffer of `window`
Return: ~
`TextDocumentPositionParams` object
@@ -1585,20 +1759,20 @@ make_position_params({window}, {offset_encoding})
make_range_params({window}, {offset_encoding})
Using the current position in the current buffer, creates an
object that can be used as a building block for several LSP
- requests, such as `textDocument/codeAction` ,
- `textDocument/colorPresentation` ,
- `textDocument/rangeFormatting` .
+ requests, such as `textDocument/codeAction`,
+ `textDocument/colorPresentation`,
+ `textDocument/rangeFormatting`.
Parameters: ~
{window} (optional, number): window handle or 0
for current, defaults to current
- {offset_encoding} string utf-8|utf-16|utf-32|nil defaults
- to `offset_encoding` of first client of
- buffer of `window`
+ {offset_encoding} (string) utf-8|utf-16|utf-32|nil
+ defaults to `offset_encoding` of first
+ client of buffer of `window`
Return: ~
{ textDocument = { uri = `current_file_uri` }, range = {
- start = `current_position` , end = `current_position` } }
+ start = `current_position`, end = `current_position` } }
*vim.lsp.util.make_text_document_params()*
make_text_document_params({bufnr})
@@ -1628,15 +1802,15 @@ open_floating_preview({contents}, {syntax}, {opts})
Shows contents in a floating window.
Parameters: ~
- {contents} table of lines to show in window
- {syntax} string of syntax to set for opened buffer
- {opts} table with optional fields (additional keys
+ {contents} (table) of lines to show in window
+ {syntax} (string) of syntax to set for opened buffer
+ {opts} (table) with optional fields (additional keys
are passed on to |vim.api.nvim_open_win()|)
• height: (number) height of floating window
• width: (number) width of floating window
• wrap: (boolean, default true) wrap long
lines
- • wrap_at: (string) character to wrap at for
+ • wrap_at: (number) character to wrap at for
computing height when wrap is enabled
• max_width: (number) maximal width of
floating window
@@ -1652,8 +1826,8 @@ open_floating_preview({contents}, {syntax}, {opts})
closes the floating window
• focusable: (boolean, default true) Make
float focusable
- • focus: (boolean, default true) If `true` ,
- and if {focusable} is also `true` , focus an
+ • focus: (boolean, default true) If `true`,
+ and if {focusable} is also `true`, focus an
existing floating window with the same
{focus_id}
@@ -1665,10 +1839,10 @@ parse_snippet({input}) *vim.lsp.util.parse_snippet()*
Parses snippets in a completion entry.
Parameters: ~
- {input} string unparsed snippet
+ {input} (string) unparsed snippet
Return: ~
- string parsed snippet
+ (string) parsed snippet
preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
Previews a location in a floating window
@@ -1721,7 +1895,7 @@ stylize_markdown({bufnr}, {contents}, {opts})
`open_floating_preview` instead
Parameters: ~
- {contents} table of lines to show in window
+ {contents} (table) of lines to show in window
{opts} dictionary with optional fields
• height of floating window
• width of floating window
@@ -1752,7 +1926,7 @@ text_document_completion_list_to_complete_items({result}, {prefix})
Parameters: ~
{result} The result of a `textDocument/completion` call,
e.g. from |vim.lsp.buf.completion()|, which may
- be one of `CompletionItem[]` , `CompletionList`
+ be one of `CompletionItem[]`, `CompletionList`
or `null`
{prefix} (string) the prefix to filter the completion
items
@@ -1799,14 +1973,15 @@ get_level() *vim.lsp.log.get_level()*
Gets the current log level.
Return: ~
- string current log level
+ (string) current log level
set_format_func({handle}) *vim.lsp.log.set_format_func()*
Sets formatting function used to format logs
Parameters: ~
- {handle} function function to apply to logging arguments,
- pass vim.inspect for multi-line formatting
+ {handle} (function) function to apply to logging
+ arguments, pass vim.inspect for multi-line
+ formatting
set_level({level}) *vim.lsp.log.set_level()*
Sets the current log level.
@@ -1818,7 +1993,7 @@ should_log({level}) *vim.lsp.log.should_log()*
Checks whether the level is sufficient for logging.
Parameters: ~
- {level} number log level
+ {level} (number) log level
Return: ~
(bool) true if would log, false if not
@@ -1857,8 +2032,8 @@ request({method}, {params}, {callback}, {notify_reply_callback})
{params} (table) Parameters for the
invoked LSP method
{callback} (function) Callback to invoke
- {notify_reply_callback} (function) Callback to invoke as
- soon as a request is no longer
+ {notify_reply_callback} (function|nil) Callback to invoke
+ as soon as a request is no longer
pending
Return: ~
@@ -1918,25 +2093,24 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
Lua module: vim.lsp.sync *lsp-sync*
*vim.lsp.sync.compute_diff()*
-compute_diff({prev_lines}, {curr_lines}, {firstline}, {lastline},
- {new_lastline}, {offset_encoding}, {line_ending})
+compute_diff({___MissingCloseParenHere___})
Returns the range table for the difference between prev and
curr lines
Parameters: ~
- {prev_lines} table list of lines
- {curr_lines} table list of lines
- {firstline} number line to begin search for first
+ {prev_lines} (table) list of lines
+ {curr_lines} (table) list of lines
+ {firstline} (number) line to begin search for first
difference
- {lastline} number line to begin search in
+ {lastline} (number) line to begin search in
old_lines for last difference
- {new_lastline} number line to begin search in
+ {new_lastline} (number) line to begin search in
new_lines for last difference
- {offset_encoding} string encoding requested by language
+ {offset_encoding} (string) encoding requested by language
server
Return: ~
- table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent
+ (table) TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent
==============================================================================
@@ -1953,10 +2127,10 @@ resolve_capabilities({server_capabilities})
capabilities.
Parameters: ~
- {server_capabilities} table Table of capabilities
+ {server_capabilities} (table) Table of capabilities
supported by the server
Return: ~
- table Normalized table of capabilities
+ (table) Normalized table of capabilities
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 80c1f58323..089cf0ce9d 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -4,65 +4,89 @@
NVIM REFERENCE MANUAL
-Lua engine *lua* *Lua*
+Lua engine *lua* *Lua*
- Type |gO| to see the table of contents.
+ Type |gO| to see the table of contents.
==============================================================================
-INTRODUCTION *lua-intro*
+INTRODUCTION *lua-intro*
-The Lua 5.1 language is builtin and always available. Try this command to get
+The Lua 5.1 language is builtin and always available. Try this command to get
an idea of what lurks beneath: >
:lua print(vim.inspect(package.loaded))
+<
+Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the
+"editor stdlib" (|builtin-functions| and Ex commands) and the |API|, all of
+which can be used from Lua code. A good overview of using Lua in neovim is
+given by https://github.com/nanotee/nvim-lua-guide.
-Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the
-"editor stdlib" (|functions| and Ex commands) and the |API|, all of which can
-be used from Lua code. A good overview of using Lua in neovim is given by
-https://github.com/nanotee/nvim-lua-guide.
-
-Module conflicts are resolved by "last wins". For example if both of these
-are on 'runtimepath':
- runtime/lua/foo.lua
- ~/.config/nvim/lua/foo.lua
-then `require('foo')` loads "~/.config/nvim/lua/foo.lua", and
-"runtime/lua/foo.lua" is not used. See |lua-require| to understand how Nvim
-finds and loads Lua modules. The conventions are similar to those of
-Vimscript |plugin|s, with some extra features. See |lua-require-example| for
-a walkthrough.
+The |:source| and |:runtime| commands can run Lua scripts as well as Vim
+scripts. Lua modules can be loaded with `require('name')`, which
+conventionally returns a table but can return any value.
-==============================================================================
-IMPORTING LUA MODULES *lua-require*
+See |lua-require| for details on how Nvim finds and loads Lua modules.
+See |lua-require-example| for an example of how to write and use a module.
- *lua-package-path*
-Nvim automatically adjusts `package.path` and `package.cpath` according to
-effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is
-changed. `package.path` is adjusted by simply appending `/lua/?.lua` and
+==============================================================================
+IMPORTING LUA MODULES *lua-require*
+
+Modules are searched for under the directories specified in 'runtimepath', in
+the order they appear. Any `.` in the module name is treated as a directory
+separator when searching. For a module `foo.bar`, each directory is searched
+for `lua/foo/bar.lua`, then `lua/foo/bar/init.lua`. If no files are found,
+the directories are searched again for a shared library with a name matching
+`lua/foo/bar.?`, where `?` is a list of suffixes (such as `so` or `dll`) derived from
+the initial value of `package.cpath`. If still no files are found, Nvim falls
+back to Lua's default search mechanism. The first script found is run and
+`require()` returns the value returned by the script if any, else `true`.
+
+The return value is cached after the first call to `require()` for each module,
+with subsequent calls returning the cached value without searching for, or
+executing any script. For further details on `require()`, see the Lua
+documentation at https://www.lua.org/manual/5.1/manual.html#pdf-require.
+
+For example, if 'runtimepath' is `foo,bar` and `package.cpath` was
+`./?.so;./?.dll` at startup, `require('mod')` searches these paths in order
+and loads the first module found:
+
+ foo/lua/mod.lua
+ foo/lua/mod/init.lua
+ bar/lua/mod.lua
+ bar/lua/mod/init.lua
+ foo/lua/mod.so
+ foo/lua/mod.dll
+ bar/lua/mod.so
+ bar/lua/mod.dll
+
+Nvim automatically adjusts `package.path` and `package.cpath` according to the
+effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is
+changed. `package.path` is adjusted by simply appending `/lua/?.lua` and
`/lua/?/init.lua` to each directory from 'runtimepath' (`/` is actually the
first character of `package.config`).
Similarly to `package.path`, modified directories from 'runtimepath' are also
-added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and
+added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and
`/lua/?/init.lua` to each runtimepath, all unique `?`-containing suffixes of
-the existing `package.cpath` are used. Example:
+the existing `package.cpath` are used. Example:
1. Given that
- 'runtimepath' contains `/foo/bar,/xxx;yyy/baz,/abc`;
- - initial (defined at compile-time or derived from
- `$LUA_CPATH`/`$LUA_INIT`) `package.cpath` contains
+ - initial (defined at compile-time or derived from
+ `$LUA_CPATH`/`$LUA_INIT`) `package.cpath` contains
`./?.so;/def/ghi/a?d/j/g.elf;/def/?.so`.
-2. It finds `?`-containing suffixes `/?.so`, `/a?d/j/g.elf` and `/?.so`, in
- order: parts of the path starting from the first path component containing
+2. It finds `?`-containing suffixes `/?.so`, `/a?d/j/g.elf` and `/?.so`, in
+ order: parts of the path starting from the first path component containing
question mark and preceding path separator.
-3. The suffix of `/def/?.so`, namely `/?.so` is not unique, as it’s the same
- as the suffix of the first path from `package.path` (i.e. `./?.so`). Which
+3. The suffix of `/def/?.so`, namely `/?.so` is not unique, as it’s the same
+ as the suffix of the first path from `package.path` (i.e. `./?.so`). Which
leaves `/?.so` and `/a?d/j/g.elf`, in this order.
-4. 'runtimepath' has three paths: `/foo/bar`, `/xxx;yyy/baz` and `/abc`. The
- second one contains semicolon which is a paths separator so it is out,
+4. 'runtimepath' has three paths: `/foo/bar`, `/xxx;yyy/baz` and `/abc`. The
+ second one contains a semicolon which is a paths separator so it is out,
leaving only `/foo/bar` and `/abc`, in order.
-5. The cartesian product of paths from 4. and suffixes from 3. is taken,
- giving four variants. In each variant `/lua` path segment is inserted
- between path and suffix, leaving
+5. The cartesian product of paths from 4. and suffixes from 3. is taken,
+ giving four variants. In each variant, a `/lua` path segment is inserted
+ between path and suffix, leaving:
- `/foo/bar/lua/?.so`
- `/foo/bar/lua/a?d/j/g.elf`
@@ -82,28 +106,28 @@ Note:
- To track 'runtimepath' updates, paths added at previous update are
remembered and removed at the next update, while all paths derived from the
- new 'runtimepath' are prepended as described above. This allows removing
+ new 'runtimepath' are prepended as described above. This allows removing
paths when path is removed from 'runtimepath', adding paths when they are
added and reordering `package.path`/`package.cpath` content if 'runtimepath'
was reordered.
- Although adjustments happen automatically, Nvim does not track current
- values of `package.path` or `package.cpath`. If you happen to delete some
+ values of `package.path` or `package.cpath`. If you happen to delete some
paths from there you can set 'runtimepath' to trigger an update: >
let &runtimepath = &runtimepath
- Skipping paths from 'runtimepath' which contain semicolons applies both to
- `package.path` and `package.cpath`. Given that there are some badly written
- plugins using shell which will not work with paths containing semicolons it
- is better to not have them in 'runtimepath' at all.
+ `package.path` and `package.cpath`. Given that there are some badly written
+ plugins using shell, which will not work with paths containing semicolons,
+ it is better to not have them in 'runtimepath' at all.
==============================================================================
-Lua Syntax Information *lua-syntax-help*
+Lua Syntax Information *lua-syntax-help*
While Lua has a simple syntax, there are a few things to understand,
particularly when looking at the documentation above.
- *lua-syntax-call-function*
+ *lua-syntax-call-function*
Lua functions can be called in multiple ways. Consider the function: >
@@ -111,31 +135,30 @@ Lua functions can be called in multiple ways. Consider the function: >
print("A is: ", a)
print("B is: ", b)
end
+<
+The first way to call this function is: >
-
-The first way to call a function is: >
-
example_func(1, 2)
-- ==== Result ====
-- A is: 1
-- B is: 2
<
- This way of calling a function is familiar to most scripting languages.
- In Lua, it's important to understand that any function arguments that are
- not supplied are automatically set to `nil`. For example: >
+This way of calling a function is familiar from most scripting languages.
+In Lua, it's important to understand that any function arguments that are
+not supplied are automatically set to `nil`. For example: >
example_func(1)
-- ==== Result ====
-- A is: 1
-- B is: nil
<
+Additionally, if any extra parameters are passed, they are discarded
+completely.
- Additionally, if any extra parameters are passed, they are discarded
- completely.
-
-In Lua, it is also possible (when only one argument is passed) to call the
-function without any parentheses. This is most often used to approximate
-"keyword"-style arguments with a single dictionary. For example: >
+In Lua, it is also possible to omit the parentheses (only) if the function
+takes a single string or table literal (`"foo"` or "`{1,2,3}`", respectively).
+The latter is most often used to approximate "keyword-style" arguments with a
+single dictionary, for example: >
local func_with_opts = function(opts)
local will_do_foo = opts.foo
@@ -146,25 +169,46 @@ function without any parentheses. This is most often used to approximate
func_with_opts { foo = true, filename = "hello.world" }
<
-
- In this style, each "parameter" is passed via keyword. It is still valid
- to call the function in this style: >
+In this style, each "parameter" is passed via keyword. It is still valid
+to call the function in the standard style: >
func_with_opts({ foo = true, filename = "hello.world" })
<
+But often in the documentation, you will see the former rather than the
+latter style due to its brevity.
+
+==============================================================================
+Lua Patterns *lua-patterns*
+
+For performance reasons, Lua does not support regular expressions natively.
+Instead, the Lua `string` standard library allows manipulations using a
+restricted set of "patterns", see https://www.lua.org/manual/5.1/manual.html#5.4.1
+
+Examples (`string.match` extracts the first match): >
+
+ print(string.match("foo123bar123", "%d+"))
+ -- -> 123
- But often in the documentation, you will see the former rather than the
- latter style, due to its brevity (this is vim after all!).
+ print(string.match("foo123bar123", "[^%d]+"))
+ -- -> foo
+ print(string.match("foo123bar123", "[abc]+"))
+ -- -> ba
+
+ print(string.match("foo.bar", "%.bar"))
+ -- -> .bar
+
+For more complex matching, Vim regular expressions can be used from Lua
+through |vim.regex()|.
------------------------------------------------------------------------------
-LUA PLUGIN EXAMPLE *lua-require-example*
+LUA PLUGIN EXAMPLE *lua-require-example*
-The following example plugin adds a command `:MakeCharBlob` which transforms
-current buffer into a long `unsigned char` array. Lua contains transformation
-function in a module `lua/charblob.lua` which is imported in
-`autoload/charblob.vim` (`require("charblob")`). Example plugin is supposed
-to be put into any directory from 'runtimepath', e.g. `~/.config/nvim` (in
+The following example plugin adds a command `:MakeCharBlob` which transforms
+current buffer into a long `unsigned char` array. Lua contains transformation
+function in a module `lua/charblob.lua` which is imported in
+`autoload/charblob.vim` (`require("charblob")`). Example plugin is supposed
+to be put into any directory from 'runtimepath', e.g. `~/.config/nvim` (in
this case `lua/charblob.lua` means `~/.config/nvim/lua/charblob.lua`).
autoload/charblob.vim: >
@@ -174,7 +218,7 @@ autoload/charblob.vim: >
\ 'require("charblob").encode(unpack(_A))',
\ [getline(1, '$'), &textwidth, ' ']))
endfunction
-
+<
plugin/charblob.vim: >
if exists('g:charblob_loaded')
@@ -183,7 +227,7 @@ plugin/charblob.vim: >
let g:charblob_loaded = 1
command MakeCharBlob :call charblob#encode_buffer()
-
+<
lua/charblob.lua: >
local function charblob_bytes_iter(lines)
@@ -233,9 +277,9 @@ lua/charblob.lua: >
bytes_iter = charblob_bytes_iter,
encode = charblob_encode,
}
-
+<
==============================================================================
-COMMANDS *lua-commands*
+COMMANDS *lua-commands*
These commands execute a Lua chunk from either the command line (:lua, :luado)
or a file (:luafile) on the given line [range]. As always in Lua, each chunk
@@ -246,10 +290,10 @@ command calls. The |lua-stdlib| modules, user modules, and anything else on
The Lua print() function redirects its output to the Nvim message area, with
arguments separated by " " (space) instead of "\t" (tab).
- *:lua*
-:[range]lua {chunk}
+ *:lua*
+:lua {chunk}
Executes Lua chunk {chunk}.
- if {chunk} starts with "=" the rest of the chunk is
+ If {chunk} starts with "=" the rest of the chunk is
evaluated as an expression and printed. `:lua =expr`
is equivalent to `:lua print(vim.inspect(expr))`
Examples: >
@@ -259,8 +303,8 @@ arguments separated by " " (space) instead of "\t" (tab).
< To see the LuaJIT version: >
:lua =jit.version
<
- *:lua-heredoc*
-:[range]lua << [endmarker]
+ *:lua-heredoc*
+:lua << [endmarker]
{script}
{endmarker}
Executes Lua script {script} from within Vimscript.
@@ -279,11 +323,11 @@ arguments separated by " " (space) instead of "\t" (tab).
linenr, #curline))
EOF
endfunction
-
-< Note that the `local` variables will disappear when
+<
+ Note that the `local` variables will disappear when
the block finishes. But not globals.
- *:luado*
+ *:luado*
:[range]luado {body} Executes Lua chunk "function(line, linenr) {body} end"
for each buffer line in [range], where `line` is the
current line text (without <EOL>), and `linenr` is the
@@ -300,9 +344,8 @@ arguments separated by " " (space) instead of "\t" (tab).
:lua bp = lpeg.P{ "(" * ((1 - lpeg.S"()") + lpeg.V(1))^0 * ")" }
:luado if bp:match(line) then return "-->\t" .. line end
<
-
- *:luafile*
-:[range]luafile {file}
+ *:luafile*
+:luafile {file}
Execute Lua script in {file}.
The whole argument is used as the filename (like
|:edit|), spaces do not need to be escaped.
@@ -314,19 +357,19 @@ arguments separated by " " (space) instead of "\t" (tab).
<
==============================================================================
-luaeval() *lua-eval* *luaeval()*
+luaeval() *lua-eval* *luaeval()*
The (dual) equivalent of "vim.eval" for passing Lua values to Nvim is
-"luaeval". "luaeval" takes an expression string and an optional argument used
-for _A inside expression and returns the result of the expression. It is
-semantically equivalent in Lua to:
->
+"luaeval". "luaeval" takes an expression string and an optional argument used
+for _A inside expression and returns the result of the expression. It is
+semantically equivalent in Lua to: >
+
local chunkheader = "local _A = select(1, ...) return "
function luaeval (expstr, arg)
local chunk = assert(loadstring(chunkheader .. expstr, "luaeval"))
return chunk(arg) -- return typval
end
-
+<
Lua nils, numbers, strings, tables and booleans are converted to their
respective Vimscript types. If a Lua string contains a NUL byte, it will be
converted to a |Blob|. Conversion of other Lua types is an error.
@@ -338,22 +381,22 @@ Example: >
42
:echo luaeval('string.match(_A, "[a-z]+")', 'XYXfoo123')
foo
-
+<
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:
0. Empty table is empty list.
-1. Table with N incrementally growing integral numbers, starting from 1 and
+1. Table with N incrementally growing integral numbers, starting from 1 and
ending with N is considered to be a list.
-2. Table with string keys, none of which contains NUL byte, is considered to
+2. Table with string keys, none of which contains NUL byte, is considered to
be a dictionary.
-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
+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|.
- *lua-special-tbl*
-4. Table with `vim.type_idx` key may be a dictionary, a list or floating-point
+ *lua-special-tbl*
+4. Table with `vim.type_idx` key may be a dictionary, a list or floating-point
value:
- `{[vim.type_idx]=vim.types.float, [vim.val_idx]=1}` is converted to
a floating-point 1.0. Note that by default integral Lua numbers are
@@ -376,14 +419,14 @@ Examples: >
: return luaeval('(_A.y-_A.x)*math.random()+_A.x', {'x':a:x,'y':a:y})
: endfunction
:echo Rand(1,10)
-
-Note: second argument to `luaeval` is converted ("marshalled") from Vimscript
+<
+Note: Second argument to `luaeval` is converted ("marshalled") from Vimscript
to Lua, so changes to Lua containers do not affect values in Vimscript. Return
value is also always converted. When converting, |msgpack-special-dict|s are
treated specially.
==============================================================================
-Vimscript v:lua interface *v:lua-call*
+Vimscript v:lua interface *v:lua-call*
From Vimscript the special `v:lua` prefix can be used to call Lua functions
which are global or accessible from global tables. The expression >
@@ -398,7 +441,7 @@ is equivalent to the Lua chunk >
In addition, functions of packages can be accessed like >
v:lua.require'mypack'.func(arg1, arg2)
v:lua.require'mypack.submod'.func(arg1, arg2)
-Note: only single quote form without parens is allowed. Using
+Note: Only single quote form without parens is allowed. Using
`require"mypack"` or `require('mypack')` as prefixes do NOT work (the latter
is still valid as a function call of itself, in case require returns a useful
value).
@@ -406,7 +449,7 @@ value).
The `v:lua` prefix may be used to call Lua functions as |method|s. For
example: >
arg1->v:lua.somemod.func(arg2)
-
+<
You can use `v:lua` in "func" options like 'tagfunc', 'omnifunc', etc.
For example consider the following Lua omnifunc handler: >
@@ -419,7 +462,7 @@ For example consider the following Lua omnifunc handler: >
end
vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.mymod.omnifunc')
-Note: the module ("mymod" in the above example) must either be a Lua global,
+Note: The module ("mymod" in the above example) must either be a Lua global,
or use the require syntax as specified above to access it from a package.
Note: `v:lua` without a call is not allowed in a Vimscript expression:
@@ -429,13 +472,12 @@ Note: `v:lua` without a call is not allowed in a Vimscript expression:
call SomeFunc(v:lua.mycallback) " Error
let g:foo = v:lua " Error
let g:foo = v:['lua'] " Error
-
-
+<
==============================================================================
-Lua standard modules *lua-stdlib*
+Lua standard modules *lua-stdlib*
The Nvim Lua "standard library" (stdlib) is the `vim` module, which exposes
-various functions and sub-modules. It is always loaded, thus require("vim")
+various functions and sub-modules. It is always loaded, thus `require("vim")`
is unnecessary.
You can peek at the module properties: >
@@ -466,34 +508,35 @@ Note that underscore-prefixed functions (e.g. "_os_proc_children") are
internal/private and must not be used by plugins.
------------------------------------------------------------------------------
-VIM.LOOP *lua-loop* *vim.loop*
+VIM.LOOP *lua-loop* *vim.loop*
-`vim.loop` exposes all features of the Nvim event-loop. This is a low-level
+`vim.loop` exposes all features of the Nvim event-loop. This is a low-level
API that provides functionality for networking, filesystem, and process
-management. Try this command to see available functions: >
+management. Try this command to see available functions: >
:lua print(vim.inspect(vim.loop))
-
+<
Reference: https://github.com/luvit/luv/blob/master/docs.md
Examples: https://github.com/luvit/luv/tree/master/examples
- *E5560* *lua-loop-callbacks*
+ *E5560* *lua-loop-callbacks*
It is an error to directly invoke `vim.api` functions (except |api-fast|) in
-`vim.loop` callbacks. For example, this is an error: >
+`vim.loop` callbacks. For example, this is an error: >
local timer = vim.loop.new_timer()
timer:start(1000, 0, function()
vim.api.nvim_command('echomsg "test"')
end)
-
+<
To avoid the error use |vim.schedule_wrap()| to defer the callback: >
local timer = vim.loop.new_timer()
timer:start(1000, 0, vim.schedule_wrap(function()
vim.api.nvim_command('echomsg "test"')
end))
-
-(For one-shot timers, see |vim.defer_fn()|, which automatically adds the wrapping.)
+<
+(For one-shot timers, see |vim.defer_fn()|, which automatically adds the
+wrapping.)
Example: repeating timer
1. Save this code to a file.
@@ -511,9 +554,8 @@ Example: repeating timer
i = i + 1
end)
print('sleeping');
-
-
-Example: File-change detection *watch-file*
+<
+Example: File-change detection *watch-file*
1. Save this code to a file.
2. Execute it with ":luafile %".
3. Use ":Watch %" to watch any file.
@@ -537,9 +579,8 @@ Example: File-change detection *watch-file*
end
vim.api.nvim_command(
"command! -nargs=1 Watch call luaeval('watch_file(_A)', expand('<args>'))")
-
-
-Example: TCP echo-server *tcp-server*
+<
+Example: TCP echo-server *tcp-server*
1. Save this code to a file.
2. Execute it with ":luafile %".
3. Note the port number.
@@ -567,9 +608,28 @@ Example: TCP echo-server *tcp-server*
end)
end)
print('TCP echo-server listening on port: '..server:getsockname().port)
+<
+Multithreading *lua-loop-threading*
+
+Plugins can perform work in separate (os-level) threads using the threading
+APIs in luv, for instance `vim.loop.new_thread`. Note that every thread
+gets its own separate lua interpreter state, with no access to lua globals
+in the main thread. Neither can the state of the editor (buffers, windows,
+etc) be directly accessed from threads.
+
+A subset of the `vim.*` API is available in threads. This includes:
+
+- `vim.loop` with a separate event loop per thread.
+- `vim.mpack` and `vim.json` (useful for serializing messages between threads)
+- `require` in threads can use lua packages from the global |lua-package-path|
+- `print()` and `vim.inspect`
+- `vim.diff`
+- most utility functions in `vim.*` for working with pure lua values
+ like `vim.split`, `vim.tbl_*`, `vim.list_*`, and so on.
+- `vim.is_thread()` returns true from a non-main thread.
------------------------------------------------------------------------------
-VIM.HIGHLIGHT *lua-highlight*
+VIM.HIGHLIGHT *lua-highlight*
Nvim includes a function for highlighting a selection on yank (see for example
https://github.com/machakann/vim-highlightedyank). To enable it, add
@@ -585,8 +645,7 @@ If you want to exclude visual selections from highlighting on yank, use
>
au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false}
<
-
-vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
+vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
Highlights the yanked text. The fields of the optional dict {opts}
control the highlight:
- {higroup} highlight group for yanked region (default |hl-IncSearch|)
@@ -595,28 +654,49 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
- {on_visual} highlight when yanking visual selection (default `true`)
- {event} event structure (default |v:event|)
-vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {rtype}, {inclusive})
+vim.highlight.range({bufnr}, {ns}, {hlgroup}, {start}, {finish}, {opts})
*vim.highlight.range()*
- Highlights the range between {start} and {finish} (tuples of {line,col})
- in buffer {bufnr} with the highlight group {higroup} using the namespace
- {ns}. Optional arguments are the type of range (characterwise, linewise,
- or blockwise, see |setreg|; default to characterwise) and whether the
- range is inclusive (default false).
+
+ Apply highlight group to range of text.
+
+ Parameters: ~
+ {bufnr} buffer number
+ {ns} namespace for highlights
+ {hlgroup} highlight group name
+ {start} starting position (tuple {line,col})
+ {finish} finish position (tuple {line,col})
+ {opts} optional parameters:
+ • `regtype`: type of range (characterwise, linewise,
+ or blockwise, see |setreg|), default `'v'`
+ • `inclusive`: range includes end position,
+ default `false`
+ • `priority`: priority of highlight, default
+ `vim.highlight.user` (see below)
+
+vim.highlight.priorities *vim.highlight.priorities*
+
+ Table with default priorities used for highlighting:
+ • `syntax`: `50`, used for standard syntax highlighting
+ • `treesitter`: `100`, used for tree-sitter-based highlighting
+ • `diagnostics`: `150`, used for code analysis such as diagnostics
+ • `user`: `200`, used for user-triggered highlights such as LSP
+ document symbols or `on_yank` autocommands
------------------------------------------------------------------------------
-VIM.REGEX *lua-regex*
+VIM.REGEX *lua-regex*
Vim regexes can be used directly from lua. Currently they only allow
matching within a single line.
-vim.regex({re}) *vim.regex()*
+vim.regex({re}) *vim.regex()*
Parse the Vim regex {re} and return a regex object. Regexes are
- "magic" and case-insensitive by default, regardless of 'magic' and
- 'ignorecase'. The can be controlled with flags, see |/magic|.
+ "magic" and case-sensitive by default, regardless of 'magic' and
+ 'ignorecase'. They can be controlled with flags, see |/magic| and
+ |/ignorecase|.
Methods on the regex object:
-regex:match_str({str}) *regex:match_str()*
+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 the was a match, the byte indices for the beginning and end of
@@ -624,7 +704,7 @@ regex:match_str({str}) *regex:match_str()*
As any integer is truth-y, `regex:match()` can be directly used
as a condition in an if-statement.
-regex:match_line({bufnr}, {line_idx}[, {start}, {end}]) *regex:match_line()*
+regex:match_line({bufnr}, {line_idx}[, {start}, {end}]) *regex:match_line()*
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
@@ -639,18 +719,19 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
1-based.
Examples: >
- vim.diff('a\n', 'b\nc\n')
- -->
- @@ -1 +1,2 @@
- -a
- +b
- +c
-
- vim.diff('a\n', 'b\nc\n', {result_type = 'indices'})
- -->
- {
- {1, 1, 1, 2}
- }
+
+ vim.diff('a\n', 'b\nc\n')
+ -->
+ @@ -1 +1,2 @@
+ -a
+ +b
+ +c
+
+ vim.diff('a\n', 'b\nc\n', {result_type = 'indices'})
+ -->
+ {
+ {1, 1, 1, 2}
+ }
<
Parameters: ~
{a} First string to compare
@@ -668,7 +749,7 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
• `result_type` (string): Form of the returned diff:
• "unified": (default) String in unified format.
• "indices": Array of hunk locations.
- Note this option is ignored if `on_hunk` is
+ Note: This option is ignored if `on_hunk` is
used.
• `algorithm` (string):
Diff algorithm to use. Values:
@@ -703,31 +784,31 @@ VIM.MPACK *lua-mpack*
The *vim.mpack* module provides encoding and decoding of Lua objects to and
from msgpack-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
-vim.mpack.encode({obj}) *vim.mpack.encode*
+vim.mpack.encode({obj}) *vim.mpack.encode*
Encodes (or "packs") Lua object {obj} as msgpack in a Lua string.
-vim.mpack.decode({str}) *vim.mpack.decode*
+vim.mpack.decode({str}) *vim.mpack.decode*
Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object.
------------------------------------------------------------------------------
-VIM.SPELL *lua-spell*
+VIM.SPELL *lua-spell*
-vim.spell.check({str}) *vim.spell.check()*
+vim.spell.check({str}) *vim.spell.check()*
Check {str} for spelling errors. Similar to the Vimscript function
|spellbadword()|.
Note: The behaviour of this function is dependent on: 'spelllang',
- 'spellfile', 'spellcapcheck' and 'spelloptions' which can all be local
- to the buffer. Consider calling this with |nvim_buf_call()|.
+ 'spellfile', 'spellcapcheck' and 'spelloptions' which can all be
+ local to the buffer. Consider calling this with |nvim_buf_call()|.
Example: >
+
vim.spell.check("the quik brown fox")
-->
{
{'quik', 'bad', 4}
}
<
-
Parameters: ~
{str} String to spell check.
@@ -742,24 +823,24 @@ vim.spell.check({str}) *vim.spell.check()*
- The position in {str} where the word begins.
------------------------------------------------------------------------------
-VIM *lua-builtin*
+VIM *lua-builtin*
-vim.api.{func}({...}) *vim.api*
+vim.api.{func}({...}) *vim.api*
Invokes Nvim |API| function {func} with arguments {...}.
Example: call the "nvim_get_current_line()" API function: >
print(tostring(vim.api.nvim_get_current_line()))
-vim.version() *vim.version*
+vim.version() *vim.version*
Gets the version of the current Nvim build.
-vim.in_fast_event() *vim.in_fast_event()*
+vim.in_fast_event() *vim.in_fast_event()*
Returns true if the code is executing as part of a "fast" event
handler, where most of the API is disabled. These are low-level events
(e.g. |lua-loop-callbacks|) which can be invoked whenever Nvim polls
- for input. When this is `false` most API functions are callable (but
+ for input. When this is `false` most API functions are callable (but
may be subject to other restrictions such as |textlock|).
-vim.NIL *vim.NIL*
+vim.NIL *vim.NIL*
Special value representing NIL in |RPC| and |v:null| in Vimscript
conversion, and similar cases. Lua `nil` cannot be used as part of
a Lua table representing a Dictionary or Array, because it is
@@ -771,10 +852,10 @@ vim.empty_dict() *vim.empty_dict()*
Vimscript or API types. Nvim by default converts an empty table `{}`
without this metatable to an list/array.
- Note: if numeric keys are present in the table, Nvim ignores the
+ Note: If numeric keys are present in the table, Nvim ignores the
metatable marker and converts the dict to a list/array anyway.
-vim.rpcnotify({channel}, {method}[, {args}...]) *vim.rpcnotify()*
+vim.rpcnotify({channel}, {method}[, {args}...]) *vim.rpcnotify()*
Sends {event} to {channel} via |RPC| and returns immediately. If
{channel} is 0, the event is broadcast to all channels.
@@ -787,12 +868,12 @@ vim.rpcrequest({channel}, {method}[, {args}...]) *vim.rpcrequest()*
Note: NIL values as part of the return value is represented as
|vim.NIL| special value
-vim.stricmp({a}, {b}) *vim.stricmp()*
- Compares strings case-insensitively. Returns 0, 1 or -1 if strings
+vim.stricmp({a}, {b}) *vim.stricmp()*
+ Compares strings case-insensitively. Returns 0, 1 or -1 if strings
are equal, {a} is greater than {b} or {a} is lesser than {b},
respectively.
-vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
+vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
Convert byte index to UTF-32 and UTF-16 indices. If {index} is not
supplied, the length of the string is used. All indices are zero-based.
Returns two values: the UTF-32 and UTF-16 indices respectively.
@@ -802,21 +883,21 @@ vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
point each. An {index} in the middle of a UTF-8 sequence is rounded
upwards to the end of that sequence.
-vim.str_byteindex({str}, {index}[, {use_utf16}]) *vim.str_byteindex()*
+vim.str_byteindex({str}, {index}[, {use_utf16}]) *vim.str_byteindex()*
Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not
supplied, it defaults to false (use UTF-32). Returns the byte index.
- Invalid UTF-8 and NUL is treated like by |vim.str_byteindex()|. An {index}
- in the middle of a UTF-16 sequence is rounded upwards to the end of that
- sequence.
+ Invalid UTF-8 and NUL is treated like by |vim.str_byteindex()|.
+ An {index} in the middle of a UTF-16 sequence is rounded upwards to
+ the end of that sequence.
-vim.schedule({callback}) *vim.schedule()*
+vim.schedule({callback}) *vim.schedule()*
Schedules {callback} to be invoked soon by the main event-loop. Useful
to avoid |textlock| or other temporary restrictions.
-vim.defer_fn({fn}, {timeout}) *vim.defer_fn*
- Defers calling {fn} until {timeout} ms passes. Use to do a one-shot timer
+vim.defer_fn({fn}, {timeout}) *vim.defer_fn*
+ Defers calling {fn} until {timeout} ms passes. Use to do a one-shot timer
that calls {fn}.
Note: The {fn} is |schedule_wrap|ped automatically, so API functions are
@@ -880,15 +961,15 @@ vim.wait({time} [, {callback}, {interval}, {fast_only}]) *vim.wait()*
end
<
-vim.type_idx *vim.type_idx*
- Type index for use in |lua-special-tbl|. Specifying one of the values
+vim.type_idx *vim.type_idx*
+ Type index for use in |lua-special-tbl|. Specifying one of the values
from |vim.types| allows typing the empty table (it is unclear whether
empty Lua table represents empty list or empty array) and forcing
- integral numbers to be |Float|. See |lua-special-tbl| for more
+ integral numbers to be |Float|. See |lua-special-tbl| for more
details.
-vim.val_idx *vim.val_idx*
- Value index for tables representing |Float|s. A table representing
+vim.val_idx *vim.val_idx*
+ Value index for tables representing |Float|s. A table representing
floating-point value 1.0 looks like this: >
{
[vim.type_idx] = vim.types.float,
@@ -896,17 +977,17 @@ vim.val_idx *vim.val_idx*
}
< See also |vim.type_idx| and |lua-special-tbl|.
-vim.types *vim.types*
- Table with possible values for |vim.type_idx|. Contains two sets of
+vim.types *vim.types*
+ Table with possible values for |vim.type_idx|. Contains two sets of
key-value pairs: first maps possible values for |vim.type_idx| to
human-readable strings, second maps human-readable type names to
- values for |vim.type_idx|. Currently contains pairs for `float`,
+ values for |vim.type_idx|. Currently contains pairs for `float`,
`array` and `dictionary` types.
- Note: one must expect that values corresponding to `vim.types.float`,
+ Note: One must expect that values corresponding to `vim.types.float`,
`vim.types.array` and `vim.types.dictionary` fall under only two
following assumptions:
- 1. Value may serve both as a key and as a value in a table. Given the
+ 1. Value may serve both as a key and as a value in a table. Given the
properties of Lua tables this basically means “value is not `nil`”.
2. For each value in `vim.types` table `vim.types[vim.types[value]]`
is the same as `value`.
@@ -923,35 +1004,25 @@ Log levels are one of the values defined in `vim.log.levels`:
vim.log.levels.INFO
vim.log.levels.TRACE
vim.log.levels.WARN
+ vim.log.levels.OFF
------------------------------------------------------------------------------
-LUA-VIMSCRIPT BRIDGE *lua-vimscript*
+LUA-VIMSCRIPT BRIDGE *lua-vimscript*
Nvim Lua provides an interface to Vimscript variables and functions, and
editor commands and options.
See also https://github.com/nanotee/nvim-lua-guide.
-vim.call({func}, {...}) *vim.call()*
+vim.call({func}, {...}) *vim.call()*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
See also |vim.fn|.
Equivalent to: >
vim.fn[func]({...})
-vim.cmd({cmd}) *vim.cmd()*
- Executes multiple lines of Vimscript at once. It is an alias to
- |nvim_exec()|, where `output` is set to false. Thus it works identical
- to |:source|.
- See also |ex-cmd-index|.
- Example: >
- vim.cmd('echo 42')
- vim.cmd([[
- augroup My_group
- autocmd!
- autocmd FileType c setlocal cindent
- augroup END
- ]])
-
-vim.fn.{func}({...}) *vim.fn*
+vim.cmd({command})
+ See |vim.cmd()|.
+
+vim.fn.{func}({...}) *vim.fn*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
To call autoload functions, use the syntax: >
vim.fn['some#function']({...})
@@ -967,8 +1038,10 @@ vim.fn.{func}({...}) *vim.fn*
Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
enumerates functions that were called at least once.
+ Note: The majority of functions cannot run in |api-fast| callbacks with some
+ undocumented exceptions which are allowed.
- *lua-vim-variables*
+ *lua-vim-variables*
The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables
described below. In this way you can easily read and modify global Vimscript
@@ -980,31 +1053,31 @@ Example: >
print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
vim.b[2].foo = 6 -- Set b:foo for buffer 2
-
-vim.g *vim.g*
+<
+vim.g *vim.g*
Global (|g:|) editor variables.
Key with no value returns `nil`.
-vim.b *vim.b*
+vim.b *vim.b*
Buffer-scoped (|b:|) variables for the current buffer.
Invalid or unset key returns `nil`. Can be indexed with
an integer to access variables for a specific buffer.
-vim.w *vim.w*
+vim.w *vim.w*
Window-scoped (|w:|) variables for the current window.
Invalid or unset key returns `nil`. Can be indexed with
an integer to access variables for a specific window.
-vim.t *vim.t*
+vim.t *vim.t*
Tabpage-scoped (|t:|) variables for the current tabpage.
Invalid or unset key returns `nil`. Can be indexed with
an integer to access variables for a specific tabpage.
-vim.v *vim.v*
+vim.v *vim.v*
|v:| variables.
Invalid or unset key returns `nil`.
-vim.env *vim.env*
+vim.env *vim.env*
Environment variables defined in the editor session.
See |expand-env| and |:let-environment| for the Vimscript behavior.
Invalid or unset key returns `nil`.
@@ -1019,7 +1092,7 @@ vim.env *vim.env*
*lua-vim-optlocal*
*lua-vim-setlocal*
-In Vimscript, there is an way to set options |set-option|. In Lua, the
+In Vimscript, there is a way to set options |set-option|. In Lua, the
corresponding method is `vim.opt`.
`vim.opt` provides several conveniences for setting and controlling options
@@ -1043,7 +1116,7 @@ from within Lua.
`vim.opt.wildignore = '*.o,*.a,__pycache__'`
However, vim.opt also supports a more elegent way of setting
- list-style options, but using lua tables:
+ list-style options by using lua tables:
`vim.opt.wildignore = { '*.o', '*.a', '__pycache__' }`
To replicate the behavior of |:set+=|, use: >
@@ -1054,7 +1127,6 @@ from within Lua.
-- or using the `:append(...)` method
vim.opt.wildignore:append { "*.pyc", "node_modules" }
<
-
To replicate the behavior of |:set^=|, use: >
-- vim.opt supports prepending options via the "^" operator
@@ -1086,7 +1158,7 @@ In any of the above examples, to replicate the behavior |setlocal|, use
|vim.opt| returns an Option object.
-For example: `local listchar_object = vim.opt.listchar`
+For example: `local listchar_object = vim.opt.listchars`
An `Option` has the following methods:
@@ -1175,14 +1247,13 @@ vim.o :set set set
vim.bo/vim.wo :setlocal - set
vim.go :setglobal set -
-vim.o *vim.o*
+vim.o *vim.o*
Get or set editor options, like |:set|. Invalid key is an error.
Example: >
vim.o.cmdheight = 4
print(vim.o.columns)
-
-
-vim.go *vim.go*
+<
+vim.go *vim.go*
Get or set an |option|. Invalid key is an error.
This is a wrapper around |nvim_set_option()| and |nvim_get_option()|.
@@ -1194,8 +1265,7 @@ vim.go *vim.go*
Example: >
vim.go.cmdheight = 4
<
-
-vim.bo *vim.bo*
+vim.bo *vim.bo*
Get or set buffer-scoped |local-options|. Invalid key is an error.
This is a wrapper around |nvim_buf_set_option()| and
@@ -1204,8 +1274,8 @@ vim.bo *vim.bo*
Example: >
vim.bo.buflisted = true
print(vim.bo.comments)
-
-vim.wo *vim.wo*
+<
+vim.wo *vim.wo*
Get or set window-scoped |local-options|. Invalid key is an error.
This is a wrapper around |nvim_win_set_option()| and
@@ -1214,11 +1284,42 @@ vim.wo *vim.wo*
Example: >
vim.wo.cursorcolumn = true
print(vim.wo.foldmarker)
-
-
+<
==============================================================================
Lua module: vim *lua-vim*
+cmd({command}) *vim.cmd()*
+ Execute Vim script commands.
+
+ Example: >
+
+ vim.cmd('echo 42')
+ vim.cmd([[
+ augroup My_group
+ autocmd!
+ autocmd FileType c setlocal cindent
+ augroup END
+ ]])
+ vim.cmd({ cmd = 'echo', args = { '"foo"' } })
+<
+
+ Parameters: ~
+ {command} string|table Command(s) to execute. If a
+ string, executes multiple lines of Vim script
+ at once. In this case, it is an alias to
+ |nvim_exec()|, where `output` is set to false.
+ Thus it works identical to |:source|. If a
+ table, executes a single command. In this case,
+ it is an alias to |nvim_cmd()| where `opts` is
+ empty.
+
+ See also: ~
+ |ex-cmd-index|
+
+ *vim.connection_failure_errmsg()*
+connection_failure_errmsg({consequence})
+ TODO: Documentation
+
defer_fn({fn}, {timeout}) *vim.defer_fn()*
Defers calling `fn` until `timeout` ms passes.
@@ -1233,6 +1334,21 @@ defer_fn({fn}, {timeout}) *vim.defer_fn()*
Return: ~
timer luv timer object
+ *vim.deprecate()*
+deprecate({name}, {alternative}, {version}, {plugin}, {backtrace})
+ Display a deprecation notification to the user.
+
+ Parameters: ~
+ {name} string Deprecated function.
+ {alternative} (string|nil) Preferred alternative
+ function.
+ {version} string Version in which the deprecated
+ function will be removed.
+ {plugin} string|nil Plugin name that the function
+ will be removed from. Defaults to "Nvim".
+ {backtrace} boolean|nil Prints backtrace. Defaults to
+ true.
+
inspect({object}, {options}) *vim.inspect()*
Return a human-readable representation of the given object.
@@ -1248,11 +1364,12 @@ notify({msg}, {level}, {opts}) *vim.notify()*
notification provider). By default, writes to |:messages|.
Parameters: ~
- {msg} string Content of the notification to show to the
- user.
- {level} number|nil One of the values from
+ {msg} (string) Content of the notification to show to
+ the user.
+ {level} (number|nil) One of the values from
|vim.log.levels|.
- {opts} table|nil Optional parameters. Unused by default.
+ {opts} (table|nil) Optional parameters. Unused by
+ default.
notify_once({msg}, {level}, {opts}) *vim.notify_once()*
Display a notification only one time.
@@ -1261,11 +1378,15 @@ notify_once({msg}, {level}, {opts}) *vim.notify_once()*
message will not display a notification.
Parameters: ~
- {msg} string Content of the notification to show to the
- user.
- {level} number|nil One of the values from
+ {msg} (string) Content of the notification to show to
+ the user.
+ {level} (number|nil) One of the values from
|vim.log.levels|.
- {opts} table|nil Optional parameters. Unused by default.
+ {opts} (table|nil) Optional parameters. Unused by
+ default.
+
+ Return: ~
+ (boolean) true if message was displayed, else false
on_key({fn}, {ns_id}) *vim.on_key()*
Adds Lua function {fn} with namespace id {ns_id} as a listener
@@ -1291,8 +1412,8 @@ on_key({fn}, {ns_id}) *vim.on_key()*
returns a new |nvim_create_namespace()| id.
Return: ~
- number Namespace id associated with {fn}. Or count of all
- callbacks if on_key() is called without arguments.
+ (number) Namespace id associated with {fn}. Or count of
+ all callbacks if on_key() is called without arguments.
Note:
{fn} will be removed if an error occurs while calling.
@@ -1346,12 +1467,12 @@ region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
marked by two points
Parameters: ~
- {bufnr} number of buffer
+ {bufnr} (number) of buffer
{pos1} (line, column) tuple marking beginning of
region
{pos2} (line, column) tuple marking end of region
{regtype} type of selection (:help setreg)
- {inclusive} boolean indicating whether the selection is
+ {inclusive} (boolean) indicating whether the selection is
end-inclusive
Return: ~
@@ -1371,14 +1492,14 @@ schedule_wrap({cb}) *vim.schedule_wrap()*
deep_equal({a}, {b}) *vim.deep_equal()*
Deep compare values for equality
- Tables are compared recursively unless they both provide the `eq` methamethod. All other types are compared using the equality `==` operator.
+ Tables are compared recursively unless they both provide the `eq` metamethod. All other types are compared using the equality `==` operator.
Parameters: ~
- {a} first value
- {b} second value
+ {a} any First value
+ {b} any Second value
Return: ~
- `true` if values are equals, else `false` .
+ (boolean) `true` if values are equals, else `false`
deepcopy({orig}) *vim.deepcopy()*
Returns a deep copy of the given object. Non-table objects are
@@ -1389,32 +1510,32 @@ deepcopy({orig}) *vim.deepcopy()*
and will throw an error.
Parameters: ~
- {orig} table Table to copy
+ {orig} (table) Table to copy
Return: ~
- New table of copied keys and (nested) values.
+ (table) Table of copied keys and (nested) values.
endswith({s}, {suffix}) *vim.endswith()*
- Tests if `s` ends with `suffix` .
+ Tests if `s` ends with `suffix`.
Parameters: ~
- {s} (string) a string
- {suffix} (string) a suffix
+ {s} (string) String
+ {suffix} (string) Suffix to match
Return: ~
- (boolean) true if `suffix` is a suffix of s
+ (boolean) `true` if `suffix` is a suffix of `s`
gsplit({s}, {sep}, {plain}) *vim.gsplit()*
Splits a string at each instance of a separator.
Parameters: ~
- {s} String to split
- {sep} Separator string or pattern
- {plain} If `true` use `sep` literally (passed to
- String.find)
+ {s} (string) String to split
+ {sep} (string) Separator or pattern
+ {plain} (boolean) If `true` use `sep` literally (passed
+ to string.find)
Return: ~
- Iterator over the split components
+ (function) Iterator over the split components
See also: ~
|vim.split()|
@@ -1425,10 +1546,10 @@ is_callable({f}) *vim.is_callable()*
Returns true if object `f` can be called as a function.
Parameters: ~
- {f} Any object
+ {f} any Any object
Return: ~
- true if `f` is callable, else false
+ (boolean) `true` if `f` is callable, else `false`
list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
Extends a list-like table with the values of another list-like
@@ -1437,13 +1558,14 @@ list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
NOTE: This mutates dst!
Parameters: ~
- {dst} list which will be modified and appended to.
- {src} list from which values will be inserted.
- {start} Start index on src. defaults to 1
- {finish} Final index on src. defaults to #src
+ {dst} (table) List which will be modified and appended
+ to
+ {src} (table) List from which values will be inserted
+ {start} (number) Start index on src. Defaults to 1
+ {finish} (number) Final index on src. Defaults to `#src`
Return: ~
- dst
+ (table) dst
See also: ~
|vim.tbl_extend()|
@@ -1453,21 +1575,22 @@ list_slice({list}, {start}, {finish}) *vim.list_slice()*
to end (inclusive)
Parameters: ~
- {list} table table
- {start} integer Start range of slice
- {finish} integer End range of slice
+ {list} (table) Table
+ {start} (number) Start range of slice
+ {finish} (number) End range of slice
Return: ~
- Copy of table sliced from start to finish (inclusive)
+ (table) Copy of table sliced from start to finish
+ (inclusive)
pesc({s}) *vim.pesc()*
Escapes magic chars in a Lua pattern.
Parameters: ~
- {s} String to escape
+ {s} (string) String to escape
Return: ~
- %-escaped pattern string
+ (string) %-escaped pattern string
See also: ~
https://github.com/rxi/lume
@@ -1484,49 +1607,55 @@ split({s}, {sep}, {kwargs}) *vim.split()*
<
Parameters: ~
- {s} String to split
- {sep} Separator string or pattern
- {kwargs} Keyword arguments:
+ {s} (string) String to split
+ {sep} (string) Separator or pattern
+ {kwargs} (table) Keyword arguments:
• plain: (boolean) If `true` use `sep` literally
(passed to string.find)
• trimempty: (boolean) If `true` remove empty
items from the front and back of the list
Return: ~
- List-like table of the split components.
+ (table) List of split components
See also: ~
|vim.gsplit()|
startswith({s}, {prefix}) *vim.startswith()*
- Tests if `s` starts with `prefix` .
+ Tests if `s` starts with `prefix`.
Parameters: ~
- {s} (string) a string
- {prefix} (string) a prefix
+ {s} (string) String
+ {prefix} (string) Prefix to match
Return: ~
- (boolean) true if `prefix` is a prefix of s
+ (boolean) `true` if `prefix` is a prefix of `s`
tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
Add the reverse lookup values to an existing table. For
- example: tbl_add_reverse_lookup { A = 1 } == { [1] = 'A , A = 1 }`
+ example: `tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A =
+ 1 }`
+
+ Note that this modifies the input.
Parameters: ~
- {o} table The table to add the reverse to.
+ {o} (table) Table to add the reverse to
+
+ Return: ~
+ (table) o
tbl_contains({t}, {value}) *vim.tbl_contains()*
- Checks if a list-like (vector) table contains `value` .
+ Checks if a list-like (vector) table contains `value`.
Parameters: ~
- {t} Table to check
- {value} Value to compare
+ {t} (table) Table to check
+ {value} any Value to compare
Return: ~
- true if `t` contains `value`
+ (boolean) `true` if `t` contains `value`
tbl_count({t}) *vim.tbl_count()*
- Counts the number of non-nil values in table `t` .
+ Counts the number of non-nil values in table `t`.
>
vim.tbl_count({ a=1, b=2 }) => 2
@@ -1534,10 +1663,10 @@ tbl_count({t}) *vim.tbl_count()*
<
Parameters: ~
- {t} Table
+ {t} (table) Table
Return: ~
- Number that is the number of the value in table
+ (number) Number of non-nil values in table
See also: ~
https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
@@ -1546,12 +1675,15 @@ tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more map-like tables.
Parameters: ~
- {behavior} Decides what to do if a key is found in more
- than one map:
+ {behavior} (string) Decides what to do if a key is found
+ in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
- {...} Two or more map-like tables.
+ {...} (table) Two or more map-like tables
+
+ Return: ~
+ (table) Merged table
See also: ~
|tbl_extend()|
@@ -1560,12 +1692,15 @@ tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more map-like tables.
Parameters: ~
- {behavior} Decides what to do if a key is found in more
- than one map:
+ {behavior} (string) Decides what to do if a key is found
+ in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
- {...} Two or more map-like tables.
+ {...} (table) Two or more map-like tables
+
+ Return: ~
+ (table) Merged table
See also: ~
|extend()|
@@ -1574,27 +1709,51 @@ tbl_filter({func}, {t}) *vim.tbl_filter()*
Filter a table using a predicate function
Parameters: ~
- {func} function or callable table
- {t} table
+ {func} function|table Function or callable table
+ {t} (table) Table
+
+ Return: ~
+ (table) Table of filtered values
tbl_flatten({t}) *vim.tbl_flatten()*
Creates a copy of a list-like table such that any nested
tables are "unrolled" and appended to the result.
Parameters: ~
- {t} List-like table
+ {t} (table) List-like table
Return: ~
- Flattened copy of the given list-like table.
+ (table) Flattened copy of the given list-like table
See also: ~
From https://github.com/premake/premake-core/blob/master/src/base/table.lua
+tbl_get({o}, {...}) *vim.tbl_get()*
+ Index into a table (first argument) via string keys passed as
+ subsequent arguments. Return `nil` if the key does not exist.
+
+ Examples: >
+
+ vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true
+ vim.tbl_get({ key = {}}, 'key', 'nested_key') == nil
+<
+
+ Parameters: ~
+ {o} (table) Table to index
+ {...} (string) Optional strings (0 or more, variadic) via
+ which to index the table
+
+ Return: ~
+ any Nested value indexed by key (if it exists), else nil
+
tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty.
Parameters: ~
- {t} Table to check
+ {t} (table) Table to check
+
+ Return: ~
+ (boolean) `true` if `t` is empty
See also: ~
https://github.com/premake/premake-core/blob/master/src/base/table.lua
@@ -1608,20 +1767,20 @@ tbl_islist({t}) *vim.tbl_islist()*
|vim.fn|.
Parameters: ~
- {t} Table
+ {t} (table) Table
Return: ~
- `true` if array-like table, else `false` .
+ (boolean) `true` if array-like table, else `false`
tbl_keys({t}) *vim.tbl_keys()*
Return a list of all keys used in a table. However, the order
of the return table of keys is not guaranteed.
Parameters: ~
- {t} Table
+ {t} (table) Table
Return: ~
- list of keys
+ (table) List of keys
See also: ~
From https://github.com/premake/premake-core/blob/master/src/base/table.lua
@@ -1630,28 +1789,32 @@ tbl_map({func}, {t}) *vim.tbl_map()*
Apply a function to all values of a table.
Parameters: ~
- {func} function or callable table
- {t} table
+ {func} function|table Function or callable table
+ {t} (table) Table
+
+ Return: ~
+ (table) Table of transformed values
tbl_values({t}) *vim.tbl_values()*
Return a list of all values used in a table. However, the
order of the return table of values is not guaranteed.
Parameters: ~
- {t} Table
+ {t} (table) Table
Return: ~
- list of values
+ (table) List of values
trim({s}) *vim.trim()*
Trim whitespace (Lua pattern "%s") from both sides of a
string.
Parameters: ~
- {s} String to trim
+ {s} (string) String to trim
Return: ~
- String with whitespace removed from its beginning and end
+ (string) String with whitespace removed from its beginning
+ and end
See also: ~
https://www.lua.org/pil/20.2.html
@@ -1693,7 +1856,7 @@ validate({opt}) *vim.validate()*
<
Parameters: ~
- {opt} table of parameter names to validations. Each key
+ {opt} (table) Names of parameters to validate. Each key
is a parameter name; each value is a tuple in one
of these forms:
1. (arg_value, type_name, optional)
@@ -1723,38 +1886,38 @@ uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()*
Get a URI from a bufnr
Parameters: ~
- {bufnr} number
+ {bufnr} (number)
Return: ~
- string URI
+ (string) URI
uri_from_fname({path}) *vim.uri_from_fname()*
Get a URI from a file path.
Parameters: ~
- {path} string Path to file
+ {path} (string) Path to file
Return: ~
- string URI
+ (string) URI
uri_to_bufnr({uri}) *vim.uri_to_bufnr()*
Get the buffer for a uri. Creates a new unloaded buffer if no
buffer for the uri already exists.
Parameters: ~
- {uri} string
+ {uri} (string)
Return: ~
- number bufnr
+ (number) bufnr
uri_to_fname({uri}) *vim.uri_to_fname()*
Get a filename from a URI
Parameters: ~
- {uri} string
+ {uri} (string)
Return: ~
- string filename or unchanged URI for non-file URIs
+ (string) filename or unchanged URI for non-file URIs
==============================================================================
@@ -1763,10 +1926,16 @@ Lua module: ui *lua-ui*
input({opts}, {on_confirm}) *vim.ui.input()*
Prompts the user for input
+ Example: >
+
+ vim.ui.input({ prompt = 'Enter value for shiftwidth: ' }, function(input)
+ vim.o.shiftwidth = tonumber(input)
+ end)
+<
+
Parameters: ~
- {opts} table Additional options. See |input()|
- • prompt (string|nil) Text of the prompt.
- Defaults to `Input:` .
+ {opts} (table) Additional options. See |input()|
+ • prompt (string|nil) Text of the prompt
• default (string|nil) Default reply to the
input
• completion (string|nil) Specifies type of
@@ -1777,32 +1946,48 @@ input({opts}, {on_confirm}) *vim.ui.input()*
|:command-completion|
• highlight (function) Function that will be
used for highlighting user inputs.
- {on_confirm} function ((input|nil) -> ()) Called once the
- user confirms or abort the input. `input` is
- what the user typed. `nil` if the user
- aborted the dialog.
+ {on_confirm} (function) ((input|nil) -> ()) Called once
+ the user confirms or abort the input.
+ `input` is what the user typed. `nil` if the
+ user aborted the dialog.
select({items}, {opts}, {on_choice}) *vim.ui.select()*
Prompts the user to pick a single item from a collection of
entries
+ Example: >
+
+ vim.ui.select({ 'tabs', 'spaces' }, {
+ prompt = 'Select tabs or spaces:',
+ format_item = function(item)
+ return "I'd like to choose " .. item
+ end,
+ }, function(choice)
+ if choice == 'spaces' then
+ vim.o.expandtab = true
+ else
+ vim.o.expandtab = false
+ end
+ end)
+<
+
Parameters: ~
- {items} table Arbitrary items
- {opts} table Additional options
+ {items} (table) Arbitrary items
+ {opts} (table) Additional options
• prompt (string|nil) Text of the prompt.
Defaults to `Select one of:`
• format_item (function item -> text)
Function to format an individual item from
- `items` . Defaults to `tostring` .
+ `items`. Defaults to `tostring`.
• kind (string|nil) Arbitrary hint string
indicating the item shape. Plugins
reimplementing `vim.ui.select` may wish to
use this to infer the structure or
- semantics of `items` , or the context in
+ semantics of `items`, or the context in
which select() was called.
- {on_choice} function ((item|nil, idx|nil) -> ()) Called
+ {on_choice} (function) ((item|nil, idx|nil) -> ()) Called
once the user made a choice. `idx` is the
- 1-based index of `item` within `item` . `nil`
+ 1-based index of `item` within `items`. `nil`
if the user aborted the dialog.
@@ -1816,16 +2001,19 @@ add({filetypes}) *vim.filetype.add()*
filename (either the "tail" or the full file path). The full
file path is checked first, followed by the file name. If a
match is not found using the filename, then the filename is
- matched against the list of patterns (sorted by priority)
- until a match is found. Lastly, if pattern matching does not
- find a filetype, then the file extension is used.
+ matched against the list of |lua-patterns| (sorted by
+ priority) until a match is found. Lastly, if pattern matching
+ does not find a filetype, then the file extension is used.
The filetype can be either a string (in which case it is used
as the filetype directly) or a function. If a function, it
takes the full path and buffer number of the file as arguments
(along with captures from the matched pattern, if any) and
should return a string that will be used as the buffer's
- filetype.
+ filetype. Optionally, the function can return a second
+ function value which, when called, modifies the state of the
+ buffer. This can be used to, for example, set
+ filetype-specific buffer variables.
Filename patterns can specify an optional priority to resolve
cases when a file path matches multiple patterns. Higher
@@ -1834,8 +2022,8 @@ add({filetypes}) *vim.filetype.add()*
See $VIMRUNTIME/lua/vim/filetype.lua for more examples.
- Note that Lua filetype detection is only enabled when
- |g:do_filetype_lua| is set to 1.
+ Note that Lua filetype detection is disabled when
+ |g:do_legacy_filetype| is set.
Example: >
@@ -1844,7 +2032,10 @@ add({filetypes}) *vim.filetype.add()*
foo = "fooscript",
bar = function(path, bufnr)
if some_condition() then
- return "barscript"
+ return "barscript", function(bufnr)
+ -- Set a buffer variable
+ vim.b[bufnr].barscript_version = 2
+ end
end
return "bar"
end,
@@ -1868,10 +2059,87 @@ add({filetypes}) *vim.filetype.add()*
})
<
+ To add a fallback match on contents (see
+ |new-filetype-scripts|), use >
+
+ vim.filetype.add {
+ pattern = {
+ ['.*'] = {
+ priority = -math.huge,
+ function(path, bufnr)
+ local content = vim.filetype.getlines(bufnr, 1)
+ if vim.filetype.matchregex(content, { [[^#!.*\<mine\>]] }) then
+ return 'mine'
+ elseif vim.filetype.matchregex(content, { [[\<drawing\>]] }) then
+ return 'drawing'
+ end
+ end,
+ },
+ },
+ }
+<
+
Parameters: ~
- {filetypes} table A table containing new filetype maps
+ {filetypes} (table) A table containing new filetype maps
(see example).
+match({args}) *vim.filetype.match()*
+ Perform filetype detection.
+
+ The filetype can be detected using one of three methods:
+ 1. Using an existing buffer
+ 2. Using only a file name
+ 3. Using only file contents
+
+ Of these, option 1 provides the most accurate result as it
+ uses both the buffer's filename and (optionally) the buffer
+ contents. Options 2 and 3 can be used without an existing
+ buffer, but may not always provide a match in cases where the
+ filename (or contents) cannot unambiguously determine the
+ filetype.
+
+ Each of the three options is specified using a key to the
+ single argument of this function. Example:
+>
+
+ -- Using a buffer number
+ vim.filetype.match({ buf = 42 })
+
+ -- Override the filename of the given buffer
+ vim.filetype.match({ buf = 42, filename = 'foo.c' })
+
+ -- Using a filename without a buffer
+ vim.filetype.match({ filename = 'main.lua' })
+
+ -- Using file contents
+ vim.filetype.match({ contents = {'#!/usr/bin/env bash'} })
+<
+
+ Parameters: ~
+ {args} (table) Table specifying which matching strategy
+ to use. Accepted keys are:
+ • buf (number): Buffer number to use for matching.
+ Mutually exclusive with {contents}
+ • filename (string): Filename to use for matching.
+ When {buf} is given, defaults to the filename of
+ the given buffer number. The file need not
+ actually exist in the filesystem. When used
+ without {buf} only the name of the file is used
+ for filetype matching. This may result in
+ failure to detect the filetype in cases where
+ the filename alone is not enough to disambiguate
+ the filetype.
+ • contents (table): An array of lines representing
+ file contents to use for matching. Can be used
+ with {filename}. Mutually exclusive with {buf}.
+
+ Return: ~
+ (string|nil) If a match was found, the matched filetype.
+ (function|nil) A function that modifies buffer state when
+ called (for example, to set some filetype specific buffer
+ variables). The function accepts a buffer number as its
+ only argument.
+
==============================================================================
Lua module: keymap *lua-keymap*
@@ -1885,7 +2153,7 @@ del({modes}, {lhs}, {opts}) *vim.keymap.del()*
<
Parameters: ~
- {opts} table A table of optional arguments:
+ {opts} (table) A table of optional arguments:
• buffer: (number or boolean) Remove a mapping
from the given buffer. When "true" or 0, use the
current buffer.
@@ -1918,9 +2186,9 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
vim.keymap.set('n', 'asdf', require('jkl').my_fun)
<
- the require('jkl') gets evaluated during this call in order to
- access the function. If you want to avoid this cost at startup
- you can wrap it in a function, for example: >
+ the `require('jkl')` gets evaluated during this call in order to access the
+ function. If you want to avoid this cost at startup you can
+ wrap it in a function, for example: >
vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end)
<
@@ -1929,24 +2197,152 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
{mode} string|table Same mode short names as
|nvim_set_keymap()|. Can also be list of modes to
create mapping on multiple modes.
- {lhs} string Left-hand side |{lhs}| of the mapping.
+ {lhs} (string) Left-hand side |{lhs}| of the mapping.
{rhs} string|function Right-hand side |{rhs}| of the
- mapping. Can also be a Lua function.
- {opts} table A table of |:map-arguments| such as
+ mapping. Can also be a Lua function. If a Lua
+ function and `opts.expr == true`, returning `nil`
+ is equivalent to an empty string.
+ {opts} (table) A table of |:map-arguments| such as
"silent". In addition to the options listed in
|nvim_set_keymap()|, this table also accepts the
following keys:
+ • buffer: (number or boolean) Add a mapping to the
+ given buffer. When "true" or 0, use the current
+ buffer.
• replace_keycodes: (boolean, default true) When
both this and expr is "true",
|nvim_replace_termcodes()| is applied to the
result of Lua expr maps.
• remap: (boolean) Make the mapping recursive.
This is the inverse of the "noremap" option from
- |nvim_set_keymap()|. Default `true` if `lhs` is
- a string starting with `<plug>`
- (case-insensitive), `false` otherwise.
+ |nvim_set_keymap()|. Default `false`.
See also: ~
|nvim_set_keymap()|
+
+==============================================================================
+Lua module: fs *lua-fs*
+
+basename({file}) *vim.fs.basename()*
+ Return the basename of the given file or directory
+
+ Parameters: ~
+ {file} (string) File or directory
+
+ Return: ~
+ (string) Basename of {file}
+
+dir({path}) *vim.fs.dir()*
+ Return an iterator over the files and directories located in
+ {path}
+
+ Parameters: ~
+ {path} (string) An absolute or relative path to the
+ directory to iterate over. The path is first
+ normalized |vim.fs.normalize()|.
+
+ Return: ~
+ Iterator over files and directories in {path}. Each
+ iteration yields two values: name and type. Each "name" is
+ the basename of the file or directory relative to {path}.
+ Type is one of "file" or "directory".
+
+dirname({file}) *vim.fs.dirname()*
+ Return the parent directory of the given file or directory
+
+ Parameters: ~
+ {file} (string) File or directory
+
+ Return: ~
+ (string) Parent directory of {file}
+
+find({names}, {opts}) *vim.fs.find()*
+ Find files or directories in the given path.
+
+ Finds any files or directories given in {names} starting from
+ {path}. If {upward} is "true" then the search traverses upward
+ through parent directories; otherwise, the search traverses
+ downward. Note that downward searches are recursive and may
+ search through many directories! If {stop} is non-nil, then
+ the search stops when the directory given in {stop} is
+ reached. The search terminates when {limit} (default 1)
+ matches are found. The search can be narrowed to find only
+ files or or only directories by specifying {type} to be "file"
+ or "directory", respectively.
+
+ Parameters: ~
+ {names} (string|table) Names of the files and directories
+ to find. Must be base names, paths and globs are
+ not supported.
+ {opts} (table) Optional keyword arguments:
+ • path (string): Path to begin searching from. If
+ omitted, the current working directory is used.
+ • upward (boolean, default false): If true,
+ search upward through parent directories.
+ Otherwise, search through child directories
+ (recursively).
+ • stop (string): Stop searching when this
+ directory is reached. The directory itself is
+ not searched.
+ • type (string): Find only files ("file") or
+ directories ("directory"). If omitted, both
+ files and directories that match {name} are
+ included.
+ • limit (number, default 1): Stop the search
+ after finding this many matches. Use
+ `math.huge` to place no limit on the number of
+ matches.
+
+ Return: ~
+ (table) The paths of all matching files or directories
+
+normalize({path}) *vim.fs.normalize()*
+ Normalize a path to a standard format. A tilde (~) character
+ at the beginning of the path is expanded to the user's home
+ directory and any backslash (\) characters are converted to
+ forward slashes (/). Environment variables are also expanded.
+
+ Example: >
+
+ vim.fs.normalize('C:\Users\jdoe')
+ => 'C:/Users/jdoe'
+
+ vim.fs.normalize('~/src/neovim')
+ => '/home/jdoe/src/neovim'
+
+ vim.fs.normalize('$XDG_CONFIG_HOME/nvim/init.vim')
+ => '/Users/jdoe/.config/nvim/init.vim'
+<
+
+ Parameters: ~
+ {path} (string) Path to normalize
+
+ Return: ~
+ (string) Normalized path
+
+parents({start}) *vim.fs.parents()*
+ Iterate over all the parents of the given file or directory.
+
+ Example: >
+
+ local root_dir
+ for dir in vim.fs.parents(vim.api.nvim_buf_get_name(0)) do
+ if vim.fn.isdirectory(dir .. "/.git") == 1 then
+ root_dir = dir
+ break
+ end
+ end
+
+ if root_dir then
+ print("Found git repository at", root_dir)
+ end
+<
+
+ Parameters: ~
+ {start} (string) Initial file or directory.
+
+ Return: ~
+ (function) Iterator
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index e2c274e040..7e94167e07 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -48,6 +48,7 @@ modes.
allows for nested and recursive use of mappings.
Note: Trailing spaces are included in the {rhs},
because space is a valid Normal mode command.
+ See |map-trailing-white|.
*:nore* *:norem*
:no[remap] {lhs} {rhs} |mapmode-nvo| *:no* *:noremap* *:nor*
@@ -65,6 +66,8 @@ modes.
where the map command applies. Disallow mapping of
{rhs}, to avoid nested and recursive mappings. Often
used to redefine a command.
+ Note: When <Plug> appears in the {rhs} this part is
+ always applied even if remapping is disallowed.
:unm[ap] {lhs} |mapmode-nvo| *:unm* *:unmap*
@@ -83,10 +86,8 @@ modes.
for other modes where it applies.
It also works when {lhs} matches the {rhs} of a
mapping. This is for when an abbreviation applied.
- Note: Trailing spaces are included in the {lhs}. This
- unmap does NOT work: >
- :map @@ foo
- :unmap @@ | print
+ Note: Trailing spaces are included in the {lhs}.
+ See |map-trailing-white|.
:mapc[lear] |mapmode-nvo| *:mapc* *:mapclear*
:nmapc[lear] |mapmode-n| *:nmapc* *:nmapclear*
@@ -103,7 +104,7 @@ modes.
command applies.
Use the <buffer> argument to remove buffer-local
mappings |:map-<buffer>|
- Warning: This also removes the default mappings.
+ Warning: This also removes the |default-mappings|.
:map |mapmode-nvo|
:nm[ap] |mapmode-n|
@@ -150,6 +151,24 @@ that mapping won't get expanded yet, Vim is waiting for another character.
If you type a space, then "foo" will get inserted, plus the space. If you
type "a", then "bar" will get inserted.
+Trailing white space ~
+ *map-trailing-white*
+This unmap command does NOT work: >
+ :map @@ foo
+ :unmap @@ | print
+
+Because it tries to unmap "@@ ", including the white space before the command
+separator "|". Other examples with trailing white space: >
+ unmap @@
+ unmap @@ " comment
+
+An error will be issued, which is very hard to identify, because the ending
+whitespace character in `unmap @@ ` is not visible.
+
+A generic solution is to put the command separator "|" right after the mapped
+keys. After that white space and a comment may follow: >
+ unmap @@| " comment
+
1.2 SPECIAL ARGUMENTS *:map-arguments*
@@ -157,7 +176,8 @@ type "a", then "bar" will get inserted.
"<unique>" can be used in any order. They must appear right after the
command, before any other arguments.
- *:map-local* *:map-<buffer>* *:map-buffer* *E224* *E225*
+ *:map-local* *:map-<buffer>* *:map-buffer*
+ *E224* *E225*
If the first argument to one of these commands is "<buffer>" the mapping will
be effective in the current buffer only. Example: >
:map <buffer> ,w /[.,;]<CR>
@@ -244,7 +264,7 @@ go through the main loop (e.g. to update the display), return "\<Ignore>".
This is similar to "nothing" but makes Vim return from the loop that waits for
input.
-Also, keep in mind that the expression may be evaluated when looking for
+Keep in mind that the expression may be evaluated when looking for
typeahead, before the previous command has been executed. For example: >
func StoreColumn()
let g:column = col('.')
@@ -285,7 +305,7 @@ Here is an example that inserts a list number that increases: >
func ListItem()
let g:counter += 1
- return g:counter . '. '
+ return g:counter .. '. '
endfunc
func ListReset()
@@ -326,8 +346,6 @@ Note:
mapping is recursive.
- In Visual mode you can use `line('v')` and `col('v')` to get one end of the
Visual area, the cursor is at the other end.
-- In select-mode, |:map| and |:vmap| command mappings are executed in
- visual-mode. Use |:smap| to handle select-mode.
*E5520*
<Cmd> commands must terminate, that is, they must be followed by <CR> in the
@@ -502,7 +520,9 @@ Note: When using mappings for Visual mode, you can use the "'<" mark, which
is the start of the last selected Visual area in the current buffer |'<|.
The |:filter| command can be used to select what mappings to list. The
-pattern is matched against the {lhs} and {rhs} in the raw form.
+pattern is matched against the {lhs} and {rhs} in the raw form. If a
+description was added using |nvim_set_keymap()| or |nvim_buf_set_keymap()|
+then the pattern is also matched against it.
*:map-verbose*
When 'verbose' is non-zero, listing a key map will also display where it was
@@ -792,9 +812,8 @@ command. For example: >
:noremap j k
This will exchange the cursor up and down commands.
-With the normal :map command, when the 'remap' option is on, mapping takes
-place until the text is found not to be a part of a {lhs}. For example, if
-you use: >
+With the normal :map command mapping takes place until the text is found not
+to be a part of a {lhs}. For example, if you use: >
:map x y
:map y x
Vim will replace x with y, and then y with x, etc. When this has happened
@@ -1217,7 +1236,7 @@ scripts.
*:command-verbose*
When 'verbose' is non-zero, listing a command will also display where it was
-last defined. Example: >
+last defined and any completion argument. Example: >
:verbose command TOhtml
< Name Args Range Complete Definition ~
@@ -1241,6 +1260,10 @@ See |:verbose-cmd| for more information.
:delc[ommand] {cmd} *:delc* *:delcommand* *E184*
Delete the user-defined command {cmd}.
+:delc[ommand] -buffer {cmd} *E1237*
+ Delete the user-defined command {cmd} that was defined
+ for the current buffer.
+
:comc[lear] *:comc* *:comclear*
Delete all user-defined commands.
@@ -1332,6 +1355,8 @@ completion can be enabled:
-complete=custom,{func} custom completion, defined via {func}
-complete=customlist,{func} custom completion, defined via {func}
+If you specify completion while there is nothing to complete (-nargs=0, the
+default) then you get error *E1208* .
Note: That some completion methods might expand environment variables.
@@ -1411,7 +1436,7 @@ which by default correspond to the current line, last line and the whole
buffer, relate to arguments, (loaded) buffers, windows or tab pages.
Possible values are (second column is the short name used in listing):
- -addr=lines Range of lines (this is the default)
+ -addr=lines line Range of lines (this is the default)
-addr=arguments arg Range for arguments
-addr=buffers buf Range for buffers (also not loaded buffers)
-addr=loaded_buffers load Range for loaded buffers
@@ -1421,6 +1446,112 @@ Possible values are (second column is the short name used in listing):
-addr=other ? other kind of range
+Incremental preview ~
+ *:command-preview* {nvim-api}
+Commands can show an 'inccommand' (as-you-type) preview by defining a preview
+handler (only from Lua, see |nvim_create_user_command()|).
+
+The preview callback must be a Lua function with this signature: >
+
+ function cmdpreview(opts, ns, buf)
+<
+where "opts" has the same form as that given to |nvim_create_user_command()|
+callbacks, "ns" is the preview namespace id for highlights, and "buf" is the
+buffer that your preview routine will directly modify to show the previewed
+results (for "inccommand=split", or nil for "inccommand=nosplit").
+
+Your command preview routine must implement this protocol:
+
+1. Modify the current buffer as required for the preview (see
+ |nvim_buf_set_text()| and |nvim_buf_set_lines()|).
+2. If preview buffer is provided, add necessary text to the preview buffer.
+3. Add required highlights to the current buffer. If preview buffer is
+ provided, add required highlights to the preview buffer as well. All
+ highlights must be added to the preview namespace which is provided as an
+ argument to the preview callback (see |nvim_buf_add_highlight()| and
+ |nvim_buf_set_extmark()| for help on how to add highlights to a namespace).
+4. Return an integer (0, 1, 2) which controls how Nvim behaves as follows:
+ 0: No preview is shown.
+ 1: Preview is shown without preview window (even with "inccommand=split").
+ 2: Preview is shown and preview window is opened (if "inccommand=split").
+ For "inccommand=nosplit" this is the same as 1.
+
+After preview ends, Nvim discards all changes to the buffer and all highlights
+in the preview namespace.
+
+Here's an example of a command to trim trailing whitespace from lines that
+supports incremental command preview:
+>
+ -- Trims trailing whitespace in the current buffer.
+ -- Also performs 'inccommand' preview if invoked as a preview callback
+ -- (preview_ns is non-nil).
+ local function trim_space(opts, preview_ns, preview_buf)
+ local line1 = opts.line1
+ local line2 = opts.line2
+ local buf = vim.api.nvim_get_current_buf()
+ local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, 0)
+ local new_lines = {}
+ local preview_buf_line = 0
+
+ for i, line in ipairs(lines) do
+ local startidx, endidx = string.find(line, '%s+$')
+
+ if startidx ~= nil then
+ -- Highlight the match if in command preview mode
+ if preview_ns ~= nil then
+ vim.api.nvim_buf_add_highlight(
+ buf, preview_ns, 'Substitute', line1 + i - 2, startidx - 1,
+ endidx
+ )
+
+ -- Add lines and highlight to the preview buffer
+ -- if inccommand=split
+ if preview_buf ~= nil then
+ local prefix = string.format('|%d| ', line1 + i - 1)
+
+ vim.api.nvim_buf_set_lines(
+ preview_buf, preview_buf_line, preview_buf_line, 0,
+ { prefix .. line }
+ )
+ vim.api.nvim_buf_add_highlight(
+ preview_buf, preview_ns, 'Substitute', preview_buf_line,
+ #prefix + startidx - 1, #prefix + endidx
+ )
+
+ preview_buf_line = preview_buf_line + 1
+ end
+ end
+ end
+
+ if not preview_ns then
+ new_lines[#new_lines+1] = string.gsub(line, '%s+$', '')
+ end
+ end
+
+ -- Don't make any changes to the buffer if previewing
+ if not preview_ns then
+ vim.api.nvim_buf_set_lines(buf, line1 - 1, line2, 0, new_lines)
+ end
+
+ -- When called as a preview callback, return the value of the
+ -- preview type
+ if preview_ns ~= nil then
+ return 2
+ end
+ end
+
+ -- Create the user command
+ vim.api.nvim_create_user_command(
+ 'TrimTrailingWhitespace',
+ trim_space,
+ { nargs = '?', range = '%', addr = 'lines', preview = trim_space }
+ )
+<
+Note that in the above example, the same function is used as both the command
+callback and the preview callback, but you could instead use separate
+functions.
+
+
Special cases ~
*:command-bang* *:command-bar*
*:command-register* *:command-buffer*
@@ -1434,6 +1565,9 @@ There are some special cases as well:
-register The first argument to the command can be an optional
register name (like :del, :put, :yank).
-buffer The command will only be available in the current buffer.
+ -keepscript Do not use the location of where the user command was
+ defined for verbose messages, use the location of where
+ the user command was invoked.
In the cases of the -count and -register attributes, if the optional argument
is supplied, it is removed from the argument list and is available to the
@@ -1471,19 +1605,19 @@ The valid escape sequences are
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
|:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
- |:lockmarks|, |:noswapfile| |:rightbelow|, |:silent|, |:tab|,
- |:topleft|, |:verbose|, and |:vertical|.
- Note that these are not yet supported: |:noautocmd|,
- |:sandbox| and |:unsilent|.
+ |:lockmarks|, |:noautocmd|, |:noswapfile| |:rightbelow|,
+ |:sandbox|, |:silent|, |:tab|, |:topleft|, |:unsilent|,
+ |:verbose|, and |:vertical|.
+ Note that |:filter| is not supported.
Examples: >
command! -nargs=+ -complete=file MyEdit
\ for f in expand(<q-args>, 0, 1) |
- \ exe '<mods> split ' . f |
+ \ exe '<mods> split ' .. f |
\ endfor
function! SpecialEdit(files, mods)
for f in expand(a:files, 0, 1)
- exe a:mods . ' split ' . f
+ exe a:mods .. ' split ' .. f
endfor
endfunction
command! -nargs=+ -complete=file Sedit
@@ -1559,7 +1693,7 @@ This will invoke: >
: let i = 0
: while i < argc()
: if filereadable(argv(i))
- : execute "e " . argv(i)
+ : execute "e " .. argv(i)
: execute a:command
: endif
: let i = i + 1
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 950028d9cc..dac4df5ee9 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -27,8 +27,7 @@ depends on the 'shortmess' option.
Clear messages, keeping only the {count} most
recent ones.
-The number of remembered messages is fixed at 20 for the tiny version and 200
-for other versions.
+The number of remembered messages is fixed at 200.
*g<*
The "g<" command can be used to see the last page of previous command output.
@@ -62,7 +61,7 @@ If you are lazy, it also works without the shift key: >
When an error message is displayed, but it is removed before you could read
it, you can see it again with: >
- :echo errmsg
+ :echo v:errmsg
Or view a list of recent messages with: >
:messages
See `:messages` above.
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index c473244827..9655d07a84 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -735,6 +735,11 @@ Jumping to a mark can be done in two ways:
2. With ' (single quote): The cursor is positioned on the first non-blank
character in the line of the specified location and
the motion is linewise.
+ *mark-view*
+3. Apart from the above if 'jumpoptions' contains "view", they will also try to
+restore the mark view. This is the number of lines between the cursor position
+and the window topline (first buffer line displayed in the window) when it was
+set.
*m* *mark* *Mark*
m{a-zA-Z} Set mark {a-zA-Z} at cursor position (does not move
@@ -993,7 +998,7 @@ These commands are not marks themselves, but jump to a mark:
:let lnum = line(".")
:keepjumps normal gg
:call SetLastChange()
- :keepjumps exe "normal " . lnum . "G"
+ :keepjumps exe "normal " .. lnum .. "G"
<
Note that ":keepjumps" must be used for every command.
When invoking a function the commands in that function
@@ -1044,6 +1049,9 @@ The "file/text" column shows the file name, or the text at the jump if it is
in the current file (an indent is removed and a long line is truncated to fit
in the window).
+The marker ">" indicates the current position in the jumplist. It may not be
+shown when filtering the |:jumps| command using |:filter|
+
You are currently in line 1167. If you then use the CTRL-O command, the
cursor is put in line 1154. This results in:
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt
index bfacbe19f5..a7be9ff98f 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/nvim_terminal_emulator.txt
@@ -25,31 +25,30 @@ Start *terminal-start*
There are several ways to create a terminal buffer:
-- Invoke the |:terminal| command.
-- Call the |termopen()| function.
-- Edit a file with a name matching `term://(.{-}//(\d+:)?)?\zs.*`.
- For example:
->
+- Run the |:terminal| command.
+- Call the |nvim_open_term()| or |termopen()| function.
+- Edit a "term://" buffer. Examples: >
:edit term://bash
:vsplit term://top
-<
- Note: The "term://" pattern is handled by a BufReadCmd handler, so the
- |autocmd-nested| modifier is required to use it in an autocmd. >
+
+< Note: To open a "term://" buffer from an autocmd, the |autocmd-nested|
+ modifier is required. >
autocmd VimEnter * ++nested split term://sh
-< This is only mentioned for reference; use |:terminal| instead.
+< (This is only mentioned for reference; use |:terminal| instead.)
When the terminal starts, the buffer contents are updated and the buffer is
named in the form of `term://{cwd}//{pid}:{cmd}`. This naming scheme is used
by |:mksession| to restore a terminal buffer (by restarting the {cmd}).
+The terminal environment is initialized as in |jobstart-env|.
+
==============================================================================
Input *terminal-input*
-To send input, enter |Terminal-mode| using any command that would enter "insert
-mode" in a normal buffer, such as |i| or |:startinsert|. In this mode all keys
-except <C-\> are sent to the underlying program. If <C-\> is pressed, the
-next key is sent unless it is <C-N>. Use <C-\><C-N> to return to normal-mode.
-|CTRL-\_CTRL-N|
+To send input, enter |Terminal-mode| with |i|, |I|, |a|, |A| or
+|:startinsert|. In this mode all keys except <C-\> are sent to the underlying
+program. If <C-\> is pressed, the next key is sent unless it is <C-N>. Use
+<C-\><C-N> to return to normal-mode. |CTRL-\_CTRL-N|
Terminal-mode forces these local options:
@@ -81,6 +80,9 @@ To use `ALT+{h,j,k,l}` to navigate windows from any mode: >
:nnoremap <A-k> <C-w>k
:nnoremap <A-l> <C-w>l
+You can also create menus similar to terminal mode mappings, but you have to
+use |:tlmenu| instead of |:tmenu|.
+
Mouse input has the following behavior:
- If the program has enabled mouse events, the corresponding events will be
@@ -162,12 +164,11 @@ command name, for example: >
This opens two windows:
gdb window A terminal window in which "gdb vim" is executed. Here you
- can directly interact with gdb. The buffer name is "!gdb".
+ can directly interact with gdb.
program window A terminal window for the executed program. When "run" is
used in gdb the program I/O will happen in this window, so
- that it does not interfere with controlling gdb. The buffer
- name is "gdb program".
+ that it does not interfere with controlling gdb.
The current window is used to show the source code. When gdb pauses the
source file location will be displayed, if possible. A sign is used to
@@ -267,6 +268,8 @@ Put focus on the gdb window to type commands there. Some common ones are:
- next execute the current line and stop at the next line
- step execute the current line and stop at the next statement,
entering functions
+- until execute until past the current cursor line or past a specified
+ position or the current stack frame returns
- finish execute until leaving the current function
- where show the stack
- frame N go to the Nth stack frame
@@ -283,6 +286,7 @@ gdb:
*:Step* execute the gdb "step" command
*:Over* execute the gdb "next" command (`:Next` is a Vim command)
+ *:Until* execute the gdb "until" command
*:Finish* execute the gdb "finish" command
*:Continue* execute the gdb "continue" command
*:Stop* interrupt the program
@@ -303,7 +307,7 @@ breakpoint, or use the "Clear breakpoint" right-click menu entry.
Inspecting variables ~
*termdebug-variables* *:Evaluate*
`:Evaluate` evaluate the expression under the cursor
- `K` same
+ `K` same (see |termdebug_map_K| to disable)
`:Evaluate` {expr} evaluate {expr}
`:'<,'>Evaluate` evaluate the Visually selected text
@@ -332,7 +336,7 @@ Four autocommands can be used: >
*TermdebugStartPre*
TermdebugStartPre Before starting debugging.
Not triggered if the debugger is already
- running or |g:termdebugger| cannot be
+ running or the debugger command cannot be
executed.
*TermdebugStartPost*
TermdebugStartPost After debugging has initialized.
@@ -361,14 +365,24 @@ This works slightly differently:
*termdebug_use_prompt*
Prompt mode can be used with: >
+ let g:termdebug_config['use_prompt'] = 1
+Or if there is no g:termdebug_config: >
let g:termdebug_use_prompt = 1
-
+<
+ *termdebug_map_K*
+The K key is normally mapped to :Evaluate. If you do not want this use: >
+ let g:termdebug_config['map_K'] = 0
+Or if there is no g:termdebug_config: >
+ let g:termdebug_map_K = 0
<
*termdebug_disasm_window*
-If you want the Asm window shown by default, set this to 1. Setting to
-any value greater than 1 will set the Asm window height to that value: >
+If you want the Asm window shown by default, set the flag to 1.
+the "disasm_window_height" entry can be used to set the window height: >
+ let g:termdebug_config['disasm_window'] = 1
+ let g:termdebug_config['disasm_window_height'] = 15
+or, if there is no g:termdebug_config: >
let g:termdebug_disasm_window = 15
-<
+Any value greater than 1 will set the Asm window height to that value.
Communication ~
*termdebug-communication*
@@ -385,13 +399,24 @@ communication channel.
Customizing ~
+ *termdebug-customizing* *g:termdebug_config*
+In the past several global variables were used for configuration. These are
+deprecated, using the g:termdebug_config dictionary is preferred. When
+g:termdebug_config exists the other global variables will not be used.
+
-GDB command *termdebug-customizing*
+GDB command ~
+ *g:termdebugger*
+To change the name of the gdb command, set "debugger" entry in
+g:termdebug_config or the "g:termdebugger" variable before invoking
+`:Termdebug`: >
+ let g:termdebug_config['command'] = "mygdb"
+Or if there is no g:termdebug_config: >
+ let g:termdebugger = "mygdb"
-To change the name of the gdb command, set the "termdebugger" variable before
-invoking `:Termdebug`: >
- let termdebugger = "mygdb"
If the command needs an argument use a List: >
+ let g:termdebug_config['command'] = ['rr', 'replay', '--']
+Or if there is no g:termdebug_config: >
let g:termdebugger = ['rr', 'replay', '--']
To not use neovim floating windows for previewing variable evaluation, set the
@@ -405,7 +430,17 @@ cursor: >
or set/unset a breakpoint: >
nnoremap <RightMouse> :Break<CR>
-< *gdb-version*
+
+Several arguments will be added to make gdb work well for the debugger.
+If you want to modify them, add a function to filter the argument list: >
+ let g:termdebug_config['command_filter'] = MyDebugFilter
+
+If you do not want the arguments to be added, but you do need to set the
+"pty", use a function to add the necessary arguments: >
+ let g:termdebug_config['command_add_args'] = MyAddArguments
+The function will be called with the list of arguments so far, and a second
+argument that is the name of the pty.
+ *gdb-version*
Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI
interface. The "new-ui" command requires gdb version 7.12 or later. if you
get this error:
@@ -413,8 +448,8 @@ get this error:
Then your gdb is too old.
-Colors *hl-debugPC* *hl-debugBreakpoint*
-
+Colors ~
+ *hl-debugPC* *hl-debugBreakpoint*
The color of the signs can be adjusted with these highlight groups:
- debugPC the current position
- debugBreakpoint a breakpoint
@@ -428,7 +463,8 @@ When 'background' is "dark":
hi debugBreakpoint term=reverse ctermbg=red guibg=red
-Shortcuts *termdebug_shortcuts*
+Shortcuts ~
+ *termdebug_shortcuts*
You can define your own shortcuts (mappings) to control gdb, that can work in
any window, using the TermDebugSendCommand() function. Example: >
@@ -436,18 +472,37 @@ any window, using the TermDebugSendCommand() function. Example: >
The argument is the gdb command.
-Vim window width *termdebug_wide*
+Popup menu ~
+ *termdebug_popup*
+
+By default the Termdebug plugin sets 'mousemodel' to "popup_setpos" and adds
+these entries to the popup menu:
+ Set breakpoint `:Break`
+ Clear breakpoint `:Clear`
+ Evaluate `:Evaluate`
+If you don't want this then disable it with: >
+ let g:termdebug_config['popup'] = 0
+or if there is no g:termdebug_config: >
+ let g:termdebug_popup = 0
+
+
+Vim window width ~
+ *termdebug_wide*
+
+To change the width of the Vim window when debugging starts and use a vertical
+split: >
+ let g:termdebug_config['wide'] = 163
+Or if there is no g:termdebug_config: >
+ let g:termdebug_wide = 163
+
+This will set 'columns' to 163 when `:Termdebug` is used. The value is
+restored when quitting the debugger.
-To change the width of the Vim window when debugging starts, and use a
-vertical split: >
- let g:termdebug_wide = 163
-This will set &columns to 163 when `:Termdebug` is used. The value is restored
-when quitting the debugger.
-If g:termdebug_wide is set and &columns is already larger than
-g:termdebug_wide then a vertical split will be used without changing &columns.
-Set it to 1 to get a vertical split without every changing &columns (useful
-for when the terminal can't be resized by Vim).
+If the wide value is set and 'columns' is already a greater value, then a
+vertical split will be used without modifying 'columns'.
+Set the wide value to 1 to use a vertical split without ever changing
+'columns'. This is useful when the terminal can't be resized by Vim.
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 7dea475801..eda596bf71 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -20,9 +20,13 @@ achieve special effects. These options come in three forms:
1. Setting options *set-option* *E764*
*:se* *:set*
-:se[t] Show all options that differ from their default value.
+:se[t][!] Show all options that differ from their default value.
+ When [!] is present every option is on a separate
+ line.
-:se[t] all Show all options.
+:se[t][!] all Show all options.
+ When [!] is present every option is on a separate
+ line.
*E518* *E519*
:se[t] {option}? Show value of {option}.
@@ -65,7 +69,7 @@ achieve special effects. These options come in three forms:
:se[t] {option}+={value} *:set+=*
Add the {value} to a number option, or append the
{value} to a string option. When the option is a
- comma separated list, a comma is added, unless the
+ comma-separated list, a comma is added, unless the
value was empty.
If the option is a list of flags, superfluous flags
are removed. When adding a flag that was already
@@ -75,7 +79,7 @@ achieve special effects. These options come in three forms:
:se[t] {option}^={value} *:set^=*
Multiply the {value} to a number option, or prepend
the {value} to a string option. When the option is a
- comma separated list, a comma is added, unless the
+ comma-separated list, a comma is added, unless the
value was empty.
Also see |:set-args| above.
@@ -83,7 +87,7 @@ achieve special effects. These options come in three forms:
Subtract the {value} from a number option, or remove
the {value} from a string option, if it is there.
If the {value} is not found in a string option, there
- is no error or warning. When the option is a comma
+ is no error or warning. When the option is a comma-
separated list, a comma is deleted, unless the option
becomes empty.
When the option is a list of flags, {value} must be
@@ -235,7 +239,7 @@ happens when the buffer is not loaded, but they are lost when the buffer is
wiped out |:bwipe|.
*:setl* *:setlocal*
-:setl[ocal] ... Like ":set" but set only the value local to the
+:setl[ocal][!] ... Like ":set" but set only the value local to the
current buffer or window. Not all options have a
local value. If the option does not have a local
value the global value is set.
@@ -257,7 +261,7 @@ wiped out |:bwipe|.
{option}, so that the global value will be used.
*:setg* *:setglobal*
-:setg[lobal] ... Like ":set" but set only the global value for a local
+:setg[lobal][!] ... Like ":set" but set only the global value for a local
option without changing the local value.
When displaying an option, the global value is shown.
With the "all" argument: display global values for all
@@ -747,7 +751,8 @@ A jump table for the options with a short description can be found at |Q_op|.
nostop like start, except CTRL-W and CTRL-U do not stop at the start of
insert.
- When the value is empty, Vi compatible backspacing is used.
+ When the value is empty, Vi compatible backspacing is used, none of
+ the ways mentioned for the items above are possible.
For backwards compatibility with version 5.4 and earlier:
value effect ~
@@ -771,10 +776,10 @@ A jump table for the options with a short description can be found at |Q_op|.
oldest version of a file.
*'backupcopy'* *'bkc'*
-'backupcopy' 'bkc' string (Vi default for Unix: "yes", otherwise: "auto")
+'backupcopy' 'bkc' string (default: "auto")
global or local to buffer |global-local|
When writing a file and a backup is made, this option tells how it's
- done. This is a comma separated list of words.
+ done. This is a comma-separated list of words.
The main values are:
"yes" make a copy of the file and overwrite the original one
@@ -798,10 +803,10 @@ A jump table for the options with a short description can be found at |Q_op|.
file.
- When the file is a link the new file will not be a link.
- The "auto" value is the middle way: When Vim sees that renaming file
- is possible without side effects (the attributes can be passed on and
- the file is not a link) that is used. When problems are expected, a
- copy will be made.
+ The "auto" value is the middle way: When Vim sees that renaming the
+ file is possible without side effects (the attributes can be passed on
+ and the file is not a link) that is used. When problems are expected,
+ a copy will be made.
The "breaksymlink" and "breakhardlink" values can be used in
combination with any of "yes", "no" and "auto". When included, they
@@ -820,13 +825,13 @@ A jump table for the options with a short description can be found at |Q_op|.
When a copy is made, the original file is truncated and then filled
with the new text. This means that protection bits, owner and
- symbolic links of the original file are unmodified. The backup file
+ symbolic links of the original file are unmodified. The backup file,
however, is a new file, owned by the user who edited the file. The
group of the backup is set to the group of the original file. If this
fails, the protection bits for the group are made the same as for
others.
- When the file is renamed this is the other way around: The backup has
+ When the file is renamed, this is the other way around: The backup has
the same attributes of the original file, and the newly written file
is owned by the current user. When the file was a (hard/symbolic)
link, the new file will not! That's why the "auto" value doesn't
@@ -836,7 +841,7 @@ A jump table for the options with a short description can be found at |Q_op|.
again not rename the file.
*'backupdir'* *'bdir'*
-'backupdir' 'bdir' string (default ".,$XDG_DATA_HOME/nvim/backup//")
+'backupdir' 'bdir' string (default ".,$XDG_STATE_HOME/nvim/backup//")
global
List of directories for the backup file, separated with commas.
- The backup file will be created in the first directory in the list
@@ -888,12 +893,12 @@ A jump table for the options with a short description can be found at |Q_op|.
accidentally overwriting existing files with a backup file. You might
prefer using ".bak", but make sure that you don't have files with
".bak" that you want to keep.
- Only normal file name characters can be used, "/\*?[|<>" are illegal.
+ Only normal file name characters can be used; "/\*?[|<>" are illegal.
If you like to keep a lot of backups, you could use a BufWritePre
autocommand to change 'backupext' just before writing the file to
include a timestamp. >
- :au BufWritePre * let &bex = '-' . strftime("%Y%b%d%X") . '~'
+ :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
< Use 'backupdir' to put the backup in a different directory.
*'backupskip'* *'bsk'*
@@ -916,25 +921,16 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that environment variables are not expanded. If you want to use
$HOME you must expand it explicitly, e.g.: >
- :let backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
+ :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
< Note that the default also makes sure that "crontab -e" works (when a
backup would be made by renaming the original file crontab won't see
the newly created file). Also see 'backupcopy' and |crontab|.
- *'balloondelay'* *'bdlay'*
-'balloondelay' 'bdlay' Removed.
-
- *'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'*
-'ballooneval' 'beval' Removed.
-
- *'balloonexpr'* *'bexpr'*
-'balloonexpr' 'bexpr' Removed.
-
*'belloff'* *'bo'*
'belloff' 'bo' string (default "all")
global
- Specifies for which events the bell will not be rung. It is a comma
+ Specifies for which events the bell will not be rung. It is a comma-
separated list of items. For each item that is present, the bell
will be silenced. This is most useful to specify specific events in
insert mode to be silenced.
@@ -954,7 +950,6 @@ A jump table for the options with a short description can be found at |Q_op|.
(mostly used in |Normal-mode| or |Cmdline-mode|).
esc hitting <Esc> in |Normal-mode|.
hangul Ignored.
- insertmode Pressing <Esc> in 'insertmode'.
lang Calling the beep module for Lua/Mzscheme/TCL.
mess No output available for |g<|.
showmatch Error occurred for 'showmatch' function.
@@ -1025,7 +1020,7 @@ A jump table for the options with a short description can be found at |Q_op|.
This option lets you choose which characters might cause a line
break if 'linebreak' is on. Only works for ASCII characters.
- *'breakindent'* *'bri'*
+ *'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
'breakindent' 'bri' boolean (default off)
local to window
Every wrapped line will continue visually indented (same amount of
@@ -1072,16 +1067,16 @@ A jump table for the options with a short description can be found at |Q_op|.
This option specifies what happens when a buffer is no longer
displayed in a window:
<empty> follow the global 'hidden' option
- hide hide the buffer (don't unload it), also when 'hidden'
- is not set
- unload unload the buffer, also when 'hidden' is set or using
- |:hide|
- delete delete the buffer from the buffer list, also when
- 'hidden' is set or using |:hide|, like using
- |:bdelete|
- wipe wipe out the buffer from the buffer list, also when
- 'hidden' is set or using |:hide|, like using
- |:bwipeout|
+ hide hide the buffer (don't unload it), even if 'hidden' is
+ not set
+ unload unload the buffer, even if 'hidden' is set; the
+ |:hide| command will also unload the buffer
+ delete delete the buffer from the buffer list, even if
+ 'hidden' is set; the |:hide| command will also delete
+ the buffer, making it behave like |:bdelete|
+ wipe wipe the buffer from the buffer list, even if
+ 'hidden' is set; the |:hide| command will also wipe
+ out the buffer, making it behave like |:bwipeout|
CAREFUL: when "unload", "delete" or "wipe" is used changes in a buffer
are lost without a warning. Also, these values may break autocommands
@@ -1181,13 +1176,13 @@ A jump table for the options with a short description can be found at |Q_op|.
If the default value taken from $CDPATH is not what you want, include
a modified version of the following command in your vimrc file to
override it: >
- :let &cdpath = ',' . substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
+ :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
< This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
(parts of 'cdpath' can be passed to the shell to expand file names).
*'cedit'*
-'cedit' string (Vim default: CTRL-F, Vi default: "")
+'cedit' string (default: CTRL-F)
global
The key used in Command-line Mode to open the command-line window.
Only non-printable keys are allowed.
@@ -1216,8 +1211,8 @@ A jump table for the options with a short description can be found at |Q_op|.
preferred, because it is much faster.
'charconvert' is not used when reading stdin |--|, because there is no
file to convert from. You will have to save the text in a file first.
- The expression must return zero or an empty string for success,
- non-zero for failure.
+ The expression must return zero, false or an empty string for success,
+ non-zero or true for failure.
See |encoding-names| for possible encoding names.
Additionally, names given in 'fileencodings' and 'fileencoding' are
used.
@@ -1228,8 +1223,8 @@ A jump table for the options with a short description can be found at |Q_op|.
set charconvert=CharConvert()
fun CharConvert()
system("recode "
- \ . v:charconvert_from . ".." . v:charconvert_to
- \ . " <" . v:fname_in . " >" v:fname_out)
+ \ .. v:charconvert_from .. ".." .. v:charconvert_to
+ \ .. " <" .. v:fname_in .. " >" .. v:fname_out)
return v:shell_error
endfun
< The related Vim variables are:
@@ -1283,10 +1278,18 @@ A jump table for the options with a short description can be found at |Q_op|.
matter, include the keyword both the uppercase and lowercase:
"if,If,IF".
- *'clipboard'* *'cb'*
+ *'cinscopedecls'* *'cinsd'*
+'cinscopedecls' 'cinsd' string (default "public,protected,private")
+ local to buffer
+ Keywords that are interpreted as a C++ scope declaration by |cino-g|.
+ Useful e.g. for working with the Qt framework that defines additional
+ scope declarations "signals", "public slots" and "private slots": >
+ set cinscopedecls+=signals,public\ slots,private\ slots
+
+< *'clipboard'* *'cb'*
'clipboard' 'cb' string (default "")
global
- This option is a list of comma separated names.
+ This option is a list of comma-separated names.
These names are recognized:
*clipboard-unnamed*
@@ -1317,6 +1320,9 @@ A jump table for the options with a short description can be found at |Q_op|.
The value of this option is stored with the tab page, so that each tab
page can have a different value.
+ When 'cmdheight' is zero, it disables echo area and all outputs need
+ |hit-enter| prompt.
+
*'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7)
global
@@ -1325,10 +1331,11 @@ A jump table for the options with a short description can be found at |Q_op|.
*'colorcolumn'* *'cc'*
'colorcolumn' 'cc' string (default "")
local to window
- 'colorcolumn' is a comma separated list of screen columns that are
+ 'colorcolumn' is a comma-separated list of screen columns that are
highlighted with ColorColumn |hl-ColorColumn| and drawn using the
colocol option from 'fillchars'. Useful to align text. Will make
screen redrawing slower.
+
The screen column can be an absolute number, or a number preceded with
'+' or '-', which is added to or subtracted from 'textwidth'. >
@@ -1359,7 +1366,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'comments' 'com' string (default
"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-")
local to buffer
- A comma separated list of strings that can start a comment line. See
+ A comma-separated list of strings that can start a comment line. See
|format-comments|. See |option-backslash| about using backslashes to
insert a space.
@@ -1376,7 +1383,7 @@ A jump table for the options with a short description can be found at |Q_op|.
This option specifies how keyword completion |ins-completion| works
when CTRL-P or CTRL-N are used. It is also used for whole-line
completion |i_CTRL-X_CTRL-L|. It indicates the type of completion
- and the places to scan. It is a comma separated list of flags:
+ and the places to scan. It is a comma-separated list of flags:
. scan the current buffer ('wrapscan' is ignored)
w scan buffers from other windows
b scan other loaded buffers that are in the buffer list
@@ -1433,7 +1440,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'completeopt'* *'cot'*
'completeopt' 'cot' string (default: "menu,preview")
global
- A comma separated list of options for Insert mode completion
+ A comma-separated list of options for Insert mode completion
|ins-completion|. The supported values are:
menu Use a popup menu to show the possible completions. The
@@ -1531,8 +1538,7 @@ A jump table for the options with a short description can be found at |Q_op|.
See 'preserveindent'.
*'cpoptions'* *'cpo'* *cpo*
-'cpoptions' 'cpo' string (Vim default: "aABceFs_",
- Vi default: all flags)
+'cpoptions' 'cpo' string (default: "aABceFs_")
global
A sequence of single character flags. When a character is present
this indicates Vi-compatible behavior. This is used for things where
@@ -1838,7 +1844,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'cursorlineopt'* *'culopt'*
'cursorlineopt' 'culopt' string (default: "number,line")
local to window
- Comma separated list of settings for how 'cursorline' is displayed.
+ Comma-separated list of settings for how 'cursorline' is displayed.
Valid values:
"line" Highlight the text line of the cursor with
CursorLine |hl-CursorLine|.
@@ -2049,7 +2055,7 @@ A jump table for the options with a short description can be found at |Q_op|.
{char2}. See |digraphs|.
*'directory'* *'dir'*
-'directory' 'dir' string (default "$XDG_DATA_HOME/nvim/swap//")
+'directory' 'dir' string (default "$XDG_STATE_HOME/nvim/swap//")
global
List of directory names for the swap file, separated with commas.
@@ -2101,9 +2107,9 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons.
*'display'* *'dy'*
-'display' 'dy' string (default "lastline,msgsep", Vi default: "")
+'display' 'dy' string (default "lastline,msgsep")
global
- Change the way text is displayed. This is comma separated list of
+ Change the way text is displayed. This is comma-separated list of
flags:
lastline When included, as much as possible of the last line
in a window will be displayed. "@@@" is put in the
@@ -2129,7 +2135,7 @@ A jump table for the options with a short description can be found at |Q_op|.
hor horizontally, height of windows is not affected
both width and height of windows is affected
- *'emoji'* *'emo'*
+ *'emoji'* *'emo'* *'noemoji'* *'noemo'*
'emoji' 'emo' boolean (default: on)
global
When on all Unicode emoji characters are considered to be full width.
@@ -2221,7 +2227,7 @@ A jump table for the options with a short description can be found at |Q_op|.
A list of autocommand event names, which are to be ignored.
When set to "all" or when "all" is one of the items, all autocommand
events are ignored, autocommands will not be executed.
- Otherwise this is a comma separated list of event names. Example: >
+ Otherwise this is a comma-separated list of event names. Example: >
:set ei=WinEnter,WinLeave
<
*'expandtab'* *'et'* *'noexpandtab'* *'noet'*
@@ -2347,9 +2353,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'fileformats'* *'ffs'*
'fileformats' 'ffs' string (default:
- Vim+Vi Win32: "dos,unix",
- Vim Unix: "unix,dos",
- Vi others: "")
+ Win32: "dos,unix",
+ Unix: "unix,dos")
global
This gives the end-of-line (<EOL>) formats that will be tried when
starting to edit a new buffer and when reading a file into an existing
@@ -2433,12 +2438,20 @@ A jump table for the options with a short description can be found at |Q_op|.
'fillchars' 'fcs' string (default "")
global or local to window |global-local|
Characters to fill the statuslines and vertical separators.
- It is a comma separated list of items:
+ It is a comma-separated list of items:
item default Used for ~
stl:c ' ' or '^' statusline of the current window
stlnc:c ' ' or '=' statusline of the non-current windows
+ wbr:c ' ' window bar
+ horiz:c '─' or '-' horizontal separators |:split|
+ horizup:c '┴' or '-' upwards facing horizontal separator
+ horizdown:c '┬' or '-' downwards facing horizontal separator
vert:c '│' or '|' vertical separators |:vsplit|
+ vertleft:c '┤' or '|' left facing vertical separator
+ vertright:c '├' or '|' right facing vertical separator
+ verthoriz:c '┼' or '+' overlapping vertical and horizontal
+ separator
fold:c '·' or '-' filling 'foldtext'
foldopen:c '-' mark the beginning of a fold
foldclose:c '+' show a closed fold
@@ -2452,21 +2465,35 @@ A jump table for the options with a short description can be found at |Q_op|.
"stlnc" the space will be used when there is highlighting, '^' or '='
otherwise.
- If 'ambiwidth' is "double" then "vert", "foldsep" and "fold" default to
- single-byte alternatives.
+ Note that "horiz", "horizup", "horizdown", "vertleft", "vertright" and
+ "verthoriz" are only used when 'laststatus' is 3, since only vertical
+ window separators are used otherwise.
+
+ If 'ambiwidth' is "double" then "horiz", "horizup", "horizdown",
+ "vert", "vertleft", "vertright", "verthoriz", "foldsep" and "fold"
+ default to single-byte alternatives.
Example: >
:set fillchars=stl:^,stlnc:=,vert:│,fold:·,diff:-
< This is similar to the default, except that these characters will also
be used when there is highlighting.
- for "stl" and "stlnc" only single-byte values are supported.
+ For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items
+ single-byte and multibyte characters are supported. But double-width
+ characters are not supported.
The highlighting used for these items:
item highlight group ~
stl:c StatusLine |hl-StatusLine|
stlnc:c StatusLineNC |hl-StatusLineNC|
- vert:c VertSplit |hl-VertSplit|
+ wbr:c WinBar |hl-WinBar| or |hl-WinBarNC|
+ horiz:c WinSeparator |hl-WinSeparator|
+ horizup:c WinSeparator |hl-WinSeparator|
+ horizdown:c WinSeparator |hl-WinSeparator|
+ vert:c WinSeparator |hl-WinSeparator|
+ vertleft:c WinSeparator |hl-WinSeparator|
+ vertright:c WinSeparator |hl-WinSeparator|
+ verthoriz:c WinSeparator |hl-WinSeparator|
fold:c Folded |hl-Folded|
diff:c DiffDelete |hl-DiffDelete|
eob:c EndOfBuffer |hl-EndOfBuffer|
@@ -2597,7 +2624,7 @@ A jump table for the options with a short description can be found at |Q_op|.
search,tag,undo")
global
Specifies for which type of commands folds will be opened, if the
- command moves the cursor into a closed fold. It is a comma separated
+ command moves the cursor into a closed fold. It is a comma-separated
list of items.
NOTE: When the command is part of a mapping this option is not used.
Add the |zv| command to the mapping to get the same effect.
@@ -2688,7 +2715,7 @@ A jump table for the options with a short description can be found at |Q_op|.
character and white space.
*'formatoptions'* *'fo'*
-'formatoptions' 'fo' string (default: "tcqj", Vi default: "vt")
+'formatoptions' 'fo' string (default: "tcqj")
local to buffer
This is a sequence of letters which describes how automatic
formatting is to be done. See |fo-table|. When the 'paste' option is
@@ -2712,7 +2739,7 @@ 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.
- *'fsync'* *'fs'*
+ *'fsync'* *'fs'* *'nofsync'* *'nofs'*
'fsync' 'fs' boolean (default off)
global
When on, the OS function fsync() will be called after saving a file
@@ -2788,7 +2815,7 @@ A jump table for the options with a short description can be found at |Q_op|.
\,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
\,sm:block-blinkwait175-blinkoff150-blinkon175
-< The option is a comma separated list of parts. Each part consists of a
+< The option is a comma-separated list of parts. Each part consists of a
mode-list and an argument-list:
mode-list:argument-list,mode-list:argument-list,..
The mode-list is a dash separated list of these modes:
@@ -3038,7 +3065,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'guitablabel'* *'gtl'*
'guitablabel' 'gtl' string (default empty)
global
- When nonempty describes the text to use in a label of the GUI tab
+ When non-empty describes the text to use in a label of the GUI tab
pages line. When empty and when the result is empty Vim will use a
default label. See |setting-guitablabel| for more info.
@@ -3055,7 +3082,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'guitabtooltip'* *'gtt'*
'guitabtooltip' 'gtt' string (default empty)
global
- When nonempty describes the text to use in a tooltip for the GUI tab
+ When non-empty describes the text to use in a tooltip for the GUI tab
pages line. When empty Vim will use a default tooltip.
This option is otherwise just like 'guitablabel' above.
You can include a line break. Simplest method is to use |:let|: >
@@ -3088,7 +3115,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'helplang'* *'hlg'*
'helplang' 'hlg' string (default: messages language or empty)
global
- Comma separated list of languages. Vim will use the first language
+ Comma-separated list of languages. Vim will use the first language
for which the desired help can be found. The English help will always
be used as a last resort. You can add "en" to prefer English over
another language, but that will only find tags that exist in that
@@ -3108,15 +3135,19 @@ A jump table for the options with a short description can be found at |Q_op|.
when it is |abandon|ed. When on a buffer becomes hidden when it is
|abandon|ed. A buffer displayed in another window does not become
hidden, of course.
+
Commands that move through the buffer list sometimes hide a buffer
- although the 'hidden' option is off: when the buffer is modified,
- 'autowrite' is off or writing is not possible, and the '!' flag was
- used. See also |windows|.
+ although the 'hidden' option is off when these three are true:
+ - the buffer is modified
+ - 'autowrite' is off or writing is not possible
+ - the '!' flag was used
+ Also see |windows|.
+
To hide a specific buffer use the 'bufhidden' option.
'hidden' is set for one command with ":hide {command}" |:hide|.
*'history'* *'hi'*
-'history' 'hi' number (Vim default: 10000, Vi default: 0)
+'history' 'hi' number (default: 10000)
global
A history of ":" commands, and a history of previous search patterns
is remembered. This option decides how many entries may be stored in
@@ -3141,8 +3172,12 @@ A jump table for the options with a short description can be found at |Q_op|.
'hlsearch' 'hls' boolean (default on)
global
When there is a previous search pattern, highlight all its matches.
- The |hl-Search| highlight group determines the highlighting. Note that
- only the matching text is highlighted, any offsets are not applied.
+ The |hl-Search| highlight group determines the highlighting for all
+ matches not under the cursor while the |hl-CurSearch| highlight group
+ (if defined) determines the highlighting for the match under the
+ cursor. If |hl-CurSearch| is not defined, then |hl-Search| is used for
+ both. Note that only the matching text is highlighted, any offsets
+ are not applied.
See also: 'incsearch' and |:match|.
When you get bored looking at the highlighted matches, you can turn it
off with |:nohlsearch|. This does not change the option value, as
@@ -3239,8 +3274,9 @@ A jump table for the options with a short description can be found at |Q_op|.
'inccommand' 'icm' string (default "nosplit")
global
- When nonempty, shows the effects of |:substitute|, |:smagic|, and
- |:snomagic| as you type.
+ When nonempty, shows the effects of |:substitute|, |:smagic|,
+ |:snomagic| and user commands with the |:command-preview| flag as you
+ type.
Possible values:
nosplit Shows the effects of a command incrementally in the
@@ -3248,8 +3284,9 @@ A jump table for the options with a short description can be found at |Q_op|.
split Like "nosplit", but also shows partial off-screen
results in a preview window.
- If the preview is too slow (exceeds 'redrawtime') then 'inccommand' is
- automatically disabled until |Command-line-mode| is done.
+ If the preview for built-in commands is too slow (exceeds
+ 'redrawtime') then 'inccommand' is automatically disabled until
+ |Command-line-mode| is done.
*'include'* *'inc'*
'include' 'inc' string (default "^\s*#\s*include")
@@ -3375,31 +3412,6 @@ A jump table for the options with a short description can be found at |Q_op|.
and there is a letter before it, the completed part is made uppercase.
With 'noinfercase' the match is used as-is.
- *'insertmode'* *'im'* *'noinsertmode'* *'noim'*
-'insertmode' 'im' boolean (default off)
- global
- Makes Vim work in a way that Insert mode is the default mode. Useful
- if you want to use Vim as a modeless editor.
- These Insert mode commands will be useful:
- - Use the cursor keys to move around.
- - Use CTRL-O to execute one Normal mode command |i_CTRL-O|. When
- this is a mapping, it is executed as if 'insertmode' was off.
- Normal mode remains active until the mapping is finished.
- - Use CTRL-L to execute a number of Normal mode commands, then use
- <Esc> to get back to Insert mode. Note that CTRL-L moves the cursor
- left, like <Esc> does when 'insertmode' isn't set. |i_CTRL-L|
-
- These items change when 'insertmode' is set:
- - when starting to edit of a file, Vim goes to Insert mode.
- - <Esc> in Insert mode is a no-op and beeps.
- - <Esc> in Normal mode makes Vim go to Insert mode.
- - CTRL-L in Insert mode is a command, it is not inserted.
- - CTRL-Z in Insert mode suspends Vim, see |CTRL-Z|. *i_CTRL-Z*
- However, when <Esc> is used inside a mapping, it behaves like
- 'insertmode' was not set. This was done to be able to use the same
- mappings with 'insertmode' set or not set.
- When executing commands with |:normal| 'insertmode' is not used.
-
*'isfname'* *'isf'*
'isfname' 'isf' string (default for Windows:
"@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,="
@@ -3463,12 +3475,11 @@ A jump table for the options with a short description can be found at |Q_op|.
option. For '@' only characters up to 255 are used.
Careful: If you change this option, it might break expanding
environment variables. E.g., when '/' is included and Vim tries to
- expand "$HOME/.local/share/nvim/shada/main.shada". Maybe you should
+ expand "$HOME/.local/state/nvim/shada/main.shada". Maybe you should
change 'iskeyword' instead.
*'iskeyword'* *'isk'*
-'iskeyword' 'isk' string (default: @,48-57,_,192-255
- Vi default: @,48-57,_)
+'iskeyword' 'isk' string (default: @,48-57,_,192-255)
local to buffer
Keywords are used in searching and recognizing with many commands:
"w", "*", "[i", etc. It is also used for "\k" in a |pattern|. See
@@ -3524,6 +3535,10 @@ A jump table for the options with a short description can be found at |Q_op|.
jumplist and then jumping to a location.
|jumplist-stack|
+ view When moving through the jumplist, |changelist|,
+ |alternate-file| or using |mark-motions| try to
+ restore the |mark-view| in which the action occurred.
+
*'joinspaces'* *'js'* *'nojoinspaces'* *'nojs'*
'joinspaces' 'js' boolean (default off)
global
@@ -3542,7 +3557,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'keymodel'* *'km'*
'keymodel' 'km' string (default "")
global
- List of comma separated words, which enable special things that keys
+ List of comma-separated words, which enable special things that keys
can do. These values can be used:
startsel Using a shifted special key starts selection (either
Select mode or Visual mode, depending on "key" being
@@ -3618,7 +3633,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
Language to use for menu translation. Tells which file is loaded
from the "lang" directory in 'runtimepath': >
- "lang/menu_" . &langmenu . ".vim"
+ "lang/menu_" .. &langmenu .. ".vim"
< (without the spaces). For example, to always use the Dutch menus, no
matter what $LANG is set to: >
:set langmenu=nl_NL.ISO_8859-1
@@ -3650,6 +3665,7 @@ A jump table for the options with a short description can be found at |Q_op|.
0: never
1: only if there are at least two windows
2: always
+ 3: always and ONLY the last window
The screen looks nicer with a status line if you have several
windows, but it takes another screen line. |status-line|
@@ -3660,6 +3676,9 @@ A jump table for the options with a short description can be found at |Q_op|.
executing macros, registers and other commands that have not been
typed. Also, updating the window title is postponed. To force an
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.
*'linebreak'* *'lbr'* *'nolinebreak'* *'nolbr'*
'linebreak' 'lbr' boolean (default off)
@@ -3716,7 +3735,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'lispwords'* *'lw'*
'lispwords' 'lw' string (default is very long)
global or local to buffer |global-local|
- Comma separated list of words that influence the Lisp indenting.
+ Comma-separated list of words that influence the Lisp indenting.
|'lisp'|
*'list'* *'nolist'*
@@ -3737,11 +3756,10 @@ A jump table for the options with a short description can be found at |Q_op|.
changing the way tabs are displayed.
*'listchars'* *'lcs'*
-'listchars' 'lcs' string (default: "tab:> ,trail:-,nbsp:+"
- Vi default: "eol:$")
+'listchars' 'lcs' string (default: "tab:> ,trail:-,nbsp:+")
global or local to window |global-local|
Strings to use in 'list' mode and for the |:list| command. It is a
- comma separated list of string settings.
+ comma-separated list of string settings.
*lcs-eol*
eol:c Character to show at the end of each line. When
@@ -3779,14 +3797,24 @@ A jump table for the options with a short description can be found at |Q_op|.
"space" setting is used. For example,
`:set listchars=multispace:---+` shows ten consecutive
spaces as:
- ---+---+--
+ ---+---+-- ~
*lcs-lead*
lead:c Character to show for leading spaces. When omitted,
leading spaces are blank. Overrides the "space" and
"multispace" settings for leading spaces. You can
combine it with "tab:", for example: >
:set listchars+=tab:>-,lead:.
-< *lcs-trail*
+< *lcs-leadmultispace*
+ leadmultispace:c...
+ Like the |lcs-multispace| value, but for leading
+ spaces only. Also overrides |lcs-lead| for leading
+ multiple spaces.
+ `:set listchars=leadmultispace:---+` shows ten
+ consecutive leading spaces as:
+ ---+---+--XXX ~
+ Where "XXX" denotes the first non-blank characters in
+ the line.
+ *lcs-trail*
trail:c Character to show for trailing spaces. When omitted,
trailing spaces are blank. Overrides the "space" and
"multispace" settings for trailing spaces.
@@ -3918,12 +3946,6 @@ A jump table for the options with a short description can be found at |Q_op|.
set. Note that this is not in milliseconds, like other options that
set a time. This is to be compatible with Nvi.
- *'maxcombine'* *'mco'*
-'maxcombine' 'mco' Removed. |vim-differences|
- Nvim always displays up to 6 combining characters. You can still edit
- text with more than 6 combining characters, you just can't see them.
- Use |g8| or |ga|. See |mbyte-combining|.
-
*'maxfuncdepth'* *'mfd'*
'maxfuncdepth' 'mfd' number (default 100)
global
@@ -4006,8 +4028,7 @@ 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|.
*'modeline'* *'ml'* *'nomodeline'* *'noml'*
-'modeline' 'ml' boolean (Vim default: on (off for root),
- Vi default: off)
+'modeline' 'ml' boolean (default: on (off for root))
local to buffer
If 'modeline' is on 'modelines' gives the number of lines that is
checked for set commands. If 'modeline' is off or 'modelines' is zero
@@ -4062,14 +4083,14 @@ A jump table for the options with a short description can be found at |Q_op|.
when using "rA" on an "A".
*'more'* *'nomore'*
-'more' boolean (Vim default: on, Vi default: off)
+'more' boolean (default: on)
global
When on, listings pause when the whole screen is filled. You will get
the |more-prompt|. When this option is off there are no pauses, the
listing continues until finished.
*'mouse'*
-'mouse' string (default "")
+'mouse' string (default "nvi")
global
Enables mouse support. For example, to enable the mouse in Normal mode
@@ -4141,7 +4162,7 @@ A jump table for the options with a short description can be found at |Q_op|.
The mouse pointer is restored when the mouse is moved.
*'mousemodel'* *'mousem'*
-'mousemodel' 'mousem' string (default "extend")
+'mousemodel' 'mousem' string (default "popup_setpos")
global
Sets the model to use for the mouse. The name mostly specifies what
the right mouse button is used for:
@@ -4167,7 +4188,7 @@ A jump table for the options with a short description can be found at |Q_op|.
middle click paste paste
In the "popup" model the right mouse button produces a pop-up menu.
- You need to define this first, see |popup-menu|.
+ Nvim creates a default |popup-menu| but you can redefine it.
Note that you can further refine the meaning of buttons with mappings.
See |mouse-overview|. But mappings are NOT used for modeless selection.
@@ -4193,12 +4214,32 @@ A jump table for the options with a short description can be found at |Q_op|.
The 'mousemodel' option is set by the |:behave| command.
+ *mousescroll*
+'mousescroll' string (default "ver:3,hor:6")
+ global
+ This option controls the number of lines / columns to scroll by when
+ scrolling with a mouse. The option is a comma separated list of parts.
+ Each part consists of a direction and a count as follows:
+ direction:count,direction:count
+ Direction is one of either "hor" or "ver", "hor" controls horizontal
+ scrolling and "ver" controls vertical scrolling. Count sets the amount
+ to scroll by for the given direction, it should be a non negative
+ integer. Each direction should be set at most once. If a direction
+ is omitted, a default value is used (6 for horizontal scrolling and 3
+ for vertical scrolling). You can disable mouse scrolling by using
+ a count of 0.
+
+ Example: >
+ :set mousescroll=ver:5,hor:2
+< Will make Nvim scroll 5 lines at a time when scrolling vertically, and
+ scroll 2 columns at a time when scrolling horizontally.
+
*'mouseshape'* *'mouses'* *E547*
'mouseshape' 'mouses' string (default "i:beam,r:beam,s:updown,sd:cross,
m:no,ml:up-arrow,v:rightup-arrow")
global
This option tells Vim what the mouse pointer should look like in
- different modes. The option is a comma separated list of parts, much
+ different modes. The option is a comma-separated list of parts, much
like used for 'guicursor'. Each part consist of a mode/location-list
and an argument-list:
mode-list:shape,mode-list:shape,..
@@ -4317,7 +4358,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|there | 4 there | 1 there | 1 there
*'numberwidth'* *'nuw'*
-'numberwidth' 'nuw' number (Vim default: 4 Vi default: 8)
+'numberwidth' 'nuw' number (default: 4)
local to window
Minimal number of columns to use for the line number. Only relevant
when the 'number' or 'relativenumber' option is set or printing lines
@@ -4443,8 +4484,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that typing <F10> in paste mode inserts "<F10>", since in paste
mode everything is inserted literally, except the 'pastetoggle' key
sequence.
- No timeout is used, this means that a multi-key 'pastetoggle' can not
- be triggered manually.
+ When the value has several bytes 'ttimeoutlen' applies.
*'pex'* *'patchexpr'*
'patchexpr' 'pex' string (default "")
@@ -4520,7 +4560,7 @@ A jump table for the options with a short description can be found at |Q_op|.
< To use an environment variable, you probably need to replace the
separator. Here is an example to append $INCL, in which directory
names are separated with a semi-colon: >
- :let &path = &path . "," . substitute($INCL, ';', ',', 'g')
+ :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.
@@ -4636,26 +4676,11 @@ A jump table for the options with a short description can be found at |Q_op|.
nudged to fit on the screen.
*'pyxversion'* *'pyx'*
-'pyxversion' 'pyx' number (default depends on the build)
+'pyxversion' 'pyx' number (default 3)
global
Specifies the python version used for pyx* functions and commands
- |python_x|. The default value is as follows:
-
- |provider| installed Default ~
- |+python| and |+python3| 0
- only |+python| 2
- only |+python3| 3
-
- Available values are 0, 2 and 3.
- If 'pyxversion' is 0, it is set to 2 or 3 after the first execution of
- any python2/3 commands or functions. E.g. `:py` sets to 2, and `:py3`
- sets to 3. `:pyx` sets it to 3 if Python 3 is available, otherwise sets
- to 2 if Python 2 is available.
- See also: |has-pythonx|
-
- If only |+python| or |+python3| are available,
- 'pyxversion' has no effect. The pyx* functions and commands are
- always the same as the installed version.
+ |python_x|. As only Python 3 is supported, this always has the value
+ `3`. Setting any other value is an error.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -4774,15 +4799,6 @@ A jump table for the options with a short description can be found at |Q_op|.
'number', see |number_relativenumber| for all combinations of the two
options.
- *'remap'* *'noremap'*
-'remap' boolean (default on)
- global
- Allows for mappings to work recursively. If you do not want this for
- a single entry, use the :noremap[!] command.
- NOTE: To avoid portability problems with Vim scripts, always keep
- this option at the default "on". Only switch it off when working with
- old Vi scripts.
-
*'report'*
'report' number (default 2)
global
@@ -4837,9 +4853,11 @@ A jump table for the options with a short description can be found at |Q_op|.
45% relative position in the file
If 'rulerformat' is set, it will determine the contents of the ruler.
Each window has its own ruler. If a window has a status line, the
- ruler is shown there. Otherwise it is shown in the last line of the
- screen. If the statusline is given by 'statusline' (i.e. not empty),
- this option takes precedence over 'ruler' and 'rulerformat'
+ ruler is shown there. If a window doesn't have a status line and
+ 'cmdheight' is 0, the ruler is not shown. Otherwise it is shown in
+ the last line of the screen. If the statusline is given by
+ 'statusline' (i.e. not empty), this option takes precedence over
+ 'ruler' and 'rulerformat'.
If the number of characters displayed is different from the number of
bytes in the text (e.g., for a TAB or a multibyte character), both
the text column (byte number) and the screen column are shown,
@@ -4918,9 +4936,12 @@ A jump table for the options with a short description can be found at |Q_op|.
but are not part of the Nvim distribution. XDG_DATA_DIRS defaults
to /usr/local/share/:/usr/share/, so system administrators are
expected to install site plugins to /usr/share/nvim/site.
- 5. $VIMRUNTIME, for files distributed with Neovim.
+ 5. Applications state home directory, for files that contain your
+ session state (eg. backupdir, viewdir, undodir, etc).
+ Given by `stdpath("state")`. |$XDG_STATE_HOME|
+ 6. $VIMRUNTIME, for files distributed with Neovim.
*after-directory*
- 6, 7, 8, 9. In after/ subdirectories of 1, 2, 3 and 4, with reverse
+ 7, 8, 9, 10. In after/ subdirectories of 1, 2, 3 and 4, with reverse
ordering. This is for preferences to overrule or add to the
distributed defaults or system-wide settings (rarely needed).
@@ -5084,7 +5105,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'selectmode'* *'slm'*
'selectmode' 'slm' string (default "")
global
- This is a comma separated list of words, which specifies when to start
+ This is a comma-separated list of words, which specifies when to start
Select mode instead of Visual mode, when a selection is started.
Possible values:
mouse when using the mouse
@@ -5095,11 +5116,9 @@ A jump table for the options with a short description can be found at |Q_op|.
*'sessionoptions'* *'ssop'*
'sessionoptions' 'ssop' string (default: "blank,buffers,curdir,folds,
- help,tabpages,winsize"
- Vi default: "blank,buffers,curdir,folds,
- help,options,tabpages,winsize")
+ help,tabpages,winsize")
global
- Changes the effect of the |:mksession| command. It is a comma
+ Changes the effect of the |:mksession| command. It is a comma-
separated list of words. Each word enables saving and restoring
something:
word save and restore ~
@@ -5137,13 +5156,12 @@ A jump table for the options with a short description can be found at |Q_op|.
If you leave out "options" many things won't work well after restoring
the session.
*'shada'* *'sd'* *E526* *E527* *E528*
-'shada' 'sd' string (Vim default for
+'shada' 'sd' string (default for
Win32: !,'100,<50,s10,h,rA:,rB:
- others: !,'100,<50,s10,h
- Vi default: "")
+ others: !,'100,<50,s10,h)
global
When non-empty, the shada file is read upon startup and written
- when exiting Vim (see |shada-file|). The string should be a comma
+ when exiting Vim (see |shada-file|). The string should be a comma-
separated list of parameters, each consisting of a single character
identifying the particular parameter, followed by a number or string
which specifies the value of that parameter. If a particular
@@ -5303,9 +5321,9 @@ A jump table for the options with a short description can be found at |Q_op|.
unescaping, so to keep yourself sane use |:let-&| like shown above.
*shell-powershell*
To use PowerShell: >
- let &shell = has('win32') ? 'powershell' : 'pwsh'
+ let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
- let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
+ let &shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
set shellquote= shellxquote=
@@ -5418,7 +5436,7 @@ A jump table for the options with a short description can be found at |Q_op|.
< Also see 'completeslash'.
*'shelltemp'* *'stmp'* *'noshelltemp'* *'nostmp'*
-'shelltemp' 'stmp' boolean (Vim default on, Vi default off)
+'shelltemp' 'stmp' boolean (default on)
global
When on, use temp files for shell commands. When off use a pipe.
When using a pipe is not possible temp files are used anyway.
@@ -5467,7 +5485,7 @@ A jump table for the options with a short description can be found at |Q_op|.
function to get the effective shiftwidth value.
*'shortmess'* *'shm'*
-'shortmess' 'shm' string (Vim default "filnxtToOF", Vi default: "S")
+'shortmess' 'shm' string (default "filnxtToOF")
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.
@@ -5475,7 +5493,7 @@ A jump table for the options with a short description can be found at |Q_op|.
flag meaning when present ~
f use "(3 of 5)" instead of "(file 3 of 5)"
i use "[noeol]" instead of "[Incomplete last line]"
- l use "999L, 888C" instead of "999 lines, 888 characters"
+ l use "999L, 888B" instead of "999 lines, 888 bytes"
m use "[+]" instead of "[Modified]"
n use "[New]" instead of "[New File]"
r use "[RO]" instead of "[readonly]"
@@ -5507,8 +5525,7 @@ A jump table for the options with a short description can be found at |Q_op|.
"Pattern not found", "Back at original", etc.
q use "recording" instead of "recording @a"
F don't give the file info when editing a file, like `:silent`
- was used for the command; note that this also affects messages
- from autocommands
+ was used for the command
S do not show search count message when searching, e.g.
"[1/5]"
@@ -5542,10 +5559,11 @@ A jump table for the options with a short description can be found at |Q_op|.
:setlocal showbreak=NONE
<
*'showcmd'* *'sc'* *'noshowcmd'* *'nosc'*
-'showcmd' 'sc' boolean (Vim default: on, Vi default: off)
+'showcmd' 'sc' boolean (default: on)
global
Show (partial) command in the last line of the screen. Set this
option off if your terminal is slow.
+ The option is disabled if 'cmdheight' is 0.
In Visual mode the size of the selected area is shown:
- When selecting characters within a line, the number of characters.
If the number of bytes is different it is also displayed: "2-6"
@@ -5588,10 +5606,11 @@ A jump table for the options with a short description can be found at |Q_op|.
Note: Use of the short form is rated PG.
*'showmode'* *'smd'* *'noshowmode'* *'nosmd'*
-'showmode' 'smd' boolean (Vim default: on, Vi default: off)
+'showmode' 'smd' boolean (default: on)
global
If in Insert, Replace or Visual mode put a message on the last line.
The |hl-ModeMsg| highlight group determines the highlighting.
+ The option is disabled if 'cmdheight' is 0.
*'showtabline'* *'stal'*
'showtabline' 'stal' number (default 1)
@@ -5660,7 +5679,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note regarding 'orphaned signs': with signcolumn numbers higher than
1, deleting lines will also remove the associated signs automatically,
in contrast to the default Vim behavior of keeping and grouping them.
- This is done in order for the signcolumn appearence not appear weird
+ This is done in order for the signcolumn appearance not appear weird
during line deletion.
@@ -5762,7 +5781,7 @@ A jump table for the options with a short description can be found at |Q_op|.
commands. It must end in ".{encoding}.add". You need to include the
path, otherwise the file is placed in the current directory.
*E765*
- It may also be a comma separated list of names. A count before the
+ It may also be a comma-separated list of names. A count before the
|zg| and |zw| commands can be used to access each. This allows using
a personal word list file and a project word list file.
When a word is added while this option is empty Vim will set it for
@@ -5782,7 +5801,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'spelllang'* *'spl'*
'spelllang' 'spl' string (default "en")
local to buffer
- A comma separated list of word list names. When the 'spell' option is
+ A comma-separated list of word list names. When the 'spell' option is
on spellchecking will be done for these languages. Example: >
set spelllang=en_us,nl,medical
< This means US English, Dutch and medical words are recognized. Words
@@ -5822,7 +5841,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'spelloptions'* *'spo'*
'spelloptions' 'spo' string (default "")
local to buffer
- A comma separated list of options for spell checking:
+ A comma-separated list of options for spell checking:
camel When a word is CamelCased, assume "Cased" is a
separate word: every upper-case character in a word
that comes after a lower case character indicates the
@@ -5919,7 +5938,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'statusline'* *'stl'* *E540* *E542*
'statusline' 'stl' string (default empty)
global or local to window |global-local|
- When nonempty, this option determines the content of the status line.
+ When non-empty, this option determines the content of the status line.
Also see |status-line|.
The option consists of printf style '%' items interspersed with
@@ -5942,7 +5961,7 @@ A jump table for the options with a short description can be found at |Q_op|.
empty to avoid further errors. Otherwise screen updating would loop.
Note that the only effect of 'ruler' when this option is set (and
- 'laststatus' is 2) is controlling the output of |CTRL-G|.
+ 'laststatus' is 2 or 3) is controlling the output of |CTRL-G|.
field meaning ~
- Left justify the item. The default is right justified
@@ -6026,7 +6045,7 @@ A jump table for the options with a short description can be found at |Q_op|.
the label, e.g.: %3Xclose%X. Use %999X for a "close current
tab" label. Clicking this label with left mouse button closes
specified tab page.
- @ N For 'tabline': start of execute function label. Use %X or %T to
+ @ N Start of execute function label. Use %X or %T to
end the label, e.g.: %10@SwitchBuffer@foo.c%X. Clicking this
label runs specified function: in the example when clicking once
using left mouse button on "foo.c" "SwitchBuffer(10, 1, 'l',
@@ -6050,8 +6069,6 @@ A jump table for the options with a short description can be found at |Q_op|.
is a bug that denotes that new mouse button recognition was
added without modifying code that reacts on mouse clicks on
this label.
- Note: to test whether your version of Neovim contains this
- feature use `has('tablineat')`.
< - Where to truncate line if too long. Default is at the start.
No width fields allowed.
= - Separation point between alignment sections. Each section will
@@ -6095,10 +6112,9 @@ A jump table for the options with a short description can be found at |Q_op|.
If the statusline is not updated when you want it (e.g., after setting
a variable that's used in an expression), you can force an update by
- setting an option without changing its value. Example: >
- :let &ro = &ro
+ using `:redrawstatus`.
-< A result of all digits is regarded a number for display purposes.
+ A result of all digits is regarded a number for display purposes.
Otherwise the result is taken as flag text and applied to the rules
described above.
@@ -6142,7 +6158,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'suffixesadd'* *'sua'*
'suffixesadd' 'sua' string (default "")
local to buffer
- Comma separated list of suffixes, which are used when searching for a
+ Comma-separated list of suffixes, which are used when searching for a
file for the "gf", "[I", etc. commands. Example: >
:set suffixesadd=.java
<
@@ -6174,7 +6190,7 @@ A jump table for the options with a short description can be found at |Q_op|.
This option controls the behavior when switching between buffers.
Mostly for |quickfix| commands some values are also used for other
commands, as mentioned below.
- Possible values (comma separated list):
+ Possible values (comma-separated list):
useopen If included, jump to the first open window that
contains the specified buffer (if there is one).
Otherwise: Do not examine other windows.
@@ -6235,7 +6251,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'tabline'* *'tal'*
'tabline' 'tal' string (default empty)
global
- When nonempty, this option determines the content of the tab pages
+ 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.
@@ -6268,10 +6284,11 @@ A jump table for the options with a short description can be found at |Q_op|.
'tabstop' 'ts' number (default 8)
local to buffer
Number of spaces that a <Tab> in the file counts for. Also see
- |:retab| command, and 'softtabstop' option.
+ the |:retab| command, and the 'softtabstop' option.
Note: Setting 'tabstop' to any other value than 8 can make your file
- appear wrong in many places (e.g., when printing it).
+ appear wrong in many places, e.g., when printing it.
+ The value must be more than 0 and less than 10000.
There are four main ways to use tabs in Vim:
1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4
@@ -6325,9 +6342,10 @@ A jump table for the options with a short description can be found at |Q_op|.
linear search can be avoided when case is ignored. Use a value of '2'
in the "!_TAG_FILE_SORTED" line for this. A tag file can be case-fold
sorted with the -f switch to "sort" in most unices, as in the command:
- "sort -f -o tags tags". For "Exuberant ctags" version 5.x or higher
- (at least 5.5) the --sort=foldcase switch can be used for this as
- well. Note that case must be folded to uppercase for this to work.
+ "sort -f -o tags tags". For Universal ctags and Exuberant ctags
+ version 5.x or higher (at least 5.5) the --sort=foldcase switch can be
+ used for this as well. Note that case must be folded to uppercase for
+ this to work.
By default, tag searches are case-sensitive. Case is ignored when
'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is
@@ -6370,7 +6388,7 @@ A jump table for the options with a short description can be found at |Q_op|.
If non-zero, tags are significant up to this number of characters.
*'tagrelative'* *'tr'* *'notagrelative'* *'notr'*
-'tagrelative' 'tr' boolean (Vim default: on, Vi default: off)
+'tagrelative' 'tr' boolean (default: on)
global
If on and using a tags file in another directory, file names in that
tags file are relative to the directory where the tags file is.
@@ -6420,7 +6438,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'arabicshape' is ignored, but 'rightleft' isn't changed automatically.
For further details see |arabic.txt|.
- *'termguicolors'* *'tgc'*
+ *'termguicolors'* *'tgc'* *'notermguicolors'* *'notgc'*
'termguicolors' 'tgc' boolean (default off)
global
Enables 24-bit RGB color in the |TUI|. Uses "gui" |:highlight|
@@ -6430,7 +6448,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'termpastefilter'* *'tpf'*
'termpastefilter' 'tpf' string (default: "BS,HT,ESC,DEL")
global
- A comma separated list of options for specifying control characters
+ A comma-separated list of options for specifying control characters
to be removed from the text pasted into the terminal window. The
supported values are:
@@ -6450,13 +6468,6 @@ A jump table for the options with a short description can be found at |Q_op|.
C1 Control characters 0x80...0x9F
- *'terse'* *'noterse'*
-'terse' boolean (default off)
- global
- When set: Add 's' flag to 'shortmess' option (this makes the message
- for a search that hits the start or end of the file not being
- displayed). When reset: Remove 's' flag from 'shortmess' option.
-
*'textwidth'* *'tw'*
'textwidth' 'tw' number (default 0)
local to buffer
@@ -6582,7 +6593,7 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set in a modeline when 'modelineexpr' is off.
Example: >
- :auto BufEnter * let &titlestring = hostname() . "/" . expand("%:p")
+ :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
:set title titlestring=%<%F%=%l/%L-%P titlelen=70
< The value of 'titlelen' is used to align items in the middle or right
of the available space.
@@ -6594,11 +6605,8 @@ A jump table for the options with a short description can be found at |Q_op|.
NOTE: Use of special characters in 'titlestring' may cause the display
to be garbled (e.g., when it contains a CR or NL character).
- *'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
-'ttyfast' 'tf' Removed. |vim-differences|
-
*'undodir'* *'udir'* *E5003*
-'undodir' 'udir' string (default "$XDG_DATA_HOME/nvim/undo//")
+'undodir' 'udir' string (default "$XDG_STATE_HOME/nvim/undo//")
global
List of directory names for undo files, separated with commas.
See 'backupdir' for details of the format.
@@ -6766,8 +6774,8 @@ A jump table for the options with a short description can be found at |Q_op|.
global
When bigger than zero, Vim will give messages about what it is doing.
Currently, these messages are given:
- >= 1 When the shada file is read or written.
- >= 2 When a file is ":source"'ed.
+ >= 1 Lua assignments to options, mappings, etc.
+ >= 2 When a file is ":source"'ed and when the shada file is read or written..
>= 3 UI info, terminal capabilities
>= 4 Shell commands.
>= 5 Every searched tags file and include file.
@@ -6799,7 +6807,7 @@ A jump table for the options with a short description can be found at |Q_op|.
displayed when 'verbosefile' is set.
*'viewdir'* *'vdir'*
-'viewdir' 'vdir' string (default: "$XDG_DATA_HOME/nvim/view//")
+'viewdir' 'vdir' string (default: "$XDG_STATE_HOME/nvim/view//")
global
Name of the directory where to store files for |:mkview|.
This option cannot be set from a |modeline| or in the |sandbox|, for
@@ -6808,7 +6816,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'viewoptions'* *'vop'*
'viewoptions' 'vop' string (default: "folds,cursor,curdir")
global
- Changes the effect of the |:mkview| command. It is a comma separated
+ Changes the effect of the |:mkview| command. It is a comma-separated
list of words. Each word enables saving and restoring something:
word save and restore ~
cursor cursor position in file and in window
@@ -6823,12 +6831,16 @@ A jump table for the options with a short description can be found at |Q_op|.
*'virtualedit'* *'ve'*
'virtualedit' 've' string (default "")
- global
- A comma separated list of these words:
+ global or local to window |global-local|
+ A comma-separated list of these words:
block Allow virtual editing in Visual block mode.
insert Allow virtual editing in Insert mode.
all Allow virtual editing in all modes.
onemore Allow the cursor to move just past the end of the line
+ none When used as the local value, do not allow virtual
+ editing even when the global value is set. When used
+ as the global value, "none" is the same as "".
+ NONE Alternative spelling of "none".
Virtual editing means that the cursor can be positioned where there is
no actual character. This can be halfway into a tab or beyond the end
@@ -6859,7 +6871,7 @@ A jump table for the options with a short description can be found at |Q_op|.
has been changed.
*'whichwrap'* *'ww'*
-'whichwrap' 'ww' string (Vim default: "b,s", Vi default: "")
+'whichwrap' 'ww' string (default: "b,s")
global
Allow specified keys that move the cursor left/right to move to the
previous/next line when the cursor is on the first/last character in
@@ -6889,7 +6901,7 @@ A jump table for the options with a short description can be found at |Q_op|.
makes "dl", "cl", "yl" etc. work normally.
*'wildchar'* *'wc'*
-'wildchar' 'wc' number (Vim default: <Tab>, Vi default: CTRL-E)
+'wildchar' 'wc' number (default: <Tab>)
global
Character you have to type to start wildcard expansion in the
command-line, as specified with 'wildmode'.
@@ -6977,7 +6989,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'wildmode' 'wim' string (default: "full")
global
Completion mode that is used for the character specified with
- 'wildchar'. It is a comma separated list of up to four parts. Each
+ 'wildchar'. It is a comma-separated list of up to four parts. Each
part specifies what to do for each consecutive use of 'wildchar'. The
first part specifies the behavior for the first use of 'wildchar',
The second part for the second use, etc.
@@ -7024,7 +7036,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'wildoptions' 'wop' string (default "pum,tagfile")
global
List of words that change how |cmdline-completion| is done.
- pum Display the completion matches using the popupmenu
+ pum Display the completion matches using the popup menu
in the same style as the |ins-completion-menu|.
tagfile When using CTRL-D to list matching tags, the kind of
tag and the file of the tag is listed. Only one match
@@ -7051,6 +7063,23 @@ A jump table for the options with a short description can be found at |Q_op|.
key is never used for the menu.
This option is not used for <F10>; on Win32.
+ *'winbar'* *'wbr'*
+'winbar' 'wbr' string (default empty)
+ global or local to window |global-local|
+ When non-empty, this option enables the window bar and determines its
+ contents. The window bar is a bar that's shown at the top of every
+ window with it enabled. The value of 'winbar' is evaluated like with
+ 'statusline'.
+
+ When changing something that is used in 'winbar' that does not trigger
+ it to be updated, use |:redrawstatus|.
+
+ Floating windows do not use the global value of 'winbar'. The
+ window-local value of 'winbar' must be set for a floating window to
+ have a window bar.
+
+ This option cannot be set in a modeline when 'modelineexpr' is off.
+
*'winblend'* *'winbl'*
'winblend' 'winbl' number (default 0)
local to window
@@ -7192,7 +7221,7 @@ A jump table for the options with a short description can be found at |Q_op|.
starts. When typing text beyond this limit, an <EOL> will be inserted
and inserting continues on the next line.
Options that add a margin, such as 'number' and 'foldcolumn', cause
- the text width to be further reduced. This is Vi compatible.
+ the text width to be further reduced.
When 'textwidth' is non-zero, this option is not used.
See also 'formatoptions' and |ins-textwidth|.
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 634145da3e..371a210847 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -71,12 +71,18 @@ N Repeat the latest "/" or "?" [count] times in
Only whole keywords are searched for, like with the
command "/\<keyword\>". |exclusive|
'ignorecase' is used, 'smartcase' is not.
+ *v_star-default*
+ In Visual mode, search forward for the current selection.
+ |default-mappings|
*#*
# Same as "*", but search backward. The pound sign
(character 163) also works. If the "#" key works as
backspace, try using "stty erase <BS>" before starting
Vim (<BS> is CTRL-H or a real backspace).
+ *v_#-default*
+ In Visual mode, search backward for the current selection.
+ |default-mappings|
*gstar*
g* Like "*", but don't put "\<" and "\>" around the word.
@@ -153,9 +159,10 @@ index, on which the cursor is. This can look like this: >
Note: the count does not take offset into account.
When no match is found you get the error: *E486* Pattern not found
-Note that for the |:global| command this behaves like a normal message, for Vi
-compatibility. For the |:s| command the "e" flag can be used to avoid the
-error message |:s_flags|.
+Note that for the `:global` command, you get a normal message "Pattern not
+found", for Vi compatibility.
+For the |:s| command the "e" flag can be used to avoid the error message
+|:s_flags|.
*search-offset* *{offset}*
These commands search for the specified pattern. With "/" and "?" an
@@ -913,17 +920,24 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
becomes invalid. Vim doesn't automatically update the matches.
Similar to moving the cursor for "\%#" |/\%#|.
- */\%l* */\%>l* */\%<l* *E951*
+ */\%l* */\%>l* */\%<l* *E951* *E1204*
\%23l Matches in a specific line.
\%<23l Matches above a specific line (lower line number).
\%>23l Matches below a specific line (higher line number).
- These three can be used to match specific lines in a buffer. The "23"
+\%.l Matches at the cursor line.
+\%<.l Matches above the cursor line.
+\%>.l Matches below the cursor line.
+ These six can be used to match specific lines in a buffer. The "23"
can be any line number. The first line is 1.
WARNING: When inserting or deleting lines Vim does not automatically
update the matches. This means Syntax highlighting quickly becomes
- wrong.
+ wrong. Also when referring to the cursor position (".") and
+ the cursor moves the display isn't updated for this change. An update
+ is done when using the |CTRL-L| command (the whole screen is updated).
Example, to highlight the line where the cursor currently is: >
- :exe '/\%' . line(".") . 'l.*'
+ :exe '/\%' .. line(".") .. 'l'
+< Alternatively use: >
+ /\%.l
< When 'hlsearch' is set and you move the cursor around and make changes
this will clearly show when the match is updated or not.
@@ -931,15 +945,22 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
\%23c Matches in a specific column.
\%<23c Matches before a specific column.
\%>23c Matches after a specific column.
- These three can be used to match specific columns in a buffer or
- string. The "23" can be any column number. The first column is 1.
- Actually, the column is the byte number (thus it's not exactly right
- for multibyte characters).
+\%.c Matches at the cursor column.
+\%<.c Matches before the cursor column.
+\%>.c Matches after the cursor column.
+ These six can be used to match specific columns in a buffer or string.
+ The "23" can be any column number. The first column is 1. Actually,
+ the column is the byte number (thus it's not exactly right for
+ multibyte characters).
WARNING: When inserting or deleting text Vim does not automatically
update the matches. This means Syntax highlighting quickly becomes
- wrong.
+ wrong. Also when referring to the cursor position (".") and
+ the cursor moves the display isn't updated for this change. An update
+ is done when using the |CTRL-L| command (the whole screen is updated).
Example, to highlight the column where the cursor currently is: >
- :exe '/\%' . col(".") . 'c'
+ :exe '/\%' .. col(".") .. 'c'
+< Alternatively use: >
+ /\%.c
< When 'hlsearch' is set and you move the cursor around and make changes
this will clearly show when the match is updated or not.
Example for matching a single byte in column 44: >
@@ -950,8 +971,11 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
\%23v Matches in a specific virtual column.
\%<23v Matches before a specific virtual column.
\%>23v Matches after a specific virtual column.
- These three can be used to match specific virtual columns in a buffer
- or string. When not matching with a buffer in a window, the option
+\%.v Matches at the current virtual column.
+\%<.v Matches before the current virtual column.
+\%>.v Matches after the current virtual column.
+ These six can be used to match specific virtual columns in a buffer or
+ string. When not matching with a buffer in a window, the option
values of the current window are used (e.g., 'tabstop').
The "23" can be any column number. The first column is 1.
Note that some virtual column positions will never match, because they
@@ -959,13 +983,18 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
one screen character.
WARNING: When inserting or deleting text Vim does not automatically
update highlighted matches. This means Syntax highlighting quickly
- becomes wrong.
+ becomes wrong. Also when referring to the cursor position (".") and
+ the cursor moves the display isn't updated for this change. An update
+ is done when using the |CTRL-L| command (the whole screen is updated).
Example, to highlight all the characters after virtual column 72: >
/\%>72v.*
< When 'hlsearch' is set and you move the cursor around and make changes
this will clearly show when the match is updated or not.
To match the text up to column 17: >
/^.*\%17v
+< To match all characters after the current virtual column (where the
+ cursor is): >
+ /\%>.v.*
< Column 17 is not included, because this is a |/zero-width| match. To
include the column use: >
/^.*\%17v.
@@ -1421,5 +1450,38 @@ Finally, these constructs are unique to Perl:
are suggested to use ":match" for manual matching and
":2match" for another plugin.
+==============================================================================
+11. Fuzzy matching *fuzzy-matching*
+
+Fuzzy matching refers to matching strings using a non-exact search string.
+Fuzzy matching will match a string, if all the characters in the search string
+are present anywhere in the string in the same order. Case is ignored. In a
+matched string, other characters can be present between two consecutive
+characters in the search string. If the search string has multiple words, then
+each word is matched separately. So the words in the search string can be
+present in any order in a string.
+
+Fuzzy matching assigns a score for each matched string based on the following
+criteria:
+ - The number of sequentially matching characters.
+ - The number of characters (distance) between two consecutive matching
+ characters.
+ - Matches at the beginning of a word
+ - Matches at a camel case character (e.g. Case in CamelCase)
+ - Matches after a path separator or a hyphen.
+ - The number of unmatched characters in a string.
+The matching string with the highest score is returned first.
+
+For example, when you search for the "get pat" string using fuzzy matching, it
+will match the strings "GetPattern", "PatternGet", "getPattern", "patGetter",
+"getSomePattern", "MatchpatternGet" etc.
+
+The functions |matchfuzzy()| and |matchfuzzypos()| can be used to fuzzy search
+a string in a List of strings. The matchfuzzy() function returns a List of
+matching strings. The matchfuzzypos() functions returns the List of matches,
+the matching positions and the fuzzy match scores.
+
+The "f" flag of `:vimgrep` enables fuzzy matching.
+
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt
index 179c1066cd..04e04b5165 100644
--- a/runtime/doc/pi_health.txt
+++ b/runtime/doc/pi_health.txt
@@ -48,27 +48,26 @@ Commands *health-commands*
:checkhealth vim*
<
==============================================================================
-Lua Functions *health-functions-lua* *health-lua*
+Lua Functions *health-functions-lua* *health-lua* *vim.health*
The Lua "health" module can be used to create new healthchecks (see also
-|health-functions-vim|). To get started, simply use: >
- local health = require('health')
-<
-health.report_start({name}) *health.report_start()*
+|health-functions-vim|). To get started, simply use:
+
+vim.health.report_start({name}) *vim.health.report_start()*
Starts a new report. Most plugins should call this only once, but if
you want different sections to appear in your report, call this once
per section.
-health.report_info({msg}) *health.report_info()*
+vim.health.report_info({msg}) *vim.health.report_info()*
Reports an informational message.
-health.report_ok({msg}) *health.report_ok()*
+vim.health.report_ok({msg}) *vim.health.report_ok()*
Reports a "success" message.
-health.report_warn({msg} [, {advice}]) *health.report_warn()*
+vim.health.report_warn({msg} [, {advice}]) *vim.health.report_warn()*
Reports a warning. {advice} is an optional List of suggestions.
-health.report_error({msg} [, {advice}]) *health.report_error()*
+vim.health.report_error({msg} [, {advice}]) *vim.health.report_error()*
Reports an error. {advice} is an optional List of suggestions.
==============================================================================
@@ -98,15 +97,14 @@ Copy this sample code into `lua/foo/health/init.lua` or `lua/foo/health.lua`,
replacing "foo" in the path with your plugin name: >
local M = {}
- local health = require("health")
M.check = function()
- health.report_start("my_plugin report")
+ vim.health.report_start("my_plugin report")
-- make sure setup function parameters are ok
if check_setup() then
- health.report_ok("Setup function is correct")
+ vim.health.report_ok("Setup function is correct")
else
- health.report_error("Setup function is incorrect")
+ vim.health.report_error("Setup function is incorrect")
end
-- do some more checking
-- ...
diff --git a/runtime/doc/pi_msgpack.txt b/runtime/doc/pi_msgpack.txt
index 1dbd268038..801c56e49f 100644
--- a/runtime/doc/pi_msgpack.txt
+++ b/runtime/doc/pi_msgpack.txt
@@ -88,7 +88,7 @@ msgpack#type({msgpack-value}) *msgpack#type()*
Returns name of the key in |v:msgpack_types| that represents
{msgpack-value} type. Never returns zero: this function returns
msgpack type which will be dumped by |msgpackdump()| should it receive
- a list with singe {msgpack-value} as input.
+ a list with single {msgpack-value} as input.
msgpack#deepcopy({msgpack-value}) *msgpack#deepcopy()*
Like |deepcopy()|, but works correctly with |msgpack-special-dict|
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 3ac61be6f2..6f7b53722c 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -440,11 +440,11 @@ settings are described below, in |netrw-browser-options|, and in
*g:netrw_use_errorwindow* =2: messages from netrw will use a popup window
Move the mouse and pause to remove the popup window.
- (default value if popup windows are availble)
+ (default value if popup windows are available)
=1 : messages from netrw will use a separate one
line window. This window provides reliable
delivery of messages.
- (default value if popup windows are not availble)
+ (default value if popup windows are not available)
=0 : messages from netrw will use echoerr ;
messages don't always seem to show up this
way, but one doesn't have to quit the window.
@@ -968,7 +968,7 @@ itself:
fun! NetReadFixup(method, line1, line2)
if method == 3 " ftp (no <.netrc>)
let fourblanklines= line2 - 3
- silent fourblanklines.",".line2."g/^\s*/d"
+ silent fourblanklines .. "," .. line2 .. "g/^\s*/d"
endif
endfunction
endif
@@ -1198,7 +1198,7 @@ If there are marked files and/or directories, mb will add them to the bookmark
list.
*netrw-:NetrwMB*
-Addtionally, one may use :NetrwMB to bookmark files or directories. >
+Additionally, one may use :NetrwMB to bookmark files or directories. >
:NetrwMB[!] [files/directories]
@@ -1975,7 +1975,7 @@ To use this function, simply assign its output to |g:netrw_list_hide| option. >
Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
Function can take additional files with git-ignore patterns.
- Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$'
+ Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
Combining 'netrw_gitignore#Hide' with custom patterns.
<
@@ -2814,7 +2814,7 @@ your browsing preferences. (see also: |netrw-settings|)
= 2: wide listing (multiple files in columns)
= 3: tree style listing
- *g:netrw_list_hide* comma separated pattern list for hiding files
+ *g:netrw_list_hide* comma-separated pattern list for hiding files
Patterns are regular expressions (see |regexp|)
There's some special support for git-ignore
files: you may add the output from the helper
@@ -2824,7 +2824,7 @@ your browsing preferences. (see also: |netrw-settings|)
Examples:
let g:netrw_list_hide= '.*\.swp$'
- let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$'
+ let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
default: ""
*g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt
index f54d0429a6..924fab175e 100644
--- a/runtime/doc/print.txt
+++ b/runtime/doc/print.txt
@@ -127,21 +127,21 @@ file: >
system(['lpr']
+ (empty(&printdevice)?[]:['-P', &printdevice])
+ [v:fname_in])
- . delete(v:fname_in)
+ .. delete(v:fname_in)
+ v:shell_error
On MS-Dos and MS-Windows machines the default is to copy the file to the
currently specified printdevice: >
system(['copy', v:fname_in, empty(&printdevice)?'LPT1':&printdevice])
- . delete(v:fname_in)
+ .. delete(v:fname_in)
If you change this option, using a function is an easy way to avoid having to
escape all the spaces. Example: >
:set printexpr=PrintFile(v:fname_in)
:function PrintFile(fname)
- : call system("ghostview " . a:fname)
+ : call system("ghostview " .. a:fname)
: call delete(a:fname)
: return v:shell_error
:endfunc
diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt
index b785010699..9fd35f19c5 100644
--- a/runtime/doc/provider.txt
+++ b/runtime/doc/provider.txt
@@ -20,11 +20,12 @@ Run the |:checkhealth| command, and review the sections below.
==============================================================================
Python integration *provider-python*
-Nvim supports Python |remote-plugin|s and the Vim legacy |python2| and
-|python3| interfaces (which are implemented as remote-plugins).
+Nvim supports Python |remote-plugin|s and the Vim legacy |python3| and
+|pythonx| interfaces (which are implemented as remote-plugins).
Note: Only the Vim 7.3 legacy interface is supported, not later features such
-as |python-bindeval| (Vim 7.4); use the Nvim API instead.
+as |python-bindeval| (Vim 7.4); use the Nvim API instead. Python 2 is not
+supported.
PYTHON QUICKSTART ~
@@ -38,11 +39,6 @@ For Python 3 plugins:
2. Install the module (try "python" if "python3" is missing): >
python3 -m pip install --user --upgrade pynvim
-For Python 2 plugins:
-1. Make sure Python 2.7 is available in your $PATH.
-2. Install the module (try "python" if "python2" is missing): >
- python2 -m pip install --user --upgrade pynvim
-
The pip `--upgrade` flag ensures that you get the latest version even if
a previous version was already installed.
@@ -56,22 +52,12 @@ If you run into problems, uninstall _both_ then install "pynvim" again: >
PYTHON PROVIDER CONFIGURATION ~
- *g:python_host_prog*
-Command to start Python 2 (executable, not directory). Setting this makes
-startup faster. Useful for working with virtualenvs. Must be set before any
-check for has("python2"). >
- let g:python_host_prog = '/path/to/python'
-<
*g:python3_host_prog*
Command to start Python 3 (executable, not directory). Setting this makes
startup faster. Useful for working with virtualenvs. Must be set before any
check for has("python3"). >
let g:python3_host_prog = '/path/to/python3'
<
- *g:loaded_python_provider*
-To disable Python 2 support: >
- let g:loaded_python_provider = 0
-<
*g:loaded_python3_provider*
To disable Python 3 support: >
let g:loaded_python3_provider = 0
@@ -81,8 +67,8 @@ PYTHON VIRTUALENVS ~
*python-virtualenv*
If you plan to use per-project virtualenvs often, you should assign one
virtualenv for Neovim and hard-code the interpreter path via
-|g:python3_host_prog| (or |g:python_host_prog|) so that the "pynvim" package
-is not required for each virtualenv.
+|g:python3_host_prog| so that the "pynvim" package is not required
+for each virtualenv.
Example using pyenv: >
pyenv install 3.4.4
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 873fbd8971..dab3bfa280 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -341,7 +341,7 @@ processing a quickfix or location list command, it will be aborted.
cursor position will not be changed. See |:cexpr| for
more information.
Example: >
- :g/mypattern/caddexpr expand("%") . ":" . line(".") . ":" . getline(".")
+ :g/mypattern/caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")
<
*:lad* *:addd* *:laddexpr*
:lad[dexpr] {expr} Same as ":caddexpr", except the location list for the
@@ -497,7 +497,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
autocommand event is disabled by adding it to
'eventignore'. This considerably speeds up editing
each buffer.
- {not in Vi}
Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|,
|:ldo|, |:cfdo| and |:lfdo|.
@@ -510,7 +509,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:{cmd}
etc.
< Otherwise it works the same as `:cdo`.
- {not in Vi}
*:ldo*
:ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list
@@ -523,7 +521,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
etc.
< Only valid entries in the location list are used.
Otherwise it works the same as `:cdo`.
- {not in Vi}
*:lfdo*
:lfdo[!] {cmd} Execute {cmd} in each file in the location list for
@@ -535,7 +532,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:{cmd}
etc.
< Otherwise it works the same as `:ldo`.
- {not in Vi}
FILTERING A QUICKFIX OR LOCATION LIST:
*cfilter-plugin* *:Cfilter* *:Lfilter*
@@ -560,6 +556,9 @@ pattern is used.
The |:Lfilter| command does the same as |:Cfilter| but operates on the current
location list.
+The current quickfix/location list is not modified by these commands, so you
+can go back to the unfiltered list using the |:colder|/|:lolder| command.
+
=============================================================================
2. The error window *quickfix-window*
@@ -575,6 +574,7 @@ location list.
second quickfix window. If [height] is given the
existing window will be resized to it.
+ *quickfix-buffer*
The window will contain a special buffer, with
'buftype' equal to "quickfix". Don't change this!
The window will have the w:quickfix_title variable set
@@ -583,7 +583,11 @@ location list.
status line if the value of 'statusline' is adjusted
properly. Whenever this buffer is modified by a
quickfix command or function, the |b:changedtick|
- variable is incremented.
+ variable is incremented. You can get the number of
+ this buffer using the getqflist() and getloclist()
+ functions by passing the 'qfbufnr' item. For a
+ location list, this buffer is wiped out when the
+ location list is removed.
*:lop* *:lopen*
:lop[en] [height] Open a window to show the location list for the
@@ -641,6 +645,27 @@ quickfix window. If there already is a window for that file, it is used
instead. If the buffer in the used window has changed, and the error is in
another file, jumping to the error will fail. You will first have to make
sure the window contains a buffer which can be abandoned.
+
+When you select a file from the quickfix window, the following steps are used
+to find a window to edit the file:
+
+1. If a window displaying the selected file is present in the current tabpage
+ (starting with the window before the quickfix window), then that window is
+ used.
+2. If the above step fails and if 'switchbuf' contains "usetab" and a window
+ displaying the selected file is present in any one of the tabpages
+ (starting with the first tabpage) then that window is used.
+3. If the above step fails then a window in the current tabpage displaying a
+ buffer with 'buftype' not set (starting with the window before the quickfix
+ window) is used.
+4. If the above step fails and if 'switchbuf' contains "uselast", then the
+ previously accessed window is used.
+5. If the above step fails then the window before the quickfix window is used.
+ If there is no previous window, then the window after the quickfix window
+ is used.
+6. If the above step fails, then a new horizontally split window above the
+ quickfix window is used.
+
*CTRL-W_<Enter>* *CTRL-W_<CR>*
You can use CTRL-W <Enter> to open a new window and jump to the error there.
@@ -650,7 +675,7 @@ FileType event (also see |qf.vim|). Then the BufReadPost event is triggered,
using "quickfix" for the buffer name. This can be used to perform some action
on the listed errors. Example: >
au BufReadPost quickfix setlocal modifiable
- \ | silent exe 'g/^/s//\=line(".")." "/'
+ \ | silent exe 'g/^/s//\=line(".") .. " "/'
\ | setlocal nomodifiable
This prepends the line number to each line. Note the use of "\=" in the
substitute string of the ":s" command, which is used to evaluate an
@@ -679,13 +704,15 @@ this window, the displayed location list is used.
When you select a file from the location list window, the following steps are
used to find a window to edit the file:
-1. If a window with the location list displayed in the location list window is
- present, then the file is opened in that window.
-2. If the above step fails and if the file is already opened in another
- window, then that window is used.
-3. If the above step fails then an existing window showing a buffer with
- 'buftype' not set is used.
-4. If the above step fails, then the file is edited in a new window.
+1. If a non-quickfix window associated with the location list is present in
+ the current tabpage, then that window is used.
+2. If the above step fails and if the file is already opened in another window
+ in the current tabpage, then that window is used.
+3. If the above step fails and 'switchbuf' contains "usetab" and if the file
+ is opened in a window in any one of the tabpages, then that window is used.
+4. If the above step fails then a window in the current tabpage showing a
+ buffer with 'buftype' not set is used.
+5. If the above step fails, then the file is edited in a new window.
In all of the above cases, if the location list for the selected window is not
yet set, then it is set to the location list displayed in the location list
@@ -749,12 +776,18 @@ using these functions are below:
" get the quickfix list window id
:echo getqflist({'winid' : 0}).winid
+ " get the quickfix list window buffer number
+ :echo getqflist({'qfbufnr' : 0}).qfbufnr
+
" get the context of the current location list
:echo getloclist(0, {'context' : 0}).context
" get the location list window id of the third window
:echo getloclist(3, {'winid' : 0}).winid
+ " get the location list window buffer number of the third window
+ :echo getloclist(3, {'qfbufnr' : 0}).qfbufnr
+
" get the file window id of a location list window (winnr: 4)
:echo getloclist(4, {'filewinid' : 0}).filewinid
<
@@ -989,7 +1022,7 @@ commands can be combined to create a NewGrep command: >
5.1 using Vim's internal grep
*:vim* *:vimgrep* *E682* *E683*
-:vim[grep][!] /{pattern}/[g][j] {file} ...
+:vim[grep][!] /{pattern}/[g][j][f] {file} ...
Search for {pattern} in the files {file} ... and set
the error list to the matches. Files matching
'wildignore' are ignored; files in 'suffixes' are
@@ -1014,6 +1047,13 @@ commands can be combined to create a NewGrep command: >
updated. With the [!] any changes in the current
buffer are abandoned.
+ 'f' When the 'f' flag is specified, fuzzy string
+ matching is used to find matching lines. In this
+ case, {pattern} is treated as a literal string
+ instead of a regular expression. See
+ |fuzzy-matching| for more information about fuzzy
+ matching strings.
+
|QuickFixCmdPre| and |QuickFixCmdPost| are triggered.
A file that is opened for matching may use a buffer
number, but it is reused if possible to avoid
@@ -1042,20 +1082,20 @@ commands can be combined to create a NewGrep command: >
:vimgrep Error *.c
<
*:lv* *:lvimgrep*
-:lv[imgrep][!] /{pattern}/[g][j] {file} ...
+:lv[imgrep][!] /{pattern}/[g][j][f] {file} ...
:lv[imgrep][!] {pattern} {file} ...
Same as ":vimgrep", except the location list for the
current window is used instead of the quickfix list.
*:vimgrepa* *:vimgrepadd*
-:vimgrepa[dd][!] /{pattern}/[g][j] {file} ...
+:vimgrepa[dd][!] /{pattern}/[g][j][f] {file} ...
:vimgrepa[dd][!] {pattern} {file} ...
Just like ":vimgrep", but instead of making a new list
of errors the matches are appended to the current
list.
*:lvimgrepa* *:lvimgrepadd*
-:lvimgrepa[dd][!] /{pattern}/[g][j] {file} ...
+:lvimgrepa[dd][!] /{pattern}/[g][j][f] {file} ...
:lvimgrepa[dd][!] {pattern} {file} ...
Same as ":vimgrepadd", except the location list for
the current window is used instead of the quickfix
@@ -1332,12 +1372,17 @@ Basic items
%f file name (finds a string)
%o module name (finds a string)
%l line number (finds a number)
+ %e end line number (finds a number)
%c column number (finds a number representing character
column of the error, byte index, a <tab> is 1
character column)
%v virtual column number (finds a number representing
screen column of the error (1 <tab> == 8 screen
columns))
+ %k end column number (finds a number representing
+ the character column of the error, byte index, or a
+ number representing screen end column of the error if
+ it's used with %v)
%t error type (finds a single character):
e - error message
w - warning message
@@ -1446,7 +1491,7 @@ error message (line numbers are not part of the actual output):
4 Traceback (most recent call last):
5 File "unittests/dbfacadeTest.py", line 89, in testFoo
6 self.assertEquals(34, dtid)
- 7 File "/usr/lib/python2.2/unittest.py", line 286, in
+ 7 File "/usr/lib/python3.8/unittest.py", line 286, in
8 failUnlessEqual
9 raise self.failureException, \
10 AssertionError: 34 != 33
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index af8301f1a0..6f16db5cc2 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -356,6 +356,7 @@ In Insert or Command-line mode:
|v_y| {visual}y yank the highlighted text into a register
|yy| N yy yank N lines into a register
|Y| N Y yank N lines into a register
+ Note: Mapped to "y$" by default. |default-mappings|
|p| N p put a register after the cursor position (N times)
|P| N P put a register before the cursor position (N times)
|]p| N ]p like p, but adjust indent to current line
@@ -637,6 +638,7 @@ Short explanation of each option: *option-list*
'cinkeys' 'cink' keys that trigger indent when 'cindent' is set
'cinoptions' 'cino' how to do indenting when 'cindent' is set
'cinwords' 'cinw' words where 'si' and 'cin' add an indent
+'cinscopedecls' 'cinsd' words that are recognized by 'cino-g'
'clipboard' 'cb' use the clipboard as the unnamed register
'cmdheight' 'ch' number of lines to use for the command-line
'cmdwinheight' 'cwh' height of the command-line window
@@ -739,7 +741,6 @@ Short explanation of each option: *option-list*
'indentexpr' 'inde' expression used to obtain the indent of a line
'indentkeys' 'indk' keys that trigger indenting with 'indentexpr'
'infercase' 'inf' adjust case of match for keyword completion
-'insertmode' 'im' start the edit of a file in Insert mode
'isfname' 'isf' characters included in file names and pathnames
'isident' 'isi' characters included in identifiers
'iskeyword' 'isk' characters included in keywords
@@ -784,6 +785,7 @@ Short explanation of each option: *option-list*
'mousefocus' 'mousef' keyboard focus follows the mouse
'mousehide' 'mh' hide mouse pointer while typing
'mousemodel' 'mousem' changes meaning of mouse buttons
+'mousescroll' amount to scroll by when scrolling with a mouse
'mouseshape' 'mouses' shape of the mouse pointer in different modes
'mousetime' 'mouset' max time between mouse double-click
'nrformats' 'nf' number formats recognized for CTRL-A command
@@ -822,7 +824,6 @@ Short explanation of each option: *option-list*
'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting
'regexpengine' 're' default regexp engine to use
'relativenumber' 'rnu' show relative line number in front of each line
-'remap' allow mappings to work recursively
'report' threshold for reporting nr. of lines changed
'revins' 'ri' inserting characters will work backwards
'rightleft' 'rl' window is right-to-left oriented
@@ -894,7 +895,6 @@ 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
-'terse' shorten some messages
'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
@@ -1267,7 +1267,7 @@ Context-sensitive completion on the command-line:
|CTRL-W_^| CTRL-W ^ split window and edit alternate file
|CTRL-W_n| CTRL-W n or :new create new empty window
|CTRL-W_q| CTRL-W q or :q[uit] quit editing and close window
-|CTRL-W_c| CTRL-W c or :cl[ose] make buffer hidden and close window
+|CTRL-W_c| CTRL-W c or :clo[se] make buffer hidden and close window
|CTRL-W_o| CTRL-W o or :on[ly] make current window only one on the
screen
diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt
index 9ef5a37452..d9aaa757ad 100644
--- a/runtime/doc/recover.txt
+++ b/runtime/doc/recover.txt
@@ -108,7 +108,7 @@ command:
*:pre* *:preserve* *E313* *E314*
:pre[serve] Write all text for the current buffer into its swap
file. The original file is no longer needed for
- recovery. This sets a flag in the current buffer.
+ recovery.
A Vim swap file can be recognized by the first six characters: "b0VIM ".
After that comes the version number, e.g., "3.0".
diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt
new file mode 100644
index 0000000000..0c1e3438de
--- /dev/null
+++ b/runtime/doc/remote.txt
@@ -0,0 +1,131 @@
+*remote.txt* Nvim
+
+
+ VIM REFERENCE MANUAL by Bram Moolenaar
+
+
+Vim client-server communication *client-server*
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+1. Common functionality *clientserver*
+
+Nvim's |RPC| functionality allows clients to programmatically control Nvim. Nvim
+itself takes command-line arguments that cause it to become a client to another
+Nvim running as a server. These arguments match those provided by Vim's
+clientserver option.
+
+The following command line arguments are available:
+
+ argument meaning ~
+
+ --remote [+{cmd}] {file} ... *--remote*
+ Open the file list in a remote Vim. When
+ there is no Vim server, execute locally.
+ Vim allows one init command: +{cmd}.
+ This must be an Ex command that can be
+ followed by "|". It's not yet supported by
+ Nvim.
+ The rest of the command line is taken as the
+ file list. Thus any non-file arguments must
+ come before this.
+ You cannot edit stdin this way |--|.
+ The remote Vim is raised. If you don't want
+ this use >
+ nvim --remote-send "<C-\><C-N>:n filename<CR>"
+<
+ --remote-silent [+{cmd}] {file} ... *--remote-silent*
+ As above, but don't complain if there is no
+ server and the file is edited locally.
+ *--remote-tab*
+ --remote-tab Like --remote but open each file in a new
+ tabpage.
+ *--remote-tab-silent*
+ --remote-tab-silent Like --remote-silent but open each file in a
+ new tabpage.
+ *--remote-send*
+ --remote-send {keys} Send {keys} to server and exit. The {keys}
+ are not mapped. Special key names are
+ recognized, e.g., "<CR>" results in a CR
+ character.
+ *--remote-expr*
+ --remote-expr {expr} Evaluate {expr} in server and print the result
+ on stdout.
+ *--server*
+ --server {addr} Connect to the named pipe or socket at the
+ given address for executing remote commands.
+ See |--listen| for specifying an address when
+ starting a server.
+
+Examples ~
+
+Start an Nvim server listening on a named pipe at '~/.cache/nvim/server.pipe': >
+ nvim --listen ~/.cache/nvim/server.pipe
+
+Edit "file.txt" in an Nvim server listening at '~/.cache/nvim/server.pipe': >
+ nvim --server ~/.cache/nvim/server.pipe --remote file.txt
+
+This doesn't work, all arguments after --remote will be used as file names: >
+ nvim --remote --server ~/.cache/nvim/server.pipe file.txt
+
+Tell the remote server to write all files and exit: >
+ nvim --server ~/.cache/nvim/server.pipe --remote-send '<C-\><C-N>:wqa<CR>'
+
+
+REMOTE EDITING
+
+The --remote argument will cause a |:drop| command to be constructed from the
+rest of the command line and sent as described above.
+Note that the --remote and --remote-wait arguments will consume the rest of
+the command line. I.e. all remaining arguments will be regarded as filenames.
+You can not put options there!
+
+
+==============================================================================
+2. Missing functionality *E5600* *clientserver-missing*
+
+Vim supports additional functionality in clientserver that's not yet
+implemented in Nvim. In particular, none of the "wait" variants are supported
+yet. The following command line arguments are not yet available:
+
+ argument meaning ~
+
+ --remote-wait [+{cmd}] {file} ... *--remote-wait*
+ Not yet supported by Nvim.
+ As --remote, but wait for files to complete
+ (unload) in remote Vim.
+ --remote-wait-silent [+{cmd}] {file} ... *--remote-wait-silent*
+ Not yet supported by Nvim.
+ As --remote-wait, but don't complain if there
+ is no server.
+ *--remote-tab-wait*
+ --remote-tab-wait Not yet supported by Nvim.
+ Like --remote-wait but open each file in a new
+ tabpage.
+ *--remote-tab-wait-silent*
+ --remote-tab-wait-silent Not yet supported by Nvim.
+ Like --remote-wait-silent but open each file
+ in a new tabpage.
+ *--servername*
+ --servername {name} Not yet supported by Nvim.
+ Become the server {name}. When used together
+ with one of the --remote commands: connect to
+ server {name} instead of the default (see
+ below). The name used will be uppercase.
+
+ *--serverlist*
+ --serverlist Not yet supported by Nvim.
+ Output a list of server names.
+
+
+
+
+SERVER NAME *client-server-name*
+
+By default Vim will try to register the name under which it was invoked (gvim,
+egvim ...). This can be overridden with the --servername argument. Nvim
+either listens on a named pipe or a socket and does not yet support this
+--servername functionality.
+
+ vim:tw=78:sw=4:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index c7481ad290..508565dea4 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -161,6 +161,11 @@ Q Repeat the last recorded register [count] times.
result of evaluating the expression is executed as an
Ex command.
Mappings are not recognized in these commands.
+ When the |line-continuation| character (\) is present
+ at the beginning of a line in a linewise register,
+ then it is combined with the previous line. This is
+ useful for yanking and executing parts of a Vim
+ script.
*:@:*
:[addr]@: Repeat last command-line. First set cursor at line
@@ -177,8 +182,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
*:so* *:source* *load-vim-script*
:[range]so[urce] [file] Runs |Ex| commands or Lua code (".lua" files) from
- [file], or from the current buffer if no [file] is
- given.
+ [file], or current buffer if no [file].
Triggers the |SourcePre| autocommand.
*:source!*
:[range]so[urce]! {file}
@@ -253,21 +257,22 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
below "plugin", just like with plugins in
'runtimepath'.
- If the filetype detection was not enabled yet (this
+ If the filetype detection was already enabled (this
is usually done with a "syntax enable" or "filetype
- on" command in your .vimrc file), this will also look
+ on" command in your |init.vim|, or automatically during
+ |initialization|), and the package was found in
+ "pack/*/opt/{name}", this command will also look
for "{name}/ftdetect/*.vim" files.
When the optional ! is added no plugin files or
ftdetect scripts are loaded, only the matching
directories are added to 'runtimepath'. This is
- useful in your .vimrc. The plugins will then be
- loaded during initialization, see |load-plugins| (note
+ useful in your |init.vim|. The plugins will then be
+ loaded during |initialization|, see |load-plugins| (note
that the loading order will be reversed, because each
- directory is inserted before others).
- Note that for ftdetect scripts to be loaded
- you will need to write `filetype plugin indent on`
- AFTER all `packadd!` commands.
+ directory is inserted before others). In this case, the
+ ftdetect scripts will be loaded during |initialization|,
+ before the |load-plugins| step.
Also see |pack-add|.
@@ -465,8 +470,8 @@ flag when defining the function, it is not relevant when executing it. >
:set cpo-=C
<
*line-continuation-comment*
-To add a comment in between the lines start with '\" '. Notice the space
-after the double quote. Example: >
+To add a comment in between the lines start with '"\ '. Notice the space
+after the backslash. Example: >
let array = [
"\ first entry comment
\ 'first',
diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt
index 7d1da3b409..170c87a1a4 100644
--- a/runtime/doc/scroll.txt
+++ b/runtime/doc/scroll.txt
@@ -239,12 +239,16 @@ the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
line if the cursor line is about to be scrolled off the screen (similarly to
how the horizontal scrollbar works).
-You can modify the default behavior by mapping the keys. For example, to make
-the scroll wheel move one line or half a page in Normal mode: >
- :map <ScrollWheelUp> <C-Y>
- :map <S-ScrollWheelUp> <C-U>
- :map <ScrollWheelDown> <C-E>
- :map <S-ScrollWheelDown> <C-D>
-You can also use Alt and Ctrl modifiers.
+You can control the number of lines / columns to scroll by using the
+'mousescroll' option. You can also modify the default behavior by mapping
+the keys. For example, to scroll a page at a time in normal mode: >
+ :map <ScrollWheelUp> <C-B>
+ :map <ScrollWheelDown> <C-F>
+Scroll keys can also be combined with modifiers such as Shift, Ctrl, and Alt.
+
+When scrolling with a mouse, the window currently under the cursor is
+scrolled. This allows you to scroll inactive windows. Note that when scroll
+keys are remapped to keyboard keys, the active window is affected regardless
+of the current cursor position.
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt
index 5cfa06c33c..a2a5645baa 100644
--- a/runtime/doc/sign.txt
+++ b/runtime/doc/sign.txt
@@ -87,7 +87,7 @@ the delete is undone the sign does not move back.
Here is an example that places a sign "piet", displayed with the text ">>", in
line 23 of the current file: >
:sign define piet text=>> texthl=Search
- :exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
+ :exe ":sign place 2 line=23 name=piet file=" .. expand("%:p")
And here is the command to delete it again: >
:sign unplace 2
diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt
index 03c00c8495..bc45b0e511 100644
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -120,8 +120,8 @@ zuG Undo |zW| and |zG|, remove the word from the internal
rare as this is a fairly uncommon command and all
intuitive commands for this are already taken. If you
want you can add mappings with e.g.: >
- nnoremap z? :exe ':spellrare ' . expand('<cWORD>')<CR>
- nnoremap z/ :exe ':spellrare! ' . expand('<cWORD>')<CR>
+ nnoremap z? :exe ':spellrare ' .. expand('<cWORD>')<CR>
+ nnoremap z/ :exe ':spellrare! ' .. expand('<cWORD>')<CR>
< |:spellundo|, |zuw|, or |zuW| can be used to undo this.
:spellr[rare]! {word} Add {word} as a rare word to the internal word
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index bb775ec884..d57a85423c 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -188,7 +188,7 @@ argument.
changes and writing.
-e *-e* *-E*
--E Start Nvim in Ex mode |gQ|.
+-E Start Nvim in Ex mode |gQ|, see |Ex-mode|.
If stdin is not a TTY:
-e reads/executes stdin as Ex commands.
@@ -367,7 +367,7 @@ argument.
*--headless*
--headless Start without UI, and do not wait for `nvim_ui_attach`. The
builtin TUI is not used, so stdio works as an arbitrary
- communication channel. |channel-stdio|
+ communication channel. |channel-stdio|
Also useful for scripting (tests) to see messages that would
not be printed by |-es|.
@@ -407,9 +407,14 @@ accordingly, proceeding as follows:
Nvim started with |--embed| waits for the UI to connect before
proceeding to load user configuration.
-4. Setup |default-mappings| and |default-autocmds|.
+4. Setup |default-mappings| and |default-autocmds|. Create |popup-menu|.
-5. Load user config (execute Ex commands from files, environment, …).
+5. Enable filetype and indent plugins.
+ This does the same as the command: >
+ :runtime! ftplugin.vim indent.vim
+< Skipped if the "-u NONE" command line argument was given.
+
+6. Load user config (execute Ex commands from files, environment, …).
$VIMINIT environment variable is read as one Ex command line (separate
multiple commands with '|' or <NL>).
*config* *init.vim* *init.lua* *vimrc* *exrc*
@@ -453,21 +458,19 @@ accordingly, proceeding as follows:
- The file ".nvimrc"
- The file ".exrc"
-6. Enable filetype and indent plugins.
- This does the same as the commands: >
- :runtime! filetype.vim
- :runtime! ftplugin.vim
- :runtime! indent.vim
-< Skipped if ":filetype … off" was called or if the "-u NONE" command
- line argument was given.
+7. Enable filetype detection.
+ This does the same as the command: >
+ :runtime! filetype.lua filetype.vim
+< Skipped if ":filetype off" was called or if the "-u NONE" command line
+ argument was given.
-7. Enable syntax highlighting.
+8. Enable syntax highlighting.
This does the same as the command: >
:runtime! syntax/syntax.vim
< Skipped if ":syntax off" was called or if the "-u NONE" command
line argument was given.
-8. Load the plugin scripts. *load-plugins*
+9. Load the plugin scripts. *load-plugins*
This does the same as the command: >
:runtime! plugin/**/*.vim
:runtime! plugin/**/*.lua
@@ -497,21 +500,21 @@ accordingly, proceeding as follows:
if packages have been found, but that should not add a directory
ending in "after".
-9. Set 'shellpipe' and 'shellredir'
+10. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
This means that Nvim will figure out the values of 'shellpipe' and
'shellredir' for you, unless you have set them yourself.
-10. Set 'updatecount' to zero, if "-n" command argument used
+11. Set 'updatecount' to zero, if "-n" command argument used
-11. Set binary options if the |-b| flag was given.
+12. Set binary options if the |-b| flag was given.
-12. Read the |shada-file|.
+13. Read the |shada-file|.
-13. Read the quickfix file if the |-q| flag was given, or exit on failure.
+14. Read the quickfix file if the |-q| flag was given, or exit on failure.
-14. Open all windows
+15. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
When the |-p| flag was given, tab pages will be created (but not
@@ -521,10 +524,9 @@ accordingly, proceeding as follows:
Buffers for all windows will be loaded, without triggering |BufAdd|
autocommands.
-15. Execute startup commands
+16. Execute startup commands
If a |-t| flag was given, the tag is jumped to.
Commands given with |-c| and |+cmd| are executed.
- If the 'insertmode' option is set, Insert mode is entered.
The starting flag is reset, has("vim_starting") will now return zero.
The |v:vim_did_enter| variable is set to 1.
The |VimEnter| autocommands are executed.
@@ -581,7 +583,7 @@ setting can affect the entire editor in ways that are not initially obvious.
To find the cause of a problem in your config, you must "bisect" it:
1. Remove or disable half of your |config|.
2. Restart Nvim.
-3. If the problem still occurs, goto 1.
+3. If the problem still occurs, goto 1.
4. If the problem is gone, restore half of the removed lines.
5. Continue narrowing your config in this way, until you find the setting or
plugin causing the issue.
@@ -698,7 +700,7 @@ vimrc file.
These commands will write ":map" and ":set" commands to a file, in such a way
that when these commands are executed, the current key mappings and options
will be set to the same values. The options 'columns', 'endofline',
-'fileformat', 'lines', 'modified', and 'scroll' are not included, because
+'fileformat', 'lines', 'modified', and 'scroll' are not included, because
these are terminal or file dependent.
Note that the options 'binary', 'paste' and 'readonly' are included, this
might not always be what you want.
@@ -715,7 +717,7 @@ with ":map" and ":set" commands and write the modified file. First read the
default vimrc in with a command like ":source ~piet/.vimrc.Cprogs", change
the settings and then save them in the current directory with ":mkvimrc!". If
you want to make this file your default |config|, move it to
-$XDG_CONFIG_HOME/nvim. You could also use autocommands |autocommand| and/or
+$XDG_CONFIG_HOME/nvim. You could also use autocommands |autocommand| and/or
modelines |modeline|.
*vimrc-option-example*
@@ -797,7 +799,7 @@ resulting file, when executed with a ":source" command:
After restoring the Session, the full filename of your current Session is
available in the internal variable |v:this_session|.
An example mapping: >
- :nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/
+ :nmap <F2> :wa<Bar>exe "mksession! " .. v:this_session<CR>:so ~/sessions/
This saves the current Session, and starts off the command to load another.
A session includes all tab pages, unless "tabpages" was removed from
@@ -883,7 +885,7 @@ Shada ("shared data") file *shada* *shada-file*
If you exit Vim and later start it again, you would normally lose a lot of
information. The ShaDa file can be used to remember that information, which
-enables you to continue where you left off. Its name is the abbreviation of
+enables you to continue where you left off. Its name is the abbreviation of
SHAred DAta because it is used for sharing data between Neovim sessions.
This is introduced in section |21.3| of the user manual.
@@ -914,9 +916,9 @@ The |v:oldfiles| variable is filled. The marks are not read in at startup
option upon startup.
*shada-write*
-When Vim exits and 'shada' is non-empty, the info is stored in the ShaDa file
-(it's actually merged with the existing one, if one exists |shada-merging|).
-The 'shada' option is a string containing information about what info should
+When Vim exits and 'shada' is non-empty, the info is stored in the ShaDa file
+(it's actually merged with the existing one, if one exists |shada-merging|).
+The 'shada' option is a string containing information about what info should
be stored, and contains limits on how much should be stored (see 'shada').
Notes for Unix:
@@ -974,75 +976,75 @@ remembered.
MERGING *shada-merging*
-When writing ShaDa files with |:wshada| without bang or at regular exit
-information in the existing ShaDa file is merged with information from current
-Neovim instance. For this purpose ShaDa files store timestamps associated
+When writing ShaDa files with |:wshada| without bang or at regular exit
+information in the existing ShaDa file is merged with information from current
+Neovim instance. For this purpose ShaDa files store timestamps associated
with ShaDa entries. Specifically the following is being done:
-1. History lines are merged, ordered by timestamp. Maximum amount of items in
- ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|,
- etc: one suboption for each character that represents history name
+1. History lines are merged, ordered by timestamp. Maximum amount of items in
+ ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|,
+ etc: one suboption for each character that represents history name
(|:history|)).
-2. Local marks and changes for files that were not opened by Neovim are copied
- to new ShaDa file. Marks for files that were opened by Neovim are merged,
+2. Local marks and changes for files that were not opened by Neovim are copied
+ to new ShaDa file. Marks for files that were opened by Neovim are merged,
changes to files opened by Neovim are ignored. |shada-'|
-3. Jump list is merged: jumps are ordered by timestamp, identical jumps
+3. Jump list is merged: jumps are ordered by timestamp, identical jumps
(identical position AND timestamp) are squashed.
-4. Search patterns and substitute strings are not merged: search pattern or
- substitute string which has greatest timestamp will be the only one copied
+4. Search patterns and substitute strings are not merged: search pattern or
+ substitute string which has greatest timestamp will be the only one copied
to ShaDa file.
-5. For each register entity with greatest timestamp is the only saved.
+5. For each register entity with greatest timestamp is the only saved.
|shada-<|
-6. All saved variables are saved from current Neovim instance. Additionally
- existing variable values are copied, meaning that the only way to remove
- variable from a ShaDa file is either removing it by hand or disabling
+6. All saved variables are saved from current Neovim instance. Additionally
+ existing variable values are copied, meaning that the only way to remove
+ variable from a ShaDa file is either removing it by hand or disabling
writing variables completely. |shada-!|
7. For each global mark entity with greatest timestamp is the only saved.
-8. Buffer list and header are the only entries which are not merged in any
- fashion: the only header and buffer list present are the ones from the
+8. Buffer list and header are the only entries which are not merged in any
+ fashion: the only header and buffer list present are the ones from the
Neovim instance which was last writing the file. |shada-%|
COMPATIBILITY *shada-compatibility*
ShaDa files are forward and backward compatible. This means that
-1. Entries which have unknown type (i.e. that hold unidentified data) are
+1. Entries which have unknown type (i.e. that hold unidentified data) are
ignored when reading and blindly copied when writing.
-2. Register entries with unknown register name are ignored when reading and
- blindly copied when writing. Limitation: only registers that use name with
+2. Register entries with unknown register name are ignored when reading and
+ blindly copied when writing. Limitation: only registers that use name with
code in interval [1, 255] are supported. |registers|
-3. Register entries with unknown register type are ignored when reading and
+3. Register entries with unknown register type are ignored when reading and
merged as usual when writing. |getregtype()|
-4. Local and global mark entries with unknown mark names are ignored when
- reading. When writing global mark entries are blindly copied and local mark
- entries are also blindly copied, but only if file they are attached to fits
- in the |shada-'| limit. Unknown local mark entry's timestamp is also taken
- into account when calculating which files exactly should fit into this
- limit. Limitation: only marks that use name with code in interval [1, 255]
+4. Local and global mark entries with unknown mark names are ignored when
+ reading. When writing global mark entries are blindly copied and local mark
+ entries are also blindly copied, but only if file they are attached to fits
+ in the |shada-'| limit. Unknown local mark entry's timestamp is also taken
+ into account when calculating which files exactly should fit into this
+ limit. Limitation: only marks that use name with code in interval [1, 255]
are supported. |mark-motions|
-5. History entries with unknown history type are ignored when reading and
- blindly copied when writing. Limitation: there can be only up to 256
+5. History entries with unknown history type are ignored when reading and
+ blindly copied when writing. Limitation: there can be only up to 256
history types. |history|
-6. Unknown keys found in register, local mark, global mark, change, jump and
- search pattern entries are saved internally and dumped when writing.
+6. Unknown keys found in register, local mark, global mark, change, jump and
+ search pattern entries are saved internally and dumped when writing.
Entries created during Neovim session never have such additions.
-7. Additional elements found in replacement string and history entries are
- saved internally and dumped. Entries created during Neovim session never
+7. Additional elements found in replacement string and history entries are
+ saved internally and dumped. Entries created during Neovim session never
have such additions.
-8. Additional elements found in variable entries are simply ignored when
- reading. When writing new variables they will be preserved during merging,
- but that's all. Variable values dumped from current Neovim session never
- have additional elements, even if variables themselves were obtained by
+8. Additional elements found in variable entries are simply ignored when
+ reading. When writing new variables they will be preserved during merging,
+ but that's all. Variable values dumped from current Neovim session never
+ have additional elements, even if variables themselves were obtained by
reading ShaDa files.
-"Blindly" here means that there will be no attempts to somehow merge them,
+"Blindly" here means that there will be no attempts to somehow merge them,
even if other entries (with known name/type/etc) are merged. |shada-merging|
SHADA FILE NAME *shada-file-name*
- Default name of the |shada| file is:
- Unix: "$XDG_DATA_HOME/nvim/shada/main.shada"
- Windows: "$XDG_DATA_HOME/nvim-data/shada/main.shada"
+ Unix: "$XDG_STATE_HOME/nvim/shada/main.shada"
+ Windows: "$XDG_STATE_HOME/nvim-data/shada/main.shada"
See also |base-directories|.
- To choose a different file name you can use:
- The "n" flag in the 'shada' option.
@@ -1064,55 +1066,55 @@ however that this means everything will be overwritten with information from
the first Vim, including the command line history, etc.
The ShaDa file itself can be edited by hand too, although we suggest you
-start with an existing one to get the format right. You need to understand
-MessagePack (or, more likely, find software that is able to use it) format to
-do this. This can be useful in order to create a second file, say
-"~/.my.shada" which could contain certain settings that you always want when
-you first start Neovim. For example, you can preload registers with
-particular data, or put certain commands in the command line history. A line
+start with an existing one to get the format right. You need to understand
+MessagePack (or, more likely, find software that is able to use it) format to
+do this. This can be useful in order to create a second file, say
+"~/.my.shada" which could contain certain settings that you always want when
+you first start Neovim. For example, you can preload registers with
+particular data, or put certain commands in the command line history. A line
in your |config| file like >
:rshada! ~/.my.shada
-can be used to load this information. You could even have different ShaDa
-files for different types of files (e.g., C code) and load them based on the
-file name, using the ":autocmd" command (see |:autocmd|). More information on
+can be used to load this information. You could even have different ShaDa
+files for different types of files (e.g., C code) and load them based on the
+file name, using the ":autocmd" command (see |:autocmd|). More information on
ShaDa file format is contained in |shada-format| section.
*E136* *E929* *shada-error-handling*
-Some errors make Neovim leave temporary file named `{basename}.tmp.X` (X is
-any free letter from `a` to `z`) while normally it will create this file,
-write to it and then rename `{basename}.tmp.X` to `{basename}`. Such errors
+Some errors make Neovim leave temporary file named `{basename}.tmp.X` (X is
+any free letter from `a` to `z`) while normally it will create this file,
+write to it and then rename `{basename}.tmp.X` to `{basename}`. Such errors
include:
-- Errors which make Neovim think that read file is not a ShaDa file at all:
- non-ShaDa files are not overwritten for safety reasons to avoid accidentally
- destroying an unrelated file. This could happen e.g. when typing "nvim -i
- file" in place of "nvim -R file" (yes, somebody did that at least with Vim).
+- Errors which make Neovim think that read file is not a ShaDa file at all:
+ non-ShaDa files are not overwritten for safety reasons to avoid accidentally
+ destroying an unrelated file. This could happen e.g. when typing "nvim -i
+ file" in place of "nvim -R file" (yes, somebody did that at least with Vim).
Such errors are listed at |shada-critical-contents-errors|.
-- If writing to the temporary file failed: e.g. because of the insufficient
+- If writing to the temporary file failed: e.g. because of the insufficient
space left.
- If renaming file failed: e.g. because of insufficient permissions.
-- If target ShaDa file has different from the Neovim instance's owners (user
- and group) and changing them failed. Unix-specific, applies only when
+- If target ShaDa file has different from the Neovim instance's owners (user
+ and group) and changing them failed. Unix-specific, applies only when
Neovim was launched from root.
-Do not forget to remove the temporary file or replace the target file with
-temporary one after getting one of the above errors or all attempts to create
-a ShaDa file may fail with |E929|. If you got one of them when using
-|:wshada| (and not when exiting Neovim: i.e. when you have Neovim session
+Do not forget to remove the temporary file or replace the target file with
+temporary one after getting one of the above errors or all attempts to create
+a ShaDa file may fail with |E929|. If you got one of them when using
+|:wshada| (and not when exiting Neovim: i.e. when you have Neovim session
running) you have additional options:
-- First thing which you should consider if you got any error, except failure
- to write to the temporary file: remove existing file and replace it with the
+- First thing which you should consider if you got any error, except failure
+ to write to the temporary file: remove existing file and replace it with the
temporary file. Do it even if you have running Neovim instance.
-- Fix the permissions and/or file ownership, free some space and attempt to
+- Fix the permissions and/or file ownership, free some space and attempt to
write again. Do not remove the existing file.
-- Use |:wshada| with bang. Does not help in case of permission error. If
- target file was actually the ShaDa file some information may be lost in this
- case. To make the matters slightly better use |:rshada| prior to writing,
- but this still will loose buffer-local marks and change list entries for any
+- Use |:wshada| with bang. Does not help in case of permission error. If
+ target file was actually the ShaDa file some information may be lost in this
+ case. To make the matters slightly better use |:rshada| prior to writing,
+ but this still will loose buffer-local marks and change list entries for any
file which is not opened in the current Neovim instance.
-- Remove the target file from shell and use |:wshada|. Consequences are not
- different from using |:wshada| with bang, but "rm -f" works in some cases
+- Remove the target file from shell and use |:wshada|. Consequences are not
+ different from using |:wshada| with bang, but "rm -f" works in some cases
when you don't have write permissions.
*:rsh* *:rshada* *E886*
@@ -1126,13 +1128,13 @@ running) you have additional options:
The information in the file is first read in to make
a merge between old and new info. When [!] is used,
the old information is not read first, only the
- internal info is written (also disables safety checks
- described in |shada-error-handling|). If 'shada' is
+ internal info is written (also disables safety checks
+ described in |shada-error-handling|). If 'shada' is
empty, marks for up to 100 files will be written.
- When you get error "E929: All .tmp.X files exist,
- cannot write ShaDa file!" check that no old temp files
- were left behind (e.g.
- ~/.local/share/nvim/shada/main.shada.tmp*).
+ When you get error "E929: All .tmp.X files exist,
+ cannot write ShaDa file!" check that no old temp files
+ were left behind (e.g.
+ ~/.local/state/nvim/shada/main.shada.tmp*).
Note: Executing :wshada will reset all |'quote| marks.
@@ -1155,82 +1157,82 @@ running) you have additional options:
SHADA FILE FORMAT *shada-format*
-ShaDa files are concats of MessagePack entries. Each entry is a concat of
+ShaDa files are concats of MessagePack entries. Each entry is a concat of
exactly four MessagePack objects:
-1. First goes type of the entry. Object type must be an unsigned integer.
+1. First goes type of the entry. Object type must be an unsigned integer.
Object type must not be equal to zero.
2. Second goes entry timestamp. It must also be an unsigned integer.
-3. Third goes the length of the fourth entry. Unsigned integer as well, used
+3. Third goes the length of the fourth entry. Unsigned integer as well, used
for fast skipping without parsing.
-4. Fourth is actual entry data. All currently used ShaDa entries use
- containers to hold data: either map or array. All string values in those
- containers are either binary (applies to filenames) or UTF-8, yet parser
+4. Fourth is actual entry data. All currently used ShaDa entries use
+ containers to hold data: either map or array. All string values in those
+ containers are either binary (applies to filenames) or UTF-8, yet parser
needs to expect that invalid bytes may be present in a UTF-8 string.
Exact format depends on the entry type:
Entry type (name) Entry data ~
- 1 (Header) Map containing data that describes the generator
- instance that wrote this ShaDa file. It is ignored
+ 1 (Header) Map containing data that describes the generator
+ instance that wrote this ShaDa file. It is ignored
when reading ShaDa files. Contains the following data:
Key Data ~
- generator Binary, software used to generate ShaDa
- file. Is equal to "nvim" when ShaDa file was
+ generator Binary, software used to generate ShaDa
+ file. Is equal to "nvim" when ShaDa file was
written by Neovim.
version Binary, generator version.
encoding Binary, effective 'encoding' value.
max_kbyte Integer, effective |shada-s| limit value.
pid Integer, instance process ID.
- * It is allowed to have any number of
+ * It is allowed to have any number of
additional keys with any data.
- 2 (SearchPattern) Map containing data describing last used search or
- substitute pattern. Normally ShaDa file contains two
- such entries: one with "ss" key set to true (describes
- substitute pattern, see |:substitute|), and one set to
- false (describes search pattern, see
- |search-commands|). "su" key should be true on one of
- the entries. If key value is equal to default then it
+ 2 (SearchPattern) Map containing data describing last used search or
+ substitute pattern. Normally ShaDa file contains two
+ such entries: one with "ss" key set to true (describes
+ substitute pattern, see |:substitute|), and one set to
+ false (describes search pattern, see
+ |search-commands|). "su" key should be true on one of
+ the entries. If key value is equal to default then it
is normally not present. Keys:
Key Type Default Description ~
sm Boolean true Effective 'magic' value.
sc Boolean false Effective 'smartcase' value.
- sl Boolean true True if search pattern comes
- with a line offset. See
+ sl Boolean true True if search pattern comes
+ with a line offset. See
|search-offset|.
- se Boolean false True if |search-offset|
- requested to place cursor at
- (relative to) the end of the
+ se Boolean false True if |search-offset|
+ requested to place cursor at
+ (relative to) the end of the
pattern.
so Integer 0 Offset value. |search-offset|
- su Boolean false True if current entry was the
+ su Boolean false True if current entry was the
last used search pattern.
- ss Boolean false True if current entry describes
+ ss Boolean false True if current entry describes
|:substitute| pattern.
sh Boolean false True if |v:hlsearch| is on.
- With |shada-h| or 'nohlsearch'
+ With |shada-h| or 'nohlsearch'
this key is always false.
sp Binary N/A Actual pattern. Required.
- sb Boolean false True if search direction is
+ sb Boolean false True if search direction is
backward.
- * any none Other keys are allowed for
- compatibility reasons, see
+ * any none Other keys are allowed for
+ compatibility reasons, see
|shada-compatibility|.
- 3 (SubString) Array containing last |:substitute| replacement string.
- Contains single entry: binary, replacement string used.
- More entries are allowed for compatibility reasons, see
+ 3 (SubString) Array containing last |:substitute| replacement string.
+ Contains single entry: binary, replacement string used.
+ More entries are allowed for compatibility reasons, see
|shada-compatibility|.
- 4 (HistoryEntry) Array containing one entry from history. Should have
- two or three entries. First one is history type
- (unsigned integer), second is history line (binary),
- third is the separator character (unsigned integer,
- must be in interval [0, 255]). Third item is only
- valid for search history. Possible history types are
- listed in |hist-names|, here are the corresponding
- numbers: 0 - cmd, 1 - search, 2 - expr, 3 - input,
+ 4 (HistoryEntry) Array containing one entry from history. Should have
+ two or three entries. First one is history type
+ (unsigned integer), second is history line (binary),
+ third is the separator character (unsigned integer,
+ must be in interval [0, 255]). Third item is only
+ valid for search history. Possible history types are
+ listed in |hist-names|, here are the corresponding
+ numbers: 0 - cmd, 1 - search, 2 - expr, 3 - input,
4 - debug.
- 5 (Register) Map describing one register (|registers|). If key
- value is equal to default then it is normally not
+ 5 (Register) Map describing one register (|registers|). If key
+ value is equal to default then it is normally not
present. Keys:
Key Type Def Description ~
rt UInteger 0 Register type:
@@ -1258,12 +1260,12 @@ exactly four MessagePack objects:
* any none Other keys are allowed
for compatibility reasons,
see |shada-compatibility|.
- 6 (Variable) Array containing two items: variable name (binary) and
- variable value (any object). Values are converted
- using the same code |msgpackparse()| uses when reading,
- |msgpackdump()| when writing, so there may appear
- |msgpack-special-dict|s. If there are more then two
- entries then the rest are ignored
+ 6 (Variable) Array containing two items: variable name (binary) and
+ variable value (any object). Values are converted
+ using the same code |msgpackparse()| uses when reading,
+ |msgpackdump()| when writing, so there may appear
+ |msgpack-special-dict|s. If there are more then two
+ entries then the rest are ignored
(|shada-compatibility|).
7 (GlobalMark)
8 (Jump)
@@ -1277,57 +1279,58 @@ exactly four MessagePack objects:
Data contained in the map:
Key Type Default Description ~
- l UInteger 1 Position line number. Must be
+ l UInteger 1 Position line number. Must be
greater then zero.
c UInteger 0 Position column number.
- n UInteger 34 ('"') Mark name. Only valid for
- GlobalMark and LocalMark
+ n UInteger 34 ('"') Mark name. Only valid for
+ GlobalMark and LocalMark
entries.
f Binary N/A File name. Required.
- * any none Other keys are allowed for
- compatibility reasons, see
+ * any none Other keys are allowed for
+ compatibility reasons, see
|shada-compatibility|.
- 9 (BufferList) Array containing maps. Each map in the array
+ 9 (BufferList) Array containing maps. Each map in the array
represents one buffer. Possible keys:
Key Type Default Description ~
- l UInteger 1 Position line number. Must be
+ l UInteger 1 Position line number. Must be
greater then zero.
c UInteger 0 Position column number.
f Binary N/A File name. Required.
- * any none Other keys are allowed for
- compatibility reasons, see
+ * any none Other keys are allowed for
+ compatibility reasons, see
|shada-compatibility|.
- * (Unknown) Any other entry type is allowed for compatibility
+ * (Unknown) Any other entry type is allowed for compatibility
reasons, see |shada-compatibility|.
*E575* *E576*
-Errors in ShaDa file may have two types: E575 used for all “logical” errors
-and E576 used for all “critical” errors. Critical errors trigger behaviour
-described in |shada-error-handling| when writing and skipping the rest of the
+Errors in ShaDa file may have two types: E575 used for all “logical” errors
+and E576 used for all “critical” errors. Critical errors trigger behaviour
+described in |shada-error-handling| when writing and skipping the rest of the
file when reading and include:
*shada-critical-contents-errors*
- Any of first three MessagePack objects being not an unsigned integer.
-- Third object requesting amount of bytes greater then bytes left in the ShaDa
+- Third object requesting amount of bytes greater then bytes left in the ShaDa
file.
- Entry with zero type. I.e. first object being equal to zero.
- MessagePack parser failing to parse the entry data.
-- MessagePack parser consuming less or requesting greater bytes then described
- in the third object for parsing fourth object. I.e. when fourth object
- either contains more then one MessagePack object or it does not contain
+- MessagePack parser consuming less or requesting greater bytes then described
+ in the third object for parsing fourth object. I.e. when fourth object
+ either contains more then one MessagePack object or it does not contain
complete MessagePack object.
==============================================================================
Standard Paths *standard-path*
-Nvim stores configuration, data, and logs in standard locations. Plugins are
-strongly encouraged to follow this pattern also. Use |stdpath()| to get the
+Nvim stores configuration, data, and logs in standard locations. Plugins are
+strongly encouraged to follow this pattern also. Use |stdpath()| to get the
paths.
*base-directories* *xdg*
The "base" (root) directories conform to the XDG Base Directory Specification.
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
-The $XDG_CONFIG_HOME and $XDG_DATA_HOME environment variables are used if they
-exist, otherwise default values (listed below) are used.
+The $XDG_CONFIG_HOME, $XDG_DATA_HOME, $XDG_RUNTIME_DIR, and $XDG_STATE_HOME
+environment variables are used if defined, else default values (listed below)
+are used.
CONFIG DIRECTORY (DEFAULT) ~
*$XDG_CONFIG_HOME* Nvim: stdpath("config")
@@ -1339,14 +1342,24 @@ DATA DIRECTORY (DEFAULT) ~
Unix: ~/.local/share ~/.local/share/nvim
Windows: ~/AppData/Local ~/AppData/Local/nvim-data
+RUN DIRECTORY (DEFAULT) ~
+ *$XDG_RUNTIME_DIR* Nvim: stdpath("run")
+ Unix: /tmp/nvim.user/xxx /tmp/nvim.user/xxx
+ Windows: $TMP/nvim.user/xxx $TMP/nvim.user/xxx
+
+STATE DIRECTORY (DEFAULT) ~
+ *$XDG_STATE_HOME* Nvim: stdpath("state")
+ Unix: ~/.local/state ~/.local/state/nvim
+ Windows: ~/AppData/Local ~/AppData/Local/nvim-data
+
Note: Throughout the user manual these defaults are used as placeholders, e.g.
"~/.config" is understood to mean "$XDG_CONFIG_HOME or ~/.config".
-LOG FILE *$NVIM_LOG_FILE*
+LOG FILE *$NVIM_LOG_FILE* *E5430*
Besides 'debug' and 'verbose', Nvim keeps a general log file for internal
debugging, plugins and RPC clients. >
:echo $NVIM_LOG_FILE
-By default, the file is located at stdpath('cache')/log unless that path
+By default, the file is located at stdpath('log')/log unless that path
is inaccessible or if $NVIM_LOG_FILE was set before |startup|.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 2c5531411d..9ed3c37b8c 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -26,7 +26,8 @@ In the User Manual:
1. Quick start *:syn-qstart*
*:syn-enable* *:syntax-enable* *:syn-on* *:syntax-on*
-This command switches on syntax highlighting: >
+Syntax highlighting is enabled by default. If you need to enable it again
+after it was disabled (see below), use: >
:syntax enable
@@ -188,7 +189,8 @@ A syntax group name doesn't specify any color or attributes itself.
The name for a highlight or syntax group must consist of ASCII letters, digits
and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give
-an error when using other characters.
+an error when using other characters. The maximum length of a group name is
+about 200 bytes. *E1249*
To be able to allow each user to pick their favorite set of colors, there must
be preferred names for highlight groups that are common for many languages.
@@ -451,7 +453,7 @@ your own highlight colors for the progress bar. Example: >
hi TOhtmlProgress guifg=#c0ffee ctermbg=7
<
*g:html_number_lines*
-Default: current 'number' setting.
+Default: Current 'number' setting.
When 0, buffer text is displayed in the generated HTML without line numbering.
When 1, a column of line numbers is added to the generated HTML with the same
highlighting as the line number column in Vim (|hl-LineNr|).
@@ -540,7 +542,7 @@ folded text will open the fold as if |g:html_hover_unfold| were set.
:let g:html_no_foldcolumn = 1
<
*TOhtml-uncopyable-text* *g:html_prevent_copy*
-Default: empty string.
+Default: Empty string.
This option prevents certain regions of the generated HTML from being copied,
when you select all text in document rendered in a browser and copy it. Useful
for allowing users to copy-paste only the source text even if a fold column or
@@ -566,7 +568,7 @@ uncopyable regions. In some browsers, especially older browsers, after
selecting an entire page and copying the selection, the <input> tags are not
pasted with the page text. If |g:html_no_invalid| is 0, the <input> tags have
invalid type; this works in more browsers, but the page will not validate.
-Note: this method does NOT work in recent versions of Chrome and equivalent
+Note: This method does NOT work in recent versions of Chrome and equivalent
browsers; the <input> tags get pasted with the text.
When "fallback" (default value), the same <input> elements are generated for
@@ -616,18 +618,18 @@ evaluate to get a unique string to append to each ID used in a given document,
so that the full IDs will be unique even when combined with other content in a
larger HTML document. Example, to append _ and the buffer number to each ID: >
- :let g:html_id_expr = '"_".bufnr("%")'
+ :let g:html_id_expr = '"_" .. bufnr("%")'
<
To append a string "_mystring" to the end of each ID: >
:let g:html_id_expr = '"_mystring"'
<
-Note, when converting a diff view to HTML, the expression will only be
+Note: When converting a diff view to HTML, the expression will only be
evaluated for the first window in the diff, and the result used for all the
windows.
*TOhtml-wrap-text* *g:html_pre_wrap*
-Default: current 'wrap' setting.
+Default: Current 'wrap' setting.
When 0, if |g:html_no_pre| is 0 or unset, the text in the generated HTML does
not wrap at the edge of the browser window.
When 1, if |g:html_use_css| is 1, the CSS 2.0 "white-space:pre-wrap" value is
@@ -687,7 +689,7 @@ wide browser support. However, you can override this to support specific
encodings that may not be automatically detected by default (see options
below). See http://www.iana.org/assignments/character-sets for the IANA names.
-Note, by default all Unicode encodings are converted to UTF-8 with no BOM in
+Note: By default all Unicode encodings are converted to UTF-8 with no BOM in
the generated HTML, as recommended by W3C:
http://www.w3.org/International/questions/qa-choosing-encodings
@@ -920,12 +922,16 @@ in .../after/syntax/baan.vim (see |after-directory|). Eg: >
BASIC *basic.vim* *vb.vim* *ft-basic-syntax* *ft-vb-syntax*
-Both Visual Basic and "normal" basic use the extension ".bas". To detect
+Both Visual Basic and "normal" BASIC use the extension ".bas". To detect
which one should be used, Vim checks for the string "VB_Name" in the first
five lines of the file. If it is not found, filetype will be "basic",
otherwise "vb". Files with the ".frm" extension will always be seen as Visual
Basic.
+If the automatic detection doesn't work for you or you only edit, for
+example, FreeBASIC files, use this in your startup vimrc: >
+ :let filetype_bas = "freebasic"
+
C *c.vim* *ft-c-syntax*
@@ -1287,8 +1293,8 @@ the global or buffer-local variable load_doxygen_syntax. This is done by
adding the following to your vimrc. >
:let g:load_doxygen_syntax=1
-There are a couple of variables that have an effect on syntax highlighting, and
-are to do with non-standard highlighting options.
+There are a couple of variables that have an effect on syntax highlighting,
+and are to do with non-standard highlighting options.
Variable Default Effect ~
g:doxygen_enhanced_color
@@ -1430,8 +1436,8 @@ To enable highlighting some special atoms, put this in your vimrc: >
ELIXIR *elixir.vim* *ft-elixir-syntax*
-Elixir is a dynamic, functional language for building scalable and maintainable
-applications.
+Elixir is a dynamic, functional language for building scalable and
+maintainable applications.
The following file extensions are auto-detected as Elixir file types:
@@ -1447,7 +1453,7 @@ Elixir.
FLEXWIKI *flexwiki.vim* *ft-flexwiki-syntax*
FlexWiki is an ASP.NET-based wiki package available at http://www.flexwiki.com
-NOTE: this site currently doesn't work, on Wikipedia is mentioned that
+NOTE: This site currently doesn't work, on Wikipedia is mentioned that
development stopped in 2009.
Syntax highlighting is available for the most common elements of FlexWiki
@@ -1470,7 +1476,7 @@ modes Conditional, Number, Statement, Comment, PreProc, Type, and String,
following the language specifications in 'Symbolic Manipulation with FORM' by
J.A.M. Vermaseren, CAN, Netherlands, 1991.
-If you want include your own changes to the default colors, you have to
+If you want to include your own changes to the default colors, you have to
redefine the following syntax groups:
- formConditional
@@ -1496,6 +1502,14 @@ The enhanced mode also takes advantage of additional color features for a dark
gvim display. Here, statements are colored LightYellow instead of Yellow, and
conditionals are LightBlue for better distinction.
+Both Visual Basic and FORM use the extension ".frm". To detect which one
+should be used, Vim checks for the string "VB_Name" in the first five lines of
+the file. If it is found, filetype will be "vb", otherwise "form".
+
+If the automatic detection doesn't work for you or you only edit, for
+example, FORM files, use this in your startup vimrc: >
+ :let filetype_frm = "form"
+
FORTH *forth.vim* *ft-forth-syntax*
@@ -1519,8 +1533,8 @@ syntax highlighting will not be correct if the form is incorrectly set.
When you create a new fortran file, the syntax script assumes fixed source
form. If you always use free source form, then >
:let fortran_free_source=1
-in your vimrc prior to the :syntax on command. If you always use fixed source
-form, then >
+in your vimrc prior to the :syntax on command. If you always use fixed
+source form, then >
:let fortran_fixed_source=1
in your vimrc prior to the :syntax on command.
@@ -1645,6 +1659,21 @@ because Fortran90 has no reserved words.
For further information related to fortran, see |ft-fortran-indent| and
|ft-fortran-plugin|.
+FREEBASIC *freebasic.vim* *ft-freebasic-syntax*
+
+FreeBASIC files will be highlighted differently for each of the four available
+dialects, "fb", "qb", "fblite" and "deprecated". See |ft-freebasic-plugin|
+for how to select the correct dialect.
+
+Highlighting is further configurable via the following variables.
+
+Variable Highlight ~
+*freebasic_no_comment_fold* disable multiline comment folding
+*freebasic_operators* non-alpha operators
+*freebasic_space_errors* trailing white space and spaces before a <Tab>
+*freebasic_type_suffixes* QuickBASIC style type suffixes
+
+
FVWM CONFIGURATION FILES *fvwm.vim* *ft-fvwm-syntax*
@@ -1793,8 +1822,8 @@ ends with -->) you can define >
JavaScript and Visual Basic embedded inside HTML documents are highlighted as
'Special' with statements, comments, strings and so on colored as in standard
-programming languages. Note that only JavaScript and Visual Basic are currently
-supported, no other scripting language has been added yet.
+programming languages. Note that only JavaScript and Visual Basic are
+currently supported, no other scripting language has been added yet.
Embedded and inlined cascading style sheets (CSS) are highlighted too.
@@ -1898,8 +1927,8 @@ 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: >
+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
All identifiers in java.lang.* are always visible in all classes. To
@@ -2017,10 +2046,10 @@ LISP *lisp.vim* *ft-lisp-syntax*
The lisp syntax highlighting provides two options: >
- g:lisp_instring : if it exists, then "(...)" strings are highlighted
+ g:lisp_instring : If it exists, then "(...)" strings are highlighted
as if the contents of the string were lisp.
Useful for AutoLisp.
- g:lisp_rainbow : if it exists and is nonzero, then differing levels
+ g:lisp_rainbow : If it exists and is nonzero, then differing levels
of parenthesization will receive different
highlighting.
<
@@ -2150,6 +2179,15 @@ $VIMRUNTIME/syntax/syntax.vim).
mv_finance mv_logic mv_powseries
+MARKDOWN *ft-markdown-syntax*
+
+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
+the start of a region, for example 500 lines: >
+
+ :let g:markdown_minlines = 500
+
+
MATHEMATICA *mma.vim* *ft-mma-syntax* *ft-mathematica-syntax*
Empty *.m files will automatically be presumed to be Matlab files unless you
@@ -2417,8 +2455,8 @@ If you do not want complex things like '@{${"foo"}}' to be parsed: >
(In Vim 6.x it was the other way around: "perl_extended_vars" enabled it.)
-The coloring strings can be changed. By default strings and qq friends will be
-highlighted like the first line. If you set the variable
+The coloring strings can be changed. By default strings and qq friends will
+be highlighted like the first line. If you set the variable
perl_string_as_statement, it will be highlighted as in the second line.
"hello world!"; qq|hello world|;
@@ -2430,8 +2468,8 @@ perl_string_as_statement, it will be highlighted as in the second line.
The syncing has 3 options. The first two switch off some triggering of
synchronization and should only be needed in case it fails to work properly.
If while scrolling all of a sudden the whole screen changes color completely
-then you should try and switch off one of those. Let me know if you can figure
-out the line that causes the mistake.
+then you should try and switch off one of those. Let me know if you can
+figure out the line that causes the mistake.
One triggers on "^\s*sub\s*" and the other on "^[$@%]" more or less. >
@@ -2468,7 +2506,7 @@ behavior, set 'perl_nofold_packages': >
PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax*
-[note: previously this was called "php3", but since it now also supports php4
+[Note: Previously this was called "php3", but since it now also supports php4
it has been renamed to "php"]
There are the following options for the php syntax highlighting.
@@ -2538,15 +2576,15 @@ PPWizard is a preprocessor for HTML and OS/2 INF files
This syntax file has the options:
-- ppwiz_highlight_defs : determines highlighting mode for PPWizard's
+- ppwiz_highlight_defs : Determines highlighting mode for PPWizard's
definitions. Possible values are
ppwiz_highlight_defs = 1 : PPWizard #define statements retain the
- colors of their contents (e.g. PPWizard macros and variables)
+ colors of their contents (e.g. PPWizard macros and variables).
- ppwiz_highlight_defs = 2 : preprocessor #define and #evaluate
+ ppwiz_highlight_defs = 2 : Preprocessor #define and #evaluate
statements are shown in a single color with the exception of line
- continuation symbols
+ continuation symbols.
The default setting for ppwiz_highlight_defs is 1.
@@ -2585,7 +2623,7 @@ highlighted by defining the postscr_level variable as follows: >
If this variable is not defined it defaults to 2 (level 2) since this is
the most prevalent version currently.
-Note, not all PS interpreters will support all language features for a
+Note: Not all PS interpreters will support all language features for a
particular language level. In particular the %!PS-Adobe-3.0 at the start of
PS files does NOT mean the PostScript present is level 3 PostScript!
@@ -2687,7 +2725,7 @@ If you want all possible Python highlighting (the same as setting the
preceding last option and unsetting all other ones): >
:let python_highlight_all = 1
-Note: only existence of these options matter, not their value. You can replace
+Note: Only existence of these options matter, not their value. You can replace
1 above with anything.
QUAKE *quake.vim* *ft-quake-syntax*
@@ -3127,16 +3165,16 @@ The Speedup syntax file has some options:
the DECLARE section; if you defined own types, you have to include
them in the syntax file.
-- oneline_comments : this value ranges from 1 to 3 and determines the
+- oneline_comments : This value ranges from 1 to 3 and determines the
highlighting of # style comments.
- oneline_comments = 1 : allow normal Speedup code after an even
+ oneline_comments = 1 : Allow normal Speedup code after an even
number of #s.
- oneline_comments = 2 : show code starting with the second # as
+ oneline_comments = 2 : Show code starting with the second # as
error. This is the default setting.
- oneline_comments = 3 : show the whole line as error if it contains
+ oneline_comments = 3 : Show the whole line as error if it contains
more than one #.
Since especially OPERATION sections tend to become very large due to
@@ -3175,8 +3213,8 @@ This covers the shell named "tcsh". It is a superset of csh. See |csh.vim|
for how the filetype is detected.
Tcsh does not allow \" in strings unless the "backslash_quote" shell variable
-is set. If you want VIM to assume that no backslash quote constructs exist add
-this line to your vimrc: >
+is set. If you want VIM to assume that no backslash quote constructs exist
+add this line to your vimrc: >
:let tcsh_backslash_quote = 0
@@ -3529,7 +3567,7 @@ start and end tags. This can be turned on by >
:let g:xml_syntax_folding = 1
:set foldmethod=syntax
-Note: syntax folding might slow down syntax highlighting significantly,
+Note: Syntax folding might slow down syntax highlighting significantly,
especially for large files.
@@ -3546,8 +3584,8 @@ Do you want to draw with the mouse? Try the following: >
:function! GetPixel()
: let c = getline(".")[col(".") - 1]
: echo c
- : exe "noremap <LeftMouse> <LeftMouse>r".c
- : exe "noremap <LeftDrag> <LeftMouse>r".c
+ : exe "noremap <LeftMouse> <LeftMouse>r" .. c
+ : exe "noremap <LeftDrag> <LeftMouse>r" .. c
:endfunction
:noremap <RightMouse> <LeftMouse>:call GetPixel()<CR>
:set guicursor=n:hor20 " to see the color beneath the cursor
@@ -4384,7 +4422,7 @@ Leading context *:syn-lc* *:syn-leading* *:syn-context*
Note: This is an obsolete feature, only included for backwards compatibility
with previous Vim versions. It's now recommended to use the |/\@<=| construct
-in the pattern.
+in the pattern. You can also often use |/\zs|.
The "lc" offset specifies leading context -- a part of the pattern that must
be present, but is not considered part of the match. An offset of "lc=n" will
@@ -4817,6 +4855,7 @@ in their own color.
:hi[ghlight] {group-name}
List one highlight group.
+ *highlight-clear* *:hi-clear*
:hi[ghlight] clear Reset all highlighting to the defaults. Removes all
highlighting for groups added by the user!
Uses the current value of 'background' to decide which
@@ -4872,14 +4911,18 @@ the same syntax file on all UIs.
1. TUI highlight arguments
*bold* *underline* *undercurl*
- *inverse* *italic* *standout*
- *nocombine* *strikethrough*
+ *underdouble* *underdotted*
+ *underdashed* *inverse* *italic*
+ *standout* *nocombine* *strikethrough*
cterm={attr-list} *attr-list* *highlight-cterm* *E418*
- attr-list is a comma separated list (without spaces) of the
+ attr-list is a comma-separated list (without spaces) of the
following items (in any order):
bold
underline
undercurl curly underline
+ underdouble double underline
+ underdotted dotted underline
+ underdashed dashed underline
strikethrough
reverse
inverse same as reverse
@@ -4890,8 +4933,9 @@ cterm={attr-list} *attr-list* *highlight-cterm* *E418*
Note that "bold" can be used here and by using a bold font. They
have the same effect.
- "undercurl" falls back to "underline" in a terminal that does not
- support it. The color is set using |highlight-guisp|.
+ "undercurl", "underdouble", "underdotted", and "underdashed" fall back
+ to "underline" in a terminal that does not support them. The color is
+ set using |highlight-guisp|.
start={term-list} *highlight-start* *E422*
stop={term-list} *term-list* *highlight-stop*
@@ -4953,8 +4997,8 @@ ctermbg={color-nr} *highlight-ctermbg*
a number instead of a color name.
Note that for 16 color ansi style terminals (including xterms), the
- numbers in the NR-8 column is used. Here '*' means 'add 8' so that Blue
- is 12, DarkGray is 8 etc.
+ numbers in the NR-8 column is used. Here '*' means 'add 8' so that
+ Blue is 12, DarkGray is 8 etc.
Note that for some color terminals these names may result in the wrong
colors!
@@ -5024,8 +5068,8 @@ guifg={color-name} *highlight-guifg*
guibg={color-name} *highlight-guibg*
guisp={color-name} *highlight-guisp*
These give the foreground (guifg), background (guibg) and special
- (guisp) color to use in the GUI. "guisp" is used for undercurl
- and underline.
+ (guisp) color to use in the GUI. "guisp" is used for various
+ underlines.
There are a few special names:
NONE no color (transparent)
bg use normal background color
@@ -5067,53 +5111,56 @@ These are the builtin highlighting groups. Note that the highlighting depends
on the value of 'background'. You can see the current settings with the
":highlight" command.
*hl-ColorColumn*
-ColorColumn used for the columns set with 'colorcolumn'
+ColorColumn Used for the columns set with 'colorcolumn'.
*hl-Conceal*
-Conceal placeholder characters substituted for concealed
- text (see 'conceallevel')
+Conceal Placeholder characters substituted for concealed
+ text (see 'conceallevel').
+ *hl-CurSearch*
+CurSearch Used for highlighting a search pattern under the cursor
+ (see 'hlsearch').
*hl-Cursor*
-Cursor character under the cursor
-lCursor the character under the cursor when |language-mapping|
- is used (see 'guicursor')
+Cursor Character under the cursor.
+lCursor Character under the cursor when |language-mapping|
+ is used (see 'guicursor').
*hl-CursorIM*
-CursorIM like Cursor, but used when in IME mode |CursorIM|
+CursorIM Like Cursor, but used when in IME mode. |CursorIM|
*hl-CursorColumn*
CursorColumn Screen-column at the cursor, when 'cursorcolumn' is set.
*hl-CursorLine*
CursorLine Screen-line at the cursor, when 'cursorline' is set.
Low-priority if foreground (ctermfg OR guifg) is not set.
*hl-Directory*
-Directory directory names (and other special names in listings)
+Directory Directory names (and other special names in listings).
*hl-DiffAdd*
-DiffAdd diff mode: Added line |diff.txt|
+DiffAdd Diff mode: Added line. |diff.txt|
*hl-DiffChange*
-DiffChange diff mode: Changed line |diff.txt|
+DiffChange Diff mode: Changed line. |diff.txt|
*hl-DiffDelete*
-DiffDelete diff mode: Deleted line |diff.txt|
+DiffDelete Diff mode: Deleted line. |diff.txt|
*hl-DiffText*
-DiffText diff mode: Changed text within a changed line |diff.txt|
+DiffText Diff mode: Changed text within a changed line. |diff.txt|
*hl-EndOfBuffer*
-EndOfBuffer filler lines (~) after the end of the buffer.
+EndOfBuffer Filler lines (~) after the end of the buffer.
By default, this is highlighted like |hl-NonText|.
*hl-TermCursor*
-TermCursor cursor in a focused terminal
+TermCursor Cursor in a focused terminal.
*hl-TermCursorNC*
-TermCursorNC cursor in an unfocused terminal
+TermCursorNC Cursor in an unfocused terminal.
*hl-ErrorMsg*
-ErrorMsg error messages on the command line
- *hl-VertSplit*
-VertSplit the column separating vertically split windows
+ErrorMsg Error messages on the command line.
+ *hl-WinSeparator*
+WinSeparator Separators between window splits.
*hl-Folded*
-Folded line used for closed folds
+Folded Line used for closed folds.
*hl-FoldColumn*
FoldColumn 'foldcolumn'
*hl-SignColumn*
-SignColumn column where |signs| are displayed
+SignColumn Column where |signs| are displayed.
*hl-IncSearch*
IncSearch 'incsearch' highlighting; also used for the text replaced with
- ":s///c"
+ ":s///c".
*hl-Substitute*
-Substitute |:substitute| replacement text highlighting
+Substitute |:substitute| replacement text highlighting.
*hl-LineNr*
LineNr Line number for ":number" and ":#" commands, and when 'number'
@@ -5132,15 +5179,15 @@ CursorLineSign Like SignColumn when 'cursorline' is set for the cursor line.
*hl-CursorLineFold*
CursorLineFold Like FoldColumn when 'cursorline' is set for the cursor line.
*hl-MatchParen*
-MatchParen The character under the cursor or just before it, if it
+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 --")
+ModeMsg 'showmode' message (e.g., "-- INSERT --").
*hl-MsgArea*
-MsgArea Area for messages and cmdline
+MsgArea Area for messages and cmdline.
*hl-MsgSeparator*
-MsgSeparator Separator for scrolled messages, `msgsep` flag of 'display'
+MsgSeparator Separator for scrolled messages, `msgsep` flag of 'display'.
*hl-MoreMsg*
MoreMsg |more-prompt|
*hl-NonText*
@@ -5149,21 +5196,21 @@ NonText '@' at the end of the window, characters from 'showbreak'
(e.g., ">" displayed when a double-wide character doesn't
fit at the end of the line). See also |hl-EndOfBuffer|.
*hl-Normal*
-Normal normal text
+Normal Normal text.
*hl-NormalFloat*
NormalFloat Normal text in floating windows.
*hl-NormalNC*
-NormalNC normal text in non-current windows
+NormalNC Normal text in non-current windows.
*hl-Pmenu*
-Pmenu Popup menu: normal item.
+Pmenu Popup menu: Normal item.
*hl-PmenuSel*
-PmenuSel Popup menu: selected item.
+PmenuSel Popup menu: Selected item.
*hl-PmenuSbar*
-PmenuSbar Popup menu: scrollbar.
+PmenuSbar Popup menu: Scrollbar.
*hl-PmenuThumb*
PmenuThumb Popup menu: Thumb of the scrollbar.
*hl-Question*
-Question |hit-enter| prompt and yes/no questions
+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.
@@ -5171,7 +5218,7 @@ QuickFixLine Current |quickfix| item in the quickfix window. Combined with
Search Last search pattern highlighting (see 'hlsearch').
Also used for similar items that need to stand out.
*hl-SpecialKey*
-SpecialKey Unprintable characters: text displayed differently from what
+SpecialKey Unprintable characters: Text displayed differently from what
it really is. But not 'listchars' whitespace. |hl-Whitespace|
*hl-SpellBad*
SpellBad Word that is not recognized by the spellchecker. |spell|
@@ -5188,29 +5235,34 @@ SpellRare Word that is recognized by the spellchecker as one that is
hardly ever used. |spell|
Combined with the highlighting used otherwise.
*hl-StatusLine*
-StatusLine status line of current window
+StatusLine Status line of current window.
*hl-StatusLineNC*
-StatusLineNC status lines of not-current windows
- Note: if this is equal to "StatusLine" Vim will use "^^^" in
+StatusLineNC Status lines of not-current windows.
+ Note: If this is equal to "StatusLine", Vim will use "^^^" in
the status line of the current window.
*hl-TabLine*
-TabLine tab pages line, not active tab page label
+TabLine Tab pages line, not active tab page label.
*hl-TabLineFill*
-TabLineFill tab pages line, where there are no labels
+TabLineFill Tab pages line, where there are no labels.
*hl-TabLineSel*
-TabLineSel tab pages line, active tab page label
+TabLineSel Tab pages line, active tab page label.
*hl-Title*
-Title titles for output from ":set all", ":autocmd" etc.
+Title Titles for output from ":set all", ":autocmd" etc.
*hl-Visual*
-Visual Visual mode selection
+Visual Visual mode selection.
*hl-VisualNOS*
VisualNOS Visual mode selection when vim is "Not Owning the Selection".
*hl-WarningMsg*
-WarningMsg warning messages
+WarningMsg Warning messages.
*hl-Whitespace*
-Whitespace "nbsp", "space", "tab" and "trail" in 'listchars'
+Whitespace "nbsp", "space", "tab", "multispace", "lead" and "trail"
+ in 'listchars'.
*hl-WildMenu*
-WildMenu current match in 'wildmenu' completion
+WildMenu Current match in 'wildmenu' completion.
+ *hl-WinBar*
+WinBar Window bar of current window.
+ *hl-WinBarNC*
+WinBarNC Window bar of not-current windows.
*hl-User1* *hl-User1..9* *hl-User9*
The 'statusline' syntax allows the use of 9 different highlights in the
@@ -5345,11 +5397,12 @@ WARNING: The longer the tags file, the slower this will be, and the more
memory Vim will consume.
Only highlighting typedefs, unions and structs can be done too. For this you
-must use Exuberant ctags (found at http://ctags.sf.net).
+must use Universal Ctags (found at https://ctags.io) or Exuberant ctags (found
+at http://ctags.sf.net).
Put these lines in your Makefile:
-# Make a highlight file for types. Requires Exuberant ctags and awk
+# Make a highlight file for types. Requires Universal/Exuberant ctags and awk
types: types.vim
types.vim: *.[ch]
ctags --c-kinds=gstu -o- *.[ch] |\
@@ -5359,9 +5412,9 @@ types.vim: *.[ch]
And put these lines in your vimrc: >
" load the types.vim highlighting file, if it exists
- autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'
+ autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') .. '/types.vim'
autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
- autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname
+ autocmd BufRead,BufNewFile *.[ch] exe 'so ' .. fname
autocmd BufRead,BufNewFile *.[ch] endif
==============================================================================
@@ -5402,7 +5455,7 @@ To test your color setup, a file has been included in the Vim distribution.
To use it, execute this command: >
:runtime syntax/colortest.vim
-Nvim uses 256-color and |true-color| terminal capabilities whereever possible.
+Nvim uses 256-color and |true-color| terminal capabilities wherever possible.
==============================================================================
18. When syntax is slow *:syntime*
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index 7f91fda9f4..9197710819 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -129,11 +129,14 @@ something else.
:+tabclose " close the next tab page
:1tabclose " close the first tab page
:$tabclose " close the last tab page
- :tabclose -2 " close the 2nd previous tab page
+ :tabclose -2 " close the 2nd previous tab page
:tabclose + " close the next tab page
:tabclose 3 " close the third tab page
: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.
+
*:tabo* *:tabonly*
:tabo[nly][!] Close all other tab pages.
When the 'hidden' option is set, all buffers in closed windows
@@ -159,6 +162,8 @@ something else.
" one
:tabonly 1 " close all tab pages except the first one
:tabonly $ " close all tab pages except the last one
+ :tabonly # " close all tab pages except the last
+ " accessed one
SWITCHING TO ANOTHER TAB PAGE:
@@ -181,6 +186,7 @@ gt *i_CTRL-<PageDown>* *i_<C-PageDown>*
:+2tabnext " go to the two next tab page
:1tabnext " go to the first tab page
:$tabnext " go to the last tab page
+ :tabnext # " go to the last accessed tab page
:tabnext $ " as above
:tabnext - " go to the previous tab page
:tabnext -1 " as above
@@ -190,10 +196,6 @@ gt *i_CTRL-<PageDown>* *i_<C-PageDown>*
{count}<C-PageDown>
{count}gt Go to tab page {count}. The first tab page has number one.
-CTRL-<Tab> *CTRL-<Tab>*
-CTRL-W g<Tab> *g<Tab>* *CTRL-W_g<Tab>*
-g<Tab> Go to previous (last accessed) tab page.
-
:tabp[revious] *:tabp* *:tabprevious* *gT* *:tabN*
:tabN[ext] *:tabNext* *CTRL-<PageUp>*
<C-PageUp> *<C-PageUp>* *i_CTRL-<PageUp>* *i_<C-PageUp>*
@@ -213,6 +215,9 @@ gT Go to the previous tab page. Wraps around from the first one
*:tabl* *:tablast*
:tabl[ast] Go to the last tab page.
+<C-Tab> *CTRL-<Tab>* *<C-Tab>*
+CTRL-W g<Tab> *g<Tab>* *CTRL-W_g<Tab>*
+g<Tab> Go to the last accessed tab page.
Other commands:
*:tabs*
@@ -245,6 +250,8 @@ REORDERING TAB PAGES:
:tabmove " move the tab page to the last
:$tabmove " as above
:tabmove $ " as above
+ :tabmove # " move the tab page after the last accessed
+ " tab page
:tabm[ove] +[N]
:tabm[ove] -[N]
@@ -366,24 +373,24 @@ pages and define labels for them. Then get the label for each tab page. >
for i in range(tabpagenr('$'))
" select the highlighting
if i + 1 == tabpagenr()
- let s .= '%#TabLineSel#'
+ let s ..= '%#TabLineSel#'
else
- let s .= '%#TabLine#'
+ let s ..= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
- let s .= '%' . (i + 1) . 'T'
+ let s ..= '%' .. (i + 1) .. 'T'
" the label is made by MyTabLabel()
- let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
+ let s ..= ' %{MyTabLabel(' .. (i + 1) .. ')} '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
- let s .= '%#TabLineFill#%T'
+ let s ..= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
- let s .= '%=%#TabLine#%999Xclose'
+ let s ..= '%=%#TabLine#%999Xclose'
endif
return s
@@ -446,14 +453,14 @@ windows in the tab page and a '+' if there is a modified buffer: >
" Append the number of windows in the tab page if more than one
let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1
- let label .= wincount
+ let label ..= wincount
endif
if label != ''
- let label .= ' '
+ let label ..= ' '
endif
" Append the buffer name
- return label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
+ return label .. bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
endfunction
set guitablabel=%{GuiTabLabel()}
diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt
index 4d938c4a23..2485290667 100644
--- a/runtime/doc/tagsrch.txt
+++ b/runtime/doc/tagsrch.txt
@@ -544,7 +544,8 @@ also works. The <CR> and <NL> characters can never appear inside a line.
The second format is new. It includes additional information in optional
fields at the end of each line. It is backwards compatible with Vi. It is
-only supported by new versions of ctags (such as Exuberant ctags).
+only supported by new versions of ctags (such as Universal ctags or Exuberant
+ctags).
{tagname} The identifier. Normally the name of a function, but it can
be any identifier. It cannot contain a <Tab>.
@@ -705,7 +706,7 @@ matches the pattern "^# *define" it is not considered to be a comment.
If you want to list matches, and then select one to jump to, you could use a
mapping to do that for you. Here is an example: >
- :map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR>
+ :map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " .. nr .. "[\t"<CR>
<
*[i*
[i Display the first line that contains the keyword
diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index 62e13285f5..cd6798a5de 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -108,6 +108,58 @@ and right scroll margins as well. If Nvim detects that the terminal is Xterm,
it will make use of this ability to speed up scrolling that is not the full
width of the terminal.
+ *tui-input*
+Nvim uses libtermkey to convert terminal escape sequences to key codes.
+|terminfo| is used first, and CSI sequences not in |terminfo| (including
+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
+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
+and can be used differently from <C-CR> in mappings.
+
+ *tui-modifyOtherKeys* *tui-csiu*
+Historically, terminal emulators could not distinguish between certain control
+key modifiers and other keys. For example, <C-I> and <Tab> are represented the
+same way, as are <Esc> and <C-[>, <CR> and <C-M>, and <NL> and <C-J>. This
+meant that Nvim also could not map these keys separately.
+
+Modern terminal emulators are able to distinguish between these pairs of keys
+by encoding control modifiers differently. There are two common but distinct
+ways of doing this, known as "modifyOtherKeys" and "CSI u". Nvim supports both
+encoding methods and at startup will tell the terminal emulator that it
+understands these key encodings. If your terminal emulator supports it then
+this will allow you to map the key pairs listed above separately.
+
+At startup Nvim will query your terminal to see if it supports the CSI u
+encoding by writing the sequence >
+
+ CSI ? u CSI c
+
+If your terminal emulator responds with >
+
+ 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
+
+If your terminal does not support CSI u then Nvim will instead enable the
+"modifyOtherKeys" encoding by writing the sequence >
+
+ 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
+emulator could be in a bad state. If this happens, simply run "reset".
+
+
*tui-colors*
Nvim uses 256 colours by default, ignoring |terminfo| for most terminal types,
including "linux" (whose virtual terminals have had 256-colour support since
@@ -321,7 +373,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: >
- :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
diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt
index 8ec66d26a4..4e4a908d0f 100644
--- a/runtime/doc/testing.txt
+++ b/runtime/doc/testing.txt
@@ -12,7 +12,7 @@ and for testing plugins.
1. Testing Vim |testing|
2. Test functions |test-functions-details|
-3. Assert funtions |assert-functions-details|
+3. Assert functions |assert-functions-details|
==============================================================================
1. Testing Vim *testing*
diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt
index b77c7d9a6d..d913b53c6b 100644
--- a/runtime/doc/tips.txt
+++ b/runtime/doc/tips.txt
@@ -84,14 +84,14 @@ What you need:
create it with the shell command "mkid file1 file2 ..".
Put this in your |init.vim|: >
- map _u :call ID_search()<Bar>execute "/\\<" . g:word . "\\>"<CR>
- map _n :n<Bar>execute "/\\<" . g:word . "\\>"<CR>
+ map _u :call ID_search()<Bar>execute "/\\<" .. g:word .. "\\>"<CR>
+ map _n :n<Bar>execute "/\\<" .. g:word .. "\\>"<CR>
function! ID_search()
let g:word = expand("<cword>")
- let x = system("lid --key=none ". g:word)
+ let x = system("lid --key=none " .. g:word)
let x = substitute(x, "\n", " ", "g")
- execute "next " . x
+ execute "next " .. x
endfun
To use it, place the cursor on a word, type "_u" and vim will load the file
@@ -285,13 +285,13 @@ This mapping will format any bullet list. It requires that there is an empty
line above and below each list entry. The expression commands are used to
be able to give comments to the parts of the mapping. >
- :let m = ":map _f :set ai<CR>" " need 'autoindent' set
- :let m = m . "{O<Esc>" " add empty line above item
- :let m = m . "}{)^W" " move to text after bullet
- :let m = m . "i <CR> <Esc>" " add space for indent
- :let m = m . "gq}" " format text after the bullet
- :let m = m . "{dd" " remove the empty line
- :let m = m . "5lDJ" " put text after bullet
+ :let m = ":map _f :set ai<CR>" " need 'autoindent' set
+ :let m ..= "{O<Esc>" " add empty line above item
+ :let m ..= "}{)^W" " move to text after bullet
+ :let m ..= "i <CR> <Esc>" " add space for indent
+ :let m ..= "gq}" " format text after the bullet
+ :let m ..= "{dd" " remove the empty line
+ :let m ..= "5lDJ" " put text after bullet
:execute m |" define the mapping
(<> notation |<>|. Note that this is all typed literally. ^W is "^" "W", not
@@ -429,15 +429,15 @@ A slightly more advanced version is used in the |matchparen| plugin.
let c = '\['
let c2 = '\]'
endif
- let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
+ let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' ..
\ '=~? "string\\|comment"'
execute 'if' s_skip '| let s_skip = 0 | endif'
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip)
if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
- exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col .
- \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
+ exe 'match Search /\(\%' .. c_lnum .. 'l\%' .. c_col ..
+ \ 'c\)\|\(\%' .. m_lnum .. 'l\%' .. m_col .. 'c\)/'
let s:paren_hl_on = 1
endif
endfunction
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 7de6a0f890..eb19bf5934 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -14,10 +14,12 @@ VIM.TREESITTER *lua-treesitter*
Nvim integrates the tree-sitter library for incremental parsing of buffers.
*vim.treesitter.language_version*
-To check which language version is compiled with neovim, the number is stored
-within `vim.treesitter.language_version`. This number is not too helpful
-unless you are wondering about compatibility between different versions of
-compiled grammars.
+The latest parser ABI version that is supported by the bundled tree-sitter
+library.
+
+ *vim.treesitter.minimum_language_version*
+The earliest parser ABI version that is supported by the bundled tree-sitter
+library.
Parser files *treesitter-parsers*
@@ -49,10 +51,10 @@ Whenever you need to access the current syntax tree, parse the buffer: >
tstree = parser:parse()
-<This will return a table of immutable trees that represent the current state of the
-buffer. When the plugin wants to access the state after a (possible) edit
-it should call `parse()` again. If the buffer wasn't edited, the same tree will
-be returned again without extra work. If the buffer was parsed before,
+<This will return a table of immutable trees that represent the current state
+of the buffer. When the plugin wants to access the state after a (possible)
+edit it should call `parse()` again. If the buffer wasn't edited, the same tree
+will be returned again without extra work. If the buffer was parsed before,
incremental parsing will be done of the changed parts.
Note: to use the parser directly inside a |nvim_buf_attach| Lua callback, you
@@ -61,9 +63,10 @@ parsing shouldn't be done directly in the change callback anyway as they will
be very frequent. Rather a plugin that does any kind of analysis on a tree
should use a timer to throttle too frequent updates.
-tsparser:set_included_regions({region_list}) *tsparser:set_included_regions()*
+tsparser:set_included_regions({region_list}) *tsparser:set_included_regions()*
Changes the regions the parser should consider. This is used for
- language injection. {region_list} should be of the form (all zero-based): >
+ language injection. {region_list} should be of the form
+ (all zero-based): >
{
{node1, node2},
...
@@ -92,13 +95,13 @@ tsnode:next_sibling() *tsnode:next_sibling()*
tsnode:prev_sibling() *tsnode:prev_sibling()*
Get the node's previous sibling.
-tsnode:next_named_sibling() *tsnode:next_named_sibling()*
+tsnode:next_named_sibling() *tsnode:next_named_sibling()*
Get the node's next named sibling.
-tsnode:prev_named_sibling() *tsnode:prev_named_sibling()*
+tsnode:prev_named_sibling() *tsnode:prev_named_sibling()*
Get the node's previous named sibling.
-tsnode:iter_children() *tsnode:iter_children()*
+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
@@ -114,10 +117,10 @@ 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()*
+tsnode:named_child_count() *tsnode:named_child_count()*
Get the node's number of named children.
-tsnode:named_child({index}) *tsnode:named_child()*
+tsnode:named_child({index}) *tsnode:named_child()*
Get the node's named child at the given {index}, where zero represents
the first named child.
@@ -157,20 +160,20 @@ tsnode:sexpr() *tsnode:sexpr()*
tsnode:id() *tsnode:id()*
Get an 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.
+ 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:descendant_for_range()*
tsnode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col})
- *tsnode:descendant_for_range()*
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})
- *tsnode:named_descendant_for_range()*
Get the smallest named node within this node that spans the given
range of (row, column) positions
@@ -192,11 +195,11 @@ and predicates. A `capture` allows you to associate names with a specific
node in a pattern. A `predicate` adds arbitrary metadata and conditional data
to a match.
-Treesitter Query Predicates *lua-treesitter-predicates*
+Treesitter Query Predicates *lua-treesitter-predicates*
When writing queries for treesitter, one might use `predicates`, that is,
-special scheme nodes that are evaluated to verify things on a captured node for
-example, the |eq?| predicate : >
+special scheme nodes that are evaluated to verify things on a captured node
+for example, the |eq?| predicate : >
((identifier) @foo (#eq? @foo "foo"))
This will only match identifier corresponding to the `"foo"` text.
@@ -204,100 +207,102 @@ Here is a list of built-in predicates :
`eq?` *ts-predicate-eq?*
This predicate will check text correspondence between nodes or
- strings : >
+ strings: >
((identifier) @foo (#eq? @foo "foo"))
((node1) @left (node2) @right (#eq? @left @right))
<
`match?` *ts-predicate-match?*
- `vim-match?` *ts-predicate-vim-match?*
+ `vim-match?` *ts-predicate-vim-match?*
This will match if the provided vim regex matches the text
- corresponding to a node : >
+ corresponding to a node: >
((identifier) @constant (#match? @constant "^[A-Z_]+$"))
< Note: the `^` and `$` anchors will respectively match the
start and end of the node's text.
- `lua-match?` *ts-predicate-lua-match?*
+ `lua-match?` *ts-predicate-lua-match?*
This will match the same way than |match?| but using lua
regexes.
- `contains?` *ts-predicate-contains?*
+ `contains?` *ts-predicate-contains?*
Will check if any of the following arguments appears in the
- text corresponding to the node : >
+ text corresponding to the node: >
((identifier) @foo (#contains? @foo "foo"))
((identifier) @foo-bar (#contains @foo-bar "foo" "bar"))
<
- `any-of?` *ts-predicate-any-of?*
- Will check if the text is the same as any of the following.
+ `any-of?` *ts-predicate-any-of?*
+ Will check if the text is the same as any of the following
+ arguments: >
+ ((identifier) @foo (#any-of? @foo "foo" "bar"))
+<
This is the recommended way to check if the node matches one
of many keywords for example, as it has been optimized for
this.
- arguments : >
- ((identifier) @foo (#any-of? @foo "foo" "bar"))
<
- *lua-treesitter-not-predicate*
+ *lua-treesitter-not-predicate*
Each predicate has a `not-` prefixed predicate that is just the negation of
the predicate.
- *vim.treesitter.query.add_predicate()*
+ *vim.treesitter.query.add_predicate()*
vim.treesitter.query.add_predicate({name}, {handler})
This adds a predicate with the name {name} to be used in queries.
{handler} should be a function whose signature will be : >
handler(match, pattern, bufnr, predicate)
<
- *vim.treesitter.query.list_predicates()*
+ *vim.treesitter.query.list_predicates()*
vim.treesitter.query.list_predicates()
This lists the currently available predicates to use in queries.
-Treesitter Query Directive *lua-treesitter-directives*
+Treesitter Query Directive *lua-treesitter-directives*
-Treesitter queries can also contain `directives`. Directives store metadata for a node
-or match and perform side effects. For example, the |set!| predicate sets metadata on
-the match or node : >
+Treesitter queries can also contain `directives`. Directives store metadata
+for a node or match and perform side effects. For example, the |set!|
+predicate sets metadata on the match or node : >
((identifier) @foo (#set! "type" "parameter"))
-Here is a list of built-in directives:
+Built-in directives:
+
+ `set!` *ts-directive-set!*
+ Sets key/value metadata for a specific match or capture.
+ Value is accessible as either `metadata[key]` (match
+ specific) or `metadata[capture_id][key]` (capture specific).
- `set!` *ts-directive-set!*
- Sets key/value metadata for a specific node or match : >
- ((identifier) @foo (#set! @foo "kind" "parameter"))
- ((node1) @left (node2) @right (#set! "type" "pair"))
+ Parameters: ~
+ {capture_id} (optional)
+ {key}
+ {value}
+
+ Examples: >
+ ((identifier) @foo (#set! @foo "kind" "parameter"))
+ ((node1) @left (node2) @right (#set! "type" "pair"))
<
- `offset!` *ts-predicate-offset!*
- Takes the range of the captured node and applies the offsets
- to it's range : >
- ((identifier) @constant (#offset! @constant 0 1 0 -1))
-< This will generate a range object for the captured node with the
- offsets applied. The arguments are
- `({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})`
- The default key is "offset".
-
- *vim.treesitter.query.add_directive()*
-vim.treesitter.query.add_directive({name}, {handler})
-
-This adds a directive with the name {name} to be used in queries.
-{handler} should be a function whose signature will be : >
- handler(match, pattern, bufnr, predicate, metadata)
-Handlers can set match level data by setting directly on the metadata object `metadata.key = value`
-Handlers can set node level data by using the capture id on the metadata table
-`metadata[capture_id].key = value`
+ `offset!` *ts-directive-offset!*
+ Takes the range of the captured node and applies an offset.
+ This will generate a new range object for the captured node
+ as `metadata[capture_id].range`.
- *vim.treesitter.query.list_directives()*
-vim.treesitter.query.list_directives()
+ Parameters: ~
+ {capture_id}
+ {start_row}
+ {start_col}
+ {end_row}
+ {end_col}
-This lists the currently available directives to use in queries.
+ Example: >
+ ((identifier) @constant (#offset! @constant 0 1 0 -1))
+<
-Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
+Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
NOTE: This is a partially implemented feature, and not usable as a default
solution yet. What is documented here is a temporary interface intended
for those who want to experiment with this feature and contribute to
its development.
-Highlights are defined in the same query format as in the tree-sitter highlight
-crate, with some limitations and additions. Set a highlight query for a
-buffer with this code: >
+Highlights are defined in the same query format as in the tree-sitter
+highlight crate, with some limitations and additions. Set a highlight query
+for a buffer with this code: >
local query = [[
"for" @keyword
@@ -338,7 +343,8 @@ Treesitter Highlighting Priority *lua-treesitter-highlight-priority*
Tree-sitter uses |nvim_buf_set_extmark()| to set highlights with a default
priority of 100. This enables plugins to set a highlighting priority lower or
higher than tree-sitter. It is also possible to change the priority of an
-individual query pattern manually by setting its `"priority"` metadata attribute: >
+individual query pattern manually by setting its `"priority"` metadata
+attribute: >
(
(super_important_node) @ImportantHighlight
@@ -404,10 +410,15 @@ Lua module: vim.treesitter.query *treesitter-query*
add_directive({name}, {handler}, {force}) *add_directive()*
Adds a new directive to be used in queries
+ Handlers can set match level data by setting directly on the
+ metadata object `metadata.key = value`, additionally, handlers
+ can set node level data by using the capture id on the
+ metadata table `metadata[capture_id].key = value`
+
Parameters: ~
{name} the name of the directive, without leading #
{handler} the handler function to be used signature will
- be (match, pattern, bufnr, predicate)
+ be (match, pattern, bufnr, predicate, metadata)
add_predicate({name}, {handler}, {force}) *add_predicate()*
Adds a new predicate to be used in queries
@@ -446,6 +457,8 @@ get_query_files({lang}, {query_name}, {is_included})
as `nil`
list_directives() *list_directives()*
+ Lists the currently available directives to use in queries.
+
Return: ~
The list of supported directives.
@@ -461,14 +474,15 @@ parse_query({lang}, {query}) *parse_query()*
can be used to search nodes in the syntax tree for the
patterns defined in {query} using `iter_*` methods below.
- Exposes `info` and `captures` with additional information about the {query}.
+ Exposes `info` and `captures` with additional context about {query}.
• `captures` contains the list of unique capture names defined
- in {query}. - `info.captures` also points to `captures` .
+ in {query}. -`info.captures` also points to `captures`.
• `info.patterns` contains information about predicates.
Parameters: ~
- {lang} The language
- {query} A string containing the query (s-expr syntax)
+ {lang} (string) The language
+ {query} (string) A string containing the query (s-expr
+ syntax)
Return: ~
The query
@@ -522,8 +536,8 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
a table mapping capture indices to nodes, and metadata from
any directives processing the match. If the query has more
than one pattern the capture table might be sparse, and e.g.
- `pairs()` method should be used over `ipairs` . Here an
- example iterating over all captures in every match:
+ `pairs()` method should be used over `ipairs`. Here an example
+ iterating over all captures in every match:
>
for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, first, last) do
@@ -608,10 +622,7 @@ LanguageTree:children({self}) *LanguageTree:children()*
{self}
LanguageTree:contains({self}, {range}) *LanguageTree:contains()*
- Determines whether This goes down the tree to recursively check children.
-
- Parameters: ~
- {range} is contained in this language tree
+ Determines whether {range} is contained in this language tree
Parameters: ~
{range} A range, that is a `{ start_line, start_col,
@@ -621,8 +632,9 @@ LanguageTree:contains({self}, {range}) *LanguageTree:contains()*
LanguageTree:destroy({self}) *LanguageTree:destroy()*
Destroys this language tree and all its children.
- Any cleanup logic should be performed here. Note, this DOES
- NOT remove this tree from a parent. `remove_child` must be called on the parent to remove it.
+ Any cleanup logic should be performed here.
+
+ Note: This DOES NOT remove this tree from a parent. Instead, `remove_child` must be called on the parent to remove it.
Parameters: ~
{self}
@@ -665,7 +677,8 @@ LanguageTree:invalidate({self}, {reload}) *LanguageTree:invalidate()*
{self}
LanguageTree:is_valid({self}) *LanguageTree:is_valid()*
- Determines whether this tree is valid. If the tree is invalid, `parse()` must be called to get the an updated tree.
+ Determines whether this tree is valid. If the tree is invalid,
+ call `parse()` . This will return the updated tree.
Parameters: ~
{self}
@@ -678,7 +691,7 @@ LanguageTree:lang({self}) *LanguageTree:lang()*
*LanguageTree:language_for_range()*
LanguageTree:language_for_range({self}, {range})
- Gets the appropriate language that contains
+ Gets the appropriate language that contains {range}
Parameters: ~
{range} A text range, see |LanguageTree:contains|
@@ -694,13 +707,22 @@ LanguageTree:parse({self}) *LanguageTree:parse()*
{self}
LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()*
- Registers callbacks for the parser
-
- Parameters: ~
- {cbs} An `nvim_buf_attach` -like table argument with the following keys : `on_bytes` : see `nvim_buf_attach` , but this will be called after the parsers callback. `on_changedtree` : a callback that will be called every time the
- tree has syntactical changes. it will only be
- passed one argument, that is a table of the ranges
- (as node ranges) that changed. `on_child_added` : emitted when a child is added to the tree. `on_child_removed` : emitted when a child is removed from the tree.
+ Registers callbacks for the parser.
+
+ Parameters: ~
+ {cbs} (table) An |nvim_buf_attach()|-like table argument
+ with the following keys :
+ • `on_bytes` : see |nvim_buf_attach()|, but this will be
+ called after the parsers callback.
+ • `on_changedtree` : a callback that will be
+ called every time the tree has syntactical
+ changes. It will only be passed one argument,
+ which is a table of the ranges (as node ranges)
+ that changed.
+ • `on_child_added` : emitted when a child is added
+ to the tree.
+ • `on_child_removed` : emitted when a child is
+ removed from the tree.
{self}
LanguageTree:remove_child({self}, {lang}) *LanguageTree:remove_child()*
@@ -732,8 +754,8 @@ LanguageTree:set_included_regions({self}, {regions})
parsed again.
Parameters: ~
- {regions} A list of regions this tree should manage and
- parse.
+ {regions} (table) list of regions this tree should manage
+ and parse.
{self}
LanguageTree:source({self}) *LanguageTree:source()*
diff --git a/runtime/doc/uganda.txt b/runtime/doc/uganda.txt
index 79519da51e..23dfa082a0 100644
--- a/runtime/doc/uganda.txt
+++ b/runtime/doc/uganda.txt
@@ -129,11 +129,12 @@ Kibaale Children's Centre *kcc* *Kibaale* *charity*
Kibaale Children's Centre (KCC) is located in Kibaale, a small town in the
south of Uganda, near Tanzania, in East Africa. The area is known as Rakai
District. The population is mostly farmers. Although people are poor, there
-is enough food. But this district is suffering from AIDS more than any other
-part of the world. Some say that it started there. Estimations are that 10
-to 30% of the Ugandans are infected with HIV. Because parents die, there are
-many orphans. In this district about 60,000 children have lost one or both
-parents, out of a population of 350,000. And this is still continuing.
+usually is enough food. But this district is suffering from AIDS more than
+any other part of the world. Some say that it started there. Estimations are
+that in the past 10 to 30% of the Ugandans are infected with HIV. Because
+parents die, there are many orphans. In this district about 60,000 children
+have lost one or both parents, out of a population of 350,000. Although AIDS
+is now mostly under control, the problems are still continuing.
The children need a lot of help. The KCC is working hard to provide the needy
with food, medical care and education. Food and medical care to keep them
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index e7be14e732..3fb9ed1125 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -49,6 +49,14 @@ with these (optional) keys:
'wildmenu'. |ui-popupmenu|
`ext_tabline` Externalize the tabline. |ui-tabline|
`ext_termcolors` Use external default colors.
+ `term_name` Sets the name of the terminal 'term'.
+ `term_colors` Sets the number of supported colors 't_Co'.
+ `term_background` Sets the default value of 'background'.
+ `stdin_fd` Read buffer from `fd` as if it was a stdin pipe
+ This option can only used by |--embed| ui,
+ see |ui-startup-stdin|.
+
+
Specifying an unknown option is an error; UIs can check the |api-metadata|
`ui_options` key for supported options.
@@ -137,6 +145,19 @@ procedure:
Inside this request handler, the UI can safely do any initialization before
entering normal mode, for example reading variables set by init.vim.
+ *ui-startup-stdin*
+An UI can support the native read from stdin feature as invoked with
+`command | nvim -` for the builtin TUI. |--|
+The embedding process can detect that its stdin is open to a file which
+not is a terminal, just like nvim does. It then needs to forward this fd
+to Nvim. As fd=0 is already is used to send rpc data from the embedder to
+Nvim, it needs to use some other file descriptor, like fd=3 or higher.
+
+Then, `stdin_fd` option should be passed to `nvim_ui_attach` and nvim will
+implicitly read it as a buffer. This option can only be used when Nvim is
+launched with `--embed` option, as described above.
+
+
==============================================================================
Global Events *ui-global*
@@ -283,19 +304,23 @@ numerical highlight ids to the actual attributes.
attributes specified by the `rgb_attr` and `cterm_attr` dicts, with the
following (all optional) keys.
- `foreground`: foreground color.
- `background`: background color.
- `special`: color to use for underline and undercurl, when present.
- `reverse`: reverse video. Foreground and background colors are
- switched.
- `italic`: italic text.
- `bold`: bold text.
- `strikethrough`: struckthrough text.
- `underline`: underlined text. The line has `special` color.
- `undercurl`: undercurled text. The curl has `special` color.
- `blend`: Blend level (0-100). Could be used by UIs to support
- blending floating windows to the background or to
- signal a transparent cursor.
+ `foreground`: foreground color.
+ `background`: background color.
+ `special`: color to use for various underlines, when
+ present.
+ `reverse`: reverse video. Foreground and background colors
+ are switched.
+ `italic`: italic text.
+ `bold`: bold text.
+ `strikethrough`: struckthrough text.
+ `underline`: underlined text. The line has `special` color.
+ `undercurl`: undercurled text. The curl has `special` color.
+ `underdouble`: double underlined text. The lines have `special` color.
+ `underdotted`: underdotted text. The dots have `special` color.
+ `underdashed`: underdashed text. The dashes have `special` color.
+ `blend`: Blend level (0-100). Could be used by UIs to
+ support blending floating windows to the
+ background or to signal a transparent cursor.
For absent color keys the default color should be used. Don't store
the default value in the table, rather a sentinel value, so that
@@ -444,7 +469,7 @@ is not active. New UIs should implement |ui-linegrid| instead.
`foreground`: foreground color.
`background`: background color.
- `special`: color to use for underline and undercurl, when present.
+ `special`: color to use for various underlines, when present.
`reverse`: reverse video. Foreground and background colors are
switched.
`italic`: italic text.
@@ -452,6 +477,9 @@ is not active. New UIs should implement |ui-linegrid| instead.
`strikethrough`: struckthrough text.
`underline`: underlined text. The line has `special` color.
`undercurl`: undercurled text. The curl has `special` color.
+ `underdouble`: double underlined text. The lines have `special` color.
+ `underdotted`: underdotted text. The dots have `special` color.
+ `underdashed`: underdashed text. The dashes have `special` color.
["put", text]
The (utf-8 encoded) string `text` is put at the cursor position
@@ -598,6 +626,10 @@ tabs.
`botline` is set to one more than the line count of the buffer, if
there are filler lines past the end.
+["win_extmark", grid, win, ns_id, mark_id, row, col]
+ Updates the position of an extmark which is currently visible in a
+ window. Only emitted if the mark has the `ui_watched` attribute.
+
==============================================================================
Popupmenu Events *ui-popupmenu*
diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt
index b11d7581ed..67f24103cd 100644
--- a/runtime/doc/undo.txt
+++ b/runtime/doc/undo.txt
@@ -22,6 +22,14 @@ u Undo [count] changes.
:u[ndo] {N} Jump to after change number {N}. See |undo-branches|
for the meaning of {N}.
+:u[ndo]! Undo one change and remove it from undo history.
+ *E5767*
+:u[ndo]! {N} Like ":u[ndo] {N}", but forget all changes in the
+ current undo branch up until {N}. You may only use
+ ":undo! {N}" to move backwards in the same undo
+ branch, not to redo or switch to a different undo
+ branch.
+
*CTRL-R*
CTRL-R Redo [count] changes which were undone.
@@ -100,12 +108,14 @@ change again. But you can do something like this: >
After this a "u" command will undo the delete command and the previous
change.
-
+ *undo-break*
To do the opposite, break a change into two undo blocks, in Insert mode use
CTRL-G u. This is useful if you want an insert command to be undoable in
parts. E.g., for each sentence. |i_CTRL-G_u|
+
Setting the value of 'undolevels' also breaks undo. Even when the new value
-is equal to the old value.
+is equal to the old value: >
+ let &undolevels = &undolevels
==============================================================================
4. Undo branches *undo-branches* *undo-tree*
@@ -272,12 +282,12 @@ history file. E.g.: >
au BufReadPost * call ReadUndo()
au BufWritePost * call WriteUndo()
func ReadUndo()
- if filereadable(expand('%:h'). '/UNDO/' . expand('%:t'))
+ if filereadable(expand('%:h') .. '/UNDO/' .. expand('%:t'))
rundo %:h/UNDO/%:t
endif
endfunc
func WriteUndo()
- let dirname = expand('%:h') . '/UNDO'
+ let dirname = expand('%:h') .. '/UNDO'
if !isdirectory(dirname)
call mkdir(dirname)
endif
diff --git a/runtime/doc/usr_04.txt b/runtime/doc/usr_04.txt
index b2dd617542..c7c900274b 100644
--- a/runtime/doc/usr_04.txt
+++ b/runtime/doc/usr_04.txt
@@ -349,15 +349,17 @@ Notice that "yw" includes the white space after a word. If you don't want
this, use "ye".
The "yy" command yanks a whole line, just like "dd" deletes a whole line.
-Unexpectedly, while "D" deletes from the cursor to the end of the line, "Y"
-works like "yy", it yanks the whole line. Watch out for this inconsistency!
-Use "y$" to yank to the end of the line.
a text line yy a text line a text line
line 2 line 2 p line 2
last line last line a text line
last line
+"Y" was originally equivalent to "yank the entire line", as opposed to "D"
+which is "delete to end of the line". "Y" has thus been remapped to mean
+"yank to end of the line" to make it consistent with the behavior of "D".
+Mappings will be covered in later chapters.
+
==============================================================================
*04.7* Using the clipboard
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index f93a221e43..0e94d9a1b1 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -45,7 +45,7 @@ This file is always used and is recommended:
The vimrc file can contain all the commands that you type after a colon. The
simplest ones are for setting options. For example, if you want Vim to always
-start with the 'incsearch' option on, add this line your vimrc file: >
+start with the 'ignorecase' option on, add this line your vimrc file: >
set ignorecase
@@ -131,7 +131,7 @@ it worked before Vim 5.0. Otherwise the "Q" command starts Ex mode, but you
will not need it.
>
- vnoremap _g y:exe "grep /" . escape(@", '\\/') . "/ *.c *.h"<CR>
+ vnoremap _g y:exe "grep /" .. escape(@", '\\/') .. "/ *.c *.h"<CR>
This mapping yanks the visually selected text and searches for it in C files.
This is a complicated mapping. You can see that mappings can be used to do
@@ -139,13 +139,11 @@ quite complicated things. Still, it is just a sequence of commands that are
executed like you typed them.
>
- syntax on
set hlsearch
-This switches on syntax highlighting. And the 'hlsearch' option tells Vim to
-highlight matches with the last used search pattern. The "if" command is very
-useful to set options only when some condition is met. More about that in
-|usr_41.txt|.
+This option tells Vim to highlight matches with the last used search pattern.
+The "if" command is very useful to set options only when some condition is
+met. More about that in |usr_41.txt|.
*vimrc-filetype* >
filetype plugin indent on
diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt
index 360f72ec63..b99e0fb482 100644
--- a/runtime/doc/usr_06.txt
+++ b/runtime/doc/usr_06.txt
@@ -24,28 +24,8 @@ Table of contents: |usr_toc.txt|
==============================================================================
*06.1* Switching it on
-It all starts with one simple command: >
-
- :syntax enable
-
-That should work in most situations to get color in your files. Vim will
-automagically detect the type of file and load the right syntax highlighting.
-Suddenly comments are blue, keywords brown and strings red. This makes it
-easy to overview the file. After a while you will find that black&white text
-slows you down!
-
-If you always want to use syntax highlighting, put the ":syntax enable"
-command in your |init.vim| file.
-
-If you want syntax highlighting only when the terminal supports colors, you
-can put this in your |init.vim| file: >
-
- if &t_Co > 1
- syntax enable
- endif
-
-If you want syntax highlighting only in the GUI version, put the ":syntax
-enable" command in your |ginit.vim| file.
+Syntax highlighting is enabled by default. Nvim will automagically detect the
+type of file and load the right syntax highlighting.
==============================================================================
*06.2* No or wrong colors?
diff --git a/runtime/doc/usr_07.txt b/runtime/doc/usr_07.txt
index 649be8d7ce..ebf5c3d7b8 100644
--- a/runtime/doc/usr_07.txt
+++ b/runtime/doc/usr_07.txt
@@ -336,7 +336,7 @@ there. >
Of course you can use many other commands to yank the text. For example, to
select whole lines start Visual mode with "V". Or use CTRL-V to select a
-rectangular block. Or use "Y" to yank a single line, "yaw" to yank-a-word,
+rectangular block. Or use "yy" to yank a single line, "yaw" to yank-a-word,
etc.
The "p" command puts the text after the cursor. Use "P" to put the text
before the cursor. Notice that Vim remembers if you yanked a whole line or a
@@ -359,7 +359,7 @@ the text should be placed in the f register. This must come just before the
yank command.
Now yank three whole lines to the l register (l for line): >
- "l3Y
+ "l3yy
The count could be before the "l just as well. To yank a block of text to the
b (for block) register: >
diff --git a/runtime/doc/usr_08.txt b/runtime/doc/usr_08.txt
index 8ccaa73006..1d20913a14 100644
--- a/runtime/doc/usr_08.txt
+++ b/runtime/doc/usr_08.txt
@@ -482,6 +482,8 @@ statusline:
0 never
1 only when there are split windows (the default)
2 always
+ 3 have a global statusline at the bottom instead of one for each
+ window
Many commands that edit another file have a variant that splits the window.
For Command-line commands this is done by prepending an "s". For example:
diff --git a/runtime/doc/usr_10.txt b/runtime/doc/usr_10.txt
index 5365f90314..8844671e01 100644
--- a/runtime/doc/usr_10.txt
+++ b/runtime/doc/usr_10.txt
@@ -132,11 +132,11 @@ This works both with recording and with yank and delete commands. For
example, you want to collect a sequence of lines into the a register. Yank
the first line with: >
- "aY
+ "ayy
Now move to the second line, and type: >
- "AY
+ "Ayy
Repeat this command for all lines. The a register now contains all those
lines, in the order you yanked them.
diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt
index 44d653a1a7..add5d48073 100644
--- a/runtime/doc/usr_21.txt
+++ b/runtime/doc/usr_21.txt
@@ -352,12 +352,12 @@ another session.
this yourself then. Example: >
:mksession! ~/.config/nvim/secret.vim
- :wshada! ~/.local/share/nvim/shada/secret.shada
+ :wshada! ~/.local/state/nvim/shada/secret.shada
And to restore this again: >
:source ~/.config/nvim/secret.vim
- :rshada! ~/.local/share/nvim/shada/secret.shada
+ :rshada! ~/.local/state/nvim/shada/secret.shada
==============================================================================
*21.5* Views
diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt
index 3381d1870c..d8c556c281 100644
--- a/runtime/doc/usr_29.txt
+++ b/runtime/doc/usr_29.txt
@@ -33,10 +33,12 @@ following command: >
ctags *.c
"ctags" is a separate program. Most Unix systems already have it installed.
-If you do not have it yet, you can find Exuberant ctags here:
-
+If you do not have it yet, you can find Universal/Exuberant ctags at:
+ http://ctags.io ~
http://ctags.sf.net ~
+Universal ctags is preferred, Exuberant ctags is no longer being developed.
+
Now when you are in Vim and you want to go to a function definition, you can
jump to it by using the following command: >
@@ -142,15 +144,15 @@ ONE TAGS FILE
When Vim has to search many places for tags files, you can hear the disk
rattling. It may get a bit slow. In that case it's better to spend this
time while generating one big tags file. You might do this overnight.
- This requires the Exuberant ctags program, mentioned above. It offers an
-argument to search a whole directory tree: >
+ This requires the Universal or Exuberant ctags program, mentioned above.
+It offers an argument to search a whole directory tree: >
cd ~/proj
ctags -R .
-The nice thing about this is that Exuberant ctags recognizes various file
-types. Thus this doesn't work just for C and C++ programs, also for Eiffel
-and even Vim scripts. See the ctags documentation to tune this.
+The nice thing about this is that Universal/Exuberant ctags recognizes various
+file types. Thus this doesn't work just for C and C++ programs, also for
+Eiffel and even Vim scripts. See the ctags documentation to tune this.
Now you only need to tell Vim where your big tags file is: >
:set tags=~/proj/tags
@@ -232,7 +234,8 @@ A TAGS BROWSER
Since CTRL-] takes you to the definition of the identifier under the cursor,
you can use a list of identifier names as a table of contents. Here is an
example.
- First create a list of identifiers (this requires Exuberant ctags): >
+ First create a list of identifiers (this requires Universal or Exuberant
+ctags): >
ctags --c-types=f -f functions *.c
diff --git a/runtime/doc/usr_40.txt b/runtime/doc/usr_40.txt
index 5b1254e2ae..f47c933124 100644
--- a/runtime/doc/usr_40.txt
+++ b/runtime/doc/usr_40.txt
@@ -463,6 +463,17 @@ separated) that trigger the command.
The optional [++nested] flag allows for nesting of autocommands (see below),
and finally, {command} is the command to be executed.
+When adding an autocommand the already existing ones remain. To avoid adding
+the autocommand several times you should use this form: >
+
+ :augroup updateDate
+ : autocmd!
+ : autocmd BufWritePre * call DateInsert()
+ :augroup END
+
+This will delete any previously defined autocommand with `:autocmd!` before
+defining the new one. Groups are explained later.
+
EVENTS
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 7e611a47f3..5acef2f352 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -157,7 +157,7 @@ cannot start with a digit. Valid variable names are:
FuncLength
LENGTH
-Invalid names are "foo+bar" and "6var".
+Invalid names are "foo.bar" and "6var".
These variables are global. To see a list of currently defined variables
use this command: >
@@ -549,7 +549,7 @@ A "&" character is prepended to "path", thus the argument to eval() is
Vim defines many functions and provides a large amount of functionality that
way. A few examples will be given in this section. You can find the whole
-list here: |functions|.
+list below: |function-list|.
A function is called with the ":call" command. The parameters are passed in
between parentheses separated by commas. Example: >
@@ -581,15 +581,15 @@ statements is equal to: >
:substitute/\a/*/g
-Using the functions becomes more interesting when you do more work before and
+Using the functions becomes interesting when you do more work before and
after the substitute() call.
FUNCTIONS *function-list*
There are many functions. We will mention them here, grouped by what they are
-used for. You can find an alphabetical list here: |functions|. Use CTRL-] on
-the function name to jump to detailed help on it.
+used for. You can find an alphabetical list here: |builtin-function-list|.
+Use CTRL-] on the function name to jump to detailed help on it.
String manipulation: *string-functions*
nr2char() get a character by its number value
@@ -608,6 +608,8 @@ String manipulation: *string-functions*
toupper() turn a string to uppercase
match() position where a pattern matches in a string
matchend() position where a pattern match ends in a string
+ matchfuzzy() fuzzy matches a string in a list of strings
+ matchfuzzypos() fuzzy matches a string in a list of strings
matchstr() match of a pattern in a string
matchstrpos() match and positions of a pattern in a string
matchlist() like matchstr() and also return submatches
@@ -746,6 +748,11 @@ Cursor and mark position: *cursor-functions* *mark-functions*
screenchar() get character code at a screen line/row
screenchars() get character codes at a screen line/row
screenstring() get string of characters at a screen line/row
+ charcol() character number of the cursor or a mark
+ getcharpos() get character position of cursor, mark, etc.
+ setcharpos() set character position of cursor, mark, etc.
+ getcursorcharpos() get character position of the cursor
+ setcursorcharpos() set character position of the cursor
Working with text in the current buffer: *text-functions*
getline() get a line or list of lines from the buffer
@@ -837,6 +844,8 @@ Buffers, windows and the argument list:
win_gotoid() go to window with ID
win_id2tabwin() get tab and window nr from window ID
win_id2win() get window nr from window ID
+ win_move_separator() move window vertical separator
+ win_move_statusline() move window status line
getbufinfo() get a list with buffer information
gettabinfo() get a list with tab page information
getwininfo() get a list with window information
@@ -846,8 +855,12 @@ Buffers, windows and the argument list:
swapname() get the swap file path of a buffer
Command line: *command-line-functions*
+ getcmdcompltype() get the type of the current command line
+ completion
getcmdline() get the current command line
getcmdpos() get position of the cursor in the command line
+ getcmdscreenpos() get screen position of the cursor in the
+ command line
setcmdpos() set position of the cursor in the command line
getcmdtype() return the current command-line type
getcmdwintype() return the current command-line window type
@@ -951,6 +964,10 @@ Window size and position: *window-size-functions*
winrestview() restore saved view of current window
Mappings: *mapping-functions*
+ digraph_get() get |digraph|
+ digraph_getlist() get all |digraph|s
+ digraph_set() register |digraph|
+ digraph_setlist() register multiple |digraph|s
hasmapto() check if a mapping exists
mapcheck() check if a matching mapping exists
maparg() get rhs of a mapping
@@ -1579,7 +1596,7 @@ the same (the text may change, e.g., it may be translated).
When the ":read" command causes another error, the pattern "E484:" will not
match in it. Thus this exception will not be caught and result in the usual
-error message.
+error message and execution is aborted.
You might be tempted to do this: >
@@ -1619,27 +1636,29 @@ manual: |exception-handling|.
Here is a summary of items that apply to Vim scripts. They are also mentioned
elsewhere, but form a nice checklist.
-The end-of-line character depends on the system. For Unix a single <NL>
-character is used. For Windows <CR><NL> is used. This is important when
-using mappings that end in a <CR>. See |:source_crnl|.
+The end-of-line character depends on the system. For Vim scripts it is
+recommended to always use the Unix fileformat. Lines are then separated with
+the Newline character. This also works on any other system. That way you can
+copy your Vim scripts from MS-Windows to Unix and they still work. See
+|:source_crnl|. To be sure it is set right, do this before writing the file:
+ >
+ :setlocal fileformat=unix
+When using "dos" fileformat, lines are separated with CR-NL, two characters.
+The CR character causes various problems, better avoid this.
-WHITE SPACE
-
-Blank lines are allowed and ignored.
-Leading whitespace characters (blanks and TABs) are always ignored. The
-whitespaces between parameters (e.g. between the "set" and the "cpoptions" in
-the example below) are reduced to one blank character and plays the role of a
-separator, the whitespaces after the last (visible) character may or may not
-be ignored depending on the situation, see below.
+WHITE SPACE
-For a ":set" command involving the "=" (equal) sign, such as in: >
+Blank lines are allowed in a script and ignored.
- :set cpoptions =aABceFst
+Leading whitespace characters (blanks and TABs) are ignored, except when using
+|:let-heredoc| without "trim".
-the whitespace immediately before the "=" sign is ignored. But there can be
-no whitespace after the "=" sign!
+Trailing whitespace is often ignored, but not always. One command that
+includes it is `map`. You have to watch out for that, it can cause hard to
+understand mistakes. A generic solution is to never use trailing white space,
+unless you really need it.
To include a whitespace character in the value of an option, it must be
escaped by a "\" (backslash) as in the following example: >
diff --git a/runtime/doc/usr_42.txt b/runtime/doc/usr_42.txt
index ff3ae7057a..470f4e0fe5 100644
--- a/runtime/doc/usr_42.txt
+++ b/runtime/doc/usr_42.txt
@@ -150,7 +150,8 @@ like the variations on the ":map" command:
:menu! Insert and Command-line mode
:imenu Insert mode
:cmenu Command-line mode
- :amenu All modes
+ :tlmenu Terminal mode
+ :amenu All modes (except for Terminal mode)
To avoid that the commands of a menu item are being mapped, use the command
":noremenu", ":nnoremenu", ":anoremenu", etc.
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 05bffc3038..9eb6470962 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -30,10 +30,10 @@ CTRL-L Clears and redraws the screen. The redraw may happen
function (or a mapping if 'lazyredraw' set).
*:redraws* *:redrawstatus*
-:redraws[tatus][!] Redraws the status line of the current window, or all
- status lines if "!" is included.
- Useful if 'statusline' includes an item that doesn't
- cause automatic updating.
+:redraws[tatus][!] Redraws the status line and window bar of the current
+ window, or all status lines and window bars if "!" is
+ included. Useful if 'statusline' or 'winbar' includes
+ an item that doesn't cause automatic updating.
*:redrawt* *:redrawtabline*
:redrawt[abline] Redraw the tabline. Useful to update the tabline when
@@ -208,8 +208,6 @@ g8 Print the hex values of the bytes used in the
{commands} cannot start with a space. Put a count of
1 (one) before it, "1 " is one space.
- The 'insertmode' option is ignored for {commands}.
-
This command cannot be followed by another command,
since any '|' is considered part of the command.
@@ -275,7 +273,7 @@ g8 Print the hex values of the bytes used in the
Special characters are not escaped, use quotes or
|shellescape()|: >
:!ls "%"
- :exe "!ls " . shellescape(expand("%"))
+ :exe "!ls " .. shellescape(expand("%"))
<
Newline character ends {cmd} unless a backslash
precedes the newline. What follows is interpreted as
@@ -348,7 +346,11 @@ g8 Print the hex values of the bytes used in the
Only string variables can be used. After the
redirection starts, if the variable is removed or
locked or the variable type is changed, then further
- command output messages will cause errors.
+ command output messages will cause errors. When using
+ a local variable (l:var in a function or s:var in a
+ script) and another `:redir` causes the current one to
+ end, the scope might be different and the assignment
+ fails.
To get the output of one command the |execute()|
function can be used instead of redirection.
@@ -358,19 +360,19 @@ g8 Print the hex values of the bytes used in the
:redi[r] END End redirecting messages.
*:filt* *:filter*
-:filt[er][!] {pat} {command}
-:filt[er][!] /{pat}/ {command}
+:filt[er][!] {pattern} {command}
+:filt[er][!] /{pattern}/ {command}
Restrict the output of {command} to lines matching
- with {pat}. For example, to list only xml files: >
+ with {pattern}. For example, to list only xml files: >
:filter /\.xml$/ oldfiles
< If the [!] is given, restrict the output of {command}
- to lines that do NOT match {pat}.
+ to lines that do NOT match {pattern}.
- {pat} is a Vim search pattern. Instead of enclosing
+ {pattern} is a Vim search pattern. Instead of enclosing
it in / any non-ID character (see |'isident'|) can be
- used, so long as it does not appear in {pat}. Without
- the enclosing character the pattern cannot include the
- bar character. 'ignorecase' is not used.
+ used, so long as it does not appear in {pattern}.
+ Without the enclosing character the pattern cannot
+ include the bar character. 'ignorecase' is not used.
The pattern is matched against the relevant part of
the output, not necessarily the whole line. Only some
@@ -388,6 +390,8 @@ g8 Print the hex values of the bytes used in the
|:marks| - filter by text in the current file,
or file name for other files
|:oldfiles| - filter by file name
+ |:registers| - filter by register contents
+ (does not work multi-line)
|:set| - filter by option name
Only normal messages are filtered, error messages are
@@ -430,7 +434,7 @@ g8 Print the hex values of the bytes used in the
used. In this example |:silent| is used to avoid the
message about reading the file and |:unsilent| to be
able to list the first line of each file. >
- :silent argdo unsilent echo expand('%') . ": " . getline(1)
+ :silent argdo unsilent echo expand('%') .. ": " .. getline(1)
<
*:verb* *:verbose*
@@ -459,10 +463,11 @@ g8 Print the hex values of the bytes used in the
*:verbose-cmd*
When 'verbose' is non-zero, listing the value of a Vim option or a key map or
an abbreviation or a user-defined function or a command or a highlight group
-or an autocommand will also display where it was last defined. If it was
-defined manually then there will be no "Last set" message. When it was
-defined while executing a function, user command or autocommand, the script in
-which it was defined is reported.
+or an autocommand will also display where it was last defined. If they were
+defined in Lua they will only be located if 'verbose' is set. So Start
+nvim with -V1 arg to see them. If it was defined manually then there
+will be no "Last set" message. When it was defined while executing a function,
+user command or autocommand, the script in which it was defined is reported.
*K*
[count]K Runs the program given by 'keywordprg' to lookup the
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 4fcaf15717..a74149d050 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -17,25 +17,27 @@ centralized reference of the differences.
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for your |config|.
- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files.
-- Use `$XDG_DATA_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent
+- Use `$XDG_STATE_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent
session information. |shada|
==============================================================================
2. Defaults *nvim-defaults*
-- Syntax highlighting is enabled by default
-- ":filetype plugin indent on" is enabled by default
+- Filetype detection is enabled by default. This can be disabled by adding
+ ":filetype off" to |init.vim|.
+- Syntax highlighting is enabled by default. This can be disabled by adding
+ ":syntax off" to |init.vim|.
- 'autoindent' is enabled
- 'autoread' is enabled
- 'background' defaults to "dark" (unless set automatically by the terminal/UI)
- 'backspace' defaults to "indent,eol,start"
-- 'backupdir' defaults to .,~/.local/share/nvim/backup// (|xdg|), auto-created
+- 'backupdir' defaults to .,~/.local/state/nvim/backup// (|xdg|), auto-created
- 'belloff' defaults to "all"
- 'compatible' is always disabled
- 'complete' excludes "i"
- 'cscopeverbose' is enabled
-- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
+- 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created
- 'display' defaults to "lastline,msgsep"
- 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding)
- 'fillchars' defaults (in effect) to "vert:│,fold:·,sep:│"
@@ -50,6 +52,8 @@ centralized reference of the differences.
- 'langremap' is disabled
- 'laststatus' defaults to 2 (statusline is always shown)
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
+- 'mouse' defaults to "nvi"
+- 'mousemodel' defaults to "popup_setpos"
- 'nrformats' defaults to "bin,hex"
- 'ruler' is enabled
- 'sessionoptions' includes "unix,slash", excludes "options"
@@ -63,7 +67,7 @@ centralized reference of the differences.
- 'tags' defaults to "./tags;,tags"
- 'ttimeoutlen' defaults to 50
- 'ttyfast' is always set
-- 'undodir' defaults to ~/.local/share/nvim/undo// (|xdg|), auto-created
+- 'undodir' defaults to ~/.local/state/nvim/undo// (|xdg|), auto-created
- 'viewoptions' includes "unix,slash", excludes "options"
- 'viminfo' includes "!"
- 'wildmenu' is enabled
@@ -76,15 +80,42 @@ centralized reference of the differences.
- |g:vimsyn_embed| defaults to "l" to enable Lua highlighting
+Default Mouse ~
+ *default-mouse* *disable-mouse*
+By default the mouse is enabled. The right button click opens |popup-menu|
+with standard actions, such as "Cut", "Copy" and "Paste".
+
+If you don't like this you can add to your |config| any of the following:
+
+- ignore mouse completely >
+ set mouse=
+<
+- no |popup-menu| but the right button extends selection >
+ set mousemodel=extend
+>
+- pressing ALT+LeftMouse releases mouse until main cursor moves >
+ nnoremap <M-LeftMouse> <Cmd>
+ \ set mouse=<Bar>
+ \ echo 'mouse OFF until next cursor-move'<Bar>
+ \ autocmd CursorMoved * ++once set mouse&<Bar>
+ \ echo 'mouse ON'<CR>
+<
+Also, mouse is not in use in |command-mode| or at |more-prompt|. So if you
+need to copy/paste with your terminal then just pressing ':' makes Nvim to
+release the mouse cursor temporarily.
+
Default Mappings ~
*default-mappings*
Nvim creates the following default mappings at |startup|. You can disable any
of these in your config by simply removing the mapping, e.g. ":unmap Y".
>
nnoremap Y y$
- nnoremap <C-L> <Cmd>nohlsearch<Bar>diffupdate<CR><C-L>
+ nnoremap <C-L> <Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>
inoremap <C-U> <C-G>u<C-U>
inoremap <C-W> <C-G>u<C-W>
+ xnoremap * y/\V<C-R>"<CR>
+ xnoremap # y?\V<C-R>"<CR>
+ nnoremap & :&&<CR>
<
Default Autocommands ~
*default-autocmds*
@@ -178,6 +209,8 @@ Commands:
|:Man| is available by default, with many improvements such as completion
|:sign-define| accepts a `numhl` argument, to highlight the line number
|:match| can be invoked before highlight group is defined
+ |:source| works with Lua and anonymous (no file) scripts
+ User commands can support |:command-preview| to show results as you type
Events:
|RecordingEnter|
@@ -209,6 +242,7 @@ Highlight groups:
|hl-Substitute|
|hl-TermCursor|
|hl-TermCursorNC|
+ |hl-WinSeparator| highlights window separators
|hl-Whitespace| highlights 'listchars' whitespace
Input/Mappings:
@@ -225,9 +259,13 @@ Options:
'cpoptions' flags: |cpo-_|
'display' flags: "msgsep" minimizes scrolling when showing messages
'guicursor' works in the terminal
- 'fillchars' flags: "msgsep" (see 'display')
+ 'fillchars' flags: "msgsep" (see 'display'), "horiz", "horizup",
+ "horizdown", "vertleft", "vertright", "verthoriz"
'foldcolumn' supports up to 9 dynamic/fixed columns
'inccommand' shows interactive results for |:substitute|-like commands
+ and |:command-preview| commands
+ 'laststatus' global statusline support
+ 'mousescroll' amount to scroll by when scrolling with a mouse
'pumblend' pseudo-transparent popupmenu
'scrollback'
'signcolumn' supports up to 9 dynamic/fixed columns
@@ -320,6 +358,8 @@ coerced to strings. See |id()| for more details, currently it uses
|c_CTRL-R| pasting a non-special register into |cmdline| omits the last <CR>.
+|CursorMoved| always triggers when moving between windows.
+
Lua interface (|lua.txt|):
- `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim
@@ -337,13 +377,17 @@ Commands:
Functions:
|input()| and |inputdialog()| support for each other’s features (return on
cancel and completion respectively) via dictionary argument (replaces all
- other arguments if used).
+ other arguments if used), and "cancelreturn" can have any type if passed in
+ a dictionary.
|input()| and |inputdialog()| support user-defined cmdline highlighting.
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|
Macro/|recording| behavior
Replay of a macro recorded during :lmap produces the same actions as when it
@@ -354,6 +398,10 @@ Macro/|recording| behavior
macros and 'keymap' at the same time. This also means you can use |:imap| on
the results of keys from 'keymap'.
+Mappings:
+ Creating a mapping for a simplifiable key (e.g. <C-I>) doesn't replace an
+ existing mapping for its simplified form (e.g. <Tab>).
+
Motion:
The |jumplist| avoids useless/phantom jumps.
@@ -364,6 +412,9 @@ Normal commands:
Options:
'ttimeout', 'ttimeoutlen' behavior was simplified
|jumpoptions| "stack" behavior
+ |jumpoptions| "view" tries to restore the |mark-view| when moving through
+ the |jumplist|, |changelist|, |alternate-file| or using |mark-motions|.
+ 'shortmess' the "F" flag does not affect output from autocommands
Shell:
Shell output (|:!|, |:make|, …) is always routed through the UI, so it
@@ -429,7 +480,8 @@ Vimscript compatibility:
`this_session` does not alias to |v:this_session|
Working directory (Vim implemented some of these later than Nvim):
-- |DirChanged| can be triggered when switching to another window.
+- |DirChanged| and |DirChangedPre| can be triggered when switching to another
+ window or tab.
- |getcwd()| and |haslocaldir()| may throw errors if the tab page or window
cannot be found. *E5000* *E5001* *E5002*
- |haslocaldir()| checks for tab-local directory if and only if -1 is passed as
@@ -481,7 +533,6 @@ Commands:
:tearoff
Compile-time features:
- EBCDIC
Emacs tags support
X11 integration (see |x11-selection|)
@@ -490,6 +541,9 @@ Eval:
*js_encode()*
*js_decode()*
*v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
+ *v:sizeofint*
+ *v:sizeoflong*
+ *v:sizeofpointer*
Events:
*SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.
@@ -507,6 +561,9 @@ Highlight groups:
Options:
'antialias'
+ *'balloondelay'* *'bdlay'*
+ *'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'*
+ *'balloonexpr'* *'bexpr'*
'bioskey' (MS-DOS)
'conskey' (MS-DOS)
*'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".)
@@ -522,25 +579,58 @@ Options:
*'imactivatefunc'* *'imaf'*
*'imactivatekey'* *'imak'*
*'imstatusfunc'* *'imsf'*
+ *'insertmode'* *'im'* Use the following script to emulate 'insertmode':
+>
+ autocmd BufWinEnter * startinsert
+ inoremap <Esc> <C-X><C-Z><C-]>
+ inoremap <C-C> <C-X><C-Z>
+ inoremap <C-L> <C-X><C-Z><C-]><Esc>
+ inoremap <C-Z> <C-X><C-Z><Cmd>suspend<CR>
+ noremap <C-C> <Esc>
+ snoremap <C-C> <Esc>
+ noremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR>
+ cnoremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR>
+ inoremap <C-\><C-G> <C-X><C-Z>
+ autocmd CmdWinEnter * noremap <buffer> <C-C> <C-C>
+ autocmd CmdWinEnter * inoremap <buffer> <C-C> <C-C>
+
+ lua << EOF
+ vim.on_key(function(c)
+ if c == '\27' then
+ local mode = vim.api.nvim_get_mode().mode
+ if mode:find('^[nvV\22sS\19]') and vim.fn.getcmdtype() == '' then
+ vim.schedule(function()
+ vim.cmd('startinsert')
+ end)
+ end
+ end
+ end)
+ EOF
+<
*'macatsui'*
+ *'maxcombine'* *'mco'*
+ Nvim always displays up to 6 combining characters. You can still edit
+ text with more than 6 combining characters, you just can't see them.
+ Use |g8| or |ga|. See |mbyte-combining|.
'maxmem' Nvim delegates memory-management to the OS.
'maxmemtot' Nvim delegates memory-management to the OS.
- 'maxcombine' (6 is always used)
*'prompt'* *'noprompt'*
+ *'remap'* *'noremap'*
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'shelltype'
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
*'swapsync'* *'sws'*
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
+ *'terse'* *'noterse'* (Add "s" to 'shortmess' instead)
'textauto'
'textmode'
*'toolbar'* *'tb'*
*'toolbariconsize'* *'tbis'*
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
+ *'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
*'ttymouse'* *'ttym'*
*'ttyscroll'* *'tsl'*
*'ttytype'* *'tty'*
- 'ttyfast'
'weirdinvert'
Startup:
@@ -572,6 +662,7 @@ Test functions:
test_scrollbar()
test_setmouse()
test_settime()
+ test_srand_seed()
TUI:
*t_xx* *termcap-options* *t_AB* *t_Sb* *t_vb* *t_SI*
diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt
index 4a69fc989b..905ae49887 100644
--- a/runtime/doc/visual.txt
+++ b/runtime/doc/visual.txt
@@ -255,6 +255,7 @@ Additionally the following commands can be used:
X delete (2) |v_X|
Y yank (2) |v_Y|
p put |v_p|
+ P put without overwriting registers |v_P|
J join (1) |v_J|
U make uppercase |v_U|
u make lowercase |v_u|
@@ -478,6 +479,10 @@ Commands in Select mode:
- ESC stops Select mode.
- CTRL-O switches to Visual mode for the duration of one command. *v_CTRL-O*
- CTRL-G switches to Visual mode.
+- CTRL-R {register} selects the register to be used for the text that is
+ deleted when typing text. *v_CTRL-R*
+ Unless you specify the "_" (black hole) register, the unnamed register is
+ also overwritten.
Otherwise, typed characters are handled as in Visual mode.
@@ -494,6 +499,13 @@ work both in Visual mode and in Select mode. When these are used in Select
mode Vim automatically switches to Visual mode, so that the same behavior as
in Visual mode is effective. If you don't want this use |:xmap| or |:smap|.
+One particular edge case: >
+ :vnoremap <C-K> <Esc>
+This ends Visual mode when in Visual mode, but in Select mode it does not
+work, because Select mode is restored after executing the mapped keys. You
+need to use: >
+ :snoremap <C-K> <Esc>
+<
Users will expect printable characters to replace the selected area.
Therefore avoid mapping printable characters in Select mode. Or use
|:sunmap| after |:map| and |:vmap| to remove it for Select mode.
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 5b91321c40..8062b9e28f 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -104,6 +104,8 @@ when the last window also has a status line:
'laststatus' = 0 never a status line
'laststatus' = 1 status line if there is more than one window
'laststatus' = 2 always a status line
+ 'laststatus' = 3 have a global statusline at the bottom instead
+ of one for each window
You can change the contents of the status line with the 'statusline' option.
This option can be local to the window, so that you can have a different
@@ -447,7 +449,7 @@ These commands can also be executed with ":wincmd":
the |CursorHold| autocommand event). Or when a Normal mode
command is inconvenient.
The count can also be a window number. Example: >
- :exe nr . "wincmd w"
+ :exe nr .. "wincmd w"
< This goes to window "nr".
==============================================================================
@@ -909,12 +911,12 @@ CTRL-W g } *CTRL-W_g}*
cursor. This is less clever than using |:ptag|, but you don't
need a tags file and it will also find matches in system
include files. Example: >
- :au! CursorHold *.[ch] ++nested exe "silent! psearch " . expand("<cword>")
+ :au! CursorHold *.[ch] ++nested exe "silent! psearch " .. expand("<cword>")
< Warning: This can be slow.
Example *CursorHold-example* >
- :au! CursorHold *.[ch] ++nested exe "silent! ptag " . expand("<cword>")
+ :au! CursorHold *.[ch] ++nested exe "silent! ptag " .. expand("<cword>")
This will cause a ":ptag" to be executed for the keyword under the cursor,
when the cursor hasn't moved for the time set with 'updatetime'. "++nested"
@@ -937,14 +939,14 @@ is no word under the cursor, and a few other things: >
:
: " Delete any existing highlight before showing another tag
: silent! wincmd P " jump to preview window
- : if &previewwindow " if we really get there...
+ : if &previewwindow " if we really get there...
: match none " delete existing highlight
: wincmd p " back to old window
: endif
:
: " Try displaying a matching tag for the word under the cursor
: try
- : exe "ptag " . w
+ : exe "ptag " .. w
: catch
: return
: endtry
@@ -956,10 +958,10 @@ is no word under the cursor, and a few other things: >
: endif
: call search("$", "b") " to end of previous line
: let w = substitute(w, '\\', '\\\\', "")
- : call search('\<\V' . w . '\>') " position cursor on match
+ : call search('\<\V' .. w .. '\>') " position cursor on match
: " Add a match highlight to the word at this position
: hi previewWord term=bold ctermbg=green guibg=green
- : exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"'
+ : exe 'match previewWord "\%' .. line(".") .. 'l\%' .. col(".") .. 'c\k*"'
: wincmd p " back to old window
: endif
: endif
@@ -981,7 +983,7 @@ modified, but is forced (with '!') to be removed from a window, and
'autowrite' is off or the buffer can't be written.
You can make a hidden buffer not hidden by starting to edit it with any
-command. Or by deleting it with the ":bdelete" command.
+command, or by deleting it with the ":bdelete" command.
The 'hidden' is global, it is used for all buffers. The 'bufhidden' option
can be used to make an exception for a specific buffer. It can take these
diff --git a/runtime/filetype.lua b/runtime/filetype.lua
index fcfc5701f0..9f5b5fd0dc 100644
--- a/runtime/filetype.lua
+++ b/runtime/filetype.lua
@@ -1,26 +1,51 @@
-if vim.g.did_load_filetypes and vim.g.did_load_filetypes ~= 0 then
+-- Skip if legacy filetype is enabled or filetype detection is disabled
+if vim.g.do_legacy_filetype or vim.g.did_load_filetypes then
return
end
+vim.g.did_load_filetypes = 1
--- For now, make this opt-in with a global variable
-if vim.g.do_filetype_lua ~= 1 then
- return
-end
+vim.api.nvim_create_augroup('filetypedetect', { clear = false })
-vim.cmd [[
-augroup filetypedetect
-au BufRead,BufNewFile * call v:lua.vim.filetype.match(expand('<afile>'))
+vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
+ group = 'filetypedetect',
+ callback = function(args)
+ local ft, on_detect = vim.filetype.match({ filename = args.match, buf = args.buf })
+ if not ft then
+ -- Generic configuration file used as fallback
+ ft = require('vim.filetype.detect').conf(args.file, args.buf)
+ if ft then
+ vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {})
+ end
+ else
+ vim.api.nvim_buf_set_option(args.buf, 'filetype', ft)
+ if on_detect then
+ on_detect(args.buf)
+ end
+ end
+ end,
+})
-" These *must* be sourced after the autocommand above is created
-runtime! ftdetect/*.vim
-runtime! ftdetect/*.lua
+-- 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
+ runtime! ftdetect/*.lua
+ augroup END
+ ]])
+end
-" Set a marker so that the ftdetect scripts are not sourced a second time by filetype.vim
-let g:did_load_ftdetect = 1
+-- Set up the autocmd for user scripts.vim
+vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
+ group = 'filetypedetect',
+ command = "if !did_filetype() && expand('<amatch>') !~ g:ft_ignore_pat | runtime! scripts.vim | endif",
+})
-augroup END
-]]
+vim.api.nvim_create_autocmd('StdinReadPost', {
+ group = 'filetypedetect',
+ command = 'if !did_filetype() | runtime! scripts.vim | endif',
+})
if not vim.g.ft_ignore_pat then
- vim.g.ft_ignore_pat = "\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$"
+ vim.g.ft_ignore_pat = '\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$'
end
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index aa12a5f8dd..f28118e272 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,12 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Jan 05
+" Last Change: 2022 Jul 5
+
+" Only run this if enabled
+if !exists("do_legacy_filetype")
+ finish
+endif
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -44,7 +49,7 @@ endif
" file name matches ft_ignore_pat.
" When using this, the entry should probably be further down below with the
" other StarSetf() calls.
-func! s:StarSetf(ft)
+func s:StarSetf(ft)
if expand("<amatch>") !~ g:ft_ignore_pat
exe 'setf ' . a:ft
endif
@@ -151,14 +156,21 @@ au BufNewFile,BufRead *.asp
\ setf aspvbs |
\ endif
-" Grub (must be before catch *.lst)
+" Grub (must be before pattern *.lst)
au BufNewFile,BufRead */boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub
+" Maxima, see:
+" https://maxima.sourceforge.io/docs/manual/maxima_71.html#file_005ftype_005fmaxima
+" Must be before the pattern *.mac.
+" *.dem omitted - also used by gnuplot demos
+" *.mc omitted - used by dist#ft#McSetf()
+au BufNewFile,BufRead *.demo,*.dm{1,2,3,t},*.wxm,maxima-init.mac setf maxima
+
" Assembly (all kinds)
" *.lst is not pure assembly, it has two extra columns (address, byte codes)
au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm()
-" Macro (VAX)
+" Assembly - Macro (VAX)
au BufNewFile,BufRead *.mar setf vmasm
" Atlas
@@ -189,7 +201,8 @@ au BufNewFile,BufRead *.awk,*.gawk setf awk
au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
" BASIC or Visual Basic
-au BufNewFile,BufRead *.bas call dist#ft#FTVB("basic")
+au BufNewFile,BufRead *.bas call dist#ft#FTbas()
+au BufNewFile,BufRead *.bi,*.bm call dist#ft#FTbas()
" Visual Basic Script (close to Visual Basic) or Visual Basic .NET
au BufNewFile,BufRead *.vb,*.vbs,*.dsm,*.ctl setf vb
@@ -198,13 +211,15 @@ au BufNewFile,BufRead *.vb,*.vbs,*.dsm,*.ctl setf vb
au BufNewFile,BufRead *.iba,*.ibi setf ibasic
" FreeBasic file (similar to QBasic)
-au BufNewFile,BufRead *.fb,*.bi setf freebasic
+au BufNewFile,BufRead *.fb setf freebasic
-" Batch file for MSDOS.
-au BufNewFile,BufRead *.bat,*.sys setf dosbatch
+" Batch file for MSDOS. See dist#ft#FTsys for *.sys
+au BufNewFile,BufRead *.bat setf dosbatch
" *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.
au BufNewFile,BufRead *.cmd
\ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif
+" ABB RAPID or Batch file for MSDOS.
+au BufNewFile,BufRead *.sys\c call dist#ft#FTsys()
" Batch file for 4DOS
au BufNewFile,BufRead *.btm call dist#ft#FTbtm()
@@ -224,6 +239,9 @@ au BufNewFile,BufRead *.bib setf bib
" BibTeX Bibliography Style
au BufNewFile,BufRead *.bst setf bst
+" Bicep
+au BufNewFile,BufRead *.bicep setf bicep
+
" BIND configuration
" sudoedit uses namedXXXX.conf
au BufNewFile,BufRead named*.conf,rndc*.conf,rndc*.key setf named
@@ -235,6 +253,9 @@ au BufNewFile,BufRead *.db call dist#ft#BindzoneCheck('')
" Blank
au BufNewFile,BufRead *.bl setf blank
+" Bitbake
+au BufNewFile,BufRead *.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/conf/*.conf setf bitbake
+
" Blkid cache file
au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
@@ -352,13 +373,8 @@ au BufNewFile,BufRead *.eni setf cl
" Clever or dtd
au BufNewFile,BufRead *.ent call dist#ft#FTent()
-" Clipper (or FoxPro; could also be eviews)
-au BufNewFile,BufRead *.prg
- \ if exists("g:filetype_prg") |
- \ exe "setf " . g:filetype_prg |
- \ else |
- \ setf clipper |
- \ endif
+" Clipper, FoxPro, ABB RAPID or eviews
+au BufNewFile,BufRead *.prg\c call dist#ft#FTprg()
" Clojure
au BufNewFile,BufRead *.clj,*.cljs,*.cljx,*.cljc setf clojure
@@ -389,12 +405,18 @@ au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf
" Configure scripts
au BufNewFile,BufRead configure.in,configure.ac setf config
+" Cooklang
+au BufNewFile,BufRead *.cook setf cook
+
+" CSV Files
+au BufNewFile,BufRead *.csv setf csv
+
" CUDA Compute Unified Device Architecture
au BufNewFile,BufRead *.cu,*.cuh setf cuda
" Dockerfile; Podman uses the same syntax with name Containerfile
" Also see Dockerfile.* below.
-au BufNewFile,BufRead Containerfile,Dockerfile,*.Dockerfile setf dockerfile
+au BufNewFile,BufRead Containerfile,Dockerfile,dockerfile,*.[dD]ockerfile setf dockerfile
" WildPackets EtherPeek Decoder
au BufNewFile,BufRead *.dcd setf dcd
@@ -412,6 +434,9 @@ au BufNewFile,BufRead *.ex call dist#ft#ExCheck()
au BufRead,BufNewFile mix.lock,*.exs setf elixir
au BufRead,BufNewFile *.eex,*.leex setf eelixir
+" Elvish
+au BufRead,BufNewFile *.elv setf elvish
+
" Euphoria 3 or 4
au BufNewFile,BufRead *.eu,*.ew,*.exu,*.exw call dist#ft#EuphoriaCheck()
if has("fname_case")
@@ -433,7 +458,7 @@ au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake
au BufNewFile,BufRead *.qc setf c
" Configure files
-au BufNewFile,BufRead *.cfg setf cfg
+au BufNewFile,BufRead *.cfg\c call dist#ft#FTcfg()
" Cucumber
au BufNewFile,BufRead *.feature setf cucumber
@@ -476,6 +501,7 @@ au BufNewFile,BufRead */etc/dnsmasq.conf setf dnsmasq
au BufNewFile,BufRead *.desc setf desc
" the D language or dtrace
+au BufNewFile,BufRead */dtrace/*.d setf dtrace
au BufNewFile,BufRead *.d call dist#ft#DtraceCheck()
" Desktop files
@@ -649,6 +675,9 @@ au BufNewFile,BufRead *.fsl setf framescript
" FStab
au BufNewFile,BufRead fstab,mtab setf fstab
+" Fusion
+au BufRead,BufNewFile *.fusion setf fusion
+
" F# or Forth
au BufNewFile,BufRead *.fs call dist#ft#FTfs()
@@ -656,11 +685,17 @@ au BufNewFile,BufRead *.fs call dist#ft#FTfs()
au BufNewFile,BufRead *.fsi,*.fsx setf fsharp
" GDB command files
-au BufNewFile,BufRead .gdbinit,gdbinit setf gdb
+au BufNewFile,BufRead .gdbinit,gdbinit,.gdbearlyinit,gdbearlyinit,*.gdb setf gdb
" GDMO
au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
+" GDscript
+au BufNewFile,BufRead *.gd setf gdscript
+
+" Godot resource
+au BufRead,BufNewFile *.tscn,*.tres setf gdresource
+
" Gedcom
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
@@ -673,8 +708,10 @@ autocmd BufRead,BufNewFile *.gift setf gift
" Git
au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
au BufNewFile,BufRead NOTES_EDITMSG,EDIT_DESCRIPTION setf gitcommit
-au BufNewFile,BufRead *.git/config,.gitconfig,/etc/gitconfig setf gitconfig
+au BufNewFile,BufRead *.git/config,.gitconfig,*/etc/gitconfig setf gitconfig
au BufNewFile,BufRead */.config/git/config setf gitconfig
+au BufNewFile,BufRead *.git/config.worktree setf gitconfig
+au BufNewFile,BufRead *.git/worktrees/*/config.worktree setf gitconfig
au BufNewFile,BufRead .gitmodules,*.git/modules/*/config setf gitconfig
if !empty($XDG_CONFIG_HOME)
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
@@ -689,6 +726,12 @@ au BufNewFile,BufRead *.git/*
" Gkrellmrc
au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
+" Gleam
+au BufNewFile,BufRead *.gleam setf gleam
+
+" GLSL
+au BufNewFile,BufRead *.glsl setf glsl
+
" GP scripts (2.0 and onward)
au BufNewFile,BufRead *.gp,.gprc setf gp
@@ -708,16 +751,24 @@ au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash
au BufNewFile,BufRead gitolite.conf setf gitolite
au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl
+" Glimmer-flavored TypeScript and JavaScript
+au BufNewFile,BufRead *.gts setf typescript.glimmer
+au BufNewFile,BufRead *.gjs setf javascript.glimmer
+
" Gnuplot scripts
-au BufNewFile,BufRead *.gpi setf gnuplot
+au BufNewFile,BufRead *.gpi,.gnuplot setf gnuplot
" Go (Google)
au BufNewFile,BufRead *.go setf go
au BufNewFile,BufRead Gopkg.lock setf toml
+au BufRead,BufNewFile go.work setf gowork
" GrADS scripts
au BufNewFile,BufRead *.gs setf grads
+" GraphQL
+au BufNewFile,BufRead *.graphql,*.graphqls,*.gql setf graphql
+
" Gretl
au BufNewFile,BufRead *.gretl setf gretl
@@ -733,12 +784,21 @@ au BufNewFile,BufRead */etc/group,*/etc/group-,*/etc/group.edit,*/etc/gshadow,*/
" GTK RC
au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
+" Hack
+au BufRead,BufNewFile *.hack,*.hackpartial setf hack
+
" Haml
au BufNewFile,BufRead *.haml setf haml
" Hamster Classic | Playground files
au BufNewFile,BufRead *.hsm setf hamster
+" Handlebars
+au BufNewFile,BufRead *.hbs setf handlebars
+
+" Hare
+au BufNewFile,BufRead *.ha setf hare
+
" Haskell
au BufNewFile,BufRead *.hs,*.hsc,*.hs-boot,*.hsig setf haskell
au BufNewFile,BufRead *.lhs setf lhaskell
@@ -751,20 +811,33 @@ au BufNewFile,BufRead cabal.config setf cabalconfig
au BufNewFile,BufRead *.ht setf haste
au BufNewFile,BufRead *.htpp setf hastepreproc
+" HCL
+au BufRead,BufNewFile *.hcl setf hcl
+
" Hercules
au BufNewFile,BufRead *.vc,*.ev,*.sum,*.errsum setf hercules
+" HEEx
+au BufRead,BufNewFile *.heex setf heex
+
" HEX (Intel)
au BufNewFile,BufRead *.hex,*.h32 setf hex
+" Hjson
+au BufNewFile,BufRead *.hjson setf hjson
+
" Hollywood
au BufRead,BufNewFile *.hws setf hollywood
+" Hoon
+au BufRead,BufNewFile *.hoon setf hoon
+
" Tilde (must be before HTML)
au BufNewFile,BufRead *.t.html setf tilde
" HTML (.shtml and .stm for server side)
au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call dist#ft#FThtml()
+au BufNewFile,BufRead *.cshtml setf html
" HTML with Ruby - eRuby
au BufNewFile,BufRead *.erb,*.rhtml setf eruby
@@ -881,6 +954,9 @@ au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial
" JSON
au BufNewFile,BufRead *.json,*.jsonp,*.webmanifest setf json
+" JSON5
+au BufNewFile,BufRead *.json5 setf json5
+
" JSON Patch (RFC 6902)
au BufNewFile,BufRead *.json-patch setf json
@@ -899,6 +975,11 @@ au BufNewFile,BufRead *.jl setf julia
" Kixtart
au BufNewFile,BufRead *.kix setf kix
+" Kuka Robot Language
+au BufNewFile,BufRead *.src\c call dist#ft#FTsrc()
+au BufNewFile,BufRead *.dat\c call dist#ft#FTdat()
+au BufNewFile,BufRead *.sub\c setf krl
+
" Kimwitu[++]
au BufNewFile,BufRead *.k setf kwt
@@ -923,8 +1004,8 @@ au BufNewFile,BufRead *.latte,*.lte setf latte
" Limits
au BufNewFile,BufRead */etc/limits,*/etc/*limits.conf,*/etc/*limits.d/*.conf setf limits
-" LambdaProlog (*.mod too, see Modsim)
-au BufNewFile,BufRead *.sig setf lprolog
+" LambdaProlog or SML (see dist#ft#FTmod for *.mod)
+au BufNewFile,BufRead *.sig call dist#ft#FTsig()
" LDAP LDIF
au BufNewFile,BufRead *.ldif setf ldif
@@ -932,6 +1013,9 @@ au BufNewFile,BufRead *.ldif setf ldif
" Ld loader
au BufNewFile,BufRead *.ld setf ld
+" Ledger
+au BufRead,BufNewFile *.ldg,*.ledger,*.journal setf ledger
+
" Less
au BufNewFile,BufRead *.less setf less
@@ -953,6 +1037,9 @@ au BufNewFile,BufRead *.ll setf lifelines
" Lilo: Linux loader
au BufNewFile,BufRead lilo.conf setf lilo
+" Lilypond
+au BufNewFile,BufRead *.ly,*.ily setf lilypond
+
" Lisp (*.el = ELisp, *.cl = Common Lisp)
" *.jl was removed, it's also used for Julia, better skip than guess wrong.
if has("fname_case")
@@ -1083,18 +1170,11 @@ au BufNewFile,BufRead *.mms call dist#ft#FTmms()
" Symbian meta-makefile definition (MMP)
au BufNewFile,BufRead *.mmp setf mmp
-" Modsim III (or LambdaProlog)
-au BufNewFile,BufRead *.mod
- \ if expand("<afile>") =~ '\<go.mod$' |
- \ setf gomod |
- \ elseif getline(1) =~ '\<module\>' |
- \ setf lprolog |
- \ else |
- \ setf modsim3 |
- \ endif
+" ABB Rapid, Modula-2, Modsim III or LambdaProlog
+au BufNewFile,BufRead *.mod\c call dist#ft#FTmod()
-" Modula-2 (.md removed in favor of Markdown)
-au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.mi setf modula2
+" Modula-2 (.md removed in favor of Markdown, see dist#ft#FTmod for *.MOD)
+au BufNewFile,BufRead *.m2,*.DEF,*.mi setf modula2
" Modula-3 (.m3, .i3, .mg, .ig)
au BufNewFile,BufRead *.[mi][3g] setf modula3
@@ -1105,6 +1185,9 @@ au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk
" MOO
au BufNewFile,BufRead *.moo setf moo
+" Moonscript
+au BufNewFile,BufRead *.moon setf moonscript
+
" Modconf
au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf modconf
@@ -1169,6 +1252,9 @@ au BufNewFile,BufRead *.nginx,nginx*.conf,*nginx.conf,*/etc/nginx/*,*/usr/local/
" Ninja file
au BufNewFile,BufRead *.ninja setf ninja
+" Nix
+au BufRead,BufNewFile *.nix setf nix
+
" NPM RC file
au BufNewFile,BufRead npmrc,.npmrc setf dosini
@@ -1214,24 +1300,30 @@ au BufNewFile,BufRead opam,*.opam,*.opam.template setf opam
au BufNewFile,BufRead [a-zA-Z0-9]*Dict\(.*\)\=,[a-zA-Z]*Properties\(.*\)\=,*Transport\(.*\),fvSchemes,fvSolution,fvConstrains,fvModels,*/constant/g,*/0\(\.orig\)\=/* call dist#ft#FTfoam()
" OpenROAD
-au BufNewFile,BufRead *.or setf openroad
+au BufNewFile,BufRead *.or setf openroad
" OPL
-au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
+au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
+
+" OpenSCAD
+au BufNewFile,BufRead *.scad setf openscad
" Oracle config file
-au BufNewFile,BufRead *.ora setf ora
+au BufNewFile,BufRead *.ora setf ora
+
+" Org
+au BufNewFile,BufRead *.org,*.org_archive setf org
" Packet filter conf
-au BufNewFile,BufRead pf.conf setf pf
+au BufNewFile,BufRead pf.conf setf pf
-" Pacman Config (close enough to dosini)
-au BufNewFile,BufRead */etc/pacman.conf setf dosini
+" ini style config files, using # comments
+au BufNewFile,BufRead */etc/pacman.conf,mpv.conf setf confini
" Pacman hooks
au BufNewFile,BufRead *.hook
\ if getline(1) == '[Trigger]' |
- \ setf dosini |
+ \ setf conf |
\ endif
" Pam conf
@@ -1241,36 +1333,36 @@ au BufNewFile,BufRead */etc/pam.conf setf pamconf
au BufNewFile,BufRead pam_env.conf,.pam_environment setf pamenv
" PApp
-au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
+au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
" Password file
au BufNewFile,BufRead */etc/passwd,*/etc/passwd-,*/etc/passwd.edit,*/etc/shadow,*/etc/shadow-,*/etc/shadow.edit,*/var/backups/passwd.bak,*/var/backups/shadow.bak setf passwd
" Pascal (also *.p, *.pp, *.inc)
-au BufNewFile,BufRead *.pas setf pascal
+au BufNewFile,BufRead *.pas setf pascal
" Pascal or Puppet manifest
-au BufNewFile,BufRead *.pp call dist#ft#FTpp()
+au BufNewFile,BufRead *.pp call dist#ft#FTpp()
" Delphi or Lazarus program file
-au BufNewFile,BufRead *.dpr,*.lpr setf pascal
+au BufNewFile,BufRead *.dpr,*.lpr setf pascal
" Free Pascal makefile definition file
-au BufNewFile,BufRead *.fpc setf fpcmake
+au BufNewFile,BufRead *.fpc setf fpcmake
" PDF
-au BufNewFile,BufRead *.pdf setf pdf
+au BufNewFile,BufRead *.pdf setf pdf
" PCMK - HAE - crm configure edit
-au BufNewFile,BufRead *.pcmk setf pcmk
+au BufNewFile,BufRead *.pcmk setf pcmk
" Perl
if has("fname_case")
- au BufNewFile,BufRead *.pl,*.PL call dist#ft#FTpl()
+ au BufNewFile,BufRead *.pl,*.PL call dist#ft#FTpl()
else
- au BufNewFile,BufRead *.pl call dist#ft#FTpl()
+ au BufNewFile,BufRead *.pl call dist#ft#FTpl()
endif
-au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl
+au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl
" Perl, XPM or XPM2
au BufNewFile,BufRead *.pm
@@ -1286,9 +1378,10 @@ au BufNewFile,BufRead *.pm
au BufNewFile,BufRead *.pod setf pod
" Php, php3, php4, etc.
-" Also Phtml (was used for PHP 2 in the past)
-" Also .ctp for Cake template file
-au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php
+" Also Phtml (was used for PHP 2 in the past).
+" Also .ctp for Cake template file.
+" Also .phpt for php tests.
+au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp,*.phpt setf php
" PHP config
au BufNewFile,BufRead php.ini-* setf dosini
@@ -1354,6 +1447,9 @@ au BufNewFile,BufRead *printcap
au BufNewFile,BufRead *termcap
\ let b:ptcap_type = "term" | setf ptcap
+" Prisma
+au BufRead,BufNewFile *.prisma setf prisma
+
" PCCTS / ANTLR
"au BufNewFile,BufRead *.g setf antlr
au BufNewFile,BufRead *.g setf pccts
@@ -1361,6 +1457,9 @@ au BufNewFile,BufRead *.g setf pccts
" PPWizard
au BufNewFile,BufRead *.it,*.ih setf ppwiz
+" Pug
+au BufRead,BufNewFile *.pug setf pug
+
" Puppet
au BufNewFile,BufRead Puppetfile setf ruby
@@ -1426,6 +1525,9 @@ au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc setf python
au BufNewFile,BufRead *.ptl,*.pyi,SConstruct setf python
+" QL
+au BufRead,BufNewFile *.ql,*.qll setf ql
+
" Radiance
au BufNewFile,BufRead *.rad,*.mat setf radiance
@@ -1491,6 +1593,9 @@ au BufNewFile,BufRead *.r,*.R call dist#ft#FTr()
" Remind
au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind
+" ReScript
+au BufNewFile,BufRead *.res,*.resi setf rescript
+
" Resolv.conf
au BufNewFile,BufRead resolv.conf setf resolv
@@ -1503,6 +1608,9 @@ au BufNewFile,BufRead *.rng setf rng
" RPL/2
au BufNewFile,BufRead *.rpl setf rpl
+" Robot Framework
+au BufNewFile,BufRead *.robot,*.resource setf robot
+
" Robots.txt
au BufNewFile,BufRead robots.txt setf robots
@@ -1562,16 +1670,22 @@ au BufNewFile,BufRead *.sass setf sass
au BufNewFile,BufRead *.sa setf sather
" Scala
-au BufNewFile,BufRead *.scala,*.sc setf scala
+au BufNewFile,BufRead *.scala setf scala
" SBT - Scala Build Tool
au BufNewFile,BufRead *.sbt setf sbt
+" SuperCollider
+au BufNewFile,BufRead *.sc call dist#ft#FTsc()
+
+au BufNewFile,BufRead *.quark setf supercollider
+
+" scdoc
+au BufNewFile,BufRead *.scd call dist#ft#FTscd()
+
" Scilab
au BufNewFile,BufRead *.sci,*.sce setf scilab
-" scdoc
-au BufNewFile,BufRead *.scd setf scdoc
" SCSS
au BufNewFile,BufRead *.scss setf scss
@@ -1594,7 +1708,8 @@ au BufNewFile,BufRead *.siv,*.sieve setf sieve
" Sendmail
au BufNewFile,BufRead sendmail.cf setf sm
-" Sendmail .mc files are actually m4. Could also be MS Message text file.
+" Sendmail .mc files are actually m4. Could also be MS Message text file or
+" Maxima.
au BufNewFile,BufRead *.mc call dist#ft#McSetf()
" Services
@@ -1665,7 +1780,7 @@ au BufNewFile,BufRead .zshrc,.zshenv,.zlogin,.zlogout,.zcompdump setf zsh
au BufNewFile,BufRead *.zsh setf zsh
" Scheme
-au BufNewFile,BufRead *.scm,*.ss,*.sld,*.rkt,*.rktd,*.rktl setf scheme
+au BufNewFile,BufRead *.scm,*.ss,*.sld,*.rkt,*.rktd,*.rktl setf scheme
" Screen RC
au BufNewFile,BufRead .screenrc,screenrc setf screen
@@ -1690,16 +1805,11 @@ au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill
au BufNewFile,BufRead .slrnrc setf slrnrc
au BufNewFile,BufRead *.score setf slrnsc
-" Smalltalk (and TeX)
+" Smalltalk
au BufNewFile,BufRead *.st setf st
-au BufNewFile,BufRead *.cls
- \ if getline(1) =~ '^%' |
- \ setf tex |
- \ elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' |
- \ setf rexx |
- \ else |
- \ setf st |
- \ endif
+
+" Smalltalk (and Rexx, TeX, and Visual Basic)
+au BufNewFile,BufRead *.cls call dist#ft#FTcls()
" Smarty templates
au BufNewFile,BufRead *.tpl setf smarty
@@ -1733,6 +1843,9 @@ au BufNewFile,BufRead *.mib,*.my setf mib
au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog
au BufNewFile,BufRead *.rules call dist#ft#FTRules()
+" Solidity
+au BufRead,BufNewFile *.sol setf solidity
+
" SPARQL queries
au BufNewFile,BufRead *.rq,*.sparql setf sparql
@@ -1830,6 +1943,9 @@ au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers
" SVG (Scalable Vector Graphics)
au BufNewFile,BufRead *.svg setf svg
+" Surface
+au BufRead,BufNewFile *.sface setf surface
+
" Tads (or Nroff or Perl test file)
au BufNewFile,BufRead *.t
\ if !dist#ft#FTnroff() && !dist#ft#FTperl() | setf tads | endif
@@ -1847,6 +1963,9 @@ au BufRead,BufNewFile *.task setf taskedit
" Tcl (JACL too)
au BufNewFile,BufRead *.tcl,*.tm,*.tk,*.itcl,*.itk,*.jacl,.tclshrc,.wishrc setf tcl
+" Teal
+au BufRead,BufNewFile *.tl setf teal
+
" TealInfo
au BufNewFile,BufRead *.tli setf tli
@@ -1864,6 +1983,9 @@ au BufRead,BufNewFile *.ttl
" Terminfo
au BufNewFile,BufRead *.ti setf terminfo
+" Terraform
+au BufRead,BufNewFile *.tfvars setf terraform
+
" TeX
au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
au BufNewFile,BufRead *.tex call dist#ft#FTtex()
@@ -1881,7 +2003,13 @@ au BufNewFile,BufRead texmf.cnf setf texmf
au BufNewFile,BufRead .tidyrc,tidyrc,tidy.conf setf tidy
" TF mud client
-au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
+au BufNewFile,BufRead .tfrc,tfrc setf tf
+
+" TF mud client or terraform
+au BufNewFile,BufRead *.tf call dist#ft#FTtf()
+
+" TLA+
+au BufNewFile,BufRead *.tla setf tla
" tmux configuration
au BufNewFile,BufRead {.,}tmux*.conf setf tmux
@@ -1890,7 +2018,7 @@ au BufNewFile,BufRead {.,}tmux*.conf setf tmux
au BufNewFile,BufRead *.toml setf toml
" TPP - Text Presentation Program
-au BufNewFile,BufReadPost *.tpp setf tpp
+au BufNewFile,BufRead *.tpp setf tpp
" Treetop
au BufRead,BufNewFile *.treetop setf treetop
@@ -1907,6 +2035,9 @@ au BufNewFile,BufReadPost *.tssop setf tssop
" TSS - Command Line (temporary)
au BufNewFile,BufReadPost *.tsscl setf tsscl
+" TSV Files
+au BufNewFile,BufRead *.tsv setf tsv
+
" Tutor mode
au BufNewFile,BufReadPost *.tutor setf tutor
@@ -1950,9 +2081,15 @@ au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart
au BufNewFile,BufRead */.config/upstart/*.conf setf upstart
au BufNewFile,BufRead */.config/upstart/*.override setf upstart
+" Vala
+au BufNewFile,BufRead *.vala setf vala
+
" Vera
au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera
+" Vagrant (uses Ruby syntax)
+au BufNewFile,BufRead Vagrantfile setf ruby
+
" Verilog HDL
au BufNewFile,BufRead *.v setf verilog
@@ -1980,7 +2117,7 @@ au BufRead,BufNewFile *.hw,*.module,*.pkg
\ endif
" Visual Basic (also uses *.bas) or FORM
-au BufNewFile,BufRead *.frm call dist#ft#FTVB("form")
+au BufNewFile,BufRead *.frm call dist#ft#FTfrm()
" SaxBasic is close to Visual Basic
au BufNewFile,BufRead *.sba setf vb
@@ -2006,6 +2143,9 @@ au BufNewFile,BufRead *.wm setf webmacro
" Wget config
au BufNewFile,BufRead .wgetrc,wgetrc setf wget
+" Wget2 config
+au BufNewFile,BufRead .wget2rc,wget2rc setf wget2
+
" Website MetaLanguage
au BufNewFile,BufRead *.wml setf wml
@@ -2144,6 +2284,9 @@ au BufNewFile,BufRead *.raml setf raml
" yum conf (close enough to dosini)
au BufNewFile,BufRead */etc/yum.conf setf dosini
+" YANG
+au BufRead,BufNewFile *.yang setf yang
+
" Zimbu
au BufNewFile,BufRead *.zu setf zimbu
" Zimbu Templates
@@ -2259,7 +2402,7 @@ au BufNewFile,BufRead *fvwm2rc*
au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom')
" Git
-au BufNewFile,BufRead */.gitconfig.d/*,/etc/gitconfig.d/* call s:StarSetf('gitconfig')
+au BufNewFile,BufRead */.gitconfig.d/*,*/etc/gitconfig.d/* call s:StarSetf('gitconfig')
" Gitolite
au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite')
@@ -2285,6 +2428,9 @@ au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig')
" Lilo: Linux loader
au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo')
+" Libsensors
+au BufNewFile,BufRead */etc/sensors.d/[^.]* call s:StarSetf('sensors')
+
" Logcheck
au BufNewFile,BufRead */etc/logcheck/*.d*/* call s:StarSetf('logcheck')
@@ -2321,7 +2467,7 @@ au BufNewFile,BufRead neomuttrc*,Neomuttrc* call s:StarSetf('neomuttrc')
au BufNewFile,BufRead tmac.* call s:StarSetf('nroff')
" OpenBSD hostname.if
-au BufNewFile,BufRead /etc/hostname.* call s:StarSetf('config')
+au BufNewFile,BufRead */etc/hostname.* call s:StarSetf('config')
" Pam conf
au BufNewFile,BufRead */etc/pam.d/* call s:StarSetf('pamconf')
@@ -2438,7 +2584,7 @@ endif
" Function called for testing all functions defined here. These are
" script-local, thus need to be executed here.
" Returns a string with error messages (hopefully empty).
-func! TestFiletypeFuncs(testlist)
+func TestFiletypeFuncs(testlist)
let output = ''
for f in a:testlist
try
diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim
index b263d0c318..5ce565ef3f 100644
--- a/runtime/ftplugin/abaqus.vim
+++ b/runtime/ftplugin/abaqus.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Abaqus finite element input file (www.abaqus.com)
" Maintainer: Carl Osterwisch <osterwischc@asme.org>
-" Last Change: 2012 Apr 30
+" Last Change: 2022 May 09
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -86,11 +86,11 @@ let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]"
\ . "|unmap <buffer> <LocalLeader><LocalLeader>"
" Undo must be done in nocompatible mode for <LocalLeader>.
-let b:undo_ftplugin = "let s:cpo_save = &cpoptions|"
+let b:undo_ftplugin = "let b:cpo_save = &cpoptions|"
\ . "set cpoptions&vim|"
\ . b:undo_ftplugin
- \ . "|let &cpoptions = s:cpo_save"
- \ . "|unlet s:cpo_save"
+ \ . "|let &cpoptions = b:cpo_save"
+ \ . "|unlet b:cpo_save"
" Restore saved compatibility options
let &cpoptions = s:cpo_save
diff --git a/runtime/ftplugin/ant.vim b/runtime/ftplugin/ant.vim
index 5905858896..aee07ca4b9 100644
--- a/runtime/ftplugin/ant.vim
+++ b/runtime/ftplugin/ant.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: ant
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/aspvbs.vim b/runtime/ftplugin/aspvbs.vim
index 660dab4685..70a130d287 100644
--- a/runtime/ftplugin/aspvbs.vim
+++ b/runtime/ftplugin/aspvbs.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: aspvbs
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/basic.vim b/runtime/ftplugin/basic.vim
index c6ec254dfc..4399fbf3ad 100644
--- a/runtime/ftplugin/basic.vim
+++ b/runtime/ftplugin/basic.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
-" Language: BASIC
+" Language: BASIC (QuickBASIC 4.5)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2015 Jan 10
+" Last Change: 2022 Jun 22
if exists("b:did_ftplugin")
finish
@@ -11,17 +11,47 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-setlocal comments=:REM,:'
+setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:'
setlocal commentstring='\ %s
setlocal formatoptions-=t formatoptions+=croql
-if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" .
- \ "All Files (*.*)\t*.*\n"
+let b:undo_ftplugin = "setl fo< com< cms<"
+
+" TODO: support exit ... as middle matches?
+if exists("loaded_matchit") && !exists("b:match_words")
+ let s:line_start = '\%(^\s*\)\@<='
+ let s:not_end = '\%(end\s\+\)\@<!'
+ let s:not_end_or_exit = '\%(\%(end\|exit\)\s\+\)\@<!'
+
+ let b:match_ignorecase = 1
+ let b:match_words =
+ \ s:not_end_or_exit .. '\<def\s\+fn:\<end\s\+def\>,' ..
+ \ s:not_end_or_exit .. '\<function\>:\<end\s\+function\>,' ..
+ \ s:not_end_or_exit .. '\<sub\>:\<end\s\+sub\>,' ..
+ \ s:not_end .. '\<type\>:\<end\s\+type\>,' ..
+ \ s:not_end .. '\<select\>:\%(select\s\+\)\@<!\<case\%(\s\+\%(else\|is\)\)\=\>:\<end\s\+select\>,' ..
+ \ '\<do\>:\<loop\>,' ..
+ \ '\<for\>\%(\s\+\%(input\|output\|random\|append\|binary\)\)\@!:\<next\>,' ..
+ \ '\<while\>:\<wend\>,' ..
+ \ s:line_start .. 'if\%(.*\<then\s*\%($\|''\)\)\@=:\<\%(' .. s:line_start .. 'else\|elseif\)\>:\<end\s\+if\>,' ..
+ \ '\<lock\>:\<unlock\>'
+ let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string" || ' ..
+ \ 'strpart(getline("."), 0, col(".") ) =~? "\\<exit\\s\\+"'
+
+ let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
+
+ unlet s:line_start s:not_end s:not_end_or_exit
endif
-let b:undo_ftplugin = "setl fo< com< cms< sua<" .
- \ " | unlet! b:browsefilter"
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" ..
+ \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" ..
+ \ "All Files (*.*)\t*.*\n"
+ let b:basic_set_browsefilter = 1
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter"
+endif
let &cpo = s:cpo_save
unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim
index d4564a4aec..cfaf26f66c 100644
--- a/runtime/ftplugin/c.vim
+++ b/runtime/ftplugin/c.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Sep 21
+" Last Change: 2022 Apr 08
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -31,7 +31,8 @@ if exists('&ofu')
endif
" Set 'comments' to format dashed lists in comments.
-setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+" Also include ///, used for Doxygen.
+ setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
" When the matchit plugin is loaded, this makes the % command skip parens and
" braces in comments properly.
diff --git a/runtime/ftplugin/clojure.vim b/runtime/ftplugin/clojure.vim
index 81d53b1227..c922d75699 100644
--- a/runtime/ftplugin/clojure.vim
+++ b/runtime/ftplugin/clojure.vim
@@ -5,7 +5,7 @@
" Meikel Brandmeyer <mb@kotka.de>
" URL: https://github.com/clojure-vim/clojure.vim
" License: Vim (see :h license)
-" Last Change: 2021-10-26
+" Last Change: 2022-03-24
if exists("b:did_ftplugin")
finish
@@ -43,7 +43,7 @@ setlocal commentstring=;\ %s
" specially and hence are not indented specially.
"
" -*- LISPWORDS -*-
-" Generated from https://github.com/clojure-vim/clojure.vim/blob/62b215f079ce0f3834fd295c7a7f6bd8cc54bcc3/clj/src/vim_clojure_static/generate.clj
+" Generated from https://github.com/clojure-vim/clojure.vim/blob/fd280e33e84c88e97860930557dba3ff80b1a82d/clj/src/vim_clojure_static/generate.clj
setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test
" Provide insert mode completions for special forms and clojure.core. As
@@ -66,10 +66,10 @@ endif
" Filter files in the browse dialog
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" .
- \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" .
- \ "Java Source Files (*.java)\t*.java\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "All Files\t*\n" .
+ \ "Clojure Files\t*.clj;*.cljc;*.cljs;*.cljx\n" .
+ \ "EDN Files\t*.edn\n" .
+ \ "Java Files\t*.java\n"
let b:undo_ftplugin .= ' | unlet! b:browsefilter'
endif
diff --git a/runtime/ftplugin/config.vim b/runtime/ftplugin/config.vim
index 7fde42ebf5..73136cbc66 100644
--- a/runtime/ftplugin/config.vim
+++ b/runtime/ftplugin/config.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: config
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/confini.vim b/runtime/ftplugin/confini.vim
new file mode 100644
index 0000000000..310e046353
--- /dev/null
+++ b/runtime/ftplugin/confini.vim
@@ -0,0 +1,10 @@
+" Vim filetype plugin file
+" Language: confini
+
+" Quit if a ftplugin file was already loaded
+if exists("b:did_ftplugin")
+ finish
+endif
+
+" Use the cfg plugin, it's similar enough.
+runtime! ftplugin/cfg.vim
diff --git a/runtime/ftplugin/cpp.vim b/runtime/ftplugin/cpp.vim
index f9d31cbec3..58c4e4b24a 100644
--- a/runtime/ftplugin/cpp.vim
+++ b/runtime/ftplugin/cpp.vim
@@ -10,6 +10,7 @@ endif
" Behaves mostly just like C
runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim
+runtime! ftplugin/c.lua ftplugin/c_*.lua ftplugin/c/*.lua
" C++ uses templates with <things>
" Disabled, because it gives an error for typing an unmatched ">".
diff --git a/runtime/ftplugin/cs.vim b/runtime/ftplugin/cs.vim
index 7c2cbda32f..f53ffcbc8e 100644
--- a/runtime/ftplugin/cs.vim
+++ b/runtime/ftplugin/cs.vim
@@ -1,29 +1,43 @@
" Vim filetype plugin file
-" Language: C#
-" Maintainer: Johannes Zellner <johannes@zellner.org>
-" Last Change: Tue, 09 Mar 2004 14:09:33 CET
+" Language: C#
+" Maintainer: Nick Jensen <nickspoon@gmail.com>
+" Former Maintainer: Johannes Zellner <johannes@zellner.org>
+" Last Change: 2021-12-07
+" License: Vim (see :h license)
+" Repository: https://github.com/nickspoons/vim-cs
-" Only do this when not done yet for this buffer
-if exists("b:did_ftplugin")
+if exists('b:did_ftplugin')
finish
endif
-
-" Don't load another plugin for this buffer
let b:did_ftplugin = 1
-let s:keepcpo= &cpo
-set cpo&vim
+
+let s:save_cpo = &cpoptions
+set cpoptions&vim
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
-setlocal fo-=t fo+=croql
+setlocal formatoptions-=t formatoptions+=croql
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "C# Source Files (*.cs)\t*.cs\n" .
- \ "All Files (*.*)\t*.*\n"
+let b:undo_ftplugin = 'setl com< fo<'
+
+if exists('loaded_matchit') && !exists('b:match_words')
+ " #if/#endif support included by default
+ let b:match_words = '\%(^\s*\)\@<=#\s*region\>:\%(^\s*\)\@<=#\s*endregion\>,'
+ let b:undo_ftplugin .= ' | unlet! b:match_words'
endif
-let &cpo = s:keepcpo
-unlet s:keepcpo
+if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
+ let b:browsefilter = "C# Source Files (*.cs *.csx)\t*.cs;*.csx\n" .
+ \ "C# Project Files (*.csproj)\t*.csproj\n" .
+ \ "Visual Studio Solution Files (*.sln)\t*.sln\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin .= ' | unlet! b:browsefilter'
+endif
+
+let &cpoptions = s:save_cpo
+unlet s:save_cpo
+
+" vim:et:sw=2:sts=2
diff --git a/runtime/ftplugin/csc.vim b/runtime/ftplugin/csc.vim
index 3a09c3bf8b..7b4126a503 100644
--- a/runtime/ftplugin/csc.vim
+++ b/runtime/ftplugin/csc.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: csc
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim
index 929823219c..ca5da5a8b9 100644
--- a/runtime/ftplugin/csh.vim
+++ b/runtime/ftplugin/csh.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: csh
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+" Previous Maintainer: Dan Sharp
" Contributor: Johannes Zellner <johannes@zellner.org>
" Last Change: 2021 Oct 15
diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim
index 6c08f6691d..a046118c70 100644
--- a/runtime/ftplugin/dtd.vim
+++ b/runtime/ftplugin/dtd.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: dtd
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/elixir.vim b/runtime/ftplugin/elixir.vim
new file mode 100644
index 0000000000..3b38051d08
--- /dev/null
+++ b/runtime/ftplugin/elixir.vim
@@ -0,0 +1,11 @@
+" Elixir filetype plugin
+" Language: Elixir
+" Maintainer: Mitchell Hanberg <vimNOSPAM@mitchellhanberg.com>
+" Last Change: 2022 Apr 20
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal commentstring=#\ %s
diff --git a/runtime/ftplugin/elm.vim b/runtime/ftplugin/elm.vim
index 1e10346186..8c2de190b0 100644
--- a/runtime/ftplugin/elm.vim
+++ b/runtime/ftplugin/elm.vim
@@ -1,7 +1,7 @@
" Elm filetype plugin file
" Language: Elm
" Maintainer: Andreas Scharf <as@99n.de>
-" Latest Revision: 2020-05-29
+" Latest Revision: 2022-04-25
if exists("b:did_ftplugin")
finish
@@ -14,5 +14,7 @@ set cpo&vim
setlocal comments=s1fl:{-,mb:\ ,ex:-},:--
setlocal commentstring=--\ %s
+let b:undo_ftplugin = "setl com< cms<"
+
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/fennel.vim b/runtime/ftplugin/fennel.vim
new file mode 100644
index 0000000000..2e502699c5
--- /dev/null
+++ b/runtime/ftplugin/fennel.vim
@@ -0,0 +1,18 @@
+" Vim filetype plugin file
+" Language: Fennel
+" Maintainer: Gregory Anders <greg[NOSPAM]@gpanders.com>
+" Last Update: 2022 Apr 20
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal commentstring=;%s
+setlocal comments=:;;,:;
+setlocal formatoptions-=t
+setlocal suffixesadd=.fnl
+setlocal lisp
+setlocal lispwords=accumulate,collect,do,doto,each,eval-compiler,fn,for,icollect,lambda,let,macro,macros,match,match-try,when,while,with-open
+
+let b:undo_ftplugin = 'setlocal commentstring< comments< formatoptions< suffixesadd< lisp< lispwords<'
diff --git a/runtime/ftplugin/fetchmail.vim b/runtime/ftplugin/fetchmail.vim
index 33bb417be4..032f6610f9 100644
--- a/runtime/ftplugin/fetchmail.vim
+++ b/runtime/ftplugin/fetchmail.vim
@@ -1,19 +1,16 @@
" Vim filetype plugin file
-" Language: fetchmail(1) RC File
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Language: fetchmail(1) RC File
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2022 Jun 30
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-let s:cpo_save = &cpo
-set cpo&vim
+setlocal comments=:# commentstring=#\ %s
+setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl com< cms< fo<"
-setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim
index 26dc90a184..8f5b243b82 100644
--- a/runtime/ftplugin/fortran.vim
+++ b/runtime/ftplugin/fortran.vim
@@ -1,6 +1,6 @@
" Vim settings file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66)
-" Version: (v53) 2021 April 06
+" Version: (v53) 2021 April 06 (updated 2022 May 22)
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-plugin from Vim
" Credits:
@@ -105,12 +105,13 @@ if !exists("b:match_words")
let s:notselect = '\%(\<select\s\+\)\@<!'
let s:notelse = '\%(\<end\s\+\|\<else\s\+\)\@<!'
let s:notprocedure = '\%(\s\+procedure\>\)\@!'
+ let s:nothash = '\%(^\s*#\s*\)\@<!'
let b:match_ignorecase = 1
let b:match_words =
\ '(:),' .
\ '\<select\s*case\>:' . s:notselect. '\<case\>:\<end\s*select\>,' .
\ s:notelse . '\<if\s*(.\+)\s*then\>:' .
- \ '\<else\s*\%(if\s*(.\+)\s*then\)\=\>:\<end\s*if\>,'.
+ \ s:nothash . '\<else\s*\%(if\s*(.\+)\s*then\)\=\>:' . s:nothash . '\<end\s*if\>,'.
\ 'do\s\+\(\d\+\):\%(^\s*\)\@<=\1\s,'.
\ s:notend . '\<do\>:\<end\s*do\>,'.
\ s:notelse . '\<where\>:\<elsewhere\>:\<end\s*where\>,'.
@@ -122,7 +123,8 @@ if !exists("b:match_words")
\ s:notend . '\<subroutine\>:\<end\s*subroutine\>,'.
\ s:notend . '\<function\>:\<end\s*function\>,'.
\ s:notend . '\<module\>' . s:notprocedure . ':\<end\s*module\>,'.
- \ s:notend . '\<program\>:\<end\s*program\>'
+ \ s:notend . '\<program\>:\<end\s*program\>,'.
+ \ '\%(^\s*\)\@<=#\s*if\%(def\|ndef\)\=\>:\%(^\s*\)\@<=#\s*\%(elif\|else\)\>:\%(^\s*\)\@<=#\s*endif\>'
endif
" File filters for :browse e
diff --git a/runtime/ftplugin/freebasic.vim b/runtime/ftplugin/freebasic.vim
index a2bb459f20..1680e84c9c 100644
--- a/runtime/ftplugin/freebasic.vim
+++ b/runtime/ftplugin/freebasic.vim
@@ -1,13 +1,81 @@
" Vim filetype plugin file
-" Language: FreeBasic
+" Language: FreeBASIC
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2015 Jan 10
+" Last Change: 2022 Jun 24
+" Setup {{{1
if exists("b:did_ftplugin")
finish
endif
-let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
runtime! ftplugin/basic.vim
-" vim: ts=8
+let s:dialect = freebasic#GetDialect()
+
+" Comments {{{1
+" add ''comments before 'comments
+let &l:comments = "sO:*\ -,mO:*\ \ ,exO:*/,s1:/',mb:',ex:'/,:''," .. &l:comments
+
+" Match words {{{1
+if exists("loaded_matchit")
+ let s:line_start = '\%(^\s*\)\@<='
+ let s:not_end = '\%(end\s\+\)\@<!'
+
+ let b:match_words ..= ','
+
+ if s:dialect == 'fb'
+ let b:match_words ..= s:not_end .. '\<constructor\>:\<end\s\+constructor\>,' ..
+ \ s:not_end .. '\<destructor\>:\<end\s\+destructor\>,' ..
+ \ s:not_end .. '\<property\>:\<end\s\+property\>,' ..
+ \ s:not_end .. '\<operator\>:\<end\s\+operator\>,' ..
+ \ s:not_end .. '\<extern\%(\s\+"\)\@=:\<end\s\+extern\>,'
+ endif
+
+ if s:dialect == 'fb' || s:dialect == 'deprecated'
+ let b:match_words ..= s:not_end .. '\<scope\>:\<end\s\+scope\>,'
+ endif
+
+ if s:dialect == 'qb'
+ let b:match_words ..= s:not_end .. '\<__asm\>:\<end\s\+__asm\>,' ..
+ \ s:not_end .. '\<__union\>:\<end\s\+__union\>,' ..
+ \ s:not_end .. '\<__with\>:\<end\s\+__with\>,'
+ else
+ let b:match_words ..= s:not_end .. '\<asm\>:\<end\s\+asm\>,' ..
+ \ s:not_end .. '\<namespace\>:\<end\s\+namespace\>,' ..
+ \ s:not_end .. '\<union\>:\<end\s\+union\>,' ..
+ \ s:not_end .. '\<with\>:\<end\s\+with\>,'
+ endif
+
+ let b:match_words ..= s:not_end .. '\<enum\>:\<end\s\+enum\>,' ..
+ \ s:line_start .. '#\s*\%(if\|ifdef\|ifndef\)\>:' ..
+ \ s:line_start .. '#\s*\%(else\|elseif\)\>:' ..
+ \ s:line_start .. '#\s*endif\>,' ..
+ \ s:line_start .. '#\s*macro\>:' .. s:line_start .. '#\s*endmacro\>,' ..
+ \ "/':'/"
+
+ " skip "function = <retval>" and "continue { do | for | while }"
+ if s:dialect == "qb"
+ let s:continue = "__continue"
+ else
+ let s:continue = "continue"
+ endif
+ let b:match_skip ..= ' || strpart(getline("."), col(".") - 1) =~? "^\\<function\\s\\+="' ..
+ \ ' || strpart(getline("."), 0, col(".") ) =~? "\\<' .. s:continue .. '\\s\\+"'
+
+ unlet s:not_end s:line_start
+endif
+
+if (has("gui_win32") || has("gui_gtk")) && exists("b:basic_set_browsefilter")
+ let b:browsefilter = "FreeBASIC Source Files (*.bas)\t*.bas\n" ..
+ \ "FreeBASIC Header Files (*.bi)\t*.bi\n" ..
+ \ "All Files (*.*)\t*.*\n"
+endif
+
+" Cleanup {{{1
+let &cpo = s:cpo_save
+unlet s:cpo_save s:dialect
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim
index 7579080ea5..3179aa2e88 100644
--- a/runtime/ftplugin/html.vim
+++ b/runtime/ftplugin/html.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: html
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/icon.vim b/runtime/ftplugin/icon.vim
new file mode 100644
index 0000000000..33a86dfb9e
--- /dev/null
+++ b/runtime/ftplugin/icon.vim
@@ -0,0 +1,36 @@
+" Vim filetype plugin file
+" Language: Icon
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jun 16
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal comments=:#
+setlocal commentstring=#\ %s
+setlocal formatoptions-=t formatoptions+=croql
+
+let b:undo_ftplugin = "setl fo< com< cms<"
+
+if exists("loaded_matchit")
+ " let b:match_ignorecase = 0
+ let b:match_words = '^\s*$\s*if\(def\|ndef\)\=\>:^\s*$\s*elif\>:^\s*$\s*else\>:^\s*$\s*endif\>,' .
+ \ '\<procedure\>:\<\%(initial\|return\|suspend\|fail\)\>:\<end\>'
+ let b:undo_ftplugin ..= " | unlet! b:match_words"
+endif
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Icon Source Files (*.icn)\t*.icn\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8
diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim
index 292cb6b166..74c8e8d1c1 100644
--- a/runtime/ftplugin/java.vim
+++ b/runtime/ftplugin/java.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: Java
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Change: 2012 Mar 11
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/jsp.vim b/runtime/ftplugin/jsp.vim
index fbba863b32..18136ccc24 100644
--- a/runtime/ftplugin/jsp.vim
+++ b/runtime/ftplugin/jsp.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: jsp
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/liquid.vim b/runtime/ftplugin/liquid.vim
index b211a884c6..f24ec4cbb2 100644
--- a/runtime/ftplugin/liquid.vim
+++ b/runtime/ftplugin/liquid.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2010 May 21
+" Last Change: 2022 Mar 15
if exists('b:did_ftplugin')
finish
@@ -53,7 +53,7 @@ if has('gui_win32')
endif
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\>'
+ 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\ %}
diff --git a/runtime/ftplugin/m3build.vim b/runtime/ftplugin/m3build.vim
index 9e1e169d38..c910eaecd0 100644
--- a/runtime/ftplugin/m3build.vim
+++ b/runtime/ftplugin/m3build.vim
@@ -1,21 +1,20 @@
" Vim filetype plugin file
" Language: Modula-3 Makefile
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 April 15
+" Last Change: 2022 June 12
if exists("b:did_ftplugin")
finish
endif
-let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
runtime! ftplugin/m3quake.vim
-if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Modula-3 Makefile (m3makefile m3overrides)\tm3makefile;m3overrides\n" ..
- \ "All Files (*.*)\t*.*\n"
+if (has("gui_win32") || has("gui_gtk")) && exists("b:m3quake_set_browsefilter")
+ let b:browsefilter = "Modula-3 Makefile (m3makefile m3overrides)\tm3makefile;m3overrides\n" ..
+ \ "All Files (*.*)\t*.*\n"
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/m3quake.vim b/runtime/ftplugin/m3quake.vim
index 627aabdc3e..7762875db9 100644
--- a/runtime/ftplugin/m3quake.vim
+++ b/runtime/ftplugin/m3quake.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Modula-3 Quake
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 April 15
+" Last Change: 2022 June 12
if exists("b:did_ftplugin")
finish
@@ -15,18 +15,20 @@ setlocal comments=s1:/*,mb:*,ex:*/,:%
setlocal commentstring=%\ %s
setlocal formatoptions-=t formatoptions+=croql
+let b:undo_ftplugin = "setl fo< com< cms<"
+
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_words = '\<\%(proc\|if\|foreach\)\>:\<else\>:\<end\>'
+ let b:undo_ftplugin ..= " | unlet! b:match_words"
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Modula-3 Quake Source Files (*.quake)\t*.quake\n" ..
\ "All Files (*.*)\t*.*\n"
+ let b:m3quake_set_browsefilter = 1
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter b:m3quake_set_browsefilter"
endif
-let b:undo_ftplugin = "setl fo< com< cms< " ..
- \ "| unlet! b:browsefilter b:match_words"
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index fce12012b5..d7a08a9941 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -24,7 +24,11 @@ if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nnoremap <silent> <buffer> k gk
nnoremap <silent> <buffer> gO :call man#show_toc()<CR>
nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
- nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
+ if get(b:, 'pager')
+ nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
+ else
+ nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
+ endif
endif
if get(g:, 'ft_man_folding_enable', 0)
diff --git a/runtime/ftplugin/masm.vim b/runtime/ftplugin/masm.vim
index 235469ac32..ab196eb820 100644
--- a/runtime/ftplugin/masm.vim
+++ b/runtime/ftplugin/masm.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Microsoft Macro Assembler (80x86)
" Maintainer: Wu Yongwei <wuyongwei@gmail.com>
-" Last Change: 2020-05-09 23:02:05 +0800
+" Last Change: 2022-04-24 21:24:52 +0800
if exists("b:did_ftplugin")
finish
@@ -15,5 +15,18 @@ let b:undo_ftplugin = "setl iskeyword<"
setlocal iskeyword=@,48-57,_,36,60,62,63,@-@
+" Matchit support
+if !exists('b:match_words')
+ let b:match_words = '^\s*\.IF\>:^\s*\.ELSEIF\>:^\s*\.ELSE\>:^\s*\.ENDIF\>,'
+ \ .. '^\s*\.REPEAT\>:^\s*\.UNTIL\(CXZ\)\?\>,'
+ \ .. '^\s*\.WHILE\>:^\s*\.ENDW\>,'
+ \ .. '^\s*IF\(1\|2\|E\|DEF\|NDEF\|B\|NB\|IDNI\?\|DIFI\?\)\?\>:^\s*ELSEIF\(1\|2\|E\|DEF\|NDEF\|B\|NB\|IDNI\?\|DIFI\?\)\?\>:^\s*ELSE\>:^\s*ENDIF\>,'
+ \ .. '\(\<MACRO\>\|^\s*%\?\s*FORC\?\>\|^\s*REPEAT\>\|^\s*WHILE\):^\s*ENDM\>,'
+ \ .. '\<PROC\>:\<ENDP\>,'
+ \ .. '\<SEGMENT\>:\<ENDS\>'
+ let b:match_ignorecase = 1
+ let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words"
+endif
+
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/modula3.vim b/runtime/ftplugin/modula3.vim
index fc9eb57949..1f8ab359d5 100644
--- a/runtime/ftplugin/modula3.vim
+++ b/runtime/ftplugin/modula3.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Modula-3
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Apr 08
+" Last Change: 2022 June 12
if exists("b:did_ftplugin")
finish
@@ -14,24 +14,28 @@ set cpo&vim
setlocal comments=s0:(*,mb:\ ,ex:*)
setlocal commentstring=(*%s*)
setlocal formatoptions-=t formatoptions+=croql
+setlocal suffixesadd+=.m3
+setlocal formatprg=m3pp
+
+let b:undo_ftplugin = "setlocal com< cms< fo< fp< sua<"
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_words = '\<REPEAT\>:\<UNTIL\>,' ..
- \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOCK\|LOOP\|TRY\|TYPECASE\|WHILE\|WITH\)\>' ..
+ \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOCK\|LOOP\|TRY\|TYPECASE\|WHILE\|WITH\|RECORD\|OBJECT\)\>' ..
\ ':' ..
- \ '\<\%(ELSIF\|ELSE\|EXCEPT\|FINALLY\)\>\|\%(^\s*\)\@<=\S.*=>' ..
+ \ '\<\%(ELSIF\|ELSE\|EXCEPT\|FINALLY\|METHODS\|OVERRIDES\)\>\|\%(^\s*\)\@<=\S.*=>' ..
\ ':' ..
- \ '\<END\>'
+ \ '\<END\>,' ..
+ \ '(\*:\*),<\*:\*>'
+ let b:undo_ftplugin ..= " | unlet! b:match_words"
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Modula-3 Source Files (*.m3)\t*.m3\n" ..
\ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-let b:undo_ftplugin = "setl com< cms< fo< " ..
- \ "| unlet! b:browsefilter b:match_words"
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/pascal.vim b/runtime/ftplugin/pascal.vim
index 2de92563ae..aba1e54f27 100644
--- a/runtime/ftplugin/pascal.vim
+++ b/runtime/ftplugin/pascal.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Pascal
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+" Previous Maintainer: Dan Sharp
" Last Change: 2021 Apr 23
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim
index 603ba49502..d0bdbc0cfb 100644
--- a/runtime/ftplugin/perl.vim
+++ b/runtime/ftplugin/perl.vim
@@ -3,7 +3,8 @@
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
-" Last Change: 2020 Apr 15
+" License: Vim License (see :help license)
+" Last Change: 2021 Nov 10
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -20,27 +21,36 @@ setlocal keywordprg=perldoc\ -f
setlocal comments=:#
setlocal commentstring=#%s
-" Change the browse dialog on Win32 to show mainly Perl-related files
-if has("gui_win32")
- let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
- \ "Perl Modules (*.pm)\t*.pm\n" .
- \ "Perl Documentation Files (*.pod)\t*.pod\n" .
- \ "All Files (*.*)\t*.*\n"
-endif
-
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
setlocal include=\\<\\(use\\\|require\\)\\>
-setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
+" '+' is removed to support plugins in Catalyst or DBIx::Class
+" where the leading plus indicates a fully-qualified module name.
+setlocal includeexpr=substitute(substitute(substitute(substitute(v:fname,'+','',''),'::','/','g'),'->\*','',''),'$','.pm','')
setlocal define=[^A-Za-z_]
setlocal iskeyword+=:
" The following line changes a global variable but is necessary to make
" gf and similar commands work. Thanks to Andrew Pimlott for pointing
-" out the problem. If this causes a problem for you, add an
-" after/ftplugin/perl.vim file that contains
-" set isfname-=:
+" out the problem.
+let s:old_isfname = &isfname
set isfname+=:
+let s:new_isfname = &isfname
+
+augroup perl_global_options
+ au!
+ exe "au BufEnter * if &filetype == 'perl' | let &isfname = '" . s:new_isfname . "' | endif"
+ exe "au BufLeave * if &filetype == 'perl' | let &isfname = '" . s:old_isfname . "' | endif"
+augroup END
+
+" Undo the stuff we changed.
+let b:undo_ftplugin = "setlocal fo< kp< com< cms< inc< inex< def< isk<" .
+ \ " | let &isfname = '" . s:old_isfname . "'"
+
+if get(g:, 'perl_fold', 0)
+ setlocal foldmethod=syntax
+ let b:undo_ftplugin .= " | setlocal fdm<"
+endif
" Set this once, globally.
if !exists("perlpath")
@@ -74,16 +84,26 @@ if &l:path == ""
else
let &l:path=&l:path.",".perlpath
endif
+
+let b:undo_ftplugin .= " | setlocal pa<"
"---------------------------------------------
-" Undo the stuff we changed.
-let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" .
- \ " | unlet! b:browsefilter"
+" Change the browse dialog to show mainly Perl-related files
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
+ \ "Perl Modules (*.pm)\t*.pm\n" .
+ \ "Perl Documentation Files (*.pod)\t*.pod\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
+endif
-" proper matching for matchit plugin
-let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
-let b:match_words = '\<if\>:\<elsif\>:\<else\>'
+" Proper matching for matchit plugin
+if exists("loaded_matchit") && !exists("b:match_words")
+ let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
+ let b:match_words = '\<if\>:\<elsif\>:\<else\>'
+ let b:undo_ftplugin .= " | unlet! b:match_words b:match_skip"
+endif
" Restore the saved compatibility options.
let &cpo = s:save_cpo
-unlet s:save_cpo
+unlet s:save_cpo s:old_isfname s:new_isfname
diff --git a/runtime/ftplugin/php.vim b/runtime/ftplugin/php.vim
index a2f8b4d8d3..2824a5853b 100644
--- a/runtime/ftplugin/php.vim
+++ b/runtime/ftplugin/php.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: php
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
@@ -71,10 +73,11 @@ exe 'nno <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
exe 'ono <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
exe 'ono <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
+setlocal suffixesadd=.php
setlocal commentstring=/*%s*/
" Undo the stuff we changed.
-let b:undo_ftplugin = "setlocal commentstring< include< omnifunc<" .
+let b:undo_ftplugin = "setlocal suffixesadd< commentstring< include< omnifunc<" .
\ " | unlet! b:browsefilter b:match_words | " .
\ s:undo_ftplugin
diff --git a/runtime/ftplugin/pod.vim b/runtime/ftplugin/pod.vim
new file mode 100644
index 0000000000..2a905ab354
--- /dev/null
+++ b/runtime/ftplugin/pod.vim
@@ -0,0 +1,71 @@
+" Vim filetype plugin file
+" Language: Perl POD format
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Author: Doug Kearns <dougkearns@gmail.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2021 Oct 19
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let s:save_cpo = &cpo
+set cpo-=C
+
+setlocal comments=fb:=for\ comment
+setlocal commentstring==for\ comment\ %s
+
+let b:undo_ftplugin = "setl com< cms<"
+
+if exists("loaded_matchit") && !exists("b:match_words")
+ let b:match_words =
+ \ '^=pod\>:^=cut\>,' .
+ \ '^=begin\s\+\(\S\+\):^=end\s\+\1,' .
+ \ '^=over\>:^=item\>:^=back\>,' .
+ \ '[IBCLEFSXZ]<<\%(\s\+\|$\)\@=:\%(\s\+\|^\)\@<=>>,' .
+ \ '[IBCLEFSXZ]<:>'
+ let b:undo_ftplugin .= " | unlet! b:match_words"
+endif
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "POD Source Files (*.pod)\t*.pod\n" .
+ \ "Perl Source Files (*.pl)\t*.pl\n" .
+ \ "Perl Modules (*.pm)\t*.pm\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
+endif
+
+function! s:jumpToSection(backwards)
+ let flags = a:backwards ? 'bsWz' : 'sWz'
+ if has('syntax_items')
+ let skip = "synIDattr(synID(line('.'), col('.'), 1), 'name') !~# '\\<podCommand\\>'"
+ else
+ let skip = ''
+ endif
+ for i in range(v:count1)
+ call search('^=\a', flags, 0, 0, skip)
+ endfor
+endfunction
+
+if !exists("no_plugin_maps") && !exists("no_pod_maps")
+ nnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR>
+ vnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR>
+ nnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR>
+ vnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR>
+ nnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR>
+ vnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR>
+ nnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR>
+ vnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR>
+ let b:undo_ftplugin .=
+ \ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" .
+ \ " | silent! exe 'nunmap <buffer> ][' | silent! exe 'vunmap <buffer> ]['" .
+ \ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" .
+ \ " | silent! exe 'nunmap <buffer> []' | silent! exe 'vunmap <buffer> []'"
+endif
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: set expandtab:
diff --git a/runtime/ftplugin/qb64.vim b/runtime/ftplugin/qb64.vim
new file mode 100644
index 0000000000..0fa36fc3d2
--- /dev/null
+++ b/runtime/ftplugin/qb64.vim
@@ -0,0 +1,26 @@
+" Vim filetype plugin file
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+runtime! ftplugin/basic.vim
+
+let s:not_end = '\%(end\s\+\)\@<!'
+
+let b:match_words ..= ',' ..
+ \ s:not_end .. '\<declare\>:\<end\s\+declare\>,' ..
+ \ '\<select\s\+everycase\>:\%(select\s\+\)\@<!\<case\%(\s\+\%(else\|is\)\)\=\>:\<end\s\+select\>,' ..
+ \ '$IF\>:$\%(ELSEIF\|ELSE\)\>:$END\s*IF\>'
+
+unlet s:not_end
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua
new file mode 100644
index 0000000000..3b99d67247
--- /dev/null
+++ b/runtime/ftplugin/query.lua
@@ -0,0 +1,6 @@
+-- Neovim filetype plugin file
+-- Language: Tree-sitter query
+-- Last Change: 2022 Mar 29
+
+-- it's a lisp!
+vim.cmd([[ runtime! ftplugin/lisp.vim ]])
diff --git a/runtime/ftplugin/reva.vim b/runtime/ftplugin/reva.vim
index 05c8bc3250..29ecab0d0a 100644
--- a/runtime/ftplugin/reva.vim
+++ b/runtime/ftplugin/reva.vim
@@ -1,7 +1,7 @@
" Vim ftplugin file
" Language: Reva Forth
" Version: 7.1
-" Last Change: 2008/01/11
+" Last Change: 2022 Apr 27
" Maintainer: Ron Aaron <ron@ronware.org>
" URL: http://ronware.org/reva/
" Filetypes: *.rf *.frt
@@ -23,3 +23,5 @@ setlocal com=s1:/*,mb:*,ex:*/,:\|,:\\
setlocal fo=tcrqol
setlocal matchpairs+=\::;
setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
+
+let b:undo_ftplugin = "setlocal sts< sw< com< fo< mps< isk<"
diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim
index 4a476fd8cf..8c1f47731c 100644
--- a/runtime/ftplugin/ruby.vim
+++ b/runtime/ftplugin/ruby.vim
@@ -3,7 +3,7 @@
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2020 Feb 13
+" Last Change: 2022 Mar 21
if (exists("b:did_ftplugin"))
finish
@@ -53,7 +53,7 @@ endif
" TODO:
"setlocal define=^\\s*def
-setlocal comments=:#
+setlocal comments=b:#
setlocal commentstring=#\ %s
if !exists('g:ruby_version_paths')
@@ -87,8 +87,14 @@ endfunction
function! s:build_path(path) abort
let path = join(map(copy(a:path), 'v:val ==# "." ? "" : v:val'), ',')
- if &g:path !~# '\v^%(\.,)=%(/%(usr|emx)/include,)=,$'
- let path = substitute(&g:path,',,$',',','') . ',' . path
+ if &g:path =~# '\v^%(\.,)=%(/%(usr|emx)/include,)=,$'
+ let path = path . ',.,,'
+ elseif &g:path =~# ',\.,,$'
+ let path = &g:path[0:-4] . path . ',.,,'
+ elseif &g:path =~# ',,$'
+ let path = &g:path[0:-2] . path . ',,'
+ else
+ let path = substitute(&g:path, '[^,]\zs$', ',', '') . path
endif
return path
endfunction
@@ -164,6 +170,8 @@ let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><ctag>| sil! cunmap <buffer
if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
nmap <buffer><script> <SID>: :<C-U>
nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR>
+ cmap <buffer> <SID><cfile> <Plug><cfile>
+ cmap <buffer> <SID><ctag> <Plug><ctag>
nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR>
nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR>
@@ -210,20 +218,20 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
call s:map('c', '', '<C-R><C-F> <Plug><cfile>')
cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : ''
- call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><ctag>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><ctag>"<CR>')
- call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><ctag>"<CR>')
-
- call s:map('n', '<silent>', 'gf <SID>c:find <Plug><cfile><CR>')
- call s:map('n', '<silent>', '<C-W>f <SID>c:sfind <Plug><cfile><CR>')
- call s:map('n', '<silent>', '<C-W><C-F> <SID>c:sfind <Plug><cfile><CR>')
- call s:map('n', '<silent>', '<C-W>gf <SID>c:tabfind <Plug><cfile><CR>')
+ call s:map('n', '<script><silent>', '<C-]> <SID>:exe v:count1."tag <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', 'g<C-]> <SID>:exe "tjump <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', 'g] <SID>:exe "tselect <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', '<C-W>] <SID>:exe v:count1."stag <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', '<C-W><C-]> <SID>:exe v:count1."stag <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', '<C-W>g<C-]> <SID>:exe "stjump <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', '<C-W>g] <SID>:exe "stselect <SID><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<script><silent>', '<C-W>} <SID>:exe v:count1."ptag <SID><ctag>"<CR>')
+ call s:map('n', '<script><silent>', '<C-W>g} <SID>:exe "ptjump <SID><ctag>"<CR>')
+
+ call s:map('n', '<script><silent>', 'gf <SID>c:find <SID><cfile><CR>')
+ call s:map('n', '<script><silent>', '<C-W>f <SID>c:sfind <SID><cfile><CR>')
+ call s:map('n', '<script><silent>', '<C-W><C-F> <SID>c:sfind <SID><cfile><CR>')
+ call s:map('n', '<script><silent>', '<C-W>gf <SID>c:tabfind <SID><cfile><CR>')
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/scdoc.vim b/runtime/ftplugin/scdoc.vim
index 2e98e647f4..552c865baa 100644
--- a/runtime/ftplugin/scdoc.vim
+++ b/runtime/ftplugin/scdoc.vim
@@ -1,6 +1,7 @@
" scdoc filetype plugin
-" Maintainer: Gregory Anders <greg@gpanders.com>
-" Last Updated: 2021-08-04
+" Maintainer: Gregory Anders <contact@gpanders.com>
+" Last Updated: 2022-05-09
+" Upstream: https://github.com/gpanders/vim-scdoc
" Only do this when not done yet for this buffer
if exists('b:did_ftplugin')
@@ -19,8 +20,3 @@ setlocal softtabstop=0
setlocal textwidth=80
let b:undo_ftplugin = 'setl com< cms< fo< et< sw< sts< tw<'
-
-if has('conceal')
- setlocal conceallevel=2
- let b:undo_ftplugin .= ' cole<'
-endif
diff --git a/runtime/ftplugin/sgml.vim b/runtime/ftplugin/sgml.vim
index bf63efbf1f..ef52125c68 100644
--- a/runtime/ftplugin/sgml.vim
+++ b/runtime/ftplugin/sgml.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: sgml
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim
index 593fcec927..93a46f63e2 100644
--- a/runtime/ftplugin/sh.vim
+++ b/runtime/ftplugin/sh.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: sh
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim
index ce00021a69..9040e19ce1 100644
--- a/runtime/ftplugin/spec.vim
+++ b/runtime/ftplugin/spec.vim
@@ -3,6 +3,7 @@
" 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
if exists("b:did_ftplugin")
finish
@@ -41,8 +42,8 @@ else:
headers = spec.sourceHeader
version = headers["Version"]
release = headers["Release"]
- vim.command("let ver = " + version)
- vim.command("let rel = " + release)
+ vim.command("let ver = '" + version + "'")
+ vim.command("let rel = '" + release + "'")
PYEND
endif
endfunction
diff --git a/runtime/ftplugin/svg.vim b/runtime/ftplugin/svg.vim
index 8fff6ea32c..6f16b1a0f4 100644
--- a/runtime/ftplugin/svg.vim
+++ b/runtime/ftplugin/svg.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: svg
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/tap.vim b/runtime/ftplugin/tap.vim
new file mode 100644
index 0000000000..c165c0ce68
--- /dev/null
+++ b/runtime/ftplugin/tap.vim
@@ -0,0 +1,27 @@
+" Vim filetype plugin file
+" Language: Verbose TAP Output
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2021 Oct 22
+
+" Only do this when not done yet for this buffer
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal foldtext=TAPTestLine_foldtext()
+function! TAPTestLine_foldtext()
+ let line = getline(v:foldstart)
+ let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
+ return sub
+endfunction
+
+setlocal foldminlines=5
+setlocal foldcolumn=2
+setlocal foldenable
+setlocal foldmethod=syntax
+
+let b:undo_ftplugin = 'setlocal foldtext< foldminlines< foldcolumn< foldenable< foldmethod<'
diff --git a/runtime/ftplugin/tcsh.vim b/runtime/ftplugin/tcsh.vim
index 33f1aabf68..85d3873b33 100644
--- a/runtime/ftplugin/tcsh.vim
+++ b/runtime/ftplugin/tcsh.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: tcsh
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+" Previous Maintainer: Dan Sharp
" Last Change: 2021 Oct 15
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/tt2html.vim b/runtime/ftplugin/tt2html.vim
index 10520d8064..0407dbba4e 100644
--- a/runtime/ftplugin/tt2html.vim
+++ b/runtime/ftplugin/tt2html.vim
@@ -1,8 +1,10 @@
+" Vim filetype plugin file
" Language: TT2 embedded with HTML
" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Homepage: http://github.com/vim-perl/vim-perl
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2013-07-21
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2018 Mar 28
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
diff --git a/runtime/ftplugin/vue.vim b/runtime/ftplugin/vue.vim
new file mode 100644
index 0000000000..e8833742ad
--- /dev/null
+++ b/runtime/ftplugin/vue.vim
@@ -0,0 +1,24 @@
+" Vim filetype plugin file
+" Language: vue
+
+if exists("b:did_ftplugin") | finish | endif
+let b:did_ftplugin = 1
+
+" Make sure the continuation lines below do not cause problems in
+" compatibility mode.
+let s:save_cpo = &cpo
+set cpo-=C
+
+" Copied from ftplugin/html.vim
+" Original thanks to Johannes Zellner and Benji Fisher.
+if exists("loaded_matchit")
+ let b:match_ignorecase = 1
+ let b:match_words = '<:>,'
+ \ .. '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,'
+ \ .. '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,'
+ \ .. '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
+endif
+
+" Restore the saved compatibility options.
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/runtime/ftplugin/wget.vim b/runtime/ftplugin/wget.vim
new file mode 100644
index 0000000000..7a10221824
--- /dev/null
+++ b/runtime/ftplugin/wget.vim
@@ -0,0 +1,29 @@
+" Vim filetype plugin file
+" Language: Wget configuration file (/etc/wgetrc ~/.wgetrc)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Apr 28
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal comments=:#,://
+setlocal commentstring=#\ %s
+setlocal formatoptions-=t formatoptions+=croql
+
+let b:undo_ftplugin = "setl fo< com< cms<"
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Wget Configuration File (wgetrc, .wgetrc)\twgetrc;.wgetrc\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8
diff --git a/runtime/ftplugin/wget2.vim b/runtime/ftplugin/wget2.vim
new file mode 100644
index 0000000000..a6845f6df5
--- /dev/null
+++ b/runtime/ftplugin/wget2.vim
@@ -0,0 +1,29 @@
+" Vim filetype plugin file
+" Language: Wget2 configuration file (/etc/wget2rc ~/.wget2rc)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Apr 28
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal comments=:#,://
+setlocal commentstring=#\ %s
+setlocal formatoptions-=t formatoptions+=croql
+
+let b:undo_ftplugin = "setl fo< com< cms<"
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Wget2 Configuration File (wget2rc, .wget2rc)\twget2rc;.wget2rc\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8
diff --git a/runtime/ftplugin/xhtml.vim b/runtime/ftplugin/xhtml.vim
index 21ed3e1100..d2a1c0b566 100644
--- a/runtime/ftplugin/xhtml.vim
+++ b/runtime/ftplugin/xhtml.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: xhtml
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim
index 1d43521155..9aa188cecc 100644
--- a/runtime/ftplugin/xml.vim
+++ b/runtime/ftplugin/xml.vim
@@ -3,7 +3,7 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Last Changed: Dec 07th, 2018
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
-" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+" Previous Maintainer: Dan Sharp
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/xs.vim b/runtime/ftplugin/xs.vim
index a28da6aa1e..206fbc2713 100644
--- a/runtime/ftplugin/xs.vim
+++ b/runtime/ftplugin/xs.vim
@@ -1,9 +1,10 @@
" Vim filetype plugin file
" Language: XS (Perl extension interface language)
" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Homepage: http://github.com/vim-perl/vim-perl
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2013-07-21
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2018 Mar 28
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
diff --git a/runtime/ftplugin/xsd.vim b/runtime/ftplugin/xsd.vim
index 6a4a193656..7d3efbb390 100644
--- a/runtime/ftplugin/xsd.vim
+++ b/runtime/ftplugin/xsd.vim
@@ -1,8 +1,10 @@
" Vim filetype plugin file
" Language: xsd
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
+"
+" This runtime file is looking for a new maintainer.
+"
+" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
diff --git a/runtime/ftplugin/xslt.vim b/runtime/ftplugin/xslt.vim
index 1a5ee62865..47e78eb81d 100644
--- a/runtime/ftplugin/xslt.vim
+++ b/runtime/ftplugin/xslt.vim
@@ -1,16 +1,18 @@
" Vim filetype plugin file
-" Language: xslt
-" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
-" Last Changed: 20 Jan 2009
-" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
+" Language: XSLT
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Dan Sharp
+" Last Change: 2022 Apr 25
-if exists("b:did_ftplugin") | finish | endif
+if exists("b:did_ftplugin")
+ finish
+endif
runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
let b:did_ftplugin = 1
" Change the :browse e filter to primarily show xsd-related files.
-if has("gui_win32") && exists("b:browsefilter")
- let b:browsefilter="XSLT Files (*.xsl,*.xslt)\t*.xsl;*.xslt\n" . b:browsefilter
+if (has("gui_win32") || has("gui_gtk")) && exists("b:browsefilter")
+ let b:browsefilter = "XSLT Files (*.xsl,*.xslt)\t*.xsl;*.xslt\n" . b:browsefilter
endif
diff --git a/runtime/indent/README.txt b/runtime/indent/README.txt
index 8b114365c6..649870636e 100644
--- a/runtime/indent/README.txt
+++ b/runtime/indent/README.txt
@@ -31,7 +31,7 @@ Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
to other buffers.
To trigger the indenting after typing a word like "endif", add the word to the
-'cinkeys' option with "+=".
+'indentkeys' option with "+=".
You normally set 'indentexpr' to evaluate a function and then define that
function. That function only needs to be defined once for as long as Vim is
diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim
index 6c8ab05267..582d033b23 100644
--- a/runtime/indent/ada.vim
+++ b/runtime/indent/ada.vim
@@ -16,6 +16,7 @@
" 15.10.2006 MK Bram's suggestion for runtime integration
" 05.11.2006 MK Bram suggested to save on spaces
" 19.09.2007 NO g: missing before ada#Comment
+" 2022 April: b:undo_indent added by Doug Kearns
" Help Page: ft-vim-indent
"------------------------------------------------------------------------------
" ToDo:
@@ -35,6 +36,8 @@ setlocal indentexpr=GetAdaIndent()
setlocal indentkeys-=0{,0}
setlocal indentkeys+=0=~then,0=~end,0=~elsif,0=~when,0=~exception,0=~begin,0=~is,0=~record
+let b:undo_indent = "setl inde< indk<"
+
" Only define the functions once.
if exists("*GetAdaIndent")
finish
diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim
index e65331977c..cf8132241c 100644
--- a/runtime/indent/awk.vim
+++ b/runtime/indent/awk.vim
@@ -24,6 +24,7 @@
" 29-04-2002 Fixed problems in function headers and max line width
" Added support for two-line if's without curly braces
" Fixed hang: 2011 Aug 31
+" 2022 April: b:undo_indent added by Doug Kearns
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -36,6 +37,8 @@ setlocal indentexpr=GetAwkIndent()
" Mmm, copied from the tcl indent program. Is this okay?
setlocal indentkeys-=:,0#
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*GetAwkIndent")
finish
diff --git a/runtime/indent/basic.vim b/runtime/indent/basic.vim
new file mode 100644
index 0000000000..7228772251
--- /dev/null
+++ b/runtime/indent/basic.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: BASIC (QuickBASIC 4.5)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/bst.vim b/runtime/indent/bst.vim
index 47e3058810..3dd8d711a8 100644
--- a/runtime/indent/bst.vim
+++ b/runtime/indent/bst.vim
@@ -1,20 +1,18 @@
" Vim indent file
" Language: bst
" Author: Tim Pope <vimNOSPAM@tpope.info>
-" $Id: bst.vim,v 1.1 2007/05/05 18:11:12 vimboss Exp $
+" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
-setlocal expandtab
setlocal indentexpr=GetBstIndent(v:lnum)
-"setlocal smartindent
setlocal cinkeys&
setlocal cinkeys-=0#
setlocal indentkeys&
-"setlocal indentkeys+=0%
+let b:undo_indent = 'setlocal indentexpr< cinkeys< indentkeys<'
" Only define the function once.
if exists("*GetBstIndent")
diff --git a/runtime/indent/cdl.vim b/runtime/indent/cdl.vim
index 0e3c6152b0..2c0fc7988e 100644
--- a/runtime/indent/cdl.vim
+++ b/runtime/indent/cdl.vim
@@ -1,7 +1,7 @@
" Description: Comshare Dimension Definition Language (CDL)
" Maintainer: Raul Segura Acevedo <raulseguraaceved@netscape.net> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: Fri Nov 30 13:35:48 2001 CST
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
"finish
@@ -12,6 +12,8 @@ setlocal indentexpr=CdlGetIndent(v:lnum)
setlocal indentkeys&
setlocal indentkeys+==~else,=~endif,=~then,;,),=
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*CdlGetIndent")
"finish
diff --git a/runtime/indent/chaiscript.vim b/runtime/indent/chaiscript.vim
index 445281cc46..b7a3fe5896 100644
--- a/runtime/indent/chaiscript.vim
+++ b/runtime/indent/chaiscript.vim
@@ -1,6 +1,7 @@
" Vim indent file
" Language: ChaiScript
" Maintainer: Jason Turner <lefticus 'at' gmail com>
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -11,6 +12,8 @@ let b:did_indent = 1
setlocal indentexpr=GetChaiScriptIndent()
setlocal autoindent
+let b:undo_indent = "setl ai< inde<"
+
" Only define the function once.
if exists("*GetChaiScriptIndent")
finish
diff --git a/runtime/indent/clojure.vim b/runtime/indent/clojure.vim
index fadcaf4b4a..5bfbfbb197 100644
--- a/runtime/indent/clojure.vim
+++ b/runtime/indent/clojure.vim
@@ -5,7 +5,7 @@
" Meikel Brandmeyer <mb@kotka.de>
" URL: https://github.com/clojure-vim/clojure.vim
" License: Vim (see :h license)
-" Last Change: 2021-10-26
+" Last Change: 2022-03-24
if exists("b:did_indent")
finish
diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim
index 845bdd7655..af27c0d49b 100644
--- a/runtime/indent/cmake.vim
+++ b/runtime/indent/cmake.vim
@@ -3,7 +3,7 @@
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
-" Last Change: 2017 Sep 24
+" Last Change: 2022 Apr 06
"
" Licence: The CMake license applies to this file. See
" https://cmake.org/licensing
@@ -17,6 +17,8 @@ let b:did_indent = 1
setlocal indentexpr=CMakeGetIndent(v:lnum)
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*CMakeGetIndent")
finish
diff --git a/runtime/indent/cs.vim b/runtime/indent/cs.vim
index 76c12efecf..acc3ba75d5 100644
--- a/runtime/indent/cs.vim
+++ b/runtime/indent/cs.vim
@@ -3,13 +3,10 @@
" Maintainer: Nick Jensen <nickspoon@gmail.com>
" Former Maintainers: Aquila Deus
" Johannes Zellner <johannes@zellner.org>
-" Last Change: 2018-11-21
-" Filenames: *.cs
+" Last Change: 2020-03-26
" License: Vim (see :h license)
" Repository: https://github.com/nickspoons/vim-cs
-"
-" Only load this indent file when no other was loaded.
if exists('b:did_indent')
finish
endif
@@ -22,19 +19,23 @@ set cpoptions&vim
setlocal indentexpr=GetCSIndent(v:lnum)
function! s:IsCompilerDirective(line)
- return a:line =~? '^\s*#'
+ " Exclude #region and #endregion - these should be indented normally
+ return a:line =~# '^\s*#' && !s:IsRegionDirective(a:line)
+endf
+
+function! s:IsRegionDirective(line)
+ return a:line =~# '^\s*#\s*region' || a:line =~# '^\s*#\s*endregion'
endf
function! s:IsAttributeLine(line)
- return a:line =~? '^\s*\[[A-Za-z]' && a:line =~? '\]$'
+ return a:line =~# '^\s*\[[A-Za-z]' && a:line =~# '\]$'
endf
function! s:FindPreviousNonCompilerDirectiveLine(start_lnum)
for delta in range(0, a:start_lnum)
let lnum = a:start_lnum - delta
let line = getline(lnum)
- let is_directive = s:IsCompilerDirective(line)
- if !is_directive
+ if !s:IsCompilerDirective(line) && !s:IsRegionDirective(line)
return lnum
endif
endfor
@@ -58,8 +59,9 @@ function! GetCSIndent(lnum) abort
let lnum = s:FindPreviousNonCompilerDirectiveLine(a:lnum - 1)
let previous_code_line = getline(lnum)
if s:IsAttributeLine(previous_code_line)
- let ind = indent(lnum)
- return ind
+ return indent(lnum)
+ elseif s:IsRegionDirective(this_line)
+ return cindent(lnum)
else
return cindent(a:lnum)
endif
diff --git a/runtime/indent/d.vim b/runtime/indent/d.vim
index 57f9125890..80c9a2f559 100644
--- a/runtime/indent/d.vim
+++ b/runtime/indent/d.vim
@@ -2,7 +2,7 @@
" Language: D
" Maintainer: Jason Mills <jmills@cs.mun.ca> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2005 Nov 22
+" Last Change: 2022 Apr 06
" Version: 0.1
"
" Please email me with bugs, comments, and suggestion. Put vim in the subject
@@ -19,4 +19,6 @@ let b:did_indent = 1
" D indenting is a lot like the built-in C indenting.
setlocal cindent
+let b:undo_indent = "setl cin<"
+
" vim: ts=8 noet
diff --git a/runtime/indent/dictconf.vim b/runtime/indent/dictconf.vim
index 2e15c76146..fa40585a92 100644
--- a/runtime/indent/dictconf.vim
+++ b/runtime/indent/dictconf.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: dict(1) configuration file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -11,3 +11,5 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},!^F,o,O cinwords= autoindent smartindent
setlocal nosmartindent
inoremap <buffer> # X#
+
+let b:undo_indent = "setl ai< cinw< indk< si< | silent! iunmap <buffer> #"
diff --git a/runtime/indent/dictdconf.vim b/runtime/indent/dictdconf.vim
index 5c4fbdafb5..5c0e7c566c 100644
--- a/runtime/indent/dictdconf.vim
+++ b/runtime/indent/dictdconf.vim
@@ -11,3 +11,5 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},!^F,o,O cinwords= autoindent smartindent
setlocal nosmartindent
inoremap <buffer> # X#
+
+let b:undo_indent = "setl ai< cinw< indk< si< | silent! iunmap <buffer> #"
diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim
index c2b3c0c58e..9fca296c0b 100644
--- a/runtime/indent/dtd.vim
+++ b/runtime/indent/dtd.vim
@@ -4,6 +4,12 @@
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Last Change: 24 Sep 2021
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
setlocal indentexpr=GetDTDIndent()
setlocal indentkeys=!^F,o,O,>
setlocal nosmartindent
diff --git a/runtime/indent/dylan.vim b/runtime/indent/dylan.vim
index 55255ddfa9..e2a6d1039c 100644
--- a/runtime/indent/dylan.vim
+++ b/runtime/indent/dylan.vim
@@ -3,7 +3,7 @@
" Maintainer: Brent A. Fulgham <bfulgham@debian.org> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
" Version: 0.01
-" Last Change: 2017 Jun 13
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -15,6 +15,9 @@ setlocal indentkeys+==~begin,=~block,=~case,=~cleanup,=~define,=~end,=~else,=~el
" Define the appropriate indent function but only once
setlocal indentexpr=DylanGetIndent()
+
+let b:undo_indent = "setl inde< indk<"
+
if exists("*DylanGetIndent")
finish
endif
diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim
index 664ad61aa5..a58ccad870 100644
--- a/runtime/indent/falcon.vim
+++ b/runtime/indent/falcon.vim
@@ -3,6 +3,7 @@
" Maintainer: Steven Oliver <oliver.steven@gmail.com>
" Website: https://steveno@github.com/steveno/falconpl-vim.git
" Credits: This is, to a great extent, a copy n' paste of ruby.vim.
+" 2022 April: b:undo_indent added by Doug Kearns
" 1. Setup {{{1
" ============
@@ -20,6 +21,8 @@ setlocal indentexpr=FalconGetIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e
setlocal indentkeys+==~case,=~catch,=~default,=~elif,=~else,=~end,=~\"
+let b:undo_indent = "setl inde< indk< si<"
+
" Define the appropriate indent function but only once
if exists("*FalconGetIndent")
finish
diff --git a/runtime/indent/fennel.vim b/runtime/indent/fennel.vim
new file mode 100644
index 0000000000..e12aa18a8a
--- /dev/null
+++ b/runtime/indent/fennel.vim
@@ -0,0 +1,12 @@
+" Vim indent file
+" Language: Fennel
+" Maintainer: Gregory Anders <greg[NOSPAM]@gpanders.com>
+" Last Change: 2022 Apr 20
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+" Use the Lisp indenting
+runtime! indent/lisp.vim
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index 26ed33a54d..9623014818 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,13 +1,13 @@
" Vim indent file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: (v48) 2020 October 07
-" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
+" Version: (v49) 2022 May 14
+" Maintainer: Ajit J. Thakkar <thakkar.ajit@gmail.com>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
" Version 0.1 was created in September 2000 by Ajit Thakkar.
" Since then, useful suggestions and contributions have been made, in order, by:
" Albert Oliver Serra, Takuya Fujiwara, Philipp Edelmann, Eisuke Kawashima,
-" and Louis Cochen.
+" Louis Cochen, and Doug Kearns.
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -17,6 +17,7 @@ let b:did_indent = 1
let s:cposet=&cpoptions
set cpoptions&vim
+let b:undo_indent = "setl inde< indk<"
setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select
setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect,=~elseif
diff --git a/runtime/indent/freebasic.vim b/runtime/indent/freebasic.vim
new file mode 100644
index 0000000000..248b928635
--- /dev/null
+++ b/runtime/indent/freebasic.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: FreeBASIC
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/gitolite.vim b/runtime/indent/gitolite.vim
index b36f30a494..22be6872cb 100644
--- a/runtime/indent/gitolite.vim
+++ b/runtime/indent/gitolite.vim
@@ -4,7 +4,7 @@
" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim)
" Maintainer: Sitaram Chamarty <sitaramc@gmail.com>
" (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>)
-" Last Change: 2017 Oct 05
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -15,6 +15,8 @@ setlocal autoindent
setlocal indentexpr=GetGitoliteIndent()
setlocal indentkeys=o,O,*<Return>,!^F,=repo,\",=
+let b:undo_indent = "setl ai< inde< indk<"
+
" Only define the function once.
if exists("*GetGitoliteIndent")
finish
diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim
index baca1d49d9..acd99d9c7d 100644
--- a/runtime/indent/haml.vim
+++ b/runtime/indent/haml.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2019 Dec 05
+" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
@@ -14,6 +14,8 @@ setlocal autoindent
setlocal indentexpr=GetHamlIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
+let b:undo_indent = "setl ai< inde< indk<"
+
" Only define the function once.
if exists("*GetHamlIndent")
finish
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index d4b91f6421..a3c32d6342 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,7 +1,7 @@
" Vim indent script for HTML
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
-" Last Change: 2021 Jun 13
+" Last Change: 2022 Jan 31
" Version: 1.0 "{{{
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -149,6 +149,15 @@ func HtmlIndent_CheckUserSettings()
let b:html_indent_line_limit = 200
endif
endif
+
+ if exists('b:html_indent_attribute')
+ let b:hi_attr_indent = b:html_indent_attribute
+ elseif exists('g:html_indent_attribute')
+ let b:hi_attr_indent = g:html_indent_attribute
+ else
+ let b:hi_attr_indent = 2
+ endif
+
endfunc "}}}
" Init Script Vars
@@ -946,11 +955,11 @@ func s:InsideTag(foundHtmlString)
let idx = match(text, '<' . s:tagname . '\s\+\zs\w')
endif
if idx == -1
- " after just "<tag" indent two levels more
+ " after just "<tag" indent two levels more by default
let idx = match(text, '<' . s:tagname . '$')
if idx >= 0
call cursor(lnum, idx + 1)
- return virtcol('.') - 1 + shiftwidth() * 2
+ return virtcol('.') - 1 + shiftwidth() * b:hi_attr_indent
endif
endif
if idx > 0
diff --git a/runtime/indent/idlang.vim b/runtime/indent/idlang.vim
index e6a1d73775..1519865ab5 100644
--- a/runtime/indent/idlang.vim
+++ b/runtime/indent/idlang.vim
@@ -2,7 +2,7 @@
" Language: IDL (ft=idlang)
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last change: 2017 Jun 13
+" Last change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +14,8 @@ setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,0=ENDWHIL
setlocal indentexpr=GetIdlangIndent(v:lnum)
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*GetIdlangIndent")
finish
diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim
index a90cff49e4..8e4c60322e 100644
--- a/runtime/indent/julia.vim
+++ b/runtime/indent/julia.vim
@@ -2,9 +2,15 @@
" Language: Julia
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
" Homepage: https://github.com/JuliaEditorSupport/julia-vim
-" Last Change: 2016 jun 16
+" Last Change: 2022 Jun 14
" Notes: originally based on Bram Molenaar's indent file for vim
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
setlocal autoindent
setlocal indentexpr=GetJuliaIndent()
diff --git a/runtime/indent/krl.vim b/runtime/indent/krl.vim
new file mode 100644
index 0000000000..cc3cbd1abb
--- /dev/null
+++ b/runtime/indent/krl.vim
@@ -0,0 +1,130 @@
+" Vim indent file
+" Language: Kuka Robot Language
+" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
+" Version: 3.0.0
+" Last Change: 15. Apr 2022
+" Credits: Based on indent/vim.vim
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nolisp
+setlocal nocindent
+setlocal nosmartindent
+setlocal autoindent
+setlocal indentexpr=GetKrlIndent()
+setlocal indentkeys=!^F,o,O,=~end,0=~else,0=~case,0=~default,0=~until,0=~continue,=~part
+let b:undo_indent = "setlocal lisp< cindent< smartindent< autoindent< indentexpr< indentkeys<"
+
+if get(g:,'krlSpaceIndent',1)
+ " Use spaces, not tabs, for indention, 2 is enough.
+ " More or even tabs would waste valuable space on the teach pendant.
+ setlocal softtabstop=2
+ setlocal shiftwidth=2
+ setlocal expandtab
+ setlocal shiftround
+ let b:undo_indent = b:undo_indent." softtabstop< shiftwidth< expandtab< shiftround<"
+endif
+
+" Only define the function once.
+if exists("*GetKrlIndent")
+ finish
+endif
+let s:keepcpo = &cpo
+set cpo&vim
+
+function GetKrlIndent() abort
+
+ let currentLine = getline(v:lnum)
+ if currentLine =~? '\v^;(\s*(end)?fold>)@!' && !get(g:, 'krlCommentIndent', 0)
+ " If current line has a ; in column 1 and is no fold, keep zero indent.
+ " This may be usefull if code is commented out at the first column.
+ return 0
+ endif
+
+ " Find a non-blank line above the current line.
+ let preNoneBlankLineNum = s:KrlPreNoneBlank(v:lnum - 1)
+ if preNoneBlankLineNum == 0
+ " At the start of the file use zero indent.
+ return 0
+ endif
+
+ let preNoneBlankLine = getline(preNoneBlankLineNum)
+ let ind = indent(preNoneBlankLineNum)
+
+ " Define add 'shiftwidth' pattern
+ let addShiftwidthPattern = '\v^\s*('
+ if get(g:, 'krlIndentBetweenDef', 1)
+ let addShiftwidthPattern ..= '(global\s+)?def(fct|dat)?\s+\$?\w'
+ let addShiftwidthPattern ..= '|'
+ endif
+ let addShiftwidthPattern ..= 'if>|while>|for>|loop>'
+ let addShiftwidthPattern ..= '|else>'
+ let addShiftwidthPattern ..= '|case>|default>'
+ let addShiftwidthPattern ..= '|repeat>'
+ let addShiftwidthPattern ..= '|skip>|(ptp_)?spline>'
+ let addShiftwidthPattern ..= '|time_block\s+(start|part)>'
+ let addShiftwidthPattern ..= '|const_vel\s+start>'
+ let addShiftwidthPattern ..= ')'
+
+ " Define Subtract 'shiftwidth' pattern
+ let subtractShiftwidthPattern = '\v^\s*('
+ if get(g:, 'krlIndentBetweenDef', 1)
+ let subtractShiftwidthPattern ..= 'end(fct|dat)?>'
+ let subtractShiftwidthPattern ..= '|'
+ endif
+ let subtractShiftwidthPattern ..= 'end(if|while|for|loop)>'
+ let subtractShiftwidthPattern ..= '|else>'
+ let subtractShiftwidthPattern ..= '|case>|default>|endswitch>'
+ let subtractShiftwidthPattern ..= '|until>'
+ let subtractShiftwidthPattern ..= '|end(skip|spline)>'
+ let subtractShiftwidthPattern ..= '|time_block\s+(part|end)>'
+ let subtractShiftwidthPattern ..= '|const_vel\s+end>'
+ let subtractShiftwidthPattern ..= ')'
+
+ " Add shiftwidth
+ if preNoneBlankLine =~? addShiftwidthPattern
+ let ind += &sw
+ endif
+
+ " Subtract shiftwidth
+ if currentLine =~? subtractShiftwidthPattern
+ let ind = ind - &sw
+ endif
+
+ " First case after a switch gets the indent of the switch.
+ if currentLine =~? '\v^\s*case>'
+ \&& preNoneBlankLine =~? '\v^\s*switch>'
+ let ind = ind + &sw
+ endif
+
+ " align continue with the following instruction
+ if currentLine =~? '\v^\s*continue>'
+ \&& getline(v:lnum + 1) =~? subtractShiftwidthPattern
+ let ind = ind - &sw
+ endif
+
+ return ind
+endfunction
+
+" This function works almost like prevnonblank() but handles &-headers,
+" comments and continue instructions like blank lines
+function s:KrlPreNoneBlank(lnum) abort
+
+ let nPreNoneBlank = prevnonblank(a:lnum)
+
+ while nPreNoneBlank > 0 && getline(nPreNoneBlank) =~? '\v^\s*(\&\w\+|;|continue>)'
+ " Previouse none blank line irrelevant. Look further aback.
+ let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1)
+ endwhile
+
+ return nPreNoneBlank
+endfunction
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
+" vim:sw=2 sts=2 et
diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim
index 7beb0388d1..6fc933797e 100644
--- a/runtime/indent/liquid.vim
+++ b/runtime/indent/liquid.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2017 Jun 13
+" Last Change: 2022 Mar 15
if exists('b:did_indent')
finish
@@ -29,17 +29,19 @@ let b:did_indent = 1
setlocal indentexpr=GetLiquidIndent()
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists('*GetLiquidIndent')
finish
endif
-function! s:count(string,pattern)
+function! s:count(string, pattern) abort
let string = substitute(a:string,'\C'.a:pattern,"\n",'g')
return strlen(substitute(string,"[^\n]",'','g'))
endfunction
-function! GetLiquidIndent(...)
+function! GetLiquidIndent(...) abort
if a:0 && a:1 == '.'
let v:lnum = line('.')
elseif a:0 && a:1 =~ '^\d'
@@ -51,13 +53,14 @@ function! GetLiquidIndent(...)
let lnum = prevnonblank(v:lnum-1)
let line = getline(lnum)
let cline = getline(v:lnum)
- let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
- let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
- let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
+ let line = substitute(line,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+','','')
+ let line = substitute(line,'\C\%(\s*{%-\=\s*if.\+-\=%}.\+{%-\=\s*endif\s*-\=%}\)\+','','g')
+ let line .= matchstr(cline,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+')
+ let cline = substitute(cline,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+','','')
let sw = shiftwidth()
- let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
- let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
- let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
- let ind -= sw * s:count(cline,'{%\s*end\w*$')
+ let ind += sw * s:count(line,'{%-\=\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
+ let ind -= sw * s:count(line,'{%-\=\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
+ let ind -= sw * s:count(cline,'{%-\=\s*\%(elsif\|else\|when\|empty\)\>')
+ let ind -= sw * s:count(cline,'{%-\=\s*end\w*$')
return ind
endfunction
diff --git a/runtime/indent/make.vim b/runtime/indent/make.vim
index 76c8f83399..4d1838b3aa 100644
--- a/runtime/indent/make.vim
+++ b/runtime/indent/make.vim
@@ -2,7 +2,7 @@
" Language: Makefile
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Last Change: 24 Sep 2021
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -13,7 +13,7 @@ setlocal indentexpr=GetMakeIndent()
setlocal indentkeys=!^F,o,O,<:>,=else,=endif
setlocal nosmartindent
-let b:undo_indent = "setl ai< inde< indk<"
+let b:undo_indent = "setl inde< indk< si<"
if exists("*GetMakeIndent")
finish
diff --git a/runtime/indent/mma.vim b/runtime/indent/mma.vim
index ebf98b9a38..9dbfd74d66 100644
--- a/runtime/indent/mma.vim
+++ b/runtime/indent/mma.vim
@@ -3,6 +3,7 @@
" Maintainer: Steve Layland <layland@wolfram.com> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
" Last Change: Sat May 10 18:56:22 CDT 2005
+" 2022 April: b:undo_indent added by Doug Kearns
" Source: http://vim.sourceforge.net/scripts/script.php?script_id=1274
" http://members.wolfram.com/layland/vim/indent/mma.vim
"
@@ -26,6 +27,8 @@ setlocal indentexpr=GetMmaIndent()
setlocal indentkeys+=0[,0],0(,0)
setlocal nosi "turn off smart indent so we don't over analyze } blocks
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetMmaIndent")
finish
endif
diff --git a/runtime/indent/nginx.vim b/runtime/indent/nginx.vim
index d4afec1c11..8cef7662e0 100644
--- a/runtime/indent/nginx.vim
+++ b/runtime/indent/nginx.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: nginx.conf
" Maintainer: Chris Aumann <me@chr4.org>
-" Last Change: Apr 15, 2017
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -15,3 +15,5 @@ setlocal cindent
" Just make sure that the comments are not reset as defs would be.
setlocal cinkeys-=0#
+
+let b:undo_indent = "setl inde< cin< cink<"
diff --git a/runtime/indent/objc.vim b/runtime/indent/objc.vim
index a5451a5a11..1d107050dd 100644
--- a/runtime/indent/objc.vim
+++ b/runtime/indent/objc.vim
@@ -1,9 +1,7 @@
" Vim indent file
" Language: Objective-C
" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
-" Last Change: 2004 May 16
-"
-
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -19,6 +17,8 @@ setlocal indentexpr=GetObjCIndent()
setlocal indentkeys-=:
setlocal indentkeys+=<:>
+let b:undo_indent = "setl cin< inde< indk<"
+
" Only define the function once.
if exists("*GetObjCIndent")
finish
diff --git a/runtime/indent/occam.vim b/runtime/indent/occam.vim
index 2979ac16ac..673940a7ec 100644
--- a/runtime/indent/occam.vim
+++ b/runtime/indent/occam.vim
@@ -2,7 +2,7 @@
" Language: occam
" Maintainer: Mario Schweigler <ms44@kent.ac.uk> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 23 April 2003
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -17,6 +17,8 @@ setlocal indentexpr=GetOccamIndent()
setlocal indentkeys=o,O,0=:
"}}}
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once
if exists("*GetOccamIndent")
finish
diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim
index 5fc8b7008a..4c91fa1b33 100644
--- a/runtime/indent/perl.vim
+++ b/runtime/indent/perl.vim
@@ -1,9 +1,10 @@
" Vim indent file
-" Language: Perl 5
+" Language: Perl
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
-" Last Change: 2020 Apr 15
+" License: Vim License (see :help license)
+" Last Change: 2021 Sep 24
" Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints)
@@ -35,6 +36,8 @@ if !b:indent_use_syntax
setlocal indentkeys+=0=EO
endif
+let b:undo_indent = "setl inde< indk<"
+
let s:cpo_save = &cpo
set cpo-=C
diff --git a/runtime/indent/postscr.vim b/runtime/indent/postscr.vim
index 0691cd237c..8430ccf8b8 100644
--- a/runtime/indent/postscr.vim
+++ b/runtime/indent/postscr.vim
@@ -1,9 +1,7 @@
" PostScript indent file
" Language: PostScript
-" Maintainer: Mike Williams <mrw@netcomuk.co.uk> (Invalid email address)
-" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2nd July 2001
-"
+" Maintainer: Mike Williams <mrw@eandem.co.uk>
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +12,8 @@ let b:did_indent = 1
setlocal indentexpr=PostscrIndentGet(v:lnum)
setlocal indentkeys+=0],0=>>,0=%%,0=end,0=restore,0=grestore indentkeys-=:,0#,e
+let b:undo_indent = "setl inde< indk<"
+
" Catch multiple instantiations
if exists("*PostscrIndentGet")
finish
diff --git a/runtime/indent/pov.vim b/runtime/indent/pov.vim
index f74c96b7f7..60077ffffe 100644
--- a/runtime/indent/pov.vim
+++ b/runtime/indent/pov.vim
@@ -2,6 +2,7 @@
" Language: PoV-Ray Scene Description Language
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
" Last Change: 2017 Jun 13
+" 2022 April: b:undo_indent added by Doug Kearns
" URI: http://trific.ath.cx/Ftp/vim/indent/pov.vim
" Only load this indent file when no other was loaded.
@@ -16,6 +17,8 @@ setlocal nolisp " Make sure lisp indenting doesn't supersede us.
setlocal indentexpr=GetPoVRayIndent()
setlocal indentkeys+==else,=end,0]
+let b:undo_indent = "setl inde< indk< lisp<"
+
" Only define the function once.
if exists("*GetPoVRayIndent")
finish
diff --git a/runtime/indent/prolog.vim b/runtime/indent/prolog.vim
index ac03c28064..0c4fd541f9 100644
--- a/runtime/indent/prolog.vim
+++ b/runtime/indent/prolog.vim
@@ -4,6 +4,7 @@
" Doug Kearns <dougkearns@gmail.com>
" Revised on: 2002.02.18. 23:34:05
" Last change by: Takuya Fujiwara, 2018 Sep 23
+" 2022 April: b:undo_indent added by Doug Kearns
" TODO:
" checking with respect to syntax highlighting
@@ -21,6 +22,8 @@ setlocal indentexpr=GetPrologIndent()
setlocal indentkeys-=:,0#
setlocal indentkeys+=0%,-,0;,>,0)
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
"if exists("*GetPrologIndent")
" finish
diff --git a/runtime/indent/systemd.vim b/runtime/indent/qb64.vim
index a05a87bb1c..09f815c43d 100644
--- a/runtime/indent/systemd.vim
+++ b/runtime/indent/qb64.vim
@@ -1,10 +1,11 @@
" Vim indent file
-" Language: systemd.unit(5)
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
-" Looks a lot like dosini files.
-runtime! indent/dosini.vim
+runtime! indent/vb.vim
diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua
new file mode 100644
index 0000000000..c86948e95e
--- /dev/null
+++ b/runtime/indent/query.lua
@@ -0,0 +1,6 @@
+-- Neovim indent file
+-- Language: Tree-sitter query
+-- Last Change: 2022 Mar 29
+
+-- it's a lisp!
+vim.cmd([[ runtime! indent/lisp.vim ]])
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index 559d8652a6..6ce8529fd1 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -4,7 +4,7 @@
" Previous Maintainer: Nikolai Weibull <now at bitwi.se>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Feb 03
+" Last Change: 2022 Mar 22
" 0. Initialization {{{1
" =================
@@ -40,9 +40,11 @@ setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetRubyIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,.
-setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
+setlocal indentkeys+==end,=else,=elsif,=when,=in\ ,=ensure,=rescue,==begin,==end
setlocal indentkeys+==private,=protected,=public
+let b:undo_indent = "setlocal indentexpr< indentkeys< smartindent<"
+
" Only define the function once.
if exists("*GetRubyIndent")
finish
@@ -85,14 +87,17 @@ let s:skip_expr =
" Regex used for words that, at the start of a line, add a level of indent.
let s:ruby_indent_keywords =
\ '^\s*\zs\<\%(module\|class\|if\|for' .
- \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' .
+ \ '\|while\|until\|else\|elsif\|case\|when\|in\|unless\|begin\|ensure\|rescue' .
\ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
+" Def without an end clause: def method_call(...) = <expression>
+let s:ruby_endless_def = '\<def\s\+\k\+[!?]\=\%((.*)\|\s\)\s*='
+
" Regex used for words that, at the start of a line, remove a level of indent.
let s:ruby_deindent_keywords =
- \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\):\@!\>'
+ \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|in\|end\):\@!\>'
" Regex that defines the start-match for the 'end' keyword.
"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
@@ -104,15 +109,31 @@ let s:end_start_regex =
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.
-let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
+let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|\%(\%(^\|;\)\s*\)\@<=\<in\|elsif\):\@!\>'
" Regex that defines the end-match for the 'end' keyword.
let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
-" Expression used for searchpair() call for finding match for 'end' keyword.
-let s:end_skip_expr = s:skip_expr .
- \ ' || (expand("<cword>") == "do"' .
- \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
+" Expression used for searchpair() call for finding a match for an 'end' keyword.
+function! s:EndSkipExpr()
+ if eval(s:skip_expr)
+ return 1
+ elseif expand('<cword>') == 'do'
+ \ && getline(".") =~ '^\s*\<\(while\|until\|for\):\@!\>'
+ return 1
+ elseif getline('.') =~ s:ruby_endless_def
+ return 1
+ elseif getline('.') =~ '\<def\s\+\k\+[!?]\=([^)]*$'
+ " Then it's a `def method(` with a possible `) =` later
+ call search('\<def\s\+\k\+\zs(', 'W', line('.'))
+ normal! %
+ return getline('.') =~ ')\s*='
+ else
+ return 0
+ endif
+endfunction
+
+let s:end_skip_expr = function('s:EndSkipExpr')
" Regex that defines continuation lines, not including (, {, or [.
let s:non_bracket_continuation_regex =
@@ -572,6 +593,11 @@ function! s:AfterUnbalancedBracket(pline_info) abort
call cursor(info.plnum, closing.pos + 1)
normal! %
+ if strpart(info.pline, closing.pos) =~ '^)\s*='
+ " special case: the closing `) =` of an endless def
+ return indent(s:GetMSL(line('.')))
+ endif
+
if s:Match(line('.'), s:ruby_indent_keywords)
return indent('.') + info.sw
else
@@ -610,7 +636,7 @@ function! s:AfterIndentKeyword(pline_info) abort
let info = a:pline_info
let col = s:Match(info.plnum, s:ruby_indent_keywords)
- if col > 0
+ if col > 0 && s:Match(info.plnum, s:ruby_endless_def) <= 0
call cursor(info.plnum, col)
let ind = virtcol('.') - 1 + info.sw
" TODO: make this better (we need to count them) (or, if a searchpair
@@ -657,7 +683,7 @@ function! s:IndentingKeywordInMSL(msl_info) abort
" TODO: this does not take into account contrived things such as
" module Foo; class Bar; end
let col = s:Match(info.plnum_msl, s:ruby_indent_keywords)
- if col > 0
+ if col > 0 && s:Match(info.plnum_msl, s:ruby_endless_def) <= 0
let ind = indent(info.plnum_msl) + info.sw
if s:Match(info.plnum_msl, s:end_end_regex)
let ind = ind - info.sw
diff --git a/runtime/indent/sas.vim b/runtime/indent/sas.vim
index 9cc9e025c4..bbbbbf02eb 100644
--- a/runtime/indent/sas.vim
+++ b/runtime/indent/sas.vim
@@ -2,7 +2,7 @@
" Language: SAS
" Maintainer: Zhen-Huan Hu <wildkeny@gmail.com>
" Version: 3.0.3
-" Last Change: Jun 26, 2018
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -12,6 +12,8 @@ let b:did_indent = 1
setlocal indentexpr=GetSASIndent()
setlocal indentkeys+=;,=~data,=~proc,=~macro
+let b:undo_indent = "setl inde< indk<"
+
if exists("*GetSASIndent")
finish
endif
diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim
index d6dbf3a8bb..8c0ecd0746 100644
--- a/runtime/indent/sass.vim
+++ b/runtime/indent/sass.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2017 Jun 13
+" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
@@ -12,6 +12,8 @@ setlocal autoindent sw=2 et
setlocal indentexpr=GetSassIndent()
setlocal indentkeys=o,O,*<Return>,<:>,!^F
+let b:undo_indent = "setl ai< inde< indk<"
+
" Only define the function once.
if exists("*GetSassIndent")
finish
diff --git a/runtime/indent/sml.vim b/runtime/indent/sml.vim
index e760a8e350..a0b0c3e911 100644
--- a/runtime/indent/sml.vim
+++ b/runtime/indent/sml.vim
@@ -7,10 +7,11 @@
" Mike Leary <leary@nwlink.com>
" Markus Mottl <markus@oefai.at>
" OCaml URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim
-" Last Change: 2003 Jan 04 - Adapted to SML
+" Last Change: 2022 Apr 06
" 2002 Nov 06 - Some fixes (JY)
" 2002 Oct 28 - Fixed bug with indentation of ']' (MM)
" 2002 Oct 22 - Major rewrite (JY)
+" 2022 April: b:undo_indent added by Doug Kearns
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -26,6 +27,8 @@ setlocal nosmartindent
setlocal textwidth=80
setlocal shiftwidth=2
+let b:undo_indent = "setl et< inde< indk< lisp< si< sw< tw<"
+
" Comment formatting
if (has("comments"))
set comments=sr:(*,mb:*,ex:*)
diff --git a/runtime/indent/systemverilog.vim b/runtime/indent/systemverilog.vim
index 16fb4515c5..f6114dc1fd 100644
--- a/runtime/indent/systemverilog.vim
+++ b/runtime/indent/systemverilog.vim
@@ -2,6 +2,7 @@
" Language: SystemVerilog
" Maintainer: kocha <kocha.lsifrontend@gmail.com>
" Last Change: 05-Feb-2017 by Bilal Wasim
+" 2022 April: b:undo_indent added by Doug Kearns
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -16,6 +17,8 @@ setlocal indentkeys+==endclass,=endpackage,=endsequence,=endclocking
setlocal indentkeys+==endinterface,=endgroup,=endprogram,=endproperty,=endchecker
setlocal indentkeys+==`else,=`endif
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*SystemVerilogIndent")
finish
diff --git a/runtime/indent/testdir/html.in b/runtime/indent/testdir/html.in
index 1acf8c0402..b62c67ddb2 100644
--- a/runtime/indent/testdir/html.in
+++ b/runtime/indent/testdir/html.in
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@ dd text
dt text
</dt>
</dl>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
@@ -50,6 +55,7 @@ dt text
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@ div#d2 { color: green; }
var v1 = "v1";
var v2 = "v2";
</script>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
% END_INDENT
diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok
index c0dfc9dc72..938e965d8c 100644
--- a/runtime/indent/testdir/html.ok
+++ b/runtime/indent/testdir/html.ok
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@ div#d2 { color: green; }
dt text
</dt>
</dl>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
@@ -50,6 +55,7 @@ div#d2 { color: green; }
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@ div#d2 { color: green; }
var v1 = "v1";
var v2 = "v2";
</script>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
% END_INDENT
diff --git a/runtime/indent/testdir/krl.in b/runtime/indent/testdir/krl.in
new file mode 100644
index 0000000000..ec90feb08b
--- /dev/null
+++ b/runtime/indent/testdir/krl.in
@@ -0,0 +1,148 @@
+; vim: set ft=krl :
+
+; START_INDENT
+
+def One()
+int i
+If i==1 then
+While i>=1
+For i=1 to 5 step 2
+Loop
+i = i+1
+EndLoop
+EndFor
+EndWhile
+Else
+Repeat
+Switch i
+Case 1
+Skip 123
+i = i+1
+EndSkip 123
+Spline with $acc=100, $vel.cp=3
+slin {x 100}
+scirc {x 110, y 110}, {x 120, y 90}
+slin {x 200} c_dis
+Time_Block Start
+slin {x 300} c_dis
+Time_Block Part = 22.2
+slin {y 400} c_dis
+Time_Block Part = 33.3
+Time_Block End = 10
+slin {y 200} c_dis
+Const_Vel Start +100 OnStart
+slin {y 300} c_dis
+slin {x 100}
+Const_Vel End -5.5
+slin {y 200} c_dis
+EndSpline
+Case 2,3
+PTP_Spline with $acc=100, $vel.ptp=100
+sptp {a1 0} c_ptp
+sptp {a1 90}
+EndSpline c_spl
+Default
+i = i+1
+EndSwitch
+Continue
+Until False
+EndIf
+end
+
+DEF Two()
+int i
+END
+
+global def Three()
+int i
+end
+
+GLOBAL DEF Four()
+int i
+END
+
+Global Def Five()
+int i
+End
+
+deffct bool fOne()
+int i
+endfct
+
+DEFFCT bool fTwo()
+int i
+ENDFCT
+
+global deffct bool fThree()
+int i
+endfct
+
+GLOBAL DEFFCT bool fFour()
+int i
+ENDFCT
+
+Global DefFct bool fFive()
+int i
+EndFct
+
+DefDat datfile()
+global int i=1
+; don't indent column 1 comments unless g:krlCommentIndent is set
+; global int o=2
+EndDat
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlSpaceIndent = 0
+; INDENT_EXE set shiftwidth=4
+
+def bla()
+int i
+end
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlCommentIndent = 1
+def bla()
+; indent this first column comment because of g:krlCommentIndent=1
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlIndentBetweenDef = 0
+def bla()
+int i ; don't indent this line because of g:krlIndentBetweenDef=0
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_AT this-line
+def Some()
+int f
+if true then
+f = 1 ; this-line
+endif
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_NEXT next-line
+def Some()
+ int i
+ ; next-line
+i = 1 ; should get indent of line 'int i' above
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_PREV prev-line
+def Some()
+int f
+if true then
+f = 1
+; prev-line
+endif
+end
+; END_INDENT
diff --git a/runtime/indent/testdir/krl.ok b/runtime/indent/testdir/krl.ok
new file mode 100644
index 0000000000..34dc0f57b1
--- /dev/null
+++ b/runtime/indent/testdir/krl.ok
@@ -0,0 +1,148 @@
+; vim: set ft=krl :
+
+; START_INDENT
+
+def One()
+ int i
+ If i==1 then
+ While i>=1
+ For i=1 to 5 step 2
+ Loop
+ i = i+1
+ EndLoop
+ EndFor
+ EndWhile
+ Else
+ Repeat
+ Switch i
+ Case 1
+ Skip 123
+ i = i+1
+ EndSkip 123
+ Spline with $acc=100, $vel.cp=3
+ slin {x 100}
+ scirc {x 110, y 110}, {x 120, y 90}
+ slin {x 200} c_dis
+ Time_Block Start
+ slin {x 300} c_dis
+ Time_Block Part = 22.2
+ slin {y 400} c_dis
+ Time_Block Part = 33.3
+ Time_Block End = 10
+ slin {y 200} c_dis
+ Const_Vel Start +100 OnStart
+ slin {y 300} c_dis
+ slin {x 100}
+ Const_Vel End -5.5
+ slin {y 200} c_dis
+ EndSpline
+ Case 2,3
+ PTP_Spline with $acc=100, $vel.ptp=100
+ sptp {a1 0} c_ptp
+ sptp {a1 90}
+ EndSpline c_spl
+ Default
+ i = i+1
+ EndSwitch
+ Continue
+ Until False
+ EndIf
+end
+
+DEF Two()
+ int i
+END
+
+global def Three()
+ int i
+end
+
+GLOBAL DEF Four()
+ int i
+END
+
+Global Def Five()
+ int i
+End
+
+deffct bool fOne()
+ int i
+endfct
+
+DEFFCT bool fTwo()
+ int i
+ENDFCT
+
+global deffct bool fThree()
+ int i
+endfct
+
+GLOBAL DEFFCT bool fFour()
+ int i
+ENDFCT
+
+Global DefFct bool fFive()
+ int i
+EndFct
+
+DefDat datfile()
+ global int i=1
+; don't indent column 1 comments unless g:krlCommentIndent is set
+; global int o=2
+EndDat
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlSpaceIndent = 0
+; INDENT_EXE set shiftwidth=4
+
+def bla()
+ int i
+end
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlCommentIndent = 1
+def bla()
+ ; indent this first column comment because of g:krlCommentIndent=1
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlIndentBetweenDef = 0
+def bla()
+int i ; don't indent this line because of g:krlIndentBetweenDef=0
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_AT this-line
+def Some()
+int f
+if true then
+ f = 1 ; this-line
+endif
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_NEXT next-line
+def Some()
+ int i
+ ; next-line
+ i = 1 ; should get indent of line 'int i' above
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_PREV prev-line
+def Some()
+int f
+if true then
+ f = 1
+; prev-line
+endif
+end
+; END_INDENT
diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in
index 699e4c243d..873045bc2c 100644
--- a/runtime/indent/testdir/vim.in
+++ b/runtime/indent/testdir/vim.in
@@ -30,6 +30,12 @@ for x in [
eval 0
endfor
+let t = [
+\ {
+\ 'k': 'val',
+\ },
+\ ]
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok
index f597d97e80..8e70abe619 100644
--- a/runtime/indent/testdir/vim.ok
+++ b/runtime/indent/testdir/vim.ok
@@ -30,6 +30,12 @@ for x in [
eval 0
endfor
+let t = [
+ \ {
+ \ 'k': 'val',
+ \ },
+ \ ]
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/testdir/yaml.in b/runtime/indent/testdir/yaml.in
index 8515e1752c..bf99668da2 100644
--- a/runtime/indent/testdir/yaml.in
+++ b/runtime/indent/testdir/yaml.in
@@ -14,6 +14,7 @@ map: val
# END_INDENT
# START_INDENT
-map: multiline
-value
+map: |
+line1
+line2
# END_INDENT
diff --git a/runtime/indent/testdir/yaml.ok b/runtime/indent/testdir/yaml.ok
index 5ca2871fc9..8b38633e71 100644
--- a/runtime/indent/testdir/yaml.ok
+++ b/runtime/indent/testdir/yaml.ok
@@ -14,6 +14,7 @@ map: val
# END_INDENT
# START_INDENT
-map: multiline
- value
+map: |
+ line1
+ line2
# END_INDENT
diff --git a/runtime/indent/tf.vim b/runtime/indent/tf.vim
index a980538506..bb40bf6f01 100644
--- a/runtime/indent/tf.vim
+++ b/runtime/indent/tf.vim
@@ -2,7 +2,7 @@
" Language: tf (TinyFugue)
" Maintainer: Christian J. Robinson <heptite@gmail.com>
" URL: http://www.vim.org/scripts/script.php?script_id=174
-" Last Change: 2017 Feb 25
+" Last Change: 2022 Apr 25
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +14,8 @@ setlocal indentexpr=GetTFIndent()
setlocal indentkeys-=0{,0} indentkeys-=0# indentkeys-=:
setlocal indentkeys+==/endif,=/then,=/else,=/done,0;
+let b:undo_indent = "setlocal indentexpr< indentkeys<"
+
" Only define the function once:
if exists("*GetTFIndent")
finish
diff --git a/runtime/indent/tilde.vim b/runtime/indent/tilde.vim
index e722a0994c..8658035f72 100644
--- a/runtime/indent/tilde.vim
+++ b/runtime/indent/tilde.vim
@@ -1,7 +1,8 @@
"Description: Indent scheme for the tilde weblanguage
-"Author: Tobias Rundström <tobi@tobi.nu>
+"Author: Tobias Rundström <tobi@tobi.nu> (Invalid email address)
"URL: http://tilde.tildesoftware.net
"Last Change: May 8 09:15:09 CEST 2002
+" 2022 April: b:undo_indent added by Doug Kearns
if exists ("b:did_indent")
finish
@@ -13,6 +14,8 @@ setlocal autoindent
setlocal indentexpr=GetTildeIndent(v:lnum)
setlocal indentkeys=o,O,)
+let b:undo_indent = "setl ai< inde< indk<"
+
if exists("*GetTildeIndent")
finish
endif
diff --git a/runtime/indent/treetop.vim b/runtime/indent/treetop.vim
index 42ec1c8ad9..6c39c69687 100644
--- a/runtime/indent/treetop.vim
+++ b/runtime/indent/treetop.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: Treetop
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2011-03-14
+" Language: Treetop
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
if exists("b:did_indent")
finish
@@ -12,6 +13,8 @@ setlocal indentexpr=GetTreetopIndent()
setlocal indentkeys=0{,0},!^F,o,O,=end
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetTreetopIndent")
finish
endif
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index 7c03ff2873..8076b2df07 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Nov 27
+" Last Change: 2022 Jun 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -10,7 +10,7 @@ endif
let b:did_indent = 1
setlocal indentexpr=GetVimIndent()
-setlocal indentkeys+==end,=},=else,=cat,=finall,=END,0\\,0=\"\\\
+setlocal indentkeys+==endif,=enddef,=endfu,=endfor,=endwh,=endtry,=},=else,=cat,=finall,=END,0\\,0=\"\\\
setlocal indentkeys-=0#
setlocal indentkeys-=:
@@ -36,6 +36,14 @@ endfunc
let s:lineContPat = '^\s*\(\\\|"\\ \)'
function GetVimIndentIntern()
+ " If the current line has line continuation and the previous one too, use
+ " the same indent. This does not skip empty lines.
+ let cur_text = getline(v:lnum)
+ let cur_has_linecont = cur_text =~ s:lineContPat
+ if cur_has_linecont && v:lnum > 1 && getline(v:lnum - 1) =~ s:lineContPat
+ return indent(v:lnum - 1)
+ endif
+
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -44,8 +52,7 @@ function GetVimIndentIntern()
" If the current line doesn't start with '\' or '"\ ' and below a line that
" starts with '\' or '"\ ', use the indent of the line above it.
- let cur_text = getline(v:lnum)
- if cur_text !~ s:lineContPat
+ if !cur_has_linecont
while lnum > 0 && getline(lnum) =~ s:lineContPat
let lnum = lnum - 1
endwhile
@@ -103,10 +110,11 @@ function GetVimIndentIntern()
" A line starting with :au does not increment/decrement indent.
" A { may start a block or a dict. Assume that when a } follows it's a
" terminated dict.
+ " ":function" starts a block but "function(" doesn't.
if prev_text !~ '^\s*au\%[tocmd]' && prev_text !~ '^\s*{.*}'
- let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)')
+ let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|def\|el\%[seif]\)\>\|fu\%[nction][! ]\)')
if i >= 0
- let ind += shiftwidth()
+ let ind += shiftwidth()
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
\ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\|PatSep\)$'
let ind -= shiftwidth()
@@ -170,10 +178,15 @@ function GetVimIndentIntern()
let ind = ind + shiftwidth()
endif
- " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
- " :endfun, :else and :augroup END.
- if cur_text =~ '^\s*\(ene\@!\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
+ " Subtract a 'shiftwidth' on a :endif, :endwhile, :endfor, :catch, :finally,
+ " :endtry, :endfun, :enddef, :else and :augroup END.
+ " Although ":en" would be enough only match short command names as in
+ " 'indentkeys'.
+ if cur_text =~ '^\s*\(endif\|endwh\|endfor\|endtry\|endfu\|enddef\|cat\|finall\|else\|aug\%[roup]\s\+[eE][nN][dD]\)'
let ind = ind - shiftwidth()
+ if ind < 0
+ let ind = 0
+ endif
endif
return ind
diff --git a/runtime/indent/xf86conf.vim b/runtime/indent/xf86conf.vim
index 5a8bc0fec1..834eb00b25 100644
--- a/runtime/indent/xf86conf.vim
+++ b/runtime/indent/xf86conf.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: XFree86 Configuration File
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Language: XFree86 Configuration File
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
if exists("b:did_indent")
finish
@@ -12,6 +13,8 @@ setlocal indentexpr=GetXF86ConfIndent()
setlocal indentkeys=!^F,o,O,=End
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetXF86ConfIndent")
finish
endif
diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim
index 977ee3d33b..21000b7bc4 100644
--- a/runtime/indent/xinetd.vim
+++ b/runtime/indent/xinetd.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: xinetd.conf(5) configuration file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Language: xinetd.conf(5) configuration file
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
if exists("b:did_indent")
finish
@@ -12,6 +13,8 @@ setlocal indentexpr=GetXinetdIndent()
setlocal indentkeys=0{,0},!^F,o,O
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetXinetdIndent")
finish
endif
diff --git a/runtime/indent/yacc.vim b/runtime/indent/yacc.vim
index 01ad4fc56d..253ccc5371 100644
--- a/runtime/indent/yacc.vim
+++ b/runtime/indent/yacc.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: YACC input file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Language: YACC input file
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +15,8 @@ setlocal indentexpr=GetYaccIndent()
setlocal indentkeys=!^F,o,O
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
" Only define the function once.
if exists("*GetYaccIndent")
finish
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index ed57e68d8b..d732c37c05 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -2,7 +2,7 @@
" Language: YAML
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" Last Update: Lukas Reineke
-" Last Change: 2021 Aug 13
+" Last Change: 2022 Jun 17
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -44,30 +44,30 @@ function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex)
return plilnum
endfunction
-let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''.
- \ '|\"%([^"\\]|\\.)*\"'.
+let s:mapkeyregex = '\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\''' ..
+ \ '|\"%([^"\\]|\\.)*\"' ..
\ '|%(%(\:\ )@!.)*)\:%(\ |$)'
-let s:liststartregex='\v^\s*%(\-%(\ |$))'
+let s:liststartregex = '\v^\s*%(\-%(\ |$))'
let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)'
-let s:c_ns_anchor_name = s:c_ns_anchor_char.'+'
-let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name
+let s:c_ns_anchor_name = s:c_ns_anchor_char .. '+'
+let s:c_ns_anchor_property = '\v\&' .. s:c_ns_anchor_name
let s:ns_word_char = '\v[[:alnum:]_\-]'
-let s:ns_tag_char = '\v%('.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
-let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!'
+let s:ns_tag_char = '\v%(%\x\x|' .. s:ns_word_char .. '|[#/;?:@&=+$.~*''()])'
+let s:c_named_tag_handle = '\v\!' .. s:ns_word_char .. '+\!'
let s:c_secondary_tag_handle = '\v\!\!'
let s:c_primary_tag_handle = '\v\!'
-let s:c_tag_handle = '\v%('.s:c_named_tag_handle.
- \ '|'.s:c_secondary_tag_handle.
- \ '|'.s:c_primary_tag_handle.')'
-let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+'
+let s:c_tag_handle = '\v%(' .. s:c_named_tag_handle.
+ \ '|' .. s:c_secondary_tag_handle.
+ \ '|' .. s:c_primary_tag_handle .. ')'
+let s:c_ns_shorthand_tag = '\v' .. s:c_tag_handle .. s:ns_tag_char .. '+'
let s:c_non_specific_tag = '\v\!'
-let s:ns_uri_char = '\v%('.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
-let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>'
-let s:c_ns_tag_property = '\v'.s:c_verbatim_tag.
- \ '\v|'.s:c_ns_shorthand_tag.
- \ '\v|'.s:c_non_specific_tag
+let s:ns_uri_char = '\v%(%\x\x|' .. s:ns_word_char .. '\v|[#/;?:@&=+$,.!~*''()[\]])'
+let s:c_verbatim_tag = '\v\!\<' .. s:ns_uri_char.. '+\>'
+let s:c_ns_tag_property = '\v' .. s:c_verbatim_tag.
+ \ '\v|' .. s:c_ns_shorthand_tag.
+ \ '\v|' .. s:c_non_specific_tag
let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?'
@@ -142,9 +142,9 @@ function GetYAMLIndent(lnum)
" - List with
" multiline scalar
return previndent+2
- elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property.
- \ '\v|'.s:c_ns_anchor_property.
- \ '\v|'.s:block_scalar_header.
+ elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
+ \ '\v|' .. s:c_ns_anchor_property ..
+ \ '\v|' .. s:block_scalar_header ..
\ '\v)%(\s+|\s*%(\#.*)?$))*'
" Mapping with: value
" that is multiline scalar
diff --git a/runtime/lua/health.lua b/runtime/lua/health.lua
index 142a353bf2..40e2b3c3e7 100644
--- a/runtime/lua/health.lua
+++ b/runtime/lua/health.lua
@@ -1,23 +1,6 @@
-local M = {}
-
-function M.report_start(msg)
- vim.fn['health#report_start'](msg)
-end
-
-function M.report_info(msg)
- vim.fn['health#report_info'](msg)
-end
-
-function M.report_ok(msg)
- vim.fn['health#report_ok'](msg)
-end
-
-function M.report_warn(msg, ...)
- vim.fn['health#report_warn'](msg, ...)
-end
-
-function M.report_error(msg, ...)
- vim.fn['health#report_error'](msg, ...)
-end
-
-return M
+return setmetatable({}, {
+ __index = function(_, k)
+ vim.deprecate("require('health')", 'vim.health', '0.9', false)
+ return vim.health[k]
+ end,
+})
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index ba6b9d09c9..5da3d2a92f 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -8,7 +8,7 @@ local function highlight_line(line, linenr)
local overstrike, escape = false, false
local hls = {} -- Store highlight groups as { attr, start, final }
local NONE, BOLD, UNDERLINE, ITALIC = 0, 1, 2, 3
- local hl_groups = {[BOLD]="manBold", [UNDERLINE]="manUnderline", [ITALIC]="manItalic"}
+ local hl_groups = { [BOLD] = 'manBold', [UNDERLINE] = 'manUnderline', [ITALIC] = 'manItalic' }
local attr = NONE
local byte = 0 -- byte offset
@@ -47,7 +47,7 @@ local function highlight_line(line, linenr)
end
if continue_hl then
- hls[#hls + 1] = {attr=attr, start=byte, final=-1}
+ hls[#hls + 1] = { attr = attr, start = byte, final = -1 }
else
if attr == NONE then
for a, _ in pairs(hl_groups) do
@@ -63,7 +63,7 @@ local function highlight_line(line, linenr)
-- can be represented in one byte. Any code point above that is represented by
-- a leading byte (0xc0 and above) and continuation bytes (0x80 to 0xbf, or
-- decimal 128 to 191).
- for char in line:gmatch("[^\128-\191][\128-\191]*") do
+ for char in line:gmatch('[^\128-\191][\128-\191]*') do
if overstrike then
local last_hl = hls[#hls]
if char == prev_char then
@@ -93,7 +93,7 @@ local function highlight_line(line, linenr)
if last_hl and last_hl.attr == attr and last_hl.final == byte then
last_hl.final = byte + #char
else
- hls[#hls + 1] = {attr=attr, start=byte, final=byte + #char}
+ hls[#hls + 1] = { attr = attr, start = byte, final = byte + #char }
end
overstrike = false
@@ -106,25 +106,25 @@ local function highlight_line(line, linenr)
-- We only want to match against SGR sequences, which consist of ESC
-- followed by '[', then a series of parameter and intermediate bytes in
-- the range 0x20 - 0x3f, then 'm'. (See ECMA-48, sections 5.4 & 8.3.117)
- local sgr = prev_char:match("^%[([\032-\063]*)m$")
+ local sgr = prev_char:match('^%[([\032-\063]*)m$')
-- Ignore escape sequences with : characters, as specified by ITU's T.416
-- Open Document Architecture and interchange format.
- if sgr and not string.find(sgr, ":") then
+ if sgr and not string.find(sgr, ':') then
local match
while sgr and #sgr > 0 do
-- Match against SGR parameters, which may be separated by ';'
- match, sgr = sgr:match("^(%d*);?(.*)")
+ match, sgr = sgr:match('^(%d*);?(.*)')
add_attr_hl(match + 0) -- coerce to number
end
escape = false
- elseif not prev_char:match("^%[[\032-\063]*$") then
+ elseif not prev_char:match('^%[[\032-\063]*$') then
-- Stop looking if this isn't a partial CSI sequence
escape = false
end
- elseif char == "\027" then
+ elseif char == '\027' then
escape = true
prev_char = ''
- elseif char == "\b" then
+ elseif char == '\b' then
overstrike = true
prev_char = chars[#chars]
byte = byte - #prev_char
@@ -143,7 +143,7 @@ local function highlight_line(line, linenr)
hl_groups[hl.attr],
linenr - 1,
hl.start,
- hl.final
+ hl.final,
}
end
end
@@ -152,8 +152,8 @@ local function highlight_line(line, linenr)
end
local function highlight_man_page()
- local mod = vim.api.nvim_buf_get_option(0, "modifiable")
- vim.api.nvim_buf_set_option(0, "modifiable", true)
+ local mod = vim.api.nvim_buf_get_option(0, 'modifiable')
+ vim.api.nvim_buf_set_option(0, 'modifiable', true)
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
for i, line in ipairs(lines) do
@@ -166,7 +166,7 @@ local function highlight_man_page()
end
buf_hls = {}
- vim.api.nvim_buf_set_option(0, "modifiable", mod)
+ vim.api.nvim_buf_set_option(0, 'modifiable', mod)
end
return { highlight_man_page = highlight_man_page }
diff --git a/runtime/lua/vim/F.lua b/runtime/lua/vim/F.lua
index 9327c652db..bca5ddf68b 100644
--- a/runtime/lua/vim/F.lua
+++ b/runtime/lua/vim/F.lua
@@ -5,13 +5,17 @@ local F = {}
---@param a
---@param b
function F.if_nil(a, b)
- if a == nil then return b end
+ if a == nil then
+ return b
+ end
return a
end
-- Use in combination with pcall
function F.ok_or_nil(status, ...)
- if not status then return end
+ if not status then
+ return
+ end
return ...
end
@@ -29,7 +33,7 @@ end
--- like {...} except preserve the length explicitly
function F.pack_len(...)
- return {n=select('#', ...), ...}
+ return { n = select('#', ...), ... }
end
--- like unpack() but use the length set by F.pack_len if present
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
new file mode 100644
index 0000000000..442d7b07d8
--- /dev/null
+++ b/runtime/lua/vim/_editor.lua
@@ -0,0 +1,854 @@
+-- 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.
+--
+-- Guideline: "If in doubt, put it in the runtime".
+--
+-- Most functions should live directly in `vim.`, not in submodules.
+-- The only "forbidden" names are those claimed by legacy `if_lua`:
+-- $ vim
+-- :lua for k,v in pairs(vim) do print(k) end
+-- buffer
+-- open
+-- window
+-- lastline
+-- firstline
+-- type
+-- line
+-- eval
+-- dict
+-- beep
+-- list
+-- command
+--
+-- Reference (#6580):
+-- - 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
+
+local vim = assert(vim)
+
+-- These are for loading runtime modules lazily since they aren't available in
+-- the nvim binary as specified in executor.c
+for k, v in pairs({
+ treesitter = true,
+ filetype = true,
+ F = true,
+ lsp = true,
+ highlight = true,
+ diagnostic = true,
+ keymap = true,
+ ui = true,
+ health = true,
+ fs = true,
+}) do
+ vim._submodules[k] = v
+end
+
+vim.log = {
+ levels = {
+ TRACE = 0,
+ DEBUG = 1,
+ INFO = 2,
+ WARN = 3,
+ ERROR = 4,
+ OFF = 5,
+ },
+}
+
+-- Internal-only until comments in #8107 are addressed.
+-- Returns:
+-- {errcode}, {output}
+function vim._system(cmd)
+ local out = vim.fn.system(cmd)
+ local err = vim.v.shell_error
+ return err, out
+end
+
+-- Gets process info from the `ps` command.
+-- Used by nvim_get_proc() as a fallback.
+function vim._os_proc_info(pid)
+ if pid == nil or pid <= 0 or type(pid) ~= 'number' then
+ error('invalid pid')
+ end
+ local cmd = { 'ps', '-p', pid, '-o', 'comm=' }
+ local err, name = vim._system(cmd)
+ if 1 == err and vim.trim(name) == '' then
+ return {} -- Process not found.
+ elseif 0 ~= err then
+ error('command failed: ' .. vim.fn.string(cmd))
+ end
+ local _, ppid = vim._system({ 'ps', '-p', pid, '-o', 'ppid=' })
+ -- Remove trailing whitespace.
+ name = vim.trim(name):gsub('^.*/', '')
+ ppid = tonumber(ppid) or -1
+ return {
+ name = name,
+ pid = pid,
+ ppid = ppid,
+ }
+end
+
+-- Gets process children from the `pgrep` command.
+-- Used by nvim_get_proc_children() as a fallback.
+function vim._os_proc_children(ppid)
+ if ppid == nil or ppid <= 0 or type(ppid) ~= 'number' then
+ error('invalid ppid')
+ end
+ local cmd = { 'pgrep', '-P', ppid }
+ local err, rv = vim._system(cmd)
+ if 1 == err and vim.trim(rv) == '' then
+ return {} -- Process not found.
+ elseif 0 ~= err then
+ error('command failed: ' .. vim.fn.string(cmd))
+ end
+ local children = {}
+ for s in rv:gmatch('%S+') do
+ local i = tonumber(s)
+ if i ~= nil then
+ table.insert(children, i)
+ end
+ end
+ return children
+end
+
+-- TODO(ZyX-I): Create compatibility layer.
+
+--- Return a human-readable representation of the given object.
+---
+---@see https://github.com/kikito/inspect.lua
+---@see https://github.com/mpeterv/vinspect
+local function inspect(object, options) -- luacheck: no unused
+ error(object, options) -- Stub for gen_vimdoc.py
+end
+
+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.
+ ---
+ --- Example: To remove ANSI color codes when pasting:
+ --- <pre>
+ --- vim.paste = (function(overridden)
+ --- return function(lines, phase)
+ --- for i,line in ipairs(lines) do
+ --- -- Scrub ANSI color codes from paste input.
+ --- lines[i] = line:gsub('\27%[[0-9;mK]+', '')
+ --- end
+ --- overridden(lines, phase)
+ --- end
+ --- end)(vim.paste)
+ --- </pre>
+ ---
+ ---@see |paste|
+ ---
+ ---@param lines |readfile()|-style list of lines to paste. |channel-lines|
+ ---@param phase -1: "non-streaming" paste: the call contains all lines.
+ --- If paste is "streamed", `phase` indicates the stream state:
+ --- - 1: starts the paste (exactly once)
+ --- - 2: continues the paste (zero or more times)
+ --- - 3: ends the paste (exactly once)
+ ---@returns false if client should cancel the paste.
+ function vim.paste(lines, phase)
+ local now = vim.loop.now()
+ local is_first_chunk = phase < 2
+ local is_last_chunk = phase == -1 or phase == 3
+ if is_first_chunk then -- Reset flags.
+ tdots, tick, got_line1, undo_started, trailing_nl = now, 0, false, false, false
+ end
+ if #lines == 0 then
+ lines = { '' }
+ end
+ if #lines == 1 and lines[1] == '' and not is_last_chunk then
+ -- An empty chunk can cause some edge cases in streamed pasting,
+ -- so don't do anything unless it is the last chunk.
+ return true
+ end
+ -- Note: mode doesn't always start with "c" in cmdline mode, so use getcmdtype() instead.
+ if vim.fn.getcmdtype() ~= '' then -- cmdline-mode: paste only 1 line.
+ if not got_line1 then
+ got_line1 = (#lines > 1)
+ -- Escape control characters
+ local line1 = lines[1]:gsub('(%c)', '\022%1')
+ -- nvim_input() is affected by mappings,
+ -- so use nvim_feedkeys() with "n" flag to ignore mappings.
+ vim.api.nvim_feedkeys(line1, 'n', true)
+ end
+ return true
+ end
+ local mode = vim.api.nvim_get_mode().mode
+ if undo_started then
+ vim.api.nvim_command('undojoin')
+ end
+ if mode:find('^i') or mode:find('^n?t') then -- Insert mode or Terminal buffer
+ vim.api.nvim_put(lines, 'c', false, true)
+ elseif phase < 2 and mode:find('^R') and not mode:find('^Rv') then -- Replace mode
+ -- TODO: implement Replace mode streamed pasting
+ -- TODO: support Virtual Replace mode
+ local nchars = 0
+ for _, line in ipairs(lines) do
+ nchars = nchars + line:len()
+ end
+ local row, col = unpack(vim.api.nvim_win_get_cursor(0))
+ local bufline = vim.api.nvim_buf_get_lines(0, row - 1, row, true)[1]
+ local firstline = lines[1]
+ firstline = bufline:sub(1, col) .. firstline
+ lines[1] = firstline
+ lines[#lines] = lines[#lines] .. bufline:sub(col + nchars + 1, bufline:len())
+ vim.api.nvim_buf_set_lines(0, row - 1, row, false, lines)
+ elseif mode:find('^[nvV\22sS\19]') then -- Normal or Visual or Select mode
+ if mode:find('^n') then -- Normal mode
+ -- When there was a trailing new line in the previous chunk,
+ -- the cursor is on the first character of the next line,
+ -- so paste before the cursor instead of after it.
+ vim.api.nvim_put(lines, 'c', not trailing_nl, false)
+ else -- Visual or Select mode
+ vim.api.nvim_command([[exe "silent normal! \<Del>"]])
+ local del_start = vim.fn.getpos("'[")
+ local cursor_pos = vim.fn.getpos('.')
+ if mode:find('^[VS]') then -- linewise
+ if cursor_pos[2] < del_start[2] then -- replacing lines at eof
+ -- create a new line
+ vim.api.nvim_put({ '' }, 'l', true, true)
+ end
+ vim.api.nvim_put(lines, 'c', false, false)
+ else
+ -- paste after cursor when replacing text at eol, otherwise paste before cursor
+ vim.api.nvim_put(lines, 'c', cursor_pos[3] < del_start[3], false)
+ end
+ end
+ -- put cursor at the end of the text instead of one character after it
+ vim.fn.setpos('.', vim.fn.getpos("']"))
+ trailing_nl = lines[#lines] == ''
+ else -- Don't know what to do in other modes
+ return false
+ end
+ undo_started = true
+ if phase ~= -1 and (now - tdots >= 100) then
+ local dots = ('.'):rep(tick % 4)
+ tdots = now
+ tick = tick + 1
+ -- Use :echo because Lua print('') is a no-op, and we want to clear the
+ -- message when there are zero dots.
+ vim.api.nvim_command(('echo "%s"'):format(dots))
+ end
+ if is_last_chunk then
+ vim.api.nvim_command('redraw' .. (tick > 1 and '|echo ""' or ''))
+ end
+ return true -- Paste will not continue if not returning `true`.
+ end
+end
+
+--- Defers callback `cb` until the Nvim API is safe to call.
+---
+---@see |lua-loop-callbacks|
+---@see |vim.schedule()|
+---@see |vim.in_fast_event()|
+function vim.schedule_wrap(cb)
+ return function(...)
+ local args = vim.F.pack_len(...)
+ vim.schedule(function()
+ cb(vim.F.unpack_len(args))
+ end)
+ end
+end
+
+-- vim.fn.{func}(...)
+vim.fn = setmetatable({}, {
+ __index = function(t, key)
+ local _fn
+ if vim.api[key] ~= nil then
+ _fn = function()
+ error(string.format('Tried to call API function with vim.fn: use vim.api.%s instead', key))
+ end
+ else
+ _fn = function(...)
+ return vim.call(key, ...)
+ end
+ end
+ t[key] = _fn
+ return _fn
+ end,
+})
+
+vim.funcref = function(viml_func_name)
+ return vim.fn[viml_func_name]
+end
+
+--- Execute Vim script commands.
+---
+--- Example:
+--- <pre>
+--- vim.cmd('echo 42')
+--- vim.cmd([[
+--- augroup My_group
+--- autocmd!
+--- autocmd FileType c setlocal cindent
+--- augroup END
+--- ]])
+--- vim.cmd({ cmd = 'echo', args = { '"foo"' } })
+--- </pre>
+---
+---@param command string|table Command(s) to execute.
+--- If a string, executes multiple lines of Vim script at once. In this
+--- case, it is an alias to |nvim_exec()|, where `output` is set to
+--- false. Thus it works identical to |:source|.
+--- If a table, executes a single command. In this case, it is an alias
+--- to |nvim_cmd()| where `opts` is empty.
+---@see |ex-cmd-index|
+function vim.cmd(command)
+ if type(command) == 'table' then
+ return vim.api.nvim_cmd(command, {})
+ else
+ return vim.api.nvim_exec(command, false)
+ end
+end
+
+-- These are the vim.env/v/g/o/bo/wo variable magic accessors.
+do
+ local validate = vim.validate
+
+ --@private
+ local function make_dict_accessor(scope, handle)
+ validate({
+ scope = { scope, 's' },
+ })
+ local mt = {}
+ function mt:__newindex(k, v)
+ return vim._setvar(scope, handle or 0, k, v)
+ end
+ function mt:__index(k)
+ if handle == nil and type(k) == 'number' then
+ return make_dict_accessor(scope, k)
+ end
+ return vim._getvar(scope, handle or 0, k)
+ end
+ return setmetatable({}, mt)
+ end
+
+ vim.g = make_dict_accessor('g', false)
+ vim.v = make_dict_accessor('v', false)
+ vim.b = make_dict_accessor('b')
+ vim.w = make_dict_accessor('w')
+ vim.t = make_dict_accessor('t')
+end
+
+--- Get a table of lines with start, end columns for a region marked by two points
+---
+---@param bufnr number of buffer
+---@param pos1 (line, column) tuple marking beginning of region
+---@param pos2 (line, column) tuple marking end of region
+---@param regtype type of selection (:help setreg)
+---@param inclusive boolean indicating whether the selection is end-inclusive
+---@return region lua table of the form {linenr = {startcol,endcol}}
+function vim.region(bufnr, pos1, pos2, regtype, inclusive)
+ if not vim.api.nvim_buf_is_loaded(bufnr) then
+ vim.fn.bufload(bufnr)
+ end
+
+ -- check that region falls within current buffer
+ local buf_line_count = vim.api.nvim_buf_line_count(bufnr)
+ pos1[1] = math.min(pos1[1], buf_line_count - 1)
+ pos2[1] = math.min(pos2[1], buf_line_count - 1)
+
+ -- in case of block selection, columns need to be adjusted for non-ASCII characters
+ -- TODO: handle double-width characters
+ local bufline
+ if regtype:byte() == 22 then
+ bufline = vim.api.nvim_buf_get_lines(bufnr, pos1[1], pos1[1] + 1, true)[1]
+ pos1[2] = vim.str_utfindex(bufline, pos1[2])
+ end
+
+ local region = {}
+ for l = pos1[1], pos2[1] do
+ local c1, c2
+ if regtype:byte() == 22 then -- block selection: take width from regtype
+ c1 = pos1[2]
+ c2 = c1 + regtype:sub(2)
+ -- and adjust for non-ASCII characters
+ bufline = vim.api.nvim_buf_get_lines(bufnr, l, l + 1, true)[1]
+ if c1 < #bufline then
+ c1 = vim.str_byteindex(bufline, c1)
+ end
+ if c2 < #bufline then
+ c2 = vim.str_byteindex(bufline, c2)
+ end
+ else
+ c1 = (l == pos1[1]) and pos1[2] or 0
+ c2 = (l == pos2[1]) and (pos2[2] + (inclusive and 1 or 0)) or -1
+ end
+ table.insert(region, l, { c1, c2 })
+ end
+ return region
+end
+
+--- Defers calling `fn` until `timeout` ms passes.
+---
+--- Use to do a one-shot timer that calls `fn`
+--- Note: The {fn} is |schedule_wrap|ped automatically, so API functions are
+--- safe to call.
+---@param fn Callback to call once `timeout` expires
+---@param timeout Number of milliseconds to wait before calling `fn`
+---@return timer luv timer object
+function vim.defer_fn(fn, timeout)
+ vim.validate({ fn = { fn, 'c', true } })
+ local timer = vim.loop.new_timer()
+ timer:start(
+ timeout,
+ 0,
+ vim.schedule_wrap(function()
+ if not timer:is_closing() then
+ timer:close()
+ end
+
+ fn()
+ end)
+ )
+
+ return timer
+end
+
+--- Display 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,
+--- writes to |:messages|.
+---
+---@param msg string Content of the notification to show to the user.
+---@param level number|nil One of the values from |vim.log.levels|.
+---@param opts table|nil Optional parameters. Unused by default.
+function vim.notify(msg, level, opts) -- luacheck: no unused args
+ if level == vim.log.levels.ERROR then
+ vim.api.nvim_err_writeln(msg)
+ elseif level == vim.log.levels.WARN then
+ vim.api.nvim_echo({ { msg, 'WarningMsg' } }, true, {})
+ else
+ vim.api.nvim_echo({ { msg } }, true, {})
+ end
+end
+
+do
+ local notified = {}
+
+ --- Display a notification only one time.
+ ---
+ --- Like |vim.notify()|, but subsequent calls with the same message will not
+ --- display a notification.
+ ---
+ ---@param msg string Content of the notification to show to the user.
+ ---@param level number|nil One of the values from |vim.log.levels|.
+ ---@param opts table|nil Optional parameters. Unused by default.
+ ---@return boolean true if message was displayed, else false
+ function vim.notify_once(msg, level, opts)
+ if not notified[msg] then
+ vim.notify(msg, level, opts)
+ notified[msg] = true
+ return true
+ end
+ return false
+ end
+end
+
+---@private
+function vim.register_keystroke_callback()
+ error('vim.register_keystroke_callback is deprecated, instead use: vim.on_key')
+end
+
+local on_key_cbs = {}
+
+--- Adds Lua function {fn} with namespace id {ns_id} as a listener to every,
+--- yes every, input key.
+---
+--- The Nvim command-line option |-w| is related but does not support callbacks
+--- and cannot be toggled dynamically.
+---
+---@param fn function: Callback function. It should take one string argument.
+--- On each key press, Nvim passes the key char to fn(). |i_CTRL-V|
+--- If {fn} is nil, it removes the callback for the associated {ns_id}
+---@param ns_id number? Namespace ID. If nil or 0, generates and returns a new
+--- |nvim_create_namespace()| id.
+---
+---@return number Namespace id associated with {fn}. Or count of all callbacks
+---if on_key() is called without arguments.
+---
+---@note {fn} will be removed if an error occurs while calling.
+---@note {fn} will not be cleared by |nvim_buf_clear_namespace()|
+---@note {fn} will receive the keys after mappings have been evaluated
+function vim.on_key(fn, ns_id)
+ if fn == nil and ns_id == nil then
+ return #on_key_cbs
+ end
+
+ vim.validate({
+ fn = { fn, 'c', true },
+ ns_id = { ns_id, 'n', true },
+ })
+
+ if ns_id == nil or ns_id == 0 then
+ ns_id = vim.api.nvim_create_namespace('')
+ end
+
+ on_key_cbs[ns_id] = fn
+ return ns_id
+end
+
+--- Executes the on_key callbacks.
+---@private
+function vim._on_key(char)
+ local failed_ns_ids = {}
+ local failed_messages = {}
+ for k, v in pairs(on_key_cbs) do
+ local ok, err_msg = pcall(v, char)
+ if not ok then
+ vim.on_key(nil, k)
+ table.insert(failed_ns_ids, k)
+ table.insert(failed_messages, err_msg)
+ end
+ end
+
+ if failed_ns_ids[1] then
+ error(
+ string.format(
+ "Error executing 'on_key' with ns_ids '%s'\n Messages: %s",
+ table.concat(failed_ns_ids, ', '),
+ table.concat(failed_messages, '\n')
+ )
+ )
+ end
+end
+
+--- Generate a list of possible completions for the string.
+--- String starts with ^ and then has the pattern.
+---
+--- 1. Can we get it to just return things in the global namespace with that name prefix
+--- 2. Can we get it to return things from global namespace even with `print(` in front.
+function vim._expand_pat(pat, env)
+ env = env or _G
+
+ pat = string.sub(pat, 2, #pat)
+
+ if pat == '' then
+ local result = vim.tbl_keys(env)
+ table.sort(result)
+ return result, 0
+ end
+
+ -- TODO: We can handle spaces in [] ONLY.
+ -- We should probably do that at some point, just for cooler completion.
+ -- TODO: We can suggest the variable names to go in []
+ -- This would be difficult as well.
+ -- Probably just need to do a smarter match than just `:match`
+
+ -- Get the last part of the pattern
+ local last_part = pat:match('[%w.:_%[%]\'"]+$')
+ if not last_part then
+ return {}, 0
+ end
+
+ local parts, search_index = vim._expand_pat_get_parts(last_part)
+
+ local match_part = string.sub(last_part, search_index, #last_part)
+ local prefix_match_pat = string.sub(pat, 1, #pat - #match_part) or ''
+
+ local final_env = env
+
+ for _, part in ipairs(parts) do
+ if type(final_env) ~= 'table' then
+ return {}, 0
+ end
+ local key
+
+ -- Normally, we just have a string
+ -- Just attempt to get the string directly from the environment
+ if type(part) == 'string' then
+ key = part
+ else
+ -- However, sometimes you want to use a variable, and complete on it
+ -- With this, you have the power.
+
+ -- MY_VAR = "api"
+ -- vim[MY_VAR]
+ -- -> _G[MY_VAR] -> "api"
+ local result_key = part[1]
+ if not result_key then
+ return {}, 0
+ end
+
+ local result = rawget(env, result_key)
+
+ if result == nil then
+ return {}, 0
+ end
+
+ key = result
+ end
+ local field = rawget(final_env, key)
+ if field == nil then
+ local mt = getmetatable(final_env)
+ if mt and type(mt.__index) == 'table' then
+ field = rawget(mt.__index, key)
+ elseif final_env == vim and vim._submodules[key] then
+ field = vim[key]
+ end
+ end
+ final_env = field
+
+ if not final_env then
+ return {}, 0
+ end
+ end
+
+ local keys = {}
+ ---@private
+ 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
+ keys[k] = true
+ end
+ end
+ end
+
+ if type(final_env) == 'table' then
+ insert_keys(final_env)
+ end
+ local mt = getmetatable(final_env)
+ if mt and type(mt.__index) == 'table' then
+ insert_keys(mt.__index)
+ end
+ if final_env == vim then
+ insert_keys(vim._submodules)
+ end
+
+ keys = vim.tbl_keys(keys)
+ table.sort(keys)
+
+ return keys, #prefix_match_pat
+end
+
+vim._expand_pat_get_parts = function(lua_string)
+ local parts = {}
+
+ local accumulator, search_index = '', 1
+ local in_brackets, bracket_end = false, -1
+ local string_char = nil
+ for idx = 1, #lua_string do
+ local s = lua_string:sub(idx, idx)
+
+ if not in_brackets and (s == '.' or s == ':') then
+ table.insert(parts, accumulator)
+ accumulator = ''
+
+ search_index = idx + 1
+ elseif s == '[' then
+ in_brackets = true
+
+ table.insert(parts, accumulator)
+ accumulator = ''
+
+ search_index = idx + 1
+ elseif in_brackets then
+ if idx == bracket_end then
+ in_brackets = false
+ search_index = idx + 1
+
+ if string_char == 'VAR' then
+ table.insert(parts, { accumulator })
+ accumulator = ''
+
+ string_char = nil
+ end
+ elseif not string_char then
+ bracket_end = string.find(lua_string, ']', idx, true)
+
+ if s == '"' or s == "'" then
+ string_char = s
+ elseif s ~= ' ' then
+ string_char = 'VAR'
+ accumulator = s
+ end
+ elseif string_char then
+ if string_char ~= s then
+ accumulator = accumulator .. s
+ else
+ table.insert(parts, accumulator)
+ accumulator = ''
+
+ string_char = nil
+ end
+ end
+ else
+ accumulator = accumulator .. s
+ end
+ end
+
+ parts = vim.tbl_filter(function(val)
+ return #val > 0
+ end, parts)
+
+ return parts, search_index
+end
+
+---Prints given arguments in human-readable format.
+---Example:
+---<pre>
+--- -- Print highlight group Normal and store it's contents in a variable.
+--- local hl_normal = vim.pretty_print(vim.api.nvim_get_hl_by_name("Normal", true))
+---</pre>
+---@see |vim.inspect()|
+---@return given arguments.
+function vim.pretty_print(...)
+ local objects = {}
+ for i = 1, select('#', ...) do
+ local v = select(i, ...)
+ table.insert(objects, vim.inspect(v))
+ end
+
+ print(table.concat(objects, ' '))
+ return ...
+end
+
+function vim._cs_remote(rcid, server_addr, connect_error, args)
+ local function connection_failure_errmsg(consequence)
+ local explanation
+ if server_addr == '' then
+ explanation = 'No server specified with --server'
+ else
+ explanation = "Failed to connect to '" .. server_addr .. "'"
+ if connect_error ~= '' then
+ explanation = explanation .. ': ' .. connect_error
+ end
+ end
+ return 'E247: ' .. explanation .. '. ' .. consequence
+ end
+
+ local f_silent = false
+ local f_tab = false
+
+ local subcmd = string.sub(args[1], 10)
+ if subcmd == 'tab' then
+ f_tab = true
+ elseif subcmd == 'silent' then
+ f_silent = true
+ elseif
+ subcmd == 'wait'
+ or subcmd == 'wait-silent'
+ or subcmd == 'tab-wait'
+ or subcmd == 'tab-wait-silent'
+ then
+ return { errmsg = 'E5600: Wait commands not yet implemented in nvim' }
+ elseif subcmd == 'tab-silent' then
+ f_tab = true
+ f_silent = true
+ elseif subcmd == 'send' then
+ if rcid == 0 then
+ return { errmsg = connection_failure_errmsg('Send failed.') }
+ end
+ vim.fn.rpcrequest(rcid, 'nvim_input', args[2])
+ return { should_exit = true, tabbed = false }
+ elseif subcmd == 'expr' then
+ if rcid == 0 then
+ return { errmsg = connection_failure_errmsg('Send expression failed.') }
+ end
+ print(vim.fn.rpcrequest(rcid, 'nvim_eval', args[2]))
+ return { should_exit = true, tabbed = false }
+ elseif subcmd ~= '' then
+ return { errmsg = 'Unknown option argument: ' .. args[1] }
+ end
+
+ if rcid == 0 then
+ if not f_silent then
+ vim.notify(connection_failure_errmsg('Editing locally'), vim.log.levels.WARN)
+ end
+ else
+ local command = {}
+ if f_tab then
+ table.insert(command, 'tab')
+ end
+ table.insert(command, 'drop')
+ for i = 2, #args do
+ table.insert(command, vim.fn.fnameescape(args[i]))
+ end
+ vim.fn.rpcrequest(rcid, 'nvim_command', table.concat(command, ' '))
+ end
+
+ return {
+ should_exit = rcid ~= 0,
+ tabbed = f_tab,
+ }
+end
+
+--- Display a deprecation notification to the user.
+---
+---@param name string Deprecated function.
+---@param alternative string|nil Preferred alternative function.
+---@param version string Version in which the deprecated function will
+--- be removed.
+---@param plugin string|nil Plugin name that the function will be removed
+--- from. Defaults to "Nvim".
+---@param backtrace boolean|nil Prints backtrace. Defaults to true.
+function vim.deprecate(name, alternative, version, plugin, backtrace)
+ local message = name .. ' is deprecated'
+ plugin = plugin or 'Nvim'
+ message = alternative and (message .. ', use ' .. alternative .. ' instead.') or message
+ message = message
+ .. ' See :h deprecated\nThis function will be removed in '
+ .. plugin
+ .. ' version '
+ .. version
+ if vim.notify_once(message, vim.log.levels.WARN) and backtrace ~= false then
+ vim.notify(debug.traceback('', 2):sub(2), vim.log.levels.WARN)
+ end
+end
+
+--- Create builtin mappings (incl. menus).
+--- Called once on startup.
+function vim._init_default_mappings()
+ -- mappings
+
+ --@private
+ local function map(mode, lhs, rhs)
+ vim.api.nvim_set_keymap(mode, lhs, rhs, { noremap = true, desc = 'Nvim builtin' })
+ end
+
+ map('n', 'Y', 'y$')
+ -- Use normal! <C-L> to prevent inserting raw <C-L> when using i_<C-O>. #17473
+ map('n', '<C-L>', '<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>')
+ map('i', '<C-U>', '<C-G>u<C-U>')
+ map('i', '<C-W>', '<C-G>u<C-W>')
+ map('x', '*', 'y/\\V<C-R>"<CR>')
+ map('x', '#', 'y?\\V<C-R>"<CR>')
+ -- Use : instead of <Cmd> so that ranges are supported. #19365
+ map('n', '&', ':&&<CR>')
+
+ -- menus
+
+ -- TODO VimScript, no l10n
+ vim.cmd([[
+ aunmenu *
+ vnoremenu PopUp.Cut "+x
+ vnoremenu PopUp.Copy "+y
+ anoremenu PopUp.Paste "+gP
+ vnoremenu PopUp.Paste "+P
+ vnoremenu PopUp.Delete "_x
+ nnoremenu PopUp.Select\ All ggVG
+ vnoremenu PopUp.Select\ All gg0oG$
+ inoremenu PopUp.Select\ All <C-Home><C-O>VG
+ anoremenu PopUp.-1- <Nop>
+ anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
+ ]])
+end
+
+require('vim._meta')
+
+return vim
diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua
new file mode 100644
index 0000000000..7e3c73667e
--- /dev/null
+++ b/runtime/lua/vim/_init_packages.lua
@@ -0,0 +1,83 @@
+-- prevents luacheck from making lints for setting things on vim
+local vim = assert(vim)
+
+local pathtrails = {}
+vim._so_trails = {}
+for s in (package.cpath .. ';'):gmatch('[^;]*;') do
+ s = s:sub(1, -2) -- Strip trailing semicolon
+ -- Find out path patterns. pathtrail should contain something like
+ -- /?.so, \?.dll. This allows not to bother determining what correct
+ -- suffixes are.
+ local pathtrail = s:match('[/\\][^/\\]*%?.*$')
+ if pathtrail and not pathtrails[pathtrail] then
+ pathtrails[pathtrail] = true
+ table.insert(vim._so_trails, pathtrail)
+ end
+end
+
+function vim._load_package(name)
+ local basename = name:gsub('%.', '/')
+ local paths = { 'lua/' .. basename .. '.lua', 'lua/' .. basename .. '/init.lua' }
+ local found = vim.api.nvim__get_runtime(paths, false, { is_lua = true })
+ if #found > 0 then
+ local f, err = loadfile(found[1])
+ return f or error(err)
+ end
+
+ local so_paths = {}
+ for _, trail in ipairs(vim._so_trails) do
+ local path = 'lua' .. trail:gsub('?', basename) -- so_trails contains a leading slash
+ table.insert(so_paths, path)
+ end
+
+ found = vim.api.nvim__get_runtime(so_paths, false, { is_lua = true })
+ if #found > 0 then
+ -- Making function name in Lua 5.1 (see src/loadlib.c:mkfuncname) is
+ -- a) strip prefix up to and including the first dash, if any
+ -- b) replace all dots by underscores
+ -- c) prepend "luaopen_"
+ -- So "foo-bar.baz" should result in "luaopen_bar_baz"
+ local dash = name:find('-', 1, true)
+ local modname = dash and name:sub(dash + 1) or name
+ local f, err = package.loadlib(found[1], 'luaopen_' .. modname:gsub('%.', '_'))
+ return f or error(err)
+ end
+ return nil
+end
+
+-- Insert vim._load_package after the preloader at position 2
+table.insert(package.loaders, 2, vim._load_package)
+
+-- builtin functions which always should be available
+require('vim.shared')
+
+vim._submodules = { inspect = true }
+
+-- These are for loading runtime modules in the vim namespace lazily.
+setmetatable(vim, {
+ __index = function(t, key)
+ if vim._submodules[key] then
+ t[key] = require('vim.' .. key)
+ return t[key]
+ elseif vim.startswith(key, 'uri_') then
+ local val = require('vim.uri')[key]
+ if val ~= nil then
+ -- Expose all `vim.uri` functions on the `vim` module.
+ t[key] = val
+ return t[key]
+ end
+ end
+ end,
+})
+
+--- <Docs described in |vim.empty_dict()| >
+---@private
+--- TODO: should be in vim.shared when vim.shared always uses nvim-lua
+function vim.empty_dict()
+ return setmetatable({}, vim._empty_dict_mt)
+end
+
+-- only on main thread: functions for interacting with editor state
+if not vim.is_thread() then
+ require('vim._editor')
+end
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index 522e26caa7..f1652718ee 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -5,41 +5,55 @@ local a = vim.api
local validate = vim.validate
local SET_TYPES = setmetatable({
- SET = 0,
- LOCAL = 1,
+ SET = 0,
+ LOCAL = 1,
GLOBAL = 2,
}, { __index = error })
-local options_info = {}
-for _, v in pairs(a.nvim_get_all_options_info()) do
- options_info[v.name] = v
- if v.shortname ~= "" then options_info[v.shortname] = v end
-end
+local options_info = nil
+local buf_options = nil
+local glb_options = nil
+local win_options = nil
-local get_scoped_options = function(scope)
- local result = {}
- for name, option_info in pairs(options_info) do
- if option_info.scope == scope then
- result[name] = true
+local function _setup()
+ if options_info ~= nil then
+ return
+ end
+ options_info = {}
+ for _, v in pairs(a.nvim_get_all_options_info()) do
+ options_info[v.name] = v
+ if v.shortname ~= '' then
+ options_info[v.shortname] = v
end
end
- return result
-end
+ local function get_scoped_options(scope)
+ local result = {}
+ for name, option_info in pairs(options_info) do
+ if option_info.scope == scope then
+ result[name] = true
+ end
+ end
+
+ return result
+ end
-local buf_options = get_scoped_options("buf")
-local glb_options = get_scoped_options("global")
-local win_options = get_scoped_options("win")
+ buf_options = get_scoped_options('buf')
+ glb_options = get_scoped_options('global')
+ win_options = get_scoped_options('win')
+end
local function make_meta_accessor(get, set, del, validator)
- validator = validator or function() return true end
+ validator = validator or function()
+ return true
+ end
- validate {
- get = {get, 'f'};
- set = {set, 'f'};
- del = {del, 'f', true};
- validator = {validator, 'f'};
- }
+ validate({
+ get = { get, 'f' },
+ set = { set, 'f' },
+ del = { del, 'f', true },
+ validator = { validator, 'f' },
+ })
local mt = {}
function mt:__newindex(k, v)
@@ -73,23 +87,28 @@ end, vim.fn.setenv)
do -- buffer option accessor
local function new_buf_opt_accessor(bufnr)
local function get(k)
- if bufnr == nil and type(k) == "number" then
+ if bufnr == nil and type(k) == 'number' then
return new_buf_opt_accessor(k)
end
- return a.nvim_buf_get_option(bufnr or 0, k)
+ return a.nvim_get_option_value(k, { buf = bufnr or 0 })
end
local function set(k, v)
- return a.nvim_buf_set_option(bufnr or 0, k, v)
+ return a.nvim_set_option_value(k, v, { buf = bufnr or 0 })
end
return make_meta_accessor(get, set, nil, function(k)
if type(k) == 'string' then
+ _setup()
if win_options[k] then
- error(string.format([['%s' is a window option, not a buffer option. See ":help %s"]], k, k))
+ error(
+ string.format([['%s' is a window option, not a buffer option. See ":help %s"]], k, k)
+ )
elseif glb_options[k] then
- error(string.format([['%s' is a global option, not a buffer option. See ":help %s"]], k, k))
+ error(
+ string.format([['%s' is a global option, not a buffer option. See ":help %s"]], k, k)
+ )
end
end
@@ -103,22 +122,27 @@ end
do -- window option accessor
local function new_win_opt_accessor(winnr)
local function get(k)
- if winnr == nil and type(k) == "number" then
+ if winnr == nil and type(k) == 'number' then
return new_win_opt_accessor(k)
end
- return a.nvim_win_get_option(winnr or 0, k)
+ return a.nvim_get_option_value(k, { win = winnr or 0 })
end
local function set(k, v)
- return a.nvim_win_set_option(winnr or 0, k, v)
+ return a.nvim_set_option_value(k, v, { win = winnr or 0 })
end
return make_meta_accessor(get, set, nil, function(k)
if type(k) == 'string' then
+ _setup()
if buf_options[k] then
- error(string.format([['%s' is a buffer option, not a window option. See ":help %s"]], k, k))
+ error(
+ string.format([['%s' is a buffer option, not a window option. See ":help %s"]], k, k)
+ )
elseif glb_options[k] then
- error(string.format([['%s' is a global option, not a window option. See ":help %s"]], k, k))
+ error(
+ string.format([['%s' is a global option, not a window option. See ":help %s"]], k, k)
+ )
end
end
@@ -131,17 +155,19 @@ end
-- vim global option
-- this ONLY sets the global option. like `setglobal`
-vim.go = make_meta_accessor(
- function(k) return a.nvim_get_option_value(k, {scope = "global"}) end,
- function(k, v) return a.nvim_set_option_value(k, v, {scope = "global"}) end
-)
+vim.go = make_meta_accessor(function(k)
+ return a.nvim_get_option_value(k, { scope = 'global' })
+end, function(k, v)
+ return a.nvim_set_option_value(k, v, { scope = 'global' })
+end)
-- vim `set` style options.
-- it has no additional metamethod magic.
-vim.o = make_meta_accessor(
- function(k) return a.nvim_get_option_value(k, {}) end,
- function(k, v) return a.nvim_set_option_value(k, v, {}) end
-)
+vim.o = make_meta_accessor(function(k)
+ return a.nvim_get_option_value(k, {})
+end, function(k, v)
+ return a.nvim_set_option_value(k, v, {})
+end)
---@brief [[
--- vim.opt, vim.opt_local and vim.opt_global implementation
@@ -154,7 +180,9 @@ vim.o = make_meta_accessor(
--- Preserves the order and does not mutate the original list
local remove_duplicate_values = function(t)
local result, seen = {}, {}
- if type(t) == "function" then error(debug.traceback("asdf")) end
+ if type(t) == 'function' then
+ error(debug.traceback('asdf'))
+ end
for _, v in ipairs(t) do
if not seen[v] then
table.insert(result, v)
@@ -171,37 +199,41 @@ end
local key_value_options = {
fillchars = true,
listchars = true,
- winhl = true,
+ winhl = true,
}
---@class OptionTypes
--- Option Type Enum
local OptionTypes = setmetatable({
BOOLEAN = 0,
- NUMBER = 1,
- STRING = 2,
- ARRAY = 3,
- MAP = 4,
- SET = 5,
+ NUMBER = 1,
+ STRING = 2,
+ ARRAY = 3,
+ MAP = 4,
+ SET = 5,
}, {
- __index = function(_, k) error("Not a valid OptionType: " .. k) end,
- __newindex = function(_, k) error("Cannot set a new OptionType: " .. k) end,
+ __index = function(_, k)
+ error('Not a valid OptionType: ' .. k)
+ end,
+ __newindex = function(_, k)
+ error('Cannot set a new OptionType: ' .. k)
+ end,
})
--- Convert a vimoption_T style dictionary to the correct OptionType associated with it.
---@return OptionType
local get_option_type = function(name, info)
- if info.type == "boolean" then
+ if info.type == 'boolean' then
return OptionTypes.BOOLEAN
- elseif info.type == "number" then
+ elseif info.type == 'number' then
return OptionTypes.NUMBER
- elseif info.type == "string" then
+ elseif info.type == 'string' then
if not info.commalist and not info.flaglist then
return OptionTypes.STRING
end
if key_value_options[name] then
- assert(info.commalist, "Must be a comma list to use key:value style")
+ assert(info.commalist, 'Must be a comma list to use key:value style')
return OptionTypes.MAP
end
@@ -211,13 +243,12 @@ local get_option_type = function(name, info)
return OptionTypes.ARRAY
end
- error("Fallthrough in OptionTypes")
+ error('Fallthrough in OptionTypes')
else
- error("Not a known info.type:" .. info.type)
+ error('Not a known info.type:' .. info.type)
end
end
-
-- Check whether the OptionTypes is allowed for vim.opt
-- If it does not match, throw an error which indicates which option causes the error.
local function assert_valid_value(name, value, types)
@@ -228,16 +259,23 @@ local function assert_valid_value(name, value, types)
end
end
- error(string.format("Invalid option type '%s' for '%s', should be %s", type_of_value, name, table.concat(types, " or ")))
+ error(
+ string.format(
+ "Invalid option type '%s' for '%s', should be %s",
+ type_of_value,
+ name,
+ table.concat(types, ' or ')
+ )
+ )
end
local valid_types = {
- [OptionTypes.BOOLEAN] = { "boolean" },
- [OptionTypes.NUMBER] = { "number" },
- [OptionTypes.STRING] = { "string" },
- [OptionTypes.SET] = { "string", "table" },
- [OptionTypes.ARRAY] = { "string", "table" },
- [OptionTypes.MAP] = { "string", "table" },
+ [OptionTypes.BOOLEAN] = { 'boolean' },
+ [OptionTypes.NUMBER] = { 'number' },
+ [OptionTypes.STRING] = { 'string' },
+ [OptionTypes.SET] = { 'string', 'table' },
+ [OptionTypes.ARRAY] = { 'string', 'table' },
+ [OptionTypes.MAP] = { 'string', 'table' },
}
--- Convert a lua value to a vimoption_T value
@@ -245,12 +283,20 @@ local convert_value_to_vim = (function()
-- Map of functions to take a Lua style value and convert to vimoption_T style value.
-- Each function takes (info, lua_value) -> vim_value
local to_vim_value = {
- [OptionTypes.BOOLEAN] = function(_, value) return value end,
- [OptionTypes.NUMBER] = function(_, value) return value end,
- [OptionTypes.STRING] = function(_, value) return value end,
+ [OptionTypes.BOOLEAN] = function(_, value)
+ return value
+ end,
+ [OptionTypes.NUMBER] = function(_, value)
+ return value
+ end,
+ [OptionTypes.STRING] = function(_, value)
+ return value
+ end,
[OptionTypes.SET] = function(info, value)
- if type(value) == "string" then return value end
+ if type(value) == 'string' then
+ return value
+ end
if info.flaglist and info.commalist then
local keys = {}
@@ -261,7 +307,7 @@ local convert_value_to_vim = (function()
end
table.sort(keys)
- return table.concat(keys, ",")
+ return table.concat(keys, ',')
else
local result = ''
for k, v in pairs(value) do
@@ -275,23 +321,27 @@ local convert_value_to_vim = (function()
end,
[OptionTypes.ARRAY] = function(info, value)
- if type(value) == "string" then return value end
+ if type(value) == 'string' then
+ return value
+ end
if not info.allows_duplicates then
value = remove_duplicate_values(value)
end
- return table.concat(value, ",")
+ return table.concat(value, ',')
end,
[OptionTypes.MAP] = function(_, value)
- if type(value) == "string" then return value end
+ if type(value) == 'string' then
+ return value
+ end
local result = {}
for opt_key, opt_value in pairs(value) do
- table.insert(result, string.format("%s:%s", opt_key, opt_value))
+ table.insert(result, string.format('%s:%s', opt_key, opt_value))
end
table.sort(result)
- return table.concat(result, ",")
+ return table.concat(result, ',')
end,
}
@@ -312,12 +362,18 @@ local convert_value_to_lua = (function()
-- Map of OptionType to functions that take vimoption_T values and convert to lua values.
-- Each function takes (info, vim_value) -> lua_value
local to_lua_value = {
- [OptionTypes.BOOLEAN] = function(_, value) return value end,
- [OptionTypes.NUMBER] = function(_, value) return value end,
- [OptionTypes.STRING] = function(_, value) return value end,
+ [OptionTypes.BOOLEAN] = function(_, value)
+ return value
+ end,
+ [OptionTypes.NUMBER] = function(_, value)
+ return value
+ end,
+ [OptionTypes.STRING] = function(_, value)
+ return value
+ end,
[OptionTypes.ARRAY] = function(info, value)
- if type(value) == "table" then
+ if type(value) == 'table' then
if not info.allows_duplicates then
value = remove_duplicate_values(value)
end
@@ -332,41 +388,43 @@ local convert_value_to_lua = (function()
end
-- Handles unescaped commas in a list.
- if string.find(value, ",,,") then
- local comma_split = vim.split(value, ",,,")
+ if string.find(value, ',,,') then
+ local comma_split = vim.split(value, ',,,')
local left = comma_split[1]
local right = comma_split[2]
local result = {}
- vim.list_extend(result, vim.split(left, ","))
- table.insert(result, ",")
- vim.list_extend(result, vim.split(right, ","))
+ vim.list_extend(result, vim.split(left, ','))
+ table.insert(result, ',')
+ vim.list_extend(result, vim.split(right, ','))
table.sort(result)
return result
end
- if string.find(value, ",^,,", 1, true) then
- local comma_split = vim.split(value, ",^,,", true)
+ if string.find(value, ',^,,', 1, true) then
+ local comma_split = vim.split(value, ',^,,', true)
local left = comma_split[1]
local right = comma_split[2]
local result = {}
- vim.list_extend(result, vim.split(left, ","))
- table.insert(result, "^,")
- vim.list_extend(result, vim.split(right, ","))
+ vim.list_extend(result, vim.split(left, ','))
+ table.insert(result, '^,')
+ vim.list_extend(result, vim.split(right, ','))
table.sort(result)
return result
end
- return vim.split(value, ",")
+ return vim.split(value, ',')
end,
[OptionTypes.SET] = function(info, value)
- if type(value) == "table" then return value end
+ if type(value) == 'table' then
+ return value
+ end
-- Empty strings mean that there is nothing there,
-- so empty table should be returned.
@@ -374,10 +432,10 @@ local convert_value_to_lua = (function()
return {}
end
- assert(info.flaglist, "That is the only one I know how to handle")
+ assert(info.flaglist, 'That is the only one I know how to handle')
if info.flaglist and info.commalist then
- local split_value = vim.split(value, ",")
+ local split_value = vim.split(value, ',')
local result = {}
for _, v in ipairs(split_value) do
result[v] = true
@@ -395,15 +453,17 @@ local convert_value_to_lua = (function()
end,
[OptionTypes.MAP] = function(info, raw_value)
- if type(raw_value) == "table" then return raw_value end
+ if type(raw_value) == 'table' then
+ return raw_value
+ end
- assert(info.commalist, "Only commas are supported currently")
+ assert(info.commalist, 'Only commas are supported currently')
local result = {}
- local comma_split = vim.split(raw_value, ",")
+ local comma_split = vim.split(raw_value, ',')
for _, key_value_str in ipairs(comma_split) do
- local key, value = unpack(vim.split(key_value_str, ":"))
+ local key, value = unpack(vim.split(key_value_str, ':'))
key = vim.trim(key)
result[key] = value
@@ -443,17 +503,21 @@ local prepend_value = (function()
end,
[OptionTypes.MAP] = function(left, right)
- return vim.tbl_extend("force", left, right)
+ return vim.tbl_extend('force', left, right)
end,
[OptionTypes.SET] = function(left, right)
- return vim.tbl_extend("force", left, right)
+ return vim.tbl_extend('force', left, right)
end,
}
return function(name, info, current, new)
return value_mutator(
- name, info, convert_value_to_lua(name, info, current), convert_value_to_lua(name, info, new), methods
+ name,
+ info,
+ convert_value_to_lua(name, info, current),
+ convert_value_to_lua(name, info, new),
+ methods
)
end
end)()
@@ -478,17 +542,21 @@ local add_value = (function()
end,
[OptionTypes.MAP] = function(left, right)
- return vim.tbl_extend("force", left, right)
+ return vim.tbl_extend('force', left, right)
end,
[OptionTypes.SET] = function(left, right)
- return vim.tbl_extend("force", left, right)
+ return vim.tbl_extend('force', left, right)
end,
}
return function(name, info, current, new)
return value_mutator(
- name, info, convert_value_to_lua(name, info, current), convert_value_to_lua(name, info, new), methods
+ name,
+ info,
+ convert_value_to_lua(name, info, current),
+ convert_value_to_lua(name, info, new),
+ methods
)
end
end)()
@@ -518,11 +586,11 @@ local remove_value = (function()
end,
[OptionTypes.STRING] = function()
- error("Subtraction not supported for strings.")
+ error('Subtraction not supported for strings.')
end,
[OptionTypes.ARRAY] = function(left, right)
- if type(right) == "string" then
+ if type(right) == 'string' then
remove_one_item(left, right)
else
for _, v in ipairs(right) do
@@ -534,7 +602,7 @@ local remove_value = (function()
end,
[OptionTypes.MAP] = function(left, right)
- if type(right) == "string" then
+ if type(right) == 'string' then
left[right] = nil
else
for _, v in ipairs(right) do
@@ -546,7 +614,7 @@ local remove_value = (function()
end,
[OptionTypes.SET] = function(left, right)
- if type(right) == "string" then
+ if type(right) == 'string' then
left[right] = nil
else
for _, v in ipairs(right) do
@@ -567,9 +635,10 @@ local create_option_metatable = function(set_type)
local set_mt, option_mt
local make_option = function(name, value)
- local info = assert(options_info[name], "Not a valid option name: " .. name)
+ _setup()
+ local info = assert(options_info[name], 'Not a valid option name: ' .. name)
- if type(value) == "table" and getmetatable(value) == option_mt then
+ if type(value) == 'table' and getmetatable(value) == option_mt then
assert(name == value._name, "must be the same value, otherwise that's weird.")
value = value._value
@@ -584,9 +653,9 @@ local create_option_metatable = function(set_type)
local scope
if set_type == SET_TYPES.GLOBAL then
- scope = "global"
+ scope = 'global'
elseif set_type == SET_TYPES.LOCAL then
- scope = "local"
+ scope = 'local'
end
option_mt = {
@@ -594,7 +663,7 @@ local create_option_metatable = function(set_type)
-- opt[my_option] = value
_set = function(self)
local value = convert_value_to_vim(self._name, self._info, self._value)
- a.nvim_set_option_value(self._name, value, {scope = scope})
+ a.nvim_set_option_value(self._name, value, { scope = scope })
return self
end,
@@ -625,13 +694,13 @@ local create_option_metatable = function(set_type)
__sub = function(self, right)
return make_option(self._name, remove_value(self._name, self._info, self._value, right))
- end
+ end,
}
option_mt.__index = option_mt
set_mt = {
__index = function(_, k)
- return make_option(k, a.nvim_get_option_value(k, {scope = scope}))
+ return make_option(k, a.nvim_get_option_value(k, { scope = scope }))
end,
__newindex = function(_, k, v)
diff --git a/runtime/lua/vim/compat.lua b/runtime/lua/vim/compat.lua
index 168979bb95..2c9786d491 100644
--- a/runtime/lua/vim/compat.lua
+++ b/runtime/lua/vim/compat.lua
@@ -7,6 +7,6 @@
local lua_version = _VERSION:sub(-3)
-if lua_version >= "5.2" then
- unpack = table.unpack -- luacheck: ignore 121 143
+if lua_version >= '5.2' then
+ unpack = table.unpack -- luacheck: ignore 121 143
end
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 417b661155..ae20b5c517 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -28,9 +28,9 @@ local global_diagnostic_options = {
M.handlers = setmetatable({}, {
__newindex = function(t, name, handler)
- vim.validate { handler = {handler, "t" } }
+ vim.validate({ handler = { handler, 't' } })
rawset(t, name, handler)
- if not global_diagnostic_options[name] then
+ if global_diagnostic_options[name] == nil then
global_diagnostic_options[name] = true
end
end,
@@ -39,7 +39,7 @@ M.handlers = setmetatable({}, {
-- Metatable that automatically creates an empty table when assigning to a missing key
local bufnr_and_namespace_cacher_mt = {
__index = function(t, bufnr)
- assert(bufnr > 0, "Invalid buffer number")
+ assert(bufnr > 0, 'Invalid buffer number')
t[bufnr] = {}
return t[bufnr]
end,
@@ -47,11 +47,11 @@ local bufnr_and_namespace_cacher_mt = {
local diagnostic_cache = setmetatable({}, {
__index = function(t, bufnr)
- assert(bufnr > 0, "Invalid buffer number")
+ assert(bufnr > 0, 'Invalid buffer number')
vim.api.nvim_buf_attach(bufnr, false, {
on_detach = function()
rawset(t, bufnr, nil) -- clear cache
- end
+ end,
})
t[bufnr] = {}
return t[bufnr]
@@ -68,7 +68,10 @@ local all_namespaces = {}
---@private
local function to_severity(severity)
if type(severity) == 'string' then
- return assert(M.severity[string.upper(severity)], string.format("Invalid severity: %s", severity))
+ return assert(
+ M.severity[string.upper(severity)],
+ string.format('Invalid severity: %s', severity)
+ )
end
return severity
end
@@ -79,15 +82,19 @@ local function filter_by_severity(severity, diagnostics)
return diagnostics
end
- if type(severity) ~= "table" then
+ if type(severity) ~= 'table' then
severity = to_severity(severity)
- return vim.tbl_filter(function(t) return t.severity == severity end, diagnostics)
+ return vim.tbl_filter(function(t)
+ return t.severity == severity
+ end, diagnostics)
end
local min_severity = to_severity(severity.min) or M.severity.HINT
local max_severity = to_severity(severity.max) or M.severity.ERROR
- return vim.tbl_filter(function(t) return t.severity <= min_severity and t.severity >= max_severity end, diagnostics)
+ return vim.tbl_filter(function(t)
+ return t.severity <= min_severity and t.severity >= max_severity
+ end, diagnostics)
end
---@private
@@ -113,17 +120,17 @@ local function prefix_source(diagnostics)
end
local t = vim.deepcopy(d)
- t.message = string.format("%s: %s", d.source, d.message)
+ t.message = string.format('%s: %s', d.source, d.message)
return t
end, diagnostics)
end
---@private
local function reformat_diagnostics(format, diagnostics)
- vim.validate {
- format = {format, 'f'},
- diagnostics = {diagnostics, 't'},
- }
+ vim.validate({
+ format = { format, 'f' },
+ diagnostics = { diagnostics, 't' },
+ })
local formatted = vim.deepcopy(diagnostics)
for _, diagnostic in ipairs(formatted) do
@@ -135,11 +142,11 @@ end
---@private
local function enabled_value(option, namespace)
local ns = namespace and M.get_namespace(namespace) or {}
- if ns.opts and type(ns.opts[option]) == "table" then
+ if ns.opts and type(ns.opts[option]) == 'table' then
return ns.opts[option]
end
- if type(global_diagnostic_options[option]) == "table" then
+ if type(global_diagnostic_options[option]) == 'table' then
return global_diagnostic_options[option]
end
@@ -162,7 +169,7 @@ local function resolve_optional_value(option, value, namespace, bufnr)
elseif type(value) == 'table' then
return value
else
- error("Unexpected option type: " .. vim.inspect(value))
+ error('Unexpected option type: ' .. vim.inspect(value))
end
end
@@ -181,10 +188,10 @@ end
-- Default diagnostic highlights
local diagnostic_severities = {
- [M.severity.ERROR] = { ctermfg = 1, guifg = "Red" };
- [M.severity.WARN] = { ctermfg = 3, guifg = "Orange" };
- [M.severity.INFO] = { ctermfg = 4, guifg = "LightBlue" };
- [M.severity.HINT] = { ctermfg = 7, guifg = "LightGrey" };
+ [M.severity.ERROR] = { ctermfg = 1, guifg = 'Red' },
+ [M.severity.WARN] = { ctermfg = 3, guifg = 'Orange' },
+ [M.severity.INFO] = { ctermfg = 4, guifg = 'LightBlue' },
+ [M.severity.HINT] = { ctermfg = 7, guifg = 'LightGrey' },
}
-- Make a map from DiagnosticSeverity -> Highlight Name
@@ -194,16 +201,16 @@ local function make_highlight_map(base_name)
for k in pairs(diagnostic_severities) do
local name = M.severity[k]
name = name:sub(1, 1) .. name:sub(2):lower()
- result[k] = "Diagnostic" .. base_name .. name
+ result[k] = 'Diagnostic' .. base_name .. name
end
return result
end
-local virtual_text_highlight_map = make_highlight_map("VirtualText")
-local underline_highlight_map = make_highlight_map("Underline")
-local floating_highlight_map = make_highlight_map("Floating")
-local sign_highlight_map = make_highlight_map("Sign")
+local virtual_text_highlight_map = make_highlight_map('VirtualText')
+local underline_highlight_map = make_highlight_map('Underline')
+local floating_highlight_map = make_highlight_map('Floating')
+local sign_highlight_map = make_highlight_map('Sign')
---@private
local define_default_signs = (function()
@@ -244,7 +251,7 @@ local function is_disabled(namespace, bufnr)
return true
end
- if type(diagnostic_disabled[bufnr]) == "table" then
+ if type(diagnostic_disabled[bufnr]) == 'table' then
return diagnostic_disabled[bufnr][namespace]
end
return diagnostic_disabled[bufnr]
@@ -271,9 +278,10 @@ end
---@private
local function set_diagnostic_cache(namespace, bufnr, diagnostics)
for _, diagnostic in ipairs(diagnostics) do
- assert(diagnostic.lnum, "Diagnostic line number is required")
- assert(diagnostic.col, "Diagnostic column is required")
- diagnostic.severity = diagnostic.severity and to_severity(diagnostic.severity) or M.severity.ERROR
+ assert(diagnostic.lnum, 'Diagnostic line number is required')
+ assert(diagnostic.col, 'Diagnostic column is required')
+ diagnostic.severity = diagnostic.severity and to_severity(diagnostic.severity)
+ or M.severity.ERROR
diagnostic.end_lnum = diagnostic.end_lnum or diagnostic.lnum
diagnostic.end_col = diagnostic.end_col or diagnostic.col
diagnostic.namespace = namespace
@@ -285,7 +293,7 @@ end
---@private
local function restore_extmarks(bufnr, last)
for ns, extmarks in pairs(diagnostic_cache_extmarks[bufnr]) do
- local extmarks_current = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, {details = true})
+ local extmarks_current = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, { details = true })
local found = {}
for _, extmark in ipairs(extmarks_current) do
-- nvim_buf_set_lines will move any extmark to the line after the last
@@ -314,10 +322,12 @@ local function save_extmarks(namespace, bufnr)
end,
on_detach = function()
diagnostic_cache_extmarks[bufnr] = nil
- end})
+ end,
+ })
diagnostic_attached_buffers[bufnr] = true
end
- diagnostic_cache_extmarks[bufnr][namespace] = vim.api.nvim_buf_get_extmarks(bufnr, namespace, 0, -1, {details = true})
+ diagnostic_cache_extmarks[bufnr][namespace] =
+ vim.api.nvim_buf_get_extmarks(bufnr, namespace, 0, -1, { details = true })
end
local registered_autocmds = {}
@@ -325,11 +335,37 @@ local registered_autocmds = {}
---@private
local function make_augroup_key(namespace, bufnr)
local ns = M.get_namespace(namespace)
- return string.format("DiagnosticInsertLeave:%s:%s", bufnr, ns.name)
+ return string.format('DiagnosticInsertLeave:%s:%s', bufnr, ns.name)
+end
+
+---@private
+local function execute_scheduled_display(namespace, bufnr)
+ local args = bufs_waiting_to_update[bufnr][namespace]
+ if not args then
+ return
+ end
+
+ -- Clear the args so we don't display unnecessarily.
+ bufs_waiting_to_update[bufnr][namespace] = nil
+
+ M.show(namespace, bufnr, nil, args)
+end
+
+--- @deprecated
+--- Callback scheduled when leaving Insert mode.
+---
+--- called from the Vimscript autocommand.
+---
+--- See @ref schedule_display()
+---
+---@private
+function M._execute_scheduled_display(namespace, bufnr)
+ vim.deprecate('vim.diagnostic._execute_scheduled_display', nil, '0.9')
+ execute_scheduled_display(namespace, bufnr)
end
--- Table of autocmd events to fire the update for displaying new diagnostic information
-local insert_leave_auto_cmds = { "InsertLeave", "CursorHoldI" }
+local insert_leave_auto_cmds = { 'InsertLeave', 'CursorHoldI' }
---@private
local function schedule_display(namespace, bufnr, args)
@@ -337,15 +373,15 @@ local function schedule_display(namespace, bufnr, args)
local key = make_augroup_key(namespace, bufnr)
if not registered_autocmds[key] then
- vim.cmd(string.format([[augroup %s
- au!
- autocmd %s <buffer=%s> lua vim.diagnostic._execute_scheduled_display(%s, %s)
- augroup END]],
- key,
- table.concat(insert_leave_auto_cmds, ","),
- bufnr,
- namespace,
- bufnr))
+ local group = vim.api.nvim_create_augroup(key, { clear = true })
+ vim.api.nvim_create_autocmd(insert_leave_auto_cmds, {
+ group = group,
+ buffer = bufnr,
+ callback = function()
+ execute_scheduled_display(namespace, bufnr)
+ end,
+ desc = 'vim.diagnostic: display diagnostics',
+ })
registered_autocmds[key] = true
end
end
@@ -355,9 +391,7 @@ local function clear_scheduled_display(namespace, bufnr)
local key = make_augroup_key(namespace, bufnr)
if registered_autocmds[key] then
- vim.cmd(string.format([[augroup %s
- au!
- augroup END]], key))
+ vim.api.nvim_del_augroup_by_name(key)
registered_autocmds[key] = nil
end
end
@@ -382,10 +416,19 @@ local function get_diagnostics(bufnr, opts, clamp)
if not opts.lnum or d.lnum == opts.lnum then
if clamp and vim.api.nvim_buf_is_loaded(b) then
local line_count = buf_line_count[b] - 1
- if (d.lnum > line_count or d.end_lnum > line_count or d.lnum < 0 or d.end_lnum < 0) then
+ if
+ d.lnum > line_count
+ or d.end_lnum > line_count
+ or d.lnum < 0
+ or d.end_lnum < 0
+ or d.col < 0
+ or d.end_col < 0
+ then
d = vim.deepcopy(d)
d.lnum = math.max(math.min(d.lnum, line_count), 0)
d.end_lnum = math.max(math.min(d.end_lnum, line_count), 0)
+ d.col = math.max(d.col, 0)
+ d.end_col = math.max(d.end_col, 0)
end
end
table.insert(diagnostics, d)
@@ -431,7 +474,7 @@ end
local function set_list(loclist, opts)
opts = opts or {}
local open = vim.F.if_nil(opts.open, true)
- local title = opts.title or "Diagnostics"
+ local title = opts.title or 'Diagnostics'
local winnr = opts.winnr or 0
local bufnr
if loclist then
@@ -447,7 +490,7 @@ local function set_list(loclist, opts)
vim.fn.setqflist({}, ' ', { title = title, items = items })
end
if open then
- vim.api.nvim_command(loclist and "lopen" or "copen")
+ vim.api.nvim_command(loclist and 'lopen' or 'botright copen')
end
end
@@ -457,7 +500,8 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
bufnr = get_bufnr(bufnr)
local wrap = vim.F.if_nil(opts.wrap, true)
local line_count = vim.api.nvim_buf_line_count(bufnr)
- local diagnostics = get_diagnostics(bufnr, vim.tbl_extend("keep", opts, {namespace = namespace}), true)
+ local diagnostics =
+ get_diagnostics(bufnr, vim.tbl_extend('keep', opts, { namespace = namespace }), true)
local line_diagnostics = diagnostic_lines(diagnostics)
for i = 0, line_count do
local offset = i * (search_forward and 1 or -1)
@@ -469,14 +513,22 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
lnum = (lnum + line_count) % line_count
end
if line_diagnostics[lnum] and not vim.tbl_isempty(line_diagnostics[lnum]) then
- local line_length = #vim.api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
+ local line_length = #vim.api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
local sort_diagnostics, is_next
if search_forward then
- sort_diagnostics = function(a, b) return a.col < b.col end
- is_next = function(d) return math.min(d.col, line_length - 1) > position[2] end
+ sort_diagnostics = function(a, b)
+ return a.col < b.col
+ end
+ is_next = function(d)
+ return math.min(d.col, line_length - 1) > position[2]
+ end
else
- sort_diagnostics = function(a, b) return a.col > b.col end
- is_next = function(d) return math.min(d.col, line_length - 1) < position[2] end
+ sort_diagnostics = function(a, b)
+ return a.col > b.col
+ end
+ is_next = function(d)
+ return math.min(d.col, line_length - 1) < position[2]
+ end
end
table.sort(line_diagnostics[lnum], sort_diagnostics)
if i == 0 then
@@ -500,28 +552,26 @@ local function diagnostic_move_pos(opts, pos)
local win_id = opts.win_id or vim.api.nvim_get_current_win()
if not pos then
- vim.api.nvim_echo({{"No more valid diagnostics to move to", "WarningMsg"}}, true, {})
+ vim.api.nvim_echo({ { 'No more valid diagnostics to move to', 'WarningMsg' } }, true, {})
return
end
vim.api.nvim_win_call(win_id, function()
-- Save position in the window's jumplist
vim.cmd("normal! m'")
- vim.api.nvim_win_set_cursor(win_id, {pos[1] + 1, pos[2]})
+ vim.api.nvim_win_set_cursor(win_id, { pos[1] + 1, pos[2] })
-- Open folds under the cursor
- vim.cmd("normal! zv")
+ vim.cmd('normal! zv')
end)
if float then
- local float_opts = type(float) == "table" and float or {}
+ local float_opts = type(float) == 'table' and float or {}
vim.schedule(function()
- M.open_float(
- vim.tbl_extend("keep", float_opts, {
- bufnr = vim.api.nvim_win_get_buf(win_id),
- scope = "cursor",
- focus = false,
- })
- )
+ M.open_float(vim.tbl_extend('keep', float_opts, {
+ bufnr = vim.api.nvim_win_get_buf(win_id),
+ scope = 'cursor',
+ focus = false,
+ }))
end)
end
end
@@ -552,7 +602,8 @@ end
--- - `table`: Enable this feature with overrides. Use an empty table to use default values.
--- - `function`: Function with signature (namespace, bufnr) that returns any of the above.
---
----@param opts table Configuration table with the following keys:
+---@param opts table|nil When omitted or "nil", retrieve the current configuration. Otherwise, a
+--- configuration table with the following keys:
--- - underline: (default true) Use underline for diagnostics. Options:
--- * severity: Only underline diagnostics matching the given severity
--- |diagnostic-severity|
@@ -598,10 +649,10 @@ end
---@param namespace number|nil Update the options for the given namespace. When omitted, update the
--- global diagnostic options.
function M.config(opts, namespace)
- vim.validate {
- opts = { opts, 't' },
+ vim.validate({
+ opts = { opts, 't', true },
namespace = { namespace, 'n', true },
- }
+ })
local t
if namespace then
@@ -611,10 +662,13 @@ function M.config(opts, namespace)
t = global_diagnostic_options
end
- for opt in pairs(global_diagnostic_options) do
- if opts[opt] ~= nil then
- t[opt] = opts[opt]
- end
+ if not opts then
+ -- Return current config
+ return vim.deepcopy(t)
+ end
+
+ for k, v in pairs(opts) do
+ t[k] = v
end
if namespace then
@@ -641,16 +695,16 @@ end
---@param diagnostics table A list of diagnostic items |diagnostic-structure|
---@param opts table|nil Display options to pass to |vim.diagnostic.show()|
function M.set(namespace, bufnr, diagnostics, opts)
- vim.validate {
- namespace = {namespace, 'n'},
- bufnr = {bufnr, 'n'},
+ vim.validate({
+ namespace = { namespace, 'n' },
+ bufnr = { bufnr, 'n' },
diagnostics = {
diagnostics,
vim.tbl_islist,
- "a list of diagnostics",
+ 'a list of diagnostics',
},
- opts = {opts, 't', true},
- }
+ opts = { opts, 't', true },
+ })
bufnr = get_bufnr(bufnr)
@@ -664,14 +718,10 @@ function M.set(namespace, bufnr, diagnostics, opts)
M.show(namespace, bufnr, nil, opts)
end
- vim.api.nvim_buf_call(bufnr, function()
- vim.api.nvim_command(
- string.format(
- "doautocmd <nomodeline> DiagnosticChanged %s",
- vim.fn.fnameescape(vim.api.nvim_buf_get_name(bufnr))
- )
- )
- end)
+ vim.api.nvim_exec_autocmds('DiagnosticChanged', {
+ modeline = false,
+ buffer = bufnr,
+ })
end
--- Get namespace metadata.
@@ -679,7 +729,7 @@ end
---@param namespace number Diagnostic namespace
---@return table Namespace metadata
function M.get_namespace(namespace)
- vim.validate { namespace = { namespace, 'n' } }
+ vim.validate({ namespace = { namespace, 'n' } })
if not all_namespaces[namespace] then
local name
for k, v in pairs(vim.api.nvim_get_namespaces()) do
@@ -689,7 +739,7 @@ function M.get_namespace(namespace)
end
end
- assert(name, "namespace does not exist or is anonymous")
+ assert(name, 'namespace does not exist or is anonymous')
all_namespaces[namespace] = {
name = name,
@@ -717,10 +767,10 @@ end
--- - severity: See |diagnostic-severity|.
---@return table A list of diagnostic items |diagnostic-structure|.
function M.get(bufnr, opts)
- vim.validate {
+ vim.validate({
bufnr = { bufnr, 'n', true },
opts = { opts, 't', true },
- }
+ })
return get_diagnostics(bufnr, opts, false)
end
@@ -749,16 +799,13 @@ function M.get_prev_pos(opts)
return false
end
- return {prev.lnum, prev.col}
+ return { prev.lnum, prev.col }
end
--- Move to the previous diagnostic in the current buffer.
---@param opts table See |vim.diagnostic.goto_next()|
function M.goto_prev(opts)
- return diagnostic_move_pos(
- opts,
- M.get_prev_pos(opts)
- )
+ return diagnostic_move_pos(opts, M.get_prev_pos(opts))
end
--- Get the next diagnostic closest to the cursor position.
@@ -785,7 +832,7 @@ function M.get_next_pos(opts)
return false
end
- return {next.lnum, next.col}
+ return { next.lnum, next.col }
end
--- Move to the next diagnostic.
@@ -803,26 +850,24 @@ end
--- the "scope" option).
--- - win_id: (number, default 0) Window ID
function M.goto_next(opts)
- return diagnostic_move_pos(
- opts,
- M.get_next_pos(opts)
- )
+ return diagnostic_move_pos(opts, M.get_next_pos(opts))
end
M.handlers.signs = {
show = function(namespace, bufnr, diagnostics, opts)
- vim.validate {
- namespace = {namespace, 'n'},
- bufnr = {bufnr, 'n'},
+ vim.validate({
+ namespace = { namespace, 'n' },
+ bufnr = { bufnr, 'n' },
diagnostics = {
diagnostics,
vim.tbl_islist,
- "a list of diagnostics",
+ 'a list of diagnostics',
},
- opts = {opts, 't', true},
- }
+ opts = { opts, 't', true },
+ })
bufnr = get_bufnr(bufnr)
+ opts = opts or {}
if opts.signs and opts.signs.severity then
diagnostics = filter_by_severity(opts.signs.severity, diagnostics)
@@ -834,7 +879,7 @@ M.handlers.signs = {
local priority = opts.signs and opts.signs.priority or 10
local get_priority
if opts.severity_sort then
- if type(opts.severity_sort) == "table" and opts.severity_sort.reverse then
+ if type(opts.severity_sort) == 'table' and opts.severity_sort.reverse then
get_priority = function(severity)
return priority + (severity - vim.diagnostic.severity.ERROR)
end
@@ -851,45 +896,40 @@ M.handlers.signs = {
local ns = M.get_namespace(namespace)
if not ns.user_data.sign_group then
- ns.user_data.sign_group = string.format("vim.diagnostic.%s", ns.name)
+ ns.user_data.sign_group = string.format('vim.diagnostic.%s', ns.name)
end
local sign_group = ns.user_data.sign_group
for _, diagnostic in ipairs(diagnostics) do
- vim.fn.sign_place(
- 0,
- sign_group,
- sign_highlight_map[diagnostic.severity],
- bufnr,
- {
- priority = get_priority(diagnostic.severity),
- lnum = diagnostic.lnum + 1
- }
- )
+ vim.fn.sign_place(0, sign_group, sign_highlight_map[diagnostic.severity], bufnr, {
+ priority = get_priority(diagnostic.severity),
+ lnum = diagnostic.lnum + 1,
+ })
end
end,
hide = function(namespace, bufnr)
local ns = M.get_namespace(namespace)
if ns.user_data.sign_group then
- vim.fn.sign_unplace(ns.user_data.sign_group, {buffer=bufnr})
+ vim.fn.sign_unplace(ns.user_data.sign_group, { buffer = bufnr })
end
end,
}
M.handlers.underline = {
show = function(namespace, bufnr, diagnostics, opts)
- vim.validate {
- namespace = {namespace, 'n'},
- bufnr = {bufnr, 'n'},
+ vim.validate({
+ namespace = { namespace, 'n' },
+ bufnr = { bufnr, 'n' },
diagnostics = {
diagnostics,
vim.tbl_islist,
- "a list of diagnostics",
+ 'a list of diagnostics',
},
- opts = {opts, 't', true},
- }
+ opts = { opts, 't', true },
+ })
bufnr = get_bufnr(bufnr)
+ opts = opts or {}
if opts.underline and opts.underline.severity then
diagnostics = filter_by_severity(opts.underline.severity, diagnostics)
@@ -897,7 +937,7 @@ M.handlers.underline = {
local ns = M.get_namespace(namespace)
if not ns.user_data.underline_ns then
- ns.user_data.underline_ns = vim.api.nvim_create_namespace("")
+ ns.user_data.underline_ns = vim.api.nvim_create_namespace('')
end
local underline_ns = ns.user_data.underline_ns
@@ -914,7 +954,8 @@ M.handlers.underline = {
underline_ns,
higroup,
{ diagnostic.lnum, diagnostic.col },
- { diagnostic.end_lnum, diagnostic.end_col }
+ { diagnostic.end_lnum, diagnostic.end_col },
+ { priority = vim.highlight.priorities.diagnostics }
)
end
save_extmarks(underline_ns, bufnr)
@@ -925,23 +966,24 @@ M.handlers.underline = {
diagnostic_cache_extmarks[bufnr][ns.user_data.underline_ns] = {}
vim.api.nvim_buf_clear_namespace(bufnr, ns.user_data.underline_ns, 0, -1)
end
- end
+ end,
}
M.handlers.virtual_text = {
show = function(namespace, bufnr, diagnostics, opts)
- vim.validate {
- namespace = {namespace, 'n'},
- bufnr = {bufnr, 'n'},
+ vim.validate({
+ namespace = { namespace, 'n' },
+ bufnr = { bufnr, 'n' },
diagnostics = {
diagnostics,
vim.tbl_islist,
- "a list of diagnostics",
+ 'a list of diagnostics',
},
- opts = {opts, 't', true},
- }
+ opts = { opts, 't', true },
+ })
bufnr = get_bufnr(bufnr)
+ opts = opts or {}
local severity
if opts.virtual_text then
@@ -950,7 +992,7 @@ M.handlers.virtual_text = {
end
if
opts.virtual_text.source
- and (opts.virtual_text.source ~= "if_many" or count_sources(bufnr) > 1)
+ and (opts.virtual_text.source ~= 'if_many' or count_sources(bufnr) > 1)
then
diagnostics = prefix_source(diagnostics)
end
@@ -961,7 +1003,7 @@ M.handlers.virtual_text = {
local ns = M.get_namespace(namespace)
if not ns.user_data.virt_text_ns then
- ns.user_data.virt_text_ns = vim.api.nvim_create_namespace("")
+ ns.user_data.virt_text_ns = vim.api.nvim_create_namespace('')
end
local virt_text_ns = ns.user_data.virt_text_ns
@@ -974,7 +1016,7 @@ M.handlers.virtual_text = {
if virt_texts then
vim.api.nvim_buf_set_extmark(bufnr, virt_text_ns, line, 0, {
- hl_mode = "combine",
+ hl_mode = 'combine',
virt_text = virt_texts,
})
end
@@ -1002,52 +1044,29 @@ function M._get_virt_text_chunks(line_diags, opts)
end
opts = opts or {}
- local prefix = opts.prefix or "■"
+ local prefix = opts.prefix or '■'
local spacing = opts.spacing or 4
-- Create a little more space between virtual text and contents
- local virt_texts = {{string.rep(" ", spacing)}}
+ local virt_texts = { { string.rep(' ', spacing) } }
for i = 1, #line_diags - 1 do
- table.insert(virt_texts, {prefix, virtual_text_highlight_map[line_diags[i].severity]})
+ table.insert(virt_texts, { prefix, virtual_text_highlight_map[line_diags[i].severity] })
end
local last = line_diags[#line_diags]
-- TODO(tjdevries): Allow different servers to be shown first somehow?
-- TODO(tjdevries): Display server name associated with these?
if last.message then
- table.insert(
- virt_texts,
- {
- string.format("%s %s", prefix, last.message:gsub("\r", ""):gsub("\n", " ")),
- virtual_text_highlight_map[last.severity]
- }
- )
+ table.insert(virt_texts, {
+ string.format('%s %s', prefix, last.message:gsub('\r', ''):gsub('\n', ' ')),
+ virtual_text_highlight_map[last.severity],
+ })
return virt_texts
end
end
---- Callback scheduled when leaving Insert mode.
----
---- This function must be exported publicly so that it is available to be
---- called from the Vimscript autocommand.
----
---- See @ref schedule_display()
----
----@private
-function M._execute_scheduled_display(namespace, bufnr)
- local args = bufs_waiting_to_update[bufnr][namespace]
- if not args then
- return
- end
-
- -- Clear the args so we don't display unnecessarily.
- bufs_waiting_to_update[bufnr][namespace] = nil
-
- M.show(namespace, bufnr, nil, args)
-end
-
--- Hide currently displayed diagnostics.
---
--- This only clears the decorations displayed in the buffer. Diagnostics can
@@ -1062,14 +1081,14 @@ end
---@param bufnr number|nil Buffer number, or 0 for current buffer. When
--- omitted, hide diagnostics in all buffers.
function M.hide(namespace, bufnr)
- vim.validate {
+ vim.validate({
namespace = { namespace, 'n', true },
bufnr = { bufnr, 'n', true },
- }
+ })
- local buffers = bufnr and {get_bufnr(bufnr)} or vim.tbl_keys(diagnostic_cache)
+ local buffers = bufnr and { get_bufnr(bufnr) } or vim.tbl_keys(diagnostic_cache)
for _, iter_bufnr in ipairs(buffers) do
- local namespaces = namespace and {namespace} or vim.tbl_keys(diagnostic_cache[iter_bufnr])
+ local namespaces = namespace and { namespace } or vim.tbl_keys(diagnostic_cache[iter_bufnr])
for _, iter_namespace in ipairs(namespaces) do
for _, handler in pairs(M.handlers) do
if handler.hide then
@@ -1094,19 +1113,21 @@ end
--- or {bufnr} is nil.
---@param opts table|nil Display options. See |vim.diagnostic.config()|.
function M.show(namespace, bufnr, diagnostics, opts)
- vim.validate {
+ vim.validate({
namespace = { namespace, 'n', true },
bufnr = { bufnr, 'n', true },
diagnostics = {
diagnostics,
- function(v) return v == nil or vim.tbl_islist(v) end,
- "a list of diagnostics",
+ function(v)
+ return v == nil or vim.tbl_islist(v)
+ end,
+ 'a list of diagnostics',
},
opts = { opts, 't', true },
- }
+ })
if not bufnr or not namespace then
- assert(not diagnostics, "Cannot show diagnostics without a buffer and namespace")
+ assert(not diagnostics, 'Cannot show diagnostics without a buffer and namespace')
if not bufnr then
for iter_bufnr in pairs(diagnostic_cache) do
M.show(namespace, iter_bufnr, nil, opts)
@@ -1127,7 +1148,7 @@ function M.show(namespace, bufnr, diagnostics, opts)
M.hide(namespace, bufnr)
- diagnostics = diagnostics or get_diagnostics(bufnr, {namespace=namespace}, true)
+ diagnostics = diagnostics or get_diagnostics(bufnr, { namespace = namespace }, true)
if not diagnostics or vim.tbl_isempty(diagnostics) then
return
@@ -1146,10 +1167,14 @@ function M.show(namespace, bufnr, diagnostics, opts)
end
if vim.F.if_nil(opts.severity_sort, false) then
- if type(opts.severity_sort) == "table" and opts.severity_sort.reverse then
- table.sort(diagnostics, function(a, b) return a.severity < b.severity end)
+ if type(opts.severity_sort) == 'table' and opts.severity_sort.reverse then
+ table.sort(diagnostics, function(a, b)
+ return a.severity < b.severity
+ end)
else
- table.sort(diagnostics, function(a, b) return a.severity > b.severity end)
+ table.sort(diagnostics, function(a, b)
+ return a.severity > b.severity
+ end)
end
end
@@ -1205,53 +1230,54 @@ end
function M.open_float(opts, ...)
-- Support old (bufnr, opts) signature
local bufnr
- if opts == nil or type(opts) == "number" then
+ if opts == nil or type(opts) == 'number' then
bufnr = opts
opts = ...
else
- vim.validate {
+ vim.validate({
opts = { opts, 't', true },
- }
+ })
end
opts = opts or {}
bufnr = get_bufnr(bufnr or opts.bufnr)
- local scope = ({l = "line", c = "cursor", b = "buffer"})[opts.scope] or opts.scope or "line"
+
+ do
+ -- Resolve options with user settings from vim.diagnostic.config
+ -- Unlike the other decoration functions (e.g. set_virtual_text, set_signs, etc.) `open_float`
+ -- does not have a dedicated table for configuration options; instead, the options are mixed in
+ -- with its `opts` table which also includes "keyword" parameters. So we create a dedicated
+ -- options table that inherits missing keys from the global configuration before resolving.
+ local t = global_diagnostic_options.float
+ local float_opts = vim.tbl_extend('keep', opts, type(t) == 'table' and t or {})
+ opts = get_resolved_options({ float = float_opts }, nil, bufnr).float
+ end
+
+ local scope = ({ l = 'line', c = 'cursor', b = 'buffer' })[opts.scope] or opts.scope or 'line'
local lnum, col
- if scope == "line" or scope == "cursor" then
+ if scope == 'line' or scope == 'cursor' then
if not opts.pos then
local pos = vim.api.nvim_win_get_cursor(0)
lnum = pos[1] - 1
col = pos[2]
- elseif type(opts.pos) == "number" then
+ elseif type(opts.pos) == 'number' then
lnum = opts.pos
- elseif type(opts.pos) == "table" then
+ elseif type(opts.pos) == 'table' then
lnum, col = unpack(opts.pos)
else
error("Invalid value for option 'pos'")
end
- elseif scope ~= "buffer" then
+ elseif scope ~= 'buffer' then
error("Invalid value for option 'scope'")
end
- do
- -- Resolve options with user settings from vim.diagnostic.config
- -- Unlike the other decoration functions (e.g. set_virtual_text, set_signs, etc.) `open_float`
- -- does not have a dedicated table for configuration options; instead, the options are mixed in
- -- with its `opts` table which also includes "keyword" parameters. So we create a dedicated
- -- options table that inherits missing keys from the global configuration before resolving.
- local t = global_diagnostic_options.float
- local float_opts = vim.tbl_extend("keep", opts, type(t) == "table" and t or {})
- opts = get_resolved_options({ float = float_opts }, nil, bufnr).float
- end
-
local diagnostics = get_diagnostics(bufnr, opts, true)
- if scope == "line" then
+ if scope == 'line' then
diagnostics = vim.tbl_filter(function(d)
return d.lnum == lnum
end, diagnostics)
- elseif scope == "cursor" then
+ elseif scope == 'cursor' then
-- LSP servers can send diagnostics with `end_col` past the length of the line
local line_length = #vim.api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
diagnostics = vim.tbl_filter(function(d)
@@ -1267,29 +1293,39 @@ function M.open_float(opts, ...)
local severity_sort = vim.F.if_nil(opts.severity_sort, global_diagnostic_options.severity_sort)
if severity_sort then
- if type(severity_sort) == "table" and severity_sort.reverse then
- table.sort(diagnostics, function(a, b) return a.severity > b.severity end)
+ if type(severity_sort) == 'table' and severity_sort.reverse then
+ table.sort(diagnostics, function(a, b)
+ return a.severity > b.severity
+ end)
else
- table.sort(diagnostics, function(a, b) return a.severity < b.severity end)
+ table.sort(diagnostics, function(a, b)
+ return a.severity < b.severity
+ end)
end
end
local lines = {}
local highlights = {}
- local header = if_nil(opts.header, "Diagnostics:")
+ local header = if_nil(opts.header, 'Diagnostics:')
if header then
- vim.validate { header = { header, function(v)
- return type(v) == "string" or type(v) == "table"
- end, "'string' or 'table'" } }
- if type(header) == "table" then
+ vim.validate({
+ header = {
+ header,
+ function(v)
+ return type(v) == 'string' or type(v) == 'table'
+ end,
+ "'string' or 'table'",
+ },
+ })
+ if type(header) == 'table' then
-- Don't insert any lines for an empty string
- if string.len(if_nil(header[1], "")) > 0 then
+ if string.len(if_nil(header[1], '')) > 0 then
table.insert(lines, header[1])
- table.insert(highlights, {0, header[2] or "Bold"})
+ table.insert(highlights, { 0, header[2] or 'Bold' })
end
elseif #header > 0 then
table.insert(lines, header)
- table.insert(highlights, {0, "Bold"})
+ table.insert(highlights, { 0, 'Bold' })
end
end
@@ -1297,38 +1333,45 @@ function M.open_float(opts, ...)
diagnostics = reformat_diagnostics(opts.format, diagnostics)
end
- if opts.source and (opts.source ~= "if_many" or count_sources(bufnr) > 1) then
+ if opts.source and (opts.source ~= 'if_many' or count_sources(bufnr) > 1) then
diagnostics = prefix_source(diagnostics)
end
- local prefix_opt = if_nil(opts.prefix, (scope == "cursor" and #diagnostics <= 1) and "" or function(_, i)
- return string.format("%d. ", i)
- end)
+ local prefix_opt =
+ if_nil(opts.prefix, (scope == 'cursor' and #diagnostics <= 1) and '' or function(_, i)
+ return string.format('%d. ', i)
+ end)
local prefix, prefix_hl_group
if prefix_opt then
- vim.validate { prefix = { prefix_opt, function(v)
- return type(v) == "string" or type(v) == "table" or type(v) == "function"
- end, "'string' or 'table' or 'function'" } }
- if type(prefix_opt) == "string" then
- prefix, prefix_hl_group = prefix_opt, "NormalFloat"
- elseif type(prefix_opt) == "table" then
- prefix, prefix_hl_group = prefix_opt[1] or "", prefix_opt[2] or "NormalFloat"
+ vim.validate({
+ prefix = {
+ prefix_opt,
+ function(v)
+ return type(v) == 'string' or type(v) == 'table' or type(v) == 'function'
+ end,
+ "'string' or 'table' or 'function'",
+ },
+ })
+ if type(prefix_opt) == 'string' then
+ prefix, prefix_hl_group = prefix_opt, 'NormalFloat'
+ elseif type(prefix_opt) == 'table' then
+ prefix, prefix_hl_group = prefix_opt[1] or '', prefix_opt[2] or 'NormalFloat'
end
end
for i, diagnostic in ipairs(diagnostics) do
- if prefix_opt and type(prefix_opt) == "function" then
+ if prefix_opt and type(prefix_opt) == 'function' then
prefix, prefix_hl_group = prefix_opt(diagnostic, i, #diagnostics)
- prefix, prefix_hl_group = prefix or "", prefix_hl_group or "NormalFloat"
+ prefix, prefix_hl_group = prefix or '', prefix_hl_group or 'NormalFloat'
end
local hiname = floating_highlight_map[diagnostic.severity]
local message_lines = vim.split(diagnostic.message, '\n')
- table.insert(lines, prefix..message_lines[1])
- table.insert(highlights, {#prefix, hiname, prefix_hl_group})
+ table.insert(lines, prefix .. message_lines[1])
+ table.insert(highlights, { #prefix, hiname, prefix_hl_group })
for j = 2, #message_lines do
table.insert(lines, string.rep(' ', #prefix) .. message_lines[j])
- table.insert(highlights, {0, hiname})
+ table.insert(highlights, { 0, hiname })
end
end
@@ -1340,9 +1383,9 @@ function M.open_float(opts, ...)
for i, hi in ipairs(highlights) do
local prefixlen, hiname, prefix_hiname = unpack(hi)
if prefix_hiname then
- vim.api.nvim_buf_add_highlight(float_bufnr, -1, prefix_hiname, i-1, 0, prefixlen)
+ vim.api.nvim_buf_add_highlight(float_bufnr, -1, prefix_hiname, i - 1, 0, prefixlen)
end
- vim.api.nvim_buf_add_highlight(float_bufnr, -1, hiname, i-1, prefixlen, -1)
+ vim.api.nvim_buf_add_highlight(float_bufnr, -1, hiname, i - 1, prefixlen, -1)
end
return float_bufnr, winnr
@@ -1360,27 +1403,23 @@ end
---@param bufnr number|nil Remove diagnostics for the given buffer. When omitted,
--- diagnostics are removed for all buffers.
function M.reset(namespace, bufnr)
- vim.validate {
- namespace = {namespace, 'n', true},
- bufnr = {bufnr, 'n', true},
- }
+ vim.validate({
+ namespace = { namespace, 'n', true },
+ bufnr = { bufnr, 'n', true },
+ })
- local buffers = bufnr and {get_bufnr(bufnr)} or vim.tbl_keys(diagnostic_cache)
+ local buffers = bufnr and { get_bufnr(bufnr) } or vim.tbl_keys(diagnostic_cache)
for _, iter_bufnr in ipairs(buffers) do
- local namespaces = namespace and {namespace} or vim.tbl_keys(diagnostic_cache[iter_bufnr])
+ local namespaces = namespace and { namespace } or vim.tbl_keys(diagnostic_cache[iter_bufnr])
for _, iter_namespace in ipairs(namespaces) do
diagnostic_cache[iter_bufnr][iter_namespace] = nil
M.hide(iter_namespace, iter_bufnr)
end
- vim.api.nvim_buf_call(iter_bufnr, function()
- vim.api.nvim_command(
- string.format(
- "doautocmd <nomodeline> DiagnosticChanged %s",
- vim.fn.fnameescape(vim.api.nvim_buf_get_name(iter_bufnr))
- )
- )
- end)
+ vim.api.nvim_exec_autocmds('DiagnosticChanged', {
+ modeline = false,
+ buffer = iter_bufnr,
+ })
end
end
@@ -1413,7 +1452,7 @@ end
--- omitted, disable diagnostics in all buffers.
---@param namespace number|nil Only disable diagnostics for the given namespace.
function M.disable(bufnr, namespace)
- vim.validate { bufnr = {bufnr, 'n', true}, namespace = {namespace, 'n', true} }
+ vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
if bufnr == nil then
if namespace == nil then
-- Disable everything (including as yet non-existing buffers and
@@ -1421,7 +1460,9 @@ function M.disable(bufnr, namespace)
-- its metatable to always return true. This metatable is removed
-- in enable()
diagnostic_disabled = setmetatable({}, {
- __index = function() return true end,
+ __index = function()
+ return true
+ end,
})
else
local ns = M.get_namespace(namespace)
@@ -1432,7 +1473,7 @@ function M.disable(bufnr, namespace)
if namespace == nil then
diagnostic_disabled[bufnr] = true
else
- if type(diagnostic_disabled[bufnr]) ~= "table" then
+ if type(diagnostic_disabled[bufnr]) ~= 'table' then
diagnostic_disabled[bufnr] = {}
end
diagnostic_disabled[bufnr][namespace] = true
@@ -1448,7 +1489,7 @@ end
--- omitted, enable diagnostics in all buffers.
---@param namespace number|nil Only enable diagnostics for the given namespace.
function M.enable(bufnr, namespace)
- vim.validate { bufnr = {bufnr, 'n', true}, namespace = {namespace, 'n', true} }
+ vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
if bufnr == nil then
if namespace == nil then
-- Enable everything by setting diagnostic_disabled to an empty table
@@ -1462,7 +1503,7 @@ function M.enable(bufnr, namespace)
if namespace == nil then
diagnostic_disabled[bufnr] = nil
else
- if type(diagnostic_disabled[bufnr]) ~= "table" then
+ if type(diagnostic_disabled[bufnr]) ~= 'table' then
return
end
diagnostic_disabled[bufnr][namespace] = nil
@@ -1499,33 +1540,33 @@ end
--- ERROR.
---@return diagnostic |diagnostic-structure| or `nil` if {pat} fails to match {str}.
function M.match(str, pat, groups, severity_map, defaults)
- vim.validate {
+ vim.validate({
str = { str, 's' },
pat = { pat, 's' },
groups = { groups, 't' },
severity_map = { severity_map, 't', true },
defaults = { defaults, 't', true },
- }
+ })
severity_map = severity_map or M.severity
local diagnostic = {}
- local matches = {string.match(str, pat)}
+ local matches = { string.match(str, pat) }
if vim.tbl_isempty(matches) then
return
end
for i, match in ipairs(matches) do
local field = groups[i]
- if field == "severity" then
+ if field == 'severity' then
match = severity_map[match]
- elseif field == "lnum" or field == "end_lnum" or field == "col" or field == "end_col" then
+ elseif field == 'lnum' or field == 'end_lnum' or field == 'col' or field == 'end_col' then
match = assert(tonumber(match)) - 1
end
diagnostic[field] = match
end
- diagnostic = vim.tbl_extend("keep", diagnostic, defaults or {})
+ diagnostic = vim.tbl_extend('keep', diagnostic, defaults or {})
diagnostic.severity = diagnostic.severity or M.severity.ERROR
diagnostic.col = diagnostic.col or 0
diagnostic.end_lnum = diagnostic.end_lnum or diagnostic.lnum
@@ -1546,13 +1587,13 @@ local errlist_type_map = {
---@param diagnostics table List of diagnostics |diagnostic-structure|.
---@return array of quickfix list items |setqflist-what|
function M.toqflist(diagnostics)
- vim.validate {
+ vim.validate({
diagnostics = {
diagnostics,
vim.tbl_islist,
- "a list of diagnostics",
+ 'a list of diagnostics',
},
- }
+ })
local list = {}
for _, v in ipairs(diagnostics) do
@@ -1583,13 +1624,13 @@ end
--- |getloclist()|.
---@return array of diagnostics |diagnostic-structure|
function M.fromqflist(list)
- vim.validate {
+ vim.validate({
list = {
list,
vim.tbl_islist,
- "a list of quickfix items",
+ 'a list of quickfix items',
},
- }
+ })
local diagnostics = {}
for _, item in ipairs(list) do
@@ -1598,7 +1639,7 @@ function M.fromqflist(list)
local col = math.max(0, item.col - 1)
local end_lnum = item.end_lnum > 0 and (item.end_lnum - 1) or lnum
local end_col = item.end_col > 0 and (item.end_col - 1) or col
- local severity = item.type ~= "" and M.severity[item.type] or M.severity.ERROR
+ local severity = item.type ~= '' and M.severity[item.type] or M.severity.ERROR
table.insert(diagnostics, {
bufnr = item.bufnr,
lnum = lnum,
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 3d91abc406..70c8cd15eb 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -3,1361 +3,2187 @@ local api = vim.api
local M = {}
---@private
-local function starsetf(ft)
- return {function(path)
- if not vim.g.fg_ignore_pat then
- return ft
- end
+local function starsetf(ft, opts)
+ return {
+ function(path, bufnr)
+ local f = type(ft) == 'function' and ft(path, bufnr) or ft
+ if not vim.g.ft_ignore_pat then
+ return f
+ end
- local re = vim.regex(vim.g.fg_ignore_pat)
- if re:match_str(path) then
- return ft
+ local re = vim.regex(vim.g.ft_ignore_pat)
+ if not re:match_str(path) then
+ return f
+ end
+ end,
+ {
+ -- Starset matches should have lowest priority by default
+ priority = (opts and opts.priority) or -math.huge,
+ },
+ }
+end
+
+---@private
+--- Get a single line or line range from the buffer.
+--- If only start_lnum is specified, return a single line as a string.
+--- If both start_lnum and end_lnum are omitted, return all lines from the buffer.
+---
+---@param bufnr number|nil The buffer to get the lines from
+---@param start_lnum number|nil The line number of the first line (inclusive, 1-based)
+---@param end_lnum number|nil The line number of the last line (inclusive, 1-based)
+---@return table<string>|string Array of lines, or string when end_lnum is omitted
+function M.getlines(bufnr, start_lnum, end_lnum)
+ if end_lnum then
+ -- Return a line range
+ return api.nvim_buf_get_lines(bufnr, start_lnum - 1, end_lnum, false)
+ end
+ if start_lnum then
+ -- Return a single line
+ return api.nvim_buf_get_lines(bufnr, start_lnum - 1, start_lnum, false)[1] or ''
+ else
+ -- Return all lines
+ return api.nvim_buf_get_lines(bufnr, 0, -1, false)
+ end
+end
+
+---@private
+--- Check whether a string matches any of the given Lua patterns.
+---
+---@param s string The string to check
+---@param patterns table<string> A list of Lua patterns
+---@return boolean `true` if s matched a pattern, else `false`
+function M.findany(s, patterns)
+ if s == nil then
+ return false
+ end
+ for _, v in ipairs(patterns) do
+ if s:find(v) then
+ return true
end
- end, {
- -- Starset matches should always have lowest priority
- priority = -math.huge,
- }}
+ end
+ return false
end
---@private
-local function getline(bufnr, lnum)
- return api.nvim_buf_get_lines(bufnr, lnum-1, lnum, false)[1]
+--- Get the next non-whitespace line in the buffer.
+---
+---@param bufnr number The buffer to get the line from
+---@param start_lnum number The line number of the first line to start from (inclusive, 1-based)
+---@return string|nil The first non-blank line if found or `nil` otherwise
+function M.nextnonblank(bufnr, start_lnum)
+ for _, line in ipairs(M.getlines(bufnr, start_lnum, -1)) do
+ if not line:find('^%s*$') then
+ return line
+ end
+ end
+ return nil
end
--- Filetypes based on file extension
+---@private
+--- Check whether the given string matches the Vim regex pattern.
+M.matchregex = (function()
+ local cache = {}
+ return function(s, pattern)
+ if s == nil then
+ return nil
+ end
+ if not cache[pattern] then
+ cache[pattern] = vim.regex(pattern)
+ end
+ return cache[pattern]:match_str(s)
+ end
+end)()
+
-- luacheck: push no unused args
+-- luacheck: push ignore 122
+
+-- Filetypes based on file extension
+---@diagnostic disable: unused-local
local extension = {
-- BEGIN EXTENSION
- ["8th"] = "8th",
- ["a65"] = "a65",
- aap = "aap",
- abap = "abap",
- abc = "abc",
- abl = "abel",
- wrm = "acedb",
- ads = "ada",
- ada = "ada",
- gpr = "ada",
- adb = "ada",
- tdf = "ahdl",
- aidl = "aidl",
- aml = "aml",
- run = "ampl",
- scpt = "applescript",
- ino = "arduino",
- pde = "arduino",
- art = "art",
- asciidoc = "asciidoc",
- adoc = "asciidoc",
- ["asn1"] = "asn",
- asn = "asn",
- atl = "atlas",
- as = "atlas",
- ahk = "autohotkey",
- ["au3"] = "autoit",
- ave = "ave",
- gawk = "awk",
- awk = "awk",
- ref = "b",
- imp = "b",
- mch = "b",
- bc = "bc",
- bdf = "bdf",
- beancount = "beancount",
- bib = "bib",
- bl = "blank",
- bsdl = "bsdl",
- bst = "bst",
- bzl = "bzl",
- bazel = "bzl",
- BUILD = "bzl",
- qc = "c",
- cabal = "cabal",
- cdl = "cdl",
- toc = "cdrtoc",
- cfc = "cf",
- cfm = "cf",
- cfi = "cf",
- cfg = "cfg",
- hgrc = "cfg",
- chf = "ch",
- chai = "chaiscript",
- chs = "chaskell",
- chopro = "chordpro",
- crd = "chordpro",
- crdpro = "chordpro",
- cho = "chordpro",
- chordpro = "chordpro",
- eni = "cl",
- dcl = "clean",
- icl = "clean",
- cljx = "clojure",
- clj = "clojure",
- cljc = "clojure",
- cljs = "clojure",
- cmake = "cmake",
- cmod = "cmod",
- lib = "cobol",
- cob = "cobol",
- cbl = "cobol",
- atg = "coco",
- recipe = "conaryrecipe",
- mklx = "context",
- mkiv = "context",
- mkii = "context",
- mkxl = "context",
- mkvi = "context",
- moc = "cpp",
- hh = "cpp",
- tlh = "cpp",
- inl = "cpp",
- ipp = "cpp",
- ["c++"] = "cpp",
- C = "cpp",
- cxx = "cpp",
- H = "cpp",
- tcc = "cpp",
- hxx = "cpp",
- hpp = "cpp",
- cpp = function()
- if vim.g.cynlib_syntax_for_cc then
- return "cynlib"
+ ['8th'] = '8th',
+ ['a65'] = 'a65',
+ aap = 'aap',
+ abap = 'abap',
+ abc = 'abc',
+ abl = 'abel',
+ wrm = 'acedb',
+ ads = 'ada',
+ ada = 'ada',
+ gpr = 'ada',
+ adb = 'ada',
+ tdf = 'ahdl',
+ aidl = 'aidl',
+ aml = 'aml',
+ run = 'ampl',
+ scpt = 'applescript',
+ ino = 'arduino',
+ pde = 'arduino',
+ art = 'art',
+ asciidoc = 'asciidoc',
+ adoc = 'asciidoc',
+ asa = function(path, bufnr)
+ if vim.g.filetype_asa then
+ return vim.g.filetype_asa
end
- return "cpp"
- end,
- crm = "crm",
- csx = "cs",
- cs = "cs",
- csc = "csc",
- csdl = "csdl",
- fdr = "csp",
- csp = "csp",
- css = "css",
- con = "cterm",
- feature = "cucumber",
- cuh = "cuda",
- cu = "cuda",
- pld = "cupl",
- si = "cuplsim",
- cyn = "cynpp",
- dart = "dart",
- drt = "dart",
- ds = "datascript",
- dcd = "dcd",
- def = "def",
- desc = "desc",
- directory = "desktop",
- desktop = "desktop",
- diff = "diff",
- rej = "diff",
- Dockerfile = "dockerfile",
- sys = "dosbatch",
- bat = "dosbatch",
- wrap = "dosini",
- ini = "dosini",
- dot = "dot",
- gv = "dot",
- drac = "dracula",
- drc = "dracula",
- dtd = "dtd",
- dts = "dts",
- dtsi = "dts",
- dylan = "dylan",
- intr = "dylanintr",
- lid = "dylanlid",
- ecd = "ecd",
- eex = "eelixir",
- leex = "eelixir",
- exs = "elixir",
- elm = "elm",
- epp = "epuppet",
- erl = "erlang",
- hrl = "erlang",
- yaws = "erlang",
- erb = "eruby",
- rhtml = "eruby",
- ec = "esqlc",
- EC = "esqlc",
- strl = "esterel",
- exp = "expect",
- factor = "factor",
- fal = "falcon",
- fan = "fan",
- fwt = "fan",
- fnl = "fennel",
- ["m4gl"] = "fgl",
- ["4gl"] = "fgl",
- ["4gh"] = "fgl",
- fish = "fish",
- focexec = "focexec",
- fex = "focexec",
- fth = "forth",
- ft = "forth",
- FOR = "fortran",
- ["f77"] = "fortran",
- ["f03"] = "fortran",
- fortran = "fortran",
- ["F95"] = "fortran",
- ["f90"] = "fortran",
- ["F03"] = "fortran",
- fpp = "fortran",
- FTN = "fortran",
- ftn = "fortran",
- ["for"] = "fortran",
- ["F90"] = "fortran",
- ["F77"] = "fortran",
- ["f95"] = "fortran",
- FPP = "fortran",
- f = "fortran",
- F = "fortran",
- ["F08"] = "fortran",
- ["f08"] = "fortran",
- fpc = "fpcmake",
- fsl = "framescript",
- bi = "freebasic",
- fb = "freebasic",
- fsi = "fsharp",
- fsx = "fsharp",
- gdmo = "gdmo",
- mo = "gdmo",
- ged = "gedcom",
- gmi = "gemtext",
- gemini = "gemtext",
- gift = "gift",
- gpi = "gnuplot",
- go = "go",
- gp = "gp",
- gs = "grads",
- gretl = "gretl",
- gradle = "groovy",
- groovy = "groovy",
- gsp = "gsp",
- haml = "haml",
- hsm = "hamster",
- ["hs-boot"] = "haskell",
- hsig = "haskell",
- hsc = "haskell",
- hs = "haskell",
- ht = "haste",
- htpp = "hastepreproc",
- hb = "hb",
- sum = "hercules",
- errsum = "hercules",
- ev = "hercules",
- vc = "hercules",
- hex = "hex",
- ["h32"] = "hex",
- hog = "hog",
- hws = "hollywood",
- htt = "httest",
- htb = "httest",
- iba = "ibasic",
- ibi = "ibasic",
- icn = "icon",
- inf = "inform",
- INF = "inform",
- ii = "initng",
- iss = "iss",
- mst = "ist",
- ist = "ist",
- ijs = "j",
- JAL = "jal",
- jal = "jal",
- jpr = "jam",
- jpl = "jam",
- jav = "java",
- java = "java",
- jj = "javacc",
- jjt = "javacc",
- es = "javascript",
- mjs = "javascript",
- javascript = "javascript",
- js = "javascript",
- cjs = "javascript",
- jsx = "javascriptreact",
- clp = "jess",
- jgr = "jgraph",
- ["j73"] = "jovial",
- jov = "jovial",
- jovial = "jovial",
- properties = "jproperties",
- slnf = "json",
- json = "json",
- jsonp = "json",
- webmanifest = "json",
- ipynb = "json",
- ["json-patch"] = "json",
- jsonc = "jsonc",
- jsp = "jsp",
- jl = "julia",
- kv = "kivy",
- kix = "kix",
- kts = "kotlin",
- kt = "kotlin",
- ktm = "kotlin",
- ks = "kscript",
- k = "kwt",
- ACE = "lace",
- ace = "lace",
- latte = "latte",
- lte = "latte",
- ld = "ld",
- ldif = "ldif",
- less = "less",
- lex = "lex",
- lxx = "lex",
- ["l++"] = "lex",
- l = "lex",
- lhs = "lhaskell",
- ll = "lifelines",
- liquid = "liquid",
- cl = "lisp",
- L = "lisp",
- lisp = "lisp",
- el = "lisp",
- lsp = "lisp",
- asd = "lisp",
- lt = "lite",
- lite = "lite",
- lgt = "logtalk",
- lotos = "lotos",
- lot = "lotos",
- lout = "lout",
- lou = "lout",
- ulpc = "lpc",
- lpc = "lpc",
- sig = "lprolog",
- lsl = "lsl",
- lss = "lss",
- nse = "lua",
- rockspec = "lua",
- lua = "lua",
- quake = "m3quake",
- at = "m4",
- eml = "mail",
- mk = "make",
- mak = "make",
- dsp = "make",
- page = "mallard",
- map = "map",
- mws = "maple",
- mpl = "maple",
- mv = "maple",
- mkdn = "markdown",
- md = "markdown",
- mdwn = "markdown",
- mkd = "markdown",
- markdown = "markdown",
- mdown = "markdown",
- mhtml = "mason",
- comp = "mason",
- mason = "mason",
- master = "master",
- mas = "master",
- mel = "mel",
- mf = "mf",
- mgl = "mgl",
- mgp = "mgp",
- my = "mib",
- mib = "mib",
- mix = "mix",
- mixal = "mix",
- nb = "mma",
- mmp = "mmp",
- DEF = "modula2",
- ["m2"] = "modula2",
- MOD = "modula2",
- mi = "modula2",
- ssc = "monk",
- monk = "monk",
- tsc = "monk",
- isc = "monk",
- moo = "moo",
- mp = "mp",
- mof = "msidl",
- odl = "msidl",
- msql = "msql",
- mu = "mupad",
- mush = "mush",
- mysql = "mysql",
- ["n1ql"] = "n1ql",
- nql = "n1ql",
- nanorc = "nanorc",
- ncf = "ncf",
- nginx = "nginx",
- ninja = "ninja",
- nqc = "nqc",
- roff = "nroff",
- tmac = "nroff",
- man = "nroff",
- mom = "nroff",
- nr = "nroff",
- tr = "nroff",
- nsi = "nsis",
- nsh = "nsis",
- obj = "obj",
- mlt = "ocaml",
- mly = "ocaml",
- mll = "ocaml",
- mlp = "ocaml",
- mlip = "ocaml",
- mli = "ocaml",
- ml = "ocaml",
- occ = "occam",
- xom = "omnimark",
- xin = "omnimark",
- opam = "opam",
- ["or"] = "openroad",
- ora = "ora",
- pxsl = "papp",
- papp = "papp",
- pxml = "papp",
- pas = "pascal",
- lpr = "pascal",
- dpr = "pascal",
- pbtxt = "pbtxt",
- g = "pccts",
- pcmk = "pcmk",
- pdf = "pdf",
- plx = "perl",
- psgi = "perl",
- al = "perl",
- ctp = "php",
- php = "php",
- phtml = "php",
- pike = "pike",
- pmod = "pike",
- rcp = "pilrc",
- pli = "pli",
- ["pl1"] = "pli",
- ["p36"] = "plm",
- plm = "plm",
- pac = "plm",
- plp = "plp",
- pls = "plsql",
- plsql = "plsql",
- po = "po",
- pot = "po",
- pod = "pod",
- pk = "poke",
- ps = "postscr",
- epsi = "postscr",
- afm = "postscr",
- epsf = "postscr",
- eps = "postscr",
- pfa = "postscr",
- ai = "postscr",
- pov = "pov",
- ppd = "ppd",
- it = "ppwiz",
- ih = "ppwiz",
- action = "privoxy",
- pc = "proc",
- pdb = "prolog",
- pml = "promela",
- proto = "proto",
- ["psd1"] = "ps1",
- ["psm1"] = "ps1",
- ["ps1"] = "ps1",
- pssc = "ps1",
- ["ps1xml"] = "ps1xml",
- psf = "psf",
- psl = "psl",
- arr = "pyret",
- pxd = "pyrex",
- pyx = "pyrex",
- pyw = "python",
- py = "python",
- pyi = "python",
- ptl = "python",
- rad = "radiance",
- mat = "radiance",
- ["pod6"] = "raku",
- rakudoc = "raku",
- rakutest = "raku",
- rakumod = "raku",
- ["pm6"] = "raku",
- raku = "raku",
- ["t6"] = "raku",
- ["p6"] = "raku",
- raml = "raml",
- rbs = "rbs",
- rego = "rego",
- rem = "remind",
- remind = "remind",
- frt = "reva",
- testUnit = "rexx",
- rex = "rexx",
- orx = "rexx",
- rexx = "rexx",
- jrexx = "rexx",
- rxj = "rexx",
- rexxj = "rexx",
- testGroup = "rexx",
- rxo = "rexx",
- Rd = "rhelp",
- rd = "rhelp",
- rib = "rib",
- Rmd = "rmd",
- rmd = "rmd",
- smd = "rmd",
- Smd = "rmd",
- rnc = "rnc",
- rng = "rng",
- rnw = "rnoweb",
- snw = "rnoweb",
- Rnw = "rnoweb",
- Snw = "rnoweb",
- rsc = "routeros",
- x = "rpcgen",
- rpl = "rpl",
- Srst = "rrst",
- srst = "rrst",
- Rrst = "rrst",
- rrst = "rrst",
- rst = "rst",
- rtf = "rtf",
- rjs = "ruby",
- rxml = "ruby",
- rb = "ruby",
- rant = "ruby",
- ru = "ruby",
- rbw = "ruby",
- gemspec = "ruby",
- builder = "ruby",
- rake = "ruby",
- rs = "rust",
- sas = "sas",
- sass = "sass",
- sa = "sather",
- sbt = "sbt",
- scala = "scala",
- sc = "scala",
- scd = "scdoc",
- ss = "scheme",
- scm = "scheme",
- sld = "scheme",
- rkt = "scheme",
- rktd = "scheme",
- rktl = "scheme",
- sce = "scilab",
- sci = "scilab",
- scss = "scss",
- sd = "sd",
- sdc = "sdc",
- pr = "sdl",
- sdl = "sdl",
- sed = "sed",
- sexp = "sexplib",
- sieve = "sieve",
- siv = "sieve",
- sil = "sil",
- sim = "simula",
- ["s85"] = "sinda",
- sin = "sinda",
- ssm = "sisu",
- sst = "sisu",
- ssi = "sisu",
- ["_sst"] = "sisu",
- ["-sst"] = "sisu",
- il = "skill",
- ils = "skill",
- cdf = "skill",
- sl = "slang",
- ice = "slice",
- score = "slrnsc",
- tpl = "smarty",
- ihlp = "smcl",
- smcl = "smcl",
- hlp = "smcl",
- smith = "smith",
- smt = "smith",
- sml = "sml",
- spt = "snobol4",
- sno = "snobol4",
- sln = "solution",
- sparql = "sparql",
- rq = "sparql",
- spec = "spec",
- spice = "spice",
- sp = "spice",
- spd = "spup",
- spdata = "spup",
- speedup = "spup",
- spi = "spyce",
- spy = "spyce",
- tyc = "sql",
- typ = "sql",
- pkb = "sql",
- tyb = "sql",
- pks = "sql",
- sqlj = "sqlj",
- sqi = "sqr",
- sqr = "sqr",
- nut = "squirrel",
- ["s28"] = "srec",
- ["s37"] = "srec",
- srec = "srec",
- mot = "srec",
- ["s19"] = "srec",
- st = "st",
- imata = "stata",
- ["do"] = "stata",
- mata = "stata",
- ado = "stata",
- stp = "stp",
- svelte = "svelte",
- svg = "svg",
- swift = "swift",
- svh = "systemverilog",
- sv = "systemverilog",
- tak = "tak",
- task = "taskedit",
- tm = "tcl",
- tcl = "tcl",
- itk = "tcl",
- itcl = "tcl",
- tk = "tcl",
- jacl = "tcl",
- tmpl = "template",
- ti = "terminfo",
- dtx = "tex",
- ltx = "tex",
- bbl = "tex",
- latex = "tex",
- sty = "tex",
- texi = "texinfo",
- txi = "texinfo",
- texinfo = "texinfo",
- text = "text",
- tf = "tf",
- tli = "tli",
- toml = "toml",
- tpp = "tpp",
- treetop = "treetop",
- slt = "tsalt",
- tsscl = "tsscl",
- tssgm = "tssgm",
- tssop = "tssop",
- tutor = "tutor",
- twig = "twig",
- ts = function(path, bufnr)
- if getline(bufnr, 1):find("<%?xml") then
- return "xml"
- else
- return "typescript"
+ return 'aspvbs'
+ end,
+ asm = function(path, bufnr)
+ return require('vim.filetype.detect').asm(bufnr)
+ end,
+ lst = function(path, bufnr)
+ return require('vim.filetype.detect').asm(bufnr)
+ end,
+ mac = function(path, bufnr)
+ return require('vim.filetype.detect').asm(bufnr)
+ end,
+ ['asn1'] = 'asn',
+ asn = 'asn',
+ asp = function(path, bufnr)
+ return require('vim.filetype.detect').asp(bufnr)
+ end,
+ atl = 'atlas',
+ as = 'atlas',
+ ahk = 'autohotkey',
+ ['au3'] = 'autoit',
+ ave = 'ave',
+ gawk = 'awk',
+ awk = 'awk',
+ ref = 'b',
+ imp = 'b',
+ mch = 'b',
+ bas = function(path, bufnr)
+ return require('vim.filetype.detect').bas(bufnr)
+ end,
+ bi = function(path, bufnr)
+ return require('vim.filetype.detect').bas(bufnr)
+ end,
+ bm = function(path, bufnr)
+ return require('vim.filetype.detect').bas(bufnr)
+ end,
+ bc = 'bc',
+ bdf = 'bdf',
+ beancount = 'beancount',
+ bib = 'bib',
+ com = function(path, bufnr)
+ return require('vim.filetype.detect').bindzone(bufnr, 'dcl')
+ end,
+ db = function(path, bufnr)
+ return require('vim.filetype.detect').bindzone(bufnr, '')
+ end,
+ bicep = 'bicep',
+ bb = 'bitbake',
+ bbappend = 'bitbake',
+ bbclass = 'bitbake',
+ bl = 'blank',
+ bsdl = 'bsdl',
+ bst = 'bst',
+ btm = function(path, bufnr)
+ return (vim.g.dosbatch_syntax_for_btm and vim.g.dosbatch_syntax_for_btm ~= 0) and 'dosbatch'
+ or 'btm'
+ end,
+ bzl = 'bzl',
+ bazel = 'bzl',
+ BUILD = 'bzl',
+ qc = 'c',
+ cabal = 'cabal',
+ cdl = 'cdl',
+ toc = 'cdrtoc',
+ cfc = 'cf',
+ cfm = 'cf',
+ cfi = 'cf',
+ hgrc = 'cfg',
+ chf = 'ch',
+ chai = 'chaiscript',
+ ch = function(path, bufnr)
+ return require('vim.filetype.detect').change(bufnr)
+ end,
+ chs = 'chaskell',
+ chopro = 'chordpro',
+ crd = 'chordpro',
+ crdpro = 'chordpro',
+ cho = 'chordpro',
+ chordpro = 'chordpro',
+ eni = 'cl',
+ icl = 'clean',
+ cljx = 'clojure',
+ clj = 'clojure',
+ cljc = 'clojure',
+ cljs = 'clojure',
+ cook = 'cook',
+ cmake = 'cmake',
+ cmod = 'cmod',
+ lib = 'cobol',
+ cob = 'cobol',
+ cbl = 'cobol',
+ atg = 'coco',
+ recipe = 'conaryrecipe',
+ hook = function(path, bufnr)
+ return M.getlines(bufnr, 1) == '[Trigger]' and 'conf'
+ end,
+ mklx = 'context',
+ mkiv = 'context',
+ mkii = 'context',
+ mkxl = 'context',
+ mkvi = 'context',
+ control = function(path, bufnr)
+ return require('vim.filetype.detect').control(bufnr)
+ end,
+ copyright = function(path, bufnr)
+ return require('vim.filetype.detect').copyright(bufnr)
+ end,
+ csh = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ moc = 'cpp',
+ hh = 'cpp',
+ tlh = 'cpp',
+ inl = 'cpp',
+ ipp = 'cpp',
+ ['c++'] = 'cpp',
+ C = 'cpp',
+ cxx = 'cpp',
+ H = 'cpp',
+ tcc = 'cpp',
+ hxx = 'cpp',
+ hpp = 'cpp',
+ cpp = function(path, bufnr)
+ return vim.g.cynlib_syntax_for_cpp and 'cynlib' or 'cpp'
+ end,
+ cc = function(path, bufnr)
+ return vim.g.cynlib_syntax_for_cc and 'cynlib' or 'cpp'
+ end,
+ crm = 'crm',
+ csx = 'cs',
+ cs = 'cs',
+ csc = 'csc',
+ csdl = 'csdl',
+ cshtml = 'html',
+ fdr = 'csp',
+ csp = 'csp',
+ css = 'css',
+ csv = 'csv',
+ con = 'cterm',
+ feature = 'cucumber',
+ cuh = 'cuda',
+ cu = 'cuda',
+ pld = 'cupl',
+ si = 'cuplsim',
+ cyn = 'cynpp',
+ dart = 'dart',
+ drt = 'dart',
+ ds = 'datascript',
+ dcd = 'dcd',
+ decl = function(path, bufnr)
+ return require('vim.filetype.detect').decl(bufnr)
+ end,
+ dec = function(path, bufnr)
+ return require('vim.filetype.detect').decl(bufnr)
+ end,
+ dcl = function(path, bufnr)
+ return require('vim.filetype.detect').decl(bufnr) or 'clean'
+ end,
+ def = 'def',
+ desc = 'desc',
+ directory = 'desktop',
+ desktop = 'desktop',
+ diff = 'diff',
+ rej = 'diff',
+ Dockerfile = 'dockerfile',
+ dockerfile = 'dockerfile',
+ bat = 'dosbatch',
+ wrap = 'dosini',
+ ini = 'dosini',
+ dot = 'dot',
+ gv = 'dot',
+ drac = 'dracula',
+ drc = 'dracula',
+ dtd = 'dtd',
+ d = function(path, bufnr)
+ return require('vim.filetype.detect').dtrace(bufnr)
+ end,
+ dts = 'dts',
+ dtsi = 'dts',
+ dylan = 'dylan',
+ intr = 'dylanintr',
+ lid = 'dylanlid',
+ e = function(path, bufnr)
+ return require('vim.filetype.detect').e(bufnr)
+ end,
+ E = function(path, bufnr)
+ return require('vim.filetype.detect').e(bufnr)
+ end,
+ ecd = 'ecd',
+ edf = 'edif',
+ edif = 'edif',
+ edo = 'edif',
+ edn = function(path, bufnr)
+ return require('vim.filetype.detect').edn(bufnr)
+ end,
+ eex = 'eelixir',
+ leex = 'eelixir',
+ am = function(path, bufnr)
+ if not path:lower():find('makefile%.am$') then
+ return 'elf'
end
end,
- tsx = "typescriptreact",
- uc = "uc",
- uit = "uil",
- uil = "uil",
- sba = "vb",
- vb = "vb",
- dsm = "vb",
- ctl = "vb",
- vbs = "vb",
- vr = "vera",
- vri = "vera",
- vrh = "vera",
- v = "verilog",
- va = "verilogams",
- vams = "verilogams",
- vhdl = "vhdl",
- vst = "vhdl",
- vhd = "vhdl",
- hdl = "vhdl",
- vho = "vhdl",
- vbe = "vhdl",
- vim = "vim",
- vba = "vim",
- mar = "vmasm",
- cm = "voscm",
- wrl = "vrml",
- vroom = "vroom",
- vue = "vue",
- wat = "wast",
- wast = "wast",
- wm = "webmacro",
- wbt = "winbatch",
- wml = "wml",
- wsml = "wsml",
- ad = "xdefaults",
- xhtml = "xhtml",
- xht = "xhtml",
- msc = "xmath",
- msf = "xmath",
- ["psc1"] = "xml",
- tpm = "xml",
- xliff = "xml",
- atom = "xml",
- xul = "xml",
- cdxml = "xml",
- mpd = "xml",
- rss = "xml",
- fsproj = "xml",
- ui = "xml",
- vbproj = "xml",
- xlf = "xml",
- wsdl = "xml",
- csproj = "xml",
- wpl = "xml",
- xmi = "xml",
- ["xpm2"] = "xpm2",
- xqy = "xquery",
- xqm = "xquery",
- xquery = "xquery",
- xq = "xquery",
- xql = "xquery",
- xs = "xs",
- xsd = "xsd",
- xsl = "xslt",
- xslt = "xslt",
- yy = "yacc",
- ["y++"] = "yacc",
- yxx = "yacc",
- yml = "yaml",
- yaml = "yaml",
- ["z8a"] = "z8a",
- zig = "zig",
- zu = "zimbu",
- zut = "zimbutempl",
- zsh = "zsh",
- E = function() vim.fn["dist#ft#FTe"]() end,
- EU = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- EW = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- EX = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- EXU = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- EXW = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- PL = function() vim.fn["dist#ft#FTpl"]() end,
- R = function() vim.fn["dist#ft#FTr"]() end,
- asm = function() vim.fn["dist#ft#FTasm"]() end,
- bas = function() vim.fn["dist#ft#FTVB"]("basic") end,
- bash = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- btm = function() vim.fn["dist#ft#FTbtm"]() end,
- c = function() vim.fn["dist#ft#FTlpc"]() end,
- ch = function() vim.fn["dist#ft#FTchange"]() end,
- com = function() vim.fn["dist#ft#BindzoneCheck"]('dcl') end,
- cpt = function() vim.fn["dist#ft#FThtml"]() end,
- csh = function() vim.fn["dist#ft#CSH"]() end,
- d = function() vim.fn["dist#ft#DtraceCheck"]() end,
- db = function() vim.fn["dist#ft#BindzoneCheck"]('') end,
- dtml = function() vim.fn["dist#ft#FThtml"]() end,
- e = function() vim.fn["dist#ft#FTe"]() end,
- ebuild = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- eclass = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- ent = function() vim.fn["dist#ft#FTent"]() end,
- env = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
- eu = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- ew = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- ex = function() vim.fn["dist#ft#ExCheck"]() end,
- exu = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- exw = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- frm = function() vim.fn["dist#ft#FTVB"]("form") end,
- fs = function() vim.fn["dist#ft#FTfs"]() end,
- h = function() vim.fn["dist#ft#FTheader"]() end,
- htm = function() vim.fn["dist#ft#FThtml"]() end,
- html = function() vim.fn["dist#ft#FThtml"]() end,
- i = function() vim.fn["dist#ft#FTprogress_asm"]() end,
- idl = function() vim.fn["dist#ft#FTidl"]() end,
- inc = function() vim.fn["dist#ft#FTinc"]() end,
- inp = function() vim.fn["dist#ft#Check_inp"]() end,
- ksh = function() vim.fn["dist#ft#SetFileTypeSH"]("ksh") end,
- lst = function() vim.fn["dist#ft#FTasm"]() end,
- m = function() vim.fn["dist#ft#FTm"]() end,
- mac = function() vim.fn["dist#ft#FTasm"]() end,
- mc = function() vim.fn["dist#ft#McSetf"]() end,
- mm = function() vim.fn["dist#ft#FTmm"]() end,
- mms = function() vim.fn["dist#ft#FTmms"]() end,
- p = function() vim.fn["dist#ft#FTprogress_pascal"]() end,
- pl = function() vim.fn["dist#ft#FTpl"]() end,
- pp = function() vim.fn["dist#ft#FTpp"]() end,
- pro = function() vim.fn["dist#ft#ProtoCheck"]('idlang') end,
- pt = function() vim.fn["dist#ft#FThtml"]() end,
- r = function() vim.fn["dist#ft#FTr"]() end,
- rdf = function() vim.fn["dist#ft#Redif"]() end,
- rules = function() vim.fn["dist#ft#FTRules"]() end,
- sh = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
- shtml = function() vim.fn["dist#ft#FThtml"]() end,
- sql = function() vim.fn["dist#ft#SQL"]() end,
- stm = function() vim.fn["dist#ft#FThtml"]() end,
- tcsh = function() vim.fn["dist#ft#SetFileTypeShell"]("tcsh") end,
- tex = function() vim.fn["dist#ft#FTtex"]() end,
- w = function() vim.fn["dist#ft#FTprogress_cweb"]() end,
- xml = function() vim.fn["dist#ft#FTxml"]() end,
- y = function() vim.fn["dist#ft#FTy"]() end,
- zsql = function() vim.fn["dist#ft#SQL"]() end,
+ exs = 'elixir',
+ elm = 'elm',
+ elv = 'elvish',
+ ent = function(path, bufnr)
+ return require('vim.filetype.detect').ent(bufnr)
+ end,
+ epp = 'epuppet',
+ erl = 'erlang',
+ hrl = 'erlang',
+ yaws = 'erlang',
+ erb = 'eruby',
+ rhtml = 'eruby',
+ ec = 'esqlc',
+ EC = 'esqlc',
+ strl = 'esterel',
+ eu = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ EU = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ ew = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ EW = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ EX = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ exu = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ EXU = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ exw = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ EXW = function(path, bufnr)
+ return vim.g.filetype_euphoria or 'euphoria3'
+ end,
+ ex = function(path, bufnr)
+ return require('vim.filetype.detect').ex(bufnr)
+ end,
+ exp = 'expect',
+ factor = 'factor',
+ fal = 'falcon',
+ fan = 'fan',
+ fwt = 'fan',
+ fnl = 'fennel',
+ ['m4gl'] = 'fgl',
+ ['4gl'] = 'fgl',
+ ['4gh'] = 'fgl',
+ fish = 'fish',
+ focexec = 'focexec',
+ fex = 'focexec',
+ fth = 'forth',
+ ft = 'forth',
+ FOR = 'fortran',
+ ['f77'] = 'fortran',
+ ['f03'] = 'fortran',
+ fortran = 'fortran',
+ ['F95'] = 'fortran',
+ ['f90'] = 'fortran',
+ ['F03'] = 'fortran',
+ fpp = 'fortran',
+ FTN = 'fortran',
+ ftn = 'fortran',
+ ['for'] = 'fortran',
+ ['F90'] = 'fortran',
+ ['F77'] = 'fortran',
+ ['f95'] = 'fortran',
+ FPP = 'fortran',
+ f = 'fortran',
+ F = 'fortran',
+ ['F08'] = 'fortran',
+ ['f08'] = 'fortran',
+ fpc = 'fpcmake',
+ fsl = 'framescript',
+ frm = function(path, bufnr)
+ return require('vim.filetype.detect').frm(bufnr)
+ end,
+ fb = 'freebasic',
+ fs = function(path, bufnr)
+ return require('vim.filetype.detect').fs(bufnr)
+ end,
+ fsi = 'fsharp',
+ fsx = 'fsharp',
+ fusion = 'fusion',
+ gdb = 'gdb',
+ gdmo = 'gdmo',
+ mo = 'gdmo',
+ tres = 'gdresource',
+ tscn = 'gdresource',
+ gd = 'gdscript',
+ ged = 'gedcom',
+ gmi = 'gemtext',
+ gemini = 'gemtext',
+ gift = 'gift',
+ gleam = 'gleam',
+ glsl = 'glsl',
+ gpi = 'gnuplot',
+ go = 'go',
+ gp = 'gp',
+ gs = 'grads',
+ gql = 'graphql',
+ graphql = 'graphql',
+ graphqls = 'graphql',
+ gretl = 'gretl',
+ gradle = 'groovy',
+ groovy = 'groovy',
+ gsp = 'gsp',
+ gjs = 'javascript.glimmer',
+ gts = 'typescript.glimmer',
+ hack = 'hack',
+ hackpartial = 'hack',
+ haml = 'haml',
+ hsm = 'hamster',
+ hbs = 'handlebars',
+ ha = 'hare',
+ ['hs-boot'] = 'haskell',
+ hsig = 'haskell',
+ hsc = 'haskell',
+ hs = 'haskell',
+ ht = 'haste',
+ htpp = 'hastepreproc',
+ hb = 'hb',
+ h = function(path, bufnr)
+ return require('vim.filetype.detect').header(bufnr)
+ end,
+ sum = 'hercules',
+ errsum = 'hercules',
+ ev = 'hercules',
+ vc = 'hercules',
+ hcl = 'hcl',
+ heex = 'heex',
+ hex = 'hex',
+ ['h32'] = 'hex',
+ hjson = 'hjson',
+ hog = 'hog',
+ hws = 'hollywood',
+ hoon = 'hoon',
+ cpt = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ dtml = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ htm = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ html = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ pt = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ shtml = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ stm = function(path, bufnr)
+ return require('vim.filetype.detect').html(bufnr)
+ end,
+ htt = 'httest',
+ htb = 'httest',
+ hw = function(path, bufnr)
+ return require('vim.filetype.detect').hw(bufnr)
+ end,
+ module = function(path, bufnr)
+ return require('vim.filetype.detect').hw(bufnr)
+ end,
+ pkg = function(path, bufnr)
+ return require('vim.filetype.detect').hw(bufnr)
+ end,
+ iba = 'ibasic',
+ ibi = 'ibasic',
+ icn = 'icon',
+ idl = function(path, bufnr)
+ return require('vim.filetype.detect').idl(bufnr)
+ end,
+ inc = function(path, bufnr)
+ return require('vim.filetype.detect').inc(bufnr)
+ end,
+ inf = 'inform',
+ INF = 'inform',
+ ii = 'initng',
+ inp = function(path, bufnr)
+ return require('vim.filetype.detect').inp(bufnr)
+ end,
+ ms = function(path, bufnr)
+ return require('vim.filetype.detect').nroff(bufnr) or 'xmath'
+ end,
+ iss = 'iss',
+ mst = 'ist',
+ ist = 'ist',
+ ijs = 'j',
+ JAL = 'jal',
+ jal = 'jal',
+ jpr = 'jam',
+ jpl = 'jam',
+ jav = 'java',
+ java = 'java',
+ jj = 'javacc',
+ jjt = 'javacc',
+ es = 'javascript',
+ mjs = 'javascript',
+ javascript = 'javascript',
+ js = 'javascript',
+ cjs = 'javascript',
+ jsx = 'javascriptreact',
+ clp = 'jess',
+ jgr = 'jgraph',
+ ['j73'] = 'jovial',
+ jov = 'jovial',
+ jovial = 'jovial',
+ properties = 'jproperties',
+ slnf = 'json',
+ json = 'json',
+ jsonp = 'json',
+ webmanifest = 'json',
+ ipynb = 'json',
+ ['json-patch'] = 'json',
+ json5 = 'json5',
+ jsonc = 'jsonc',
+ jsp = 'jsp',
+ jl = 'julia',
+ kv = 'kivy',
+ kix = 'kix',
+ kts = 'kotlin',
+ kt = 'kotlin',
+ ktm = 'kotlin',
+ ks = 'kscript',
+ k = 'kwt',
+ ACE = 'lace',
+ ace = 'lace',
+ latte = 'latte',
+ lte = 'latte',
+ ld = 'ld',
+ ldif = 'ldif',
+ journal = 'ledger',
+ ldg = 'ledger',
+ ledger = 'ledger',
+ less = 'less',
+ lex = 'lex',
+ lxx = 'lex',
+ ['l++'] = 'lex',
+ l = 'lex',
+ lhs = 'lhaskell',
+ ll = 'lifelines',
+ ly = 'lilypond',
+ ily = 'lilypond',
+ liquid = 'liquid',
+ cl = 'lisp',
+ L = 'lisp',
+ lisp = 'lisp',
+ el = 'lisp',
+ lsp = 'lisp',
+ asd = 'lisp',
+ lt = 'lite',
+ lite = 'lite',
+ lgt = 'logtalk',
+ lotos = 'lotos',
+ lot = 'lotos',
+ lout = 'lout',
+ lou = 'lout',
+ ulpc = 'lpc',
+ lpc = 'lpc',
+ c = function(path, bufnr)
+ return require('vim.filetype.detect').lpc(bufnr)
+ end,
+ lsl = 'lsl',
+ lss = 'lss',
+ nse = 'lua',
+ rockspec = 'lua',
+ lua = 'lua',
+ m = function(path, bufnr)
+ return require('vim.filetype.detect').m(bufnr)
+ end,
+ at = 'm4',
+ mc = function(path, bufnr)
+ return require('vim.filetype.detect').mc(bufnr)
+ end,
+ quake = 'm3quake',
+ ['m4'] = function(path, bufnr)
+ path = path:lower()
+ return not (path:find('html%.m4$') or path:find('fvwm2rc')) and 'm4'
+ end,
+ eml = 'mail',
+ mk = 'make',
+ mak = 'make',
+ dsp = 'make',
+ page = 'mallard',
+ map = 'map',
+ mws = 'maple',
+ mpl = 'maple',
+ mv = 'maple',
+ mkdn = 'markdown',
+ md = 'markdown',
+ mdwn = 'markdown',
+ mkd = 'markdown',
+ markdown = 'markdown',
+ mdown = 'markdown',
+ mhtml = 'mason',
+ comp = 'mason',
+ mason = 'mason',
+ master = 'master',
+ mas = 'master',
+ demo = 'maxima',
+ dm1 = 'maxima',
+ dm2 = 'maxima',
+ dm3 = 'maxima',
+ dmt = 'maxima',
+ wxm = 'maxima',
+ mel = 'mel',
+ mf = 'mf',
+ mgl = 'mgl',
+ mgp = 'mgp',
+ my = 'mib',
+ mib = 'mib',
+ mix = 'mix',
+ mixal = 'mix',
+ mm = function(path, bufnr)
+ return require('vim.filetype.detect').mm(bufnr)
+ end,
+ nb = 'mma',
+ mmp = 'mmp',
+ mms = function(path, bufnr)
+ return require('vim.filetype.detect').mms(bufnr)
+ end,
+ DEF = 'modula2',
+ ['m2'] = 'modula2',
+ mi = 'modula2',
+ ssc = 'monk',
+ monk = 'monk',
+ tsc = 'monk',
+ isc = 'monk',
+ moo = 'moo',
+ moon = 'moonscript',
+ mp = 'mp',
+ mof = 'msidl',
+ odl = 'msidl',
+ msql = 'msql',
+ mu = 'mupad',
+ mush = 'mush',
+ mysql = 'mysql',
+ ['n1ql'] = 'n1ql',
+ nql = 'n1ql',
+ nanorc = 'nanorc',
+ ncf = 'ncf',
+ nginx = 'nginx',
+ ninja = 'ninja',
+ nix = 'nix',
+ nqc = 'nqc',
+ roff = 'nroff',
+ tmac = 'nroff',
+ man = 'nroff',
+ mom = 'nroff',
+ nr = 'nroff',
+ tr = 'nroff',
+ nsi = 'nsis',
+ nsh = 'nsis',
+ obj = 'obj',
+ mlt = 'ocaml',
+ mly = 'ocaml',
+ mll = 'ocaml',
+ mlp = 'ocaml',
+ mlip = 'ocaml',
+ mli = 'ocaml',
+ ml = 'ocaml',
+ occ = 'occam',
+ xom = 'omnimark',
+ xin = 'omnimark',
+ opam = 'opam',
+ ['or'] = 'openroad',
+ scad = 'openscad',
+ ora = 'ora',
+ org = 'org',
+ org_archive = 'org',
+ pxsl = 'papp',
+ papp = 'papp',
+ pxml = 'papp',
+ pas = 'pascal',
+ lpr = 'pascal',
+ dpr = 'pascal',
+ pbtxt = 'pbtxt',
+ g = 'pccts',
+ pcmk = 'pcmk',
+ pdf = 'pdf',
+ plx = 'perl',
+ prisma = 'prisma',
+ psgi = 'perl',
+ al = 'perl',
+ ctp = 'php',
+ php = 'php',
+ phpt = 'php',
+ phtml = 'php',
+ pike = 'pike',
+ pmod = 'pike',
+ rcp = 'pilrc',
+ PL = function(path, bufnr)
+ return require('vim.filetype.detect').pl(bufnr)
+ end,
+ pli = 'pli',
+ ['pl1'] = 'pli',
+ ['p36'] = 'plm',
+ plm = 'plm',
+ pac = 'plm',
+ plp = 'plp',
+ pls = 'plsql',
+ plsql = 'plsql',
+ po = 'po',
+ pot = 'po',
+ pod = 'pod',
+ pk = 'poke',
+ ps = 'postscr',
+ epsi = 'postscr',
+ afm = 'postscr',
+ epsf = 'postscr',
+ eps = 'postscr',
+ pfa = 'postscr',
+ ai = 'postscr',
+ pov = 'pov',
+ ppd = 'ppd',
+ it = 'ppwiz',
+ ih = 'ppwiz',
+ action = 'privoxy',
+ pc = 'proc',
+ pdb = 'prolog',
+ pml = 'promela',
+ proto = 'proto',
+ ['psd1'] = 'ps1',
+ ['psm1'] = 'ps1',
+ ['ps1'] = 'ps1',
+ pssc = 'ps1',
+ ['ps1xml'] = 'ps1xml',
+ psf = 'psf',
+ psl = 'psl',
+ pug = 'pug',
+ arr = 'pyret',
+ pxd = 'pyrex',
+ pyx = 'pyrex',
+ pyw = 'python',
+ py = 'python',
+ pyi = 'python',
+ ptl = 'python',
+ ql = 'ql',
+ qll = 'ql',
+ R = function(path, bufnr)
+ return require('vim.filetype.detect').r(bufnr)
+ end,
+ rad = 'radiance',
+ mat = 'radiance',
+ ['pod6'] = 'raku',
+ rakudoc = 'raku',
+ rakutest = 'raku',
+ rakumod = 'raku',
+ ['pm6'] = 'raku',
+ raku = 'raku',
+ ['t6'] = 'raku',
+ ['p6'] = 'raku',
+ raml = 'raml',
+ rbs = 'rbs',
+ rego = 'rego',
+ rem = 'remind',
+ remind = 'remind',
+ res = 'rescript',
+ resi = 'rescript',
+ frt = 'reva',
+ testUnit = 'rexx',
+ rex = 'rexx',
+ orx = 'rexx',
+ rexx = 'rexx',
+ jrexx = 'rexx',
+ rxj = 'rexx',
+ rexxj = 'rexx',
+ testGroup = 'rexx',
+ rxo = 'rexx',
+ Rd = 'rhelp',
+ rd = 'rhelp',
+ rib = 'rib',
+ Rmd = 'rmd',
+ rmd = 'rmd',
+ smd = 'rmd',
+ Smd = 'rmd',
+ rnc = 'rnc',
+ rng = 'rng',
+ rnw = 'rnoweb',
+ snw = 'rnoweb',
+ Rnw = 'rnoweb',
+ Snw = 'rnoweb',
+ robot = 'robot',
+ resource = 'robot',
+ rsc = 'routeros',
+ x = 'rpcgen',
+ rpl = 'rpl',
+ Srst = 'rrst',
+ srst = 'rrst',
+ Rrst = 'rrst',
+ rrst = 'rrst',
+ rst = 'rst',
+ rtf = 'rtf',
+ rjs = 'ruby',
+ rxml = 'ruby',
+ rb = 'ruby',
+ rant = 'ruby',
+ ru = 'ruby',
+ rbw = 'ruby',
+ gemspec = 'ruby',
+ builder = 'ruby',
+ rake = 'ruby',
+ rs = 'rust',
+ sas = 'sas',
+ sass = 'sass',
+ sa = 'sather',
+ sbt = 'sbt',
+ scala = 'scala',
+ ss = 'scheme',
+ scm = 'scheme',
+ sld = 'scheme',
+ rkt = 'scheme',
+ rktd = 'scheme',
+ rktl = 'scheme',
+ sce = 'scilab',
+ sci = 'scilab',
+ scss = 'scss',
+ sd = 'sd',
+ sdc = 'sdc',
+ pr = 'sdl',
+ sdl = 'sdl',
+ sed = 'sed',
+ sexp = 'sexplib',
+ bash = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ebuild = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ eclass = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ env = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ ksh = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'ksh')
+ end,
+ sh = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ sieve = 'sieve',
+ siv = 'sieve',
+ sig = function(path, bufnr)
+ return require('vim.filetype.detect').sig(bufnr)
+ end,
+ sil = 'sil',
+ sim = 'simula',
+ ['s85'] = 'sinda',
+ sin = 'sinda',
+ ssm = 'sisu',
+ sst = 'sisu',
+ ssi = 'sisu',
+ ['_sst'] = 'sisu',
+ ['-sst'] = 'sisu',
+ il = 'skill',
+ ils = 'skill',
+ cdf = 'skill',
+ sl = 'slang',
+ ice = 'slice',
+ score = 'slrnsc',
+ sol = 'solidity',
+ tpl = 'smarty',
+ ihlp = 'smcl',
+ smcl = 'smcl',
+ hlp = 'smcl',
+ smith = 'smith',
+ smt = 'smith',
+ sml = 'sml',
+ spt = 'snobol4',
+ sno = 'snobol4',
+ sln = 'solution',
+ sparql = 'sparql',
+ rq = 'sparql',
+ spec = 'spec',
+ spice = 'spice',
+ sp = 'spice',
+ spd = 'spup',
+ spdata = 'spup',
+ speedup = 'spup',
+ spi = 'spyce',
+ spy = 'spyce',
+ tyc = 'sql',
+ typ = 'sql',
+ pkb = 'sql',
+ tyb = 'sql',
+ pks = 'sql',
+ sqlj = 'sqlj',
+ sqi = 'sqr',
+ sqr = 'sqr',
+ nut = 'squirrel',
+ ['s28'] = 'srec',
+ ['s37'] = 'srec',
+ srec = 'srec',
+ mot = 'srec',
+ ['s19'] = 'srec',
+ st = 'st',
+ imata = 'stata',
+ ['do'] = 'stata',
+ mata = 'stata',
+ ado = 'stata',
+ stp = 'stp',
+ quark = 'supercollider',
+ sface = 'surface',
+ svelte = 'svelte',
+ svg = 'svg',
+ swift = 'swift',
+ svh = 'systemverilog',
+ sv = 'systemverilog',
+ tak = 'tak',
+ task = 'taskedit',
+ tm = 'tcl',
+ tcl = 'tcl',
+ itk = 'tcl',
+ itcl = 'tcl',
+ tk = 'tcl',
+ jacl = 'tcl',
+ tl = 'teal',
+ tmpl = 'template',
+ ti = 'terminfo',
+ dtx = 'tex',
+ ltx = 'tex',
+ bbl = 'tex',
+ latex = 'tex',
+ sty = 'tex',
+ cls = function(path, bufnr)
+ return require('vim.filetype.detect').cls(bufnr)
+ end,
+ texi = 'texinfo',
+ txi = 'texinfo',
+ texinfo = 'texinfo',
+ text = 'text',
+ tfvars = 'terraform',
+ tla = 'tla',
+ tli = 'tli',
+ toml = 'toml',
+ tpp = 'tpp',
+ treetop = 'treetop',
+ slt = 'tsalt',
+ tsscl = 'tsscl',
+ tssgm = 'tssgm',
+ tssop = 'tssop',
+ tsv = 'tsv',
+ tutor = 'tutor',
+ twig = 'twig',
+ ts = function(path, bufnr)
+ return M.getlines(bufnr, 1):find('<%?xml') and 'xml' or 'typescript'
+ end,
+ tsx = 'typescriptreact',
+ uc = 'uc',
+ uit = 'uil',
+ uil = 'uil',
+ sba = 'vb',
+ vb = 'vb',
+ dsm = 'vb',
+ ctl = 'vb',
+ vbs = 'vb',
+ vr = 'vera',
+ vri = 'vera',
+ vrh = 'vera',
+ v = 'verilog',
+ va = 'verilogams',
+ vams = 'verilogams',
+ vhdl = 'vhdl',
+ vst = 'vhdl',
+ vhd = 'vhdl',
+ hdl = 'vhdl',
+ vho = 'vhdl',
+ vbe = 'vhdl',
+ vim = 'vim',
+ vba = 'vim',
+ mar = 'vmasm',
+ cm = 'voscm',
+ wrl = 'vrml',
+ vroom = 'vroom',
+ vue = 'vue',
+ wat = 'wast',
+ wast = 'wast',
+ wm = 'webmacro',
+ wbt = 'winbatch',
+ wml = 'wml',
+ wsml = 'wsml',
+ ad = 'xdefaults',
+ xhtml = 'xhtml',
+ xht = 'xhtml',
+ msc = 'xmath',
+ msf = 'xmath',
+ ['psc1'] = 'xml',
+ tpm = 'xml',
+ xliff = 'xml',
+ atom = 'xml',
+ xul = 'xml',
+ cdxml = 'xml',
+ mpd = 'xml',
+ rss = 'xml',
+ fsproj = 'xml',
+ ui = 'xml',
+ vbproj = 'xml',
+ xlf = 'xml',
+ wsdl = 'xml',
+ csproj = 'xml',
+ wpl = 'xml',
+ xmi = 'xml',
+ xpm = function(path, bufnr)
+ return M.getlines(bufnr, 1):find('XPM2') and 'xpm2' or 'xpm'
+ end,
+ ['xpm2'] = 'xpm2',
+ xqy = 'xquery',
+ xqm = 'xquery',
+ xquery = 'xquery',
+ xq = 'xquery',
+ xql = 'xquery',
+ xs = 'xs',
+ xsd = 'xsd',
+ xsl = 'xslt',
+ xslt = 'xslt',
+ yy = 'yacc',
+ ['y++'] = 'yacc',
+ yxx = 'yacc',
+ yml = 'yaml',
+ yaml = 'yaml',
+ yang = 'yang',
+ ['z8a'] = 'z8a',
+ zig = 'zig',
+ zu = 'zimbu',
+ zut = 'zimbutempl',
+ zsh = 'zsh',
+ vala = 'vala',
+ web = function(path, bufnr)
+ return require('vim.filetype.detect').web(bufnr)
+ end,
+ pl = function(path, bufnr)
+ return require('vim.filetype.detect').pl(bufnr)
+ end,
+ pp = function(path, bufnr)
+ return require('vim.filetype.detect').pp(bufnr)
+ end,
+ i = function(path, bufnr)
+ return require('vim.filetype.detect').progress_asm(bufnr)
+ end,
+ w = function(path, bufnr)
+ return require('vim.filetype.detect').progress_cweb(bufnr)
+ end,
+ p = function(path, bufnr)
+ return require('vim.filetype.detect').progress_pascal(bufnr)
+ end,
+ pro = function(path, bufnr)
+ return require('vim.filetype.detect').proto(bufnr, 'idlang')
+ end,
+ patch = function(path, bufnr)
+ return require('vim.filetype.detect').patch(bufnr)
+ end,
+ r = function(path, bufnr)
+ return require('vim.filetype.detect').r(bufnr)
+ end,
+ rdf = function(path, bufnr)
+ return require('vim.filetype.detect').redif(bufnr)
+ end,
+ rules = function(path, bufnr)
+ return require('vim.filetype.detect').rules(path)
+ end,
+ sc = function(path, bufnr)
+ return require('vim.filetype.detect').sc(bufnr)
+ end,
+ scd = function(path, bufnr)
+ return require('vim.filetype.detect').scd(bufnr)
+ end,
+ tcsh = function(path, bufnr)
+ return require('vim.filetype.detect').shell(path, M.getlines(bufnr), 'tcsh')
+ end,
+ sql = function(path, bufnr)
+ return vim.g.filetype_sql and vim.g.filetype_sql or 'sql'
+ end,
+ zsql = function(path, bufnr)
+ return vim.g.filetype_sql and vim.g.filetype_sql or 'sql'
+ end,
+ tex = function(path, bufnr)
+ return require('vim.filetype.detect').tex(path, bufnr)
+ end,
+ tf = function(path, bufnr)
+ return require('vim.filetype.detect').tf(bufnr)
+ end,
txt = function(path, bufnr)
- --helpfiles match *.txt, but should have a modeline as last line
- if not getline(bufnr, -1):match("vim:.*ft=help") then
- return "text"
+ return require('vim.filetype.detect').txt(bufnr)
+ end,
+ xml = function(path, bufnr)
+ return require('vim.filetype.detect').xml(bufnr)
+ end,
+ y = function(path, bufnr)
+ return require('vim.filetype.detect').y(bufnr)
+ end,
+ cmd = function(path, bufnr)
+ return M.getlines(bufnr, 1):find('^/%*') and 'rexx' or 'dosbatch'
+ end,
+ rul = function(path, bufnr)
+ return require('vim.filetype.detect').rul(bufnr)
+ end,
+ cpy = function(path, bufnr)
+ return M.getlines(bufnr, 1):find('^##') and 'python' or 'cobol'
+ end,
+ dsl = function(path, bufnr)
+ return M.getlines(bufnr, 1):find('^%s*<!') and 'dsl' or 'structurizr'
+ end,
+ smil = function(path, bufnr)
+ return M.getlines(bufnr, 1):find('<%?%s*xml.*%?>') and 'xml' or 'smil'
+ end,
+ smi = function(path, bufnr)
+ return require('vim.filetype.detect').smi(bufnr)
+ end,
+ install = function(path, bufnr)
+ return require('vim.filetype.detect').install(path, bufnr)
+ end,
+ pm = function(path, bufnr)
+ return require('vim.filetype.detect').pm(bufnr)
+ end,
+ me = function(path, bufnr)
+ return require('vim.filetype.detect').me(path)
+ end,
+ reg = function(path, bufnr)
+ return require('vim.filetype.detect').reg(bufnr)
+ end,
+ ttl = function(path, bufnr)
+ return require('vim.filetype.detect').ttl(bufnr)
+ end,
+ rc = function(path, bufnr)
+ if not path:find('/etc/Muttrc%.d/') then
+ return 'rc'
+ end
+ end,
+ rch = function(path, bufnr)
+ if not path:find('/etc/Muttrc%.d/') then
+ return 'rc'
end
end,
+ class = function(path, bufnr)
+ require('vim.filetype.detect').class(bufnr)
+ end,
+ sgml = function(path, bufnr)
+ return require('vim.filetype.detect').sgml(bufnr)
+ end,
+ sgm = function(path, bufnr)
+ return require('vim.filetype.detect').sgml(bufnr)
+ end,
+ t = function(path, bufnr)
+ local nroff = require('vim.filetype.detect').nroff(bufnr)
+ return nroff or require('vim.filetype.detect').perl(path, bufnr) or 'tads'
+ end,
+ -- Ignored extensions
+ bak = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ ['dpkg-bak'] = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ ['dpkg-dist'] = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ ['dpkg-old'] = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ ['dpkg-new'] = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ ['in'] = function(path, bufnr)
+ if vim.fs.basename(path) ~= 'configure.in' then
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end
+ end,
+ new = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ old = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ orig = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ pacsave = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ pacnew = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ rpmsave = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
+ rmpnew = function(path, bufnr)
+ local root = vim.fn.fnamemodify(path, ':r')
+ return M.match({ buf = bufnr, filename = root })
+ end,
-- END EXTENSION
}
local filename = {
-- BEGIN FILENAME
- ["a2psrc"] = "a2ps",
- ["/etc/a2ps.cfg"] = "a2ps",
- [".a2psrc"] = "a2ps",
- [".asoundrc"] = "alsaconf",
- ["/usr/share/alsa/alsa.conf"] = "alsaconf",
- ["/etc/asound.conf"] = "alsaconf",
- ["build.xml"] = "ant",
- [".htaccess"] = "apache",
- ["apt.conf"] = "aptconf",
- ["/.aptitude/config"] = "aptconf",
- ["=tagging-method"] = "arch",
- [".arch-inventory"] = "arch",
- ["GNUmakefile.am"] = "automake",
- ["named.root"] = "bindzone",
- WORKSPACE = "bzl",
- BUILD = "bzl",
- ["cabal.config"] = "cabalconfig",
- ["cabal.project"] = "cabalproject",
- calendar = "calendar",
- catalog = "catalog",
- ["/etc/cdrdao.conf"] = "cdrdaoconf",
- [".cdrdao"] = "cdrdaoconf",
- ["/etc/default/cdrdao"] = "cdrdaoconf",
- ["/etc/defaults/cdrdao"] = "cdrdaoconf",
- ["cfengine.conf"] = "cfengine",
- ["CMakeLists.txt"] = "cmake",
- ["auto.master"] = "conf",
- ["configure.in"] = "config",
- ["configure.ac"] = "config",
- [".cvsrc"] = "cvsrc",
- ["/debian/changelog"] = "debchangelog",
- ["changelog.dch"] = "debchangelog",
- ["changelog.Debian"] = "debchangelog",
- ["NEWS.dch"] = "debchangelog",
- ["NEWS.Debian"] = "debchangelog",
- ["/debian/control"] = "debcontrol",
- ["/debian/copyright"] = "debcopyright",
- ["/etc/apt/sources.list"] = "debsources",
- ["denyhosts.conf"] = "denyhosts",
- ["dict.conf"] = "dictconf",
- [".dictrc"] = "dictconf",
- ["/etc/DIR_COLORS"] = "dircolors",
- [".dir_colors"] = "dircolors",
- [".dircolors"] = "dircolors",
- ["/etc/dnsmasq.conf"] = "dnsmasq",
- Containerfile = "dockerfile",
- Dockerfile = "dockerfile",
- npmrc = "dosini",
- ["/etc/yum.conf"] = "dosini",
- ["/etc/pacman.conf"] = "dosini",
- [".npmrc"] = "dosini",
- [".editorconfig"] = "dosini",
- dune = "dune",
- jbuild = "dune",
- ["dune-workspace"] = "dune",
- ["dune-project"] = "dune",
- ["elinks.conf"] = "elinks",
- ["mix.lock"] = "elixir",
- ["filter-rules"] = "elmfilt",
- ["exim.conf"] = "exim",
- exports = "exports",
- [".fetchmailrc"] = "fetchmail",
- fvSchemes = function() vim.fn["dist#ft#FTfoam"]() end,
- fvSolution = function() vim.fn["dist#ft#FTfoam"]() end,
- fvConstraints = function() vim.fn["dist#ft#FTfoam"]() end,
- fvModels = function() vim.fn["dist#ft#FTfoam"]() end,
- fstab = "fstab",
- mtab = "fstab",
- [".gdbinit"] = "gdb",
- gdbinit = "gdb",
- ["lltxxxxx.txt"] = "gedcom",
- ["TAG_EDITMSG"] = "gitcommit",
- ["MERGE_MSG"] = "gitcommit",
- ["COMMIT_EDITMSG"] = "gitcommit",
- ["NOTES_EDITMSG"] = "gitcommit",
- ["EDIT_DESCRIPTION"] = "gitcommit",
- [".gitconfig"] = "gitconfig",
- [".gitmodules"] = "gitconfig",
- ["/.config/git/config"] = "gitconfig",
- ["/etc/gitconfig"] = "gitconfig",
- ["gitolite.conf"] = "gitolite",
- ["git-rebase-todo"] = "gitrebase",
- gkrellmrc = "gkrellmrc",
- [".gnashrc"] = "gnash",
- [".gnashpluginrc"] = "gnash",
- gnashpluginrc = "gnash",
- gnashrc = "gnash",
- [".gprc"] = "gp",
- ["/.gnupg/gpg.conf"] = "gpg",
- ["/.gnupg/options"] = "gpg",
- ["/var/backups/gshadow.bak"] = "group",
- ["/etc/gshadow"] = "group",
- ["/etc/group-"] = "group",
- ["/etc/gshadow.edit"] = "group",
- ["/etc/gshadow-"] = "group",
- ["/etc/group"] = "group",
- ["/var/backups/group.bak"] = "group",
- ["/etc/group.edit"] = "group",
- ["/boot/grub/menu.lst"] = "grub",
- ["/etc/grub.conf"] = "grub",
- ["/boot/grub/grub.conf"] = "grub",
- [".gtkrc"] = "gtkrc",
- gtkrc = "gtkrc",
- ["snort.conf"] = "hog",
- ["vision.conf"] = "hog",
- ["/etc/host.conf"] = "hostconf",
- ["/etc/hosts.allow"] = "hostsaccess",
- ["/etc/hosts.deny"] = "hostsaccess",
- ["/i3/config"] = "i3config",
- ["/sway/config"] = "i3config",
- ["/.sway/config"] = "i3config",
- ["/.i3/config"] = "i3config",
- ["/.icewm/menu"] = "icemenu",
- [".indent.pro"] = "indent",
- indentrc = "indent",
- inittab = "inittab",
- ["ipf.conf"] = "ipfilter",
- ["ipf6.conf"] = "ipfilter",
- ["ipf.rules"] = "ipfilter",
- [".eslintrc"] = "json",
- [".babelrc"] = "json",
- ["Pipfile.lock"] = "json",
- [".firebaserc"] = "json",
- [".prettierrc"] = "json",
- Kconfig = "kconfig",
- ["Kconfig.debug"] = "kconfig",
- ["lftp.conf"] = "lftp",
- [".lftprc"] = "lftp",
- ["/.libao"] = "libao",
- ["/etc/libao.conf"] = "libao",
- ["lilo.conf"] = "lilo",
- ["/etc/limits"] = "limits",
- [".emacs"] = "lisp",
- sbclrc = "lisp",
- [".sbclrc"] = "lisp",
- [".sawfishrc"] = "lisp",
- ["/etc/login.access"] = "loginaccess",
- ["/etc/login.defs"] = "logindefs",
- ["lynx.cfg"] = "lynx",
- ["m3overrides"] = "m3build",
- ["m3makefile"] = "m3build",
- ["cm3.cfg"] = "m3quake",
- [".followup"] = "mail",
- [".article"] = "mail",
- [".letter"] = "mail",
- ["/etc/aliases"] = "mailaliases",
- ["/etc/mail/aliases"] = "mailaliases",
- mailcap = "mailcap",
- [".mailcap"] = "mailcap",
- ["/etc/man.conf"] = "manconf",
- ["man.config"] = "manconf",
- ["meson.build"] = "meson",
- ["meson_options.txt"] = "meson",
- ["/etc/conf.modules"] = "modconf",
- ["/etc/modules"] = "modconf",
- ["/etc/modules.conf"] = "modconf",
- ["/.mplayer/config"] = "mplayerconf",
- ["mplayer.conf"] = "mplayerconf",
- mrxvtrc = "mrxvtrc",
- [".mrxvtrc"] = "mrxvtrc",
- ["/etc/nanorc"] = "nanorc",
- Neomuttrc = "neomuttrc",
- [".netrc"] = "netrc",
- [".ocamlinit"] = "ocaml",
- [".octaverc"] = "octave",
- octaverc = "octave",
- ["octave.conf"] = "octave",
- opam = "opam",
- ["/etc/pam.conf"] = "pamconf",
- ["pam_env.conf"] = "pamenv",
- [".pam_environment"] = "pamenv",
- ["/var/backups/passwd.bak"] = "passwd",
- ["/var/backups/shadow.bak"] = "passwd",
- ["/etc/passwd"] = "passwd",
- ["/etc/passwd-"] = "passwd",
- ["/etc/shadow.edit"] = "passwd",
- ["/etc/shadow-"] = "passwd",
- ["/etc/shadow"] = "passwd",
- ["/etc/passwd.edit"] = "passwd",
- ["pf.conf"] = "pf",
- ["main.cf"] = "pfmain",
- pinerc = "pine",
- [".pinercex"] = "pine",
- [".pinerc"] = "pine",
- pinercex = "pine",
- ["/etc/pinforc"] = "pinfo",
- ["/.pinforc"] = "pinfo",
- [".povrayrc"] = "povini",
- [".procmailrc"] = "procmail",
- [".procmail"] = "procmail",
- ["/etc/protocols"] = "protocols",
- [".pythonstartup"] = "python",
- [".pythonrc"] = "python",
- SConstruct = "python",
- ratpoisonrc = "ratpoison",
- [".ratpoisonrc"] = "ratpoison",
- v = "rcs",
- inputrc = "readline",
- [".inputrc"] = "readline",
- [".reminders"] = "remind",
- ["resolv.conf"] = "resolv",
- ["robots.txt"] = "robots",
- Gemfile = "ruby",
- Puppetfile = "ruby",
- [".irbrc"] = "ruby",
- irbrc = "ruby",
- ["smb.conf"] = "samba",
- screenrc = "screen",
- [".screenrc"] = "screen",
- ["/etc/sensors3.conf"] = "sensors",
- ["/etc/sensors.conf"] = "sensors",
- ["/etc/services"] = "services",
- ["/etc/serial.conf"] = "setserial",
- ["/etc/udev/cdsymlinks.conf"] = "sh",
- ["/etc/slp.conf"] = "slpconf",
- ["/etc/slp.reg"] = "slpreg",
- ["/etc/slp.spi"] = "slpspi",
- [".slrnrc"] = "slrnrc",
- ["sendmail.cf"] = "sm",
- ["squid.conf"] = "squid",
- ["/.ssh/config"] = "sshconfig",
- ["ssh_config"] = "sshconfig",
- ["sshd_config"] = "sshdconfig",
- ["/etc/sudoers"] = "sudoers",
- ["sudoers.tmp"] = "sudoers",
- ["/etc/sysctl.conf"] = "sysctl",
- tags = "tags",
- [".tclshrc"] = "tcl",
- [".wishrc"] = "tcl",
- ["tclsh.rc"] = "tcl",
- ["texmf.cnf"] = "texmf",
- COPYING = "text",
- README = "text",
- LICENSE = "text",
- AUTHORS = "text",
- tfrc = "tf",
- [".tfrc"] = "tf",
- ["tidy.conf"] = "tidy",
- tidyrc = "tidy",
- [".tidyrc"] = "tidy",
- ["/.cargo/config"] = "toml",
- Pipfile = "toml",
- ["Gopkg.lock"] = "toml",
- ["/.cargo/credentials"] = "toml",
- ["Cargo.lock"] = "toml",
- ["trustees.conf"] = "trustees",
- ["/etc/udev/udev.conf"] = "udevconf",
- ["/etc/updatedb.conf"] = "updatedb",
- ["fdrupstream.log"] = "upstreamlog",
- vgrindefs = "vgrindefs",
- [".exrc"] = "vim",
- ["_exrc"] = "vim",
- ["_viminfo"] = "viminfo",
- [".viminfo"] = "viminfo",
- [".wgetrc"] = "wget",
- wgetrc = "wget",
- [".wvdialrc"] = "wvdial",
- ["wvdial.conf"] = "wvdial",
- [".Xresources"] = "xdefaults",
- [".Xpdefaults"] = "xdefaults",
- ["xdm-config"] = "xdefaults",
- [".Xdefaults"] = "xdefaults",
- ["/etc/xinetd.conf"] = "xinetd",
- fglrxrc = "xml",
- ["/etc/blkid.tab"] = "xml",
- ["/etc/blkid.tab.old"] = "xml",
- ["/etc/zprofile"] = "zsh",
- [".zlogin"] = "zsh",
- [".zlogout"] = "zsh",
- [".zshrc"] = "zsh",
- [".zprofile"] = "zsh",
- [".zcompdump"] = "zsh",
- [".zshenv"] = "zsh",
- [".zfbfmarks"] = "zsh",
- [".alias"] = function() vim.fn["dist#ft#CSH"]() end,
- [".bashrc"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- [".cshrc"] = function() vim.fn["dist#ft#CSH"]() end,
- [".kshrc"] = function() vim.fn["dist#ft#SetFileTypeSH"]("ksh") end,
- [".login"] = function() vim.fn["dist#ft#CSH"]() end,
- [".profile"] = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
- [".tcshrc"] = function() vim.fn["dist#ft#SetFileTypeShell"]("tcsh") end,
- ["/etc/profile"] = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
- APKBUILD = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- PKGBUILD = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- ["bash.bashrc"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- bashrc = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- crontab = starsetf('crontab'),
- ["csh.cshrc"] = function() vim.fn["dist#ft#CSH"]() end,
- ["csh.login"] = function() vim.fn["dist#ft#CSH"]() end,
- ["csh.logout"] = function() vim.fn["dist#ft#CSH"]() end,
- ["indent.pro"] = function() vim.fn["dist#ft#ProtoCheck"]('indent') end,
- ["tcsh.login"] = function() vim.fn["dist#ft#SetFileTypeShell"]("tcsh") end,
- ["tcsh.tcshrc"] = function() vim.fn["dist#ft#SetFileTypeShell"]("tcsh") end,
+ ['a2psrc'] = 'a2ps',
+ ['/etc/a2ps.cfg'] = 'a2ps',
+ ['.a2psrc'] = 'a2ps',
+ ['.asoundrc'] = 'alsaconf',
+ ['/usr/share/alsa/alsa.conf'] = 'alsaconf',
+ ['/etc/asound.conf'] = 'alsaconf',
+ ['build.xml'] = 'ant',
+ ['.htaccess'] = 'apache',
+ ['apt.conf'] = 'aptconf',
+ ['/.aptitude/config'] = 'aptconf',
+ ['=tagging-method'] = 'arch',
+ ['.arch-inventory'] = 'arch',
+ ['GNUmakefile.am'] = 'automake',
+ ['named.root'] = 'bindzone',
+ WORKSPACE = 'bzl',
+ BUILD = 'bzl',
+ ['cabal.project'] = 'cabalproject',
+ [vim.env.HOME .. '/cabal.config'] = 'cabalconfig',
+ ['cabal.config'] = 'cabalconfig',
+ calendar = 'calendar',
+ catalog = 'catalog',
+ ['/etc/cdrdao.conf'] = 'cdrdaoconf',
+ ['.cdrdao'] = 'cdrdaoconf',
+ ['/etc/default/cdrdao'] = 'cdrdaoconf',
+ ['/etc/defaults/cdrdao'] = 'cdrdaoconf',
+ ['cfengine.conf'] = 'cfengine',
+ ['CMakeLists.txt'] = 'cmake',
+ ['.alias'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['.cshrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['.login'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['csh.cshrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['csh.login'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['csh.logout'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['auto.master'] = 'conf',
+ ['configure.in'] = 'config',
+ ['configure.ac'] = 'config',
+ crontab = 'crontab',
+ ['.cvsrc'] = 'cvsrc',
+ ['/debian/changelog'] = 'debchangelog',
+ ['changelog.dch'] = 'debchangelog',
+ ['changelog.Debian'] = 'debchangelog',
+ ['NEWS.dch'] = 'debchangelog',
+ ['NEWS.Debian'] = 'debchangelog',
+ ['/debian/control'] = 'debcontrol',
+ ['/debian/copyright'] = 'debcopyright',
+ ['/etc/apt/sources.list'] = 'debsources',
+ ['denyhosts.conf'] = 'denyhosts',
+ ['dict.conf'] = 'dictconf',
+ ['.dictrc'] = 'dictconf',
+ ['/etc/DIR_COLORS'] = 'dircolors',
+ ['.dir_colors'] = 'dircolors',
+ ['.dircolors'] = 'dircolors',
+ ['/etc/dnsmasq.conf'] = 'dnsmasq',
+ Containerfile = 'dockerfile',
+ dockerfile = 'dockerfile',
+ Dockerfile = 'dockerfile',
+ npmrc = 'dosini',
+ ['/etc/yum.conf'] = 'dosini',
+ ['.npmrc'] = 'dosini',
+ ['.editorconfig'] = 'dosini',
+ ['/etc/pacman.conf'] = 'confini',
+ ['mpv.conf'] = 'confini',
+ dune = 'dune',
+ jbuild = 'dune',
+ ['dune-workspace'] = 'dune',
+ ['dune-project'] = 'dune',
+ ['elinks.conf'] = 'elinks',
+ ['mix.lock'] = 'elixir',
+ ['filter-rules'] = 'elmfilt',
+ ['exim.conf'] = 'exim',
+ exports = 'exports',
+ ['.fetchmailrc'] = 'fetchmail',
+ fvSchemes = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ fvSolution = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ fvConstraints = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ fvModels = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ fstab = 'fstab',
+ mtab = 'fstab',
+ ['.gdbinit'] = 'gdb',
+ gdbinit = 'gdb',
+ ['.gdbearlyinit'] = 'gdb',
+ gdbearlyinit = 'gdb',
+ ['lltxxxxx.txt'] = 'gedcom',
+ ['TAG_EDITMSG'] = 'gitcommit',
+ ['MERGE_MSG'] = 'gitcommit',
+ ['COMMIT_EDITMSG'] = 'gitcommit',
+ ['NOTES_EDITMSG'] = 'gitcommit',
+ ['EDIT_DESCRIPTION'] = 'gitcommit',
+ ['.gitconfig'] = 'gitconfig',
+ ['.gitmodules'] = 'gitconfig',
+ ['gitolite.conf'] = 'gitolite',
+ ['git-rebase-todo'] = 'gitrebase',
+ gkrellmrc = 'gkrellmrc',
+ ['.gnashrc'] = 'gnash',
+ ['.gnashpluginrc'] = 'gnash',
+ gnashpluginrc = 'gnash',
+ gnashrc = 'gnash',
+ ['.gnuplot'] = 'gnuplot',
+ ['go.work'] = 'gowork',
+ ['.gprc'] = 'gp',
+ ['/.gnupg/gpg.conf'] = 'gpg',
+ ['/.gnupg/options'] = 'gpg',
+ ['/var/backups/gshadow.bak'] = 'group',
+ ['/etc/gshadow'] = 'group',
+ ['/etc/group-'] = 'group',
+ ['/etc/gshadow.edit'] = 'group',
+ ['/etc/gshadow-'] = 'group',
+ ['/etc/group'] = 'group',
+ ['/var/backups/group.bak'] = 'group',
+ ['/etc/group.edit'] = 'group',
+ ['/boot/grub/menu.lst'] = 'grub',
+ ['/etc/grub.conf'] = 'grub',
+ ['/boot/grub/grub.conf'] = 'grub',
+ ['.gtkrc'] = 'gtkrc',
+ gtkrc = 'gtkrc',
+ ['snort.conf'] = 'hog',
+ ['vision.conf'] = 'hog',
+ ['/etc/host.conf'] = 'hostconf',
+ ['/etc/hosts.allow'] = 'hostsaccess',
+ ['/etc/hosts.deny'] = 'hostsaccess',
+ ['/i3/config'] = 'i3config',
+ ['/sway/config'] = 'i3config',
+ ['/.sway/config'] = 'i3config',
+ ['/.i3/config'] = 'i3config',
+ ['/.icewm/menu'] = 'icemenu',
+ ['.indent.pro'] = 'indent',
+ indentrc = 'indent',
+ inittab = 'inittab',
+ ['ipf.conf'] = 'ipfilter',
+ ['ipf6.conf'] = 'ipfilter',
+ ['ipf.rules'] = 'ipfilter',
+ ['.eslintrc'] = 'json',
+ ['.babelrc'] = 'json',
+ ['Pipfile.lock'] = 'json',
+ ['.firebaserc'] = 'json',
+ ['.prettierrc'] = 'json',
+ Kconfig = 'kconfig',
+ ['Kconfig.debug'] = 'kconfig',
+ ['lftp.conf'] = 'lftp',
+ ['.lftprc'] = 'lftp',
+ ['/.libao'] = 'libao',
+ ['/etc/libao.conf'] = 'libao',
+ ['lilo.conf'] = 'lilo',
+ ['/etc/limits'] = 'limits',
+ ['.emacs'] = 'lisp',
+ sbclrc = 'lisp',
+ ['.sbclrc'] = 'lisp',
+ ['.sawfishrc'] = 'lisp',
+ ['/etc/login.access'] = 'loginaccess',
+ ['/etc/login.defs'] = 'logindefs',
+ ['lynx.cfg'] = 'lynx',
+ ['m3overrides'] = 'm3build',
+ ['m3makefile'] = 'm3build',
+ ['cm3.cfg'] = 'm3quake',
+ ['.followup'] = 'mail',
+ ['.article'] = 'mail',
+ ['.letter'] = 'mail',
+ ['/etc/aliases'] = 'mailaliases',
+ ['/etc/mail/aliases'] = 'mailaliases',
+ mailcap = 'mailcap',
+ ['.mailcap'] = 'mailcap',
+ ['/etc/man.conf'] = 'manconf',
+ ['man.config'] = 'manconf',
+ ['maxima-init.mac'] = 'maxima',
+ ['meson.build'] = 'meson',
+ ['meson_options.txt'] = 'meson',
+ ['/etc/conf.modules'] = 'modconf',
+ ['/etc/modules'] = 'modconf',
+ ['/etc/modules.conf'] = 'modconf',
+ ['/.mplayer/config'] = 'mplayerconf',
+ ['mplayer.conf'] = 'mplayerconf',
+ mrxvtrc = 'mrxvtrc',
+ ['.mrxvtrc'] = 'mrxvtrc',
+ ['/etc/nanorc'] = 'nanorc',
+ Neomuttrc = 'neomuttrc',
+ ['.netrc'] = 'netrc',
+ NEWS = function(path, bufnr)
+ return require('vim.filetype.detect').news(bufnr)
+ end,
+ ['.ocamlinit'] = 'ocaml',
+ ['.octaverc'] = 'octave',
+ octaverc = 'octave',
+ ['octave.conf'] = 'octave',
+ opam = 'opam',
+ ['/etc/pam.conf'] = 'pamconf',
+ ['pam_env.conf'] = 'pamenv',
+ ['.pam_environment'] = 'pamenv',
+ ['/var/backups/passwd.bak'] = 'passwd',
+ ['/var/backups/shadow.bak'] = 'passwd',
+ ['/etc/passwd'] = 'passwd',
+ ['/etc/passwd-'] = 'passwd',
+ ['/etc/shadow.edit'] = 'passwd',
+ ['/etc/shadow-'] = 'passwd',
+ ['/etc/shadow'] = 'passwd',
+ ['/etc/passwd.edit'] = 'passwd',
+ ['pf.conf'] = 'pf',
+ ['main.cf'] = 'pfmain',
+ pinerc = 'pine',
+ ['.pinercex'] = 'pine',
+ ['.pinerc'] = 'pine',
+ pinercex = 'pine',
+ ['/etc/pinforc'] = 'pinfo',
+ ['/.pinforc'] = 'pinfo',
+ ['.povrayrc'] = 'povini',
+ ['printcap'] = function(path, bufnr)
+ return 'ptcap', function(b)
+ vim.b[b].ptcap_type = 'print'
+ end
+ end,
+ ['termcap'] = function(path, bufnr)
+ return 'ptcap', function(b)
+ vim.b[b].ptcap_type = 'term'
+ end
+ end,
+ ['.procmailrc'] = 'procmail',
+ ['.procmail'] = 'procmail',
+ ['indent.pro'] = function(path, bufnr)
+ return require('vim.filetype.detect').proto(bufnr, 'indent')
+ end,
+ ['/etc/protocols'] = 'protocols',
+ ['INDEX'] = function(path, bufnr)
+ return require('vim.filetype.detect').psf(bufnr)
+ end,
+ ['INFO'] = function(path, bufnr)
+ return require('vim.filetype.detect').psf(bufnr)
+ end,
+ ['.pythonstartup'] = 'python',
+ ['.pythonrc'] = 'python',
+ SConstruct = 'python',
+ ratpoisonrc = 'ratpoison',
+ ['.ratpoisonrc'] = 'ratpoison',
+ inputrc = 'readline',
+ ['.inputrc'] = 'readline',
+ ['.reminders'] = 'remind',
+ ['resolv.conf'] = 'resolv',
+ ['robots.txt'] = 'robots',
+ Gemfile = 'ruby',
+ Puppetfile = 'ruby',
+ ['.irbrc'] = 'ruby',
+ irbrc = 'ruby',
+ Vagrantfile = 'ruby',
+ ['smb.conf'] = 'samba',
+ screenrc = 'screen',
+ ['.screenrc'] = 'screen',
+ ['/etc/sensors3.conf'] = 'sensors',
+ ['/etc/sensors.conf'] = 'sensors',
+ ['/etc/services'] = 'services',
+ ['/etc/serial.conf'] = 'setserial',
+ ['/etc/udev/cdsymlinks.conf'] = 'sh',
+ ['bash.bashrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ bashrc = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['.bashrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['.env'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ ['.kshrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'ksh')
+ end,
+ ['.profile'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ ['/etc/profile'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ APKBUILD = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ PKGBUILD = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['.tcshrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').shell(path, M.getlines(bufnr), 'tcsh')
+ end,
+ ['tcsh.login'] = function(path, bufnr)
+ return require('vim.filetype.detect').shell(path, M.getlines(bufnr), 'tcsh')
+ end,
+ ['tcsh.tcshrc'] = function(path, bufnr)
+ return require('vim.filetype.detect').shell(path, M.getlines(bufnr), 'tcsh')
+ end,
+ ['/etc/slp.conf'] = 'slpconf',
+ ['/etc/slp.reg'] = 'slpreg',
+ ['/etc/slp.spi'] = 'slpspi',
+ ['.slrnrc'] = 'slrnrc',
+ ['sendmail.cf'] = 'sm',
+ ['squid.conf'] = 'squid',
+ ['ssh_config'] = 'sshconfig',
+ ['sshd_config'] = 'sshdconfig',
+ ['/etc/sudoers'] = 'sudoers',
+ ['sudoers.tmp'] = 'sudoers',
+ ['/etc/sysctl.conf'] = 'sysctl',
+ tags = 'tags',
+ ['pending.data'] = 'taskdata',
+ ['completed.data'] = 'taskdata',
+ ['undo.data'] = 'taskdata',
+ ['.tclshrc'] = 'tcl',
+ ['.wishrc'] = 'tcl',
+ ['tclsh.rc'] = 'tcl',
+ ['texmf.cnf'] = 'texmf',
+ COPYING = 'text',
+ README = 'text',
+ LICENSE = 'text',
+ AUTHORS = 'text',
+ tfrc = 'tf',
+ ['.tfrc'] = 'tf',
+ ['tidy.conf'] = 'tidy',
+ tidyrc = 'tidy',
+ ['.tidyrc'] = 'tidy',
+ ['.tmux.conf'] = 'tmux',
+ ['/.cargo/config'] = 'toml',
+ Pipfile = 'toml',
+ ['Gopkg.lock'] = 'toml',
+ ['/.cargo/credentials'] = 'toml',
+ ['Cargo.lock'] = 'toml',
+ ['trustees.conf'] = 'trustees',
+ ['/etc/udev/udev.conf'] = 'udevconf',
+ ['/etc/updatedb.conf'] = 'updatedb',
+ ['fdrupstream.log'] = 'upstreamlog',
+ vgrindefs = 'vgrindefs',
+ ['.exrc'] = 'vim',
+ ['_exrc'] = 'vim',
+ ['_viminfo'] = 'viminfo',
+ ['.viminfo'] = 'viminfo',
+ ['.wgetrc'] = 'wget',
+ ['.wget2rc'] = 'wget2',
+ wgetrc = 'wget',
+ wget2rc = 'wget2',
+ ['.wvdialrc'] = 'wvdial',
+ ['wvdial.conf'] = 'wvdial',
+ ['.Xresources'] = 'xdefaults',
+ ['.Xpdefaults'] = 'xdefaults',
+ ['xdm-config'] = 'xdefaults',
+ ['.Xdefaults'] = 'xdefaults',
+ ['xorg.conf'] = function(path, bufnr)
+ return 'xf86conf', function(b)
+ vim.b[b].xf86conf_xfree86_version = 4
+ end
+ end,
+ ['xorg.conf-4'] = function(path, bufnr)
+ return 'xf86conf', function(b)
+ vim.b[b].xf86conf_xfree86_version = 4
+ end
+ end,
+ ['XF86Config'] = function(path, bufnr)
+ return require('vim.filetype.detect').xfree86()
+ end,
+ ['/etc/xinetd.conf'] = 'xinetd',
+ fglrxrc = 'xml',
+ ['/etc/blkid.tab'] = 'xml',
+ ['/etc/blkid.tab.old'] = 'xml',
+ ['/etc/zprofile'] = 'zsh',
+ ['.zlogin'] = 'zsh',
+ ['.zlogout'] = 'zsh',
+ ['.zshrc'] = 'zsh',
+ ['.zprofile'] = 'zsh',
+ ['.zcompdump'] = 'zsh',
+ ['.zshenv'] = 'zsh',
+ ['.zfbfmarks'] = 'zsh',
-- END FILENAME
}
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",
- [".*/%.aptitude/config"] = "aptconf",
- ["[mM]akefile%.am"] = "automake",
- [".*bsd"] = "bsdl",
- ["bzr_log%..*"] = "bzr",
- [".*enlightenment/.*%.cfg"] = "c",
- [".*/etc/defaults/cdrdao"] = "cdrdaoconf",
- [".*/etc/cdrdao%.conf"] = "cdrdaoconf",
- [".*/etc/default/cdrdao"] = "cdrdaoconf",
- [".*hgrc"] = "cfg",
- [".*%.%.ch"] = "chill",
- [".*%.cmake%.in"] = "cmake",
- [".*/debian/changelog"] = "debchangelog",
- [".*/debian/control"] = "debcontrol",
- [".*/debian/copyright"] = "debcopyright",
- [".*/etc/apt/sources%.list%.d/.*%.list"] = "debsources",
- [".*/etc/apt/sources%.list"] = "debsources",
- ["dictd.*%.conf"] = "dictdconf",
- [".*/etc/DIR_COLORS"] = "dircolors",
- [".*/etc/dnsmasq%.conf"] = "dnsmasq",
- ["php%.ini%-.*"] = "dosini",
- [".*/etc/pacman%.conf"] = "dosini",
- [".*/etc/yum%.conf"] = "dosini",
- [".*lvs"] = "dracula",
- [".*lpe"] = "dracula",
- [".*esmtprc"] = "esmtprc",
- [".*Eterm/.*%.cfg"] = "eterm",
- [".*%.git/modules/.*/config"] = "gitconfig",
- [".*%.git/config"] = "gitconfig",
- [".*/%.config/git/config"] = "gitconfig",
- ["%.gitsendemail%.msg%......."] = "gitsendemail",
- ["gkrellmrc_."] = "gkrellmrc",
- [".*/usr/.*/gnupg/options%.skel"] = "gpg",
- [".*/%.gnupg/options"] = "gpg",
- [".*/%.gnupg/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",
- ["hg%-editor%-.*%.txt"] = "hgcommit",
- [".*/etc/host%.conf"] = "hostconf",
- [".*/etc/hosts%.deny"] = "hostsaccess",
- [".*/etc/hosts%.allow"] = "hostsaccess",
- [".*%.html%.m4"] = "htmlm4",
- [".*/%.i3/config"] = "i3config",
- [".*/sway/config"] = "i3config",
- [".*/i3/config"] = "i3config",
- [".*/%.sway/config"] = "i3config",
- [".*/%.icewm/menu"] = "icemenu",
- [".*/etc/initng/.*/.*%.i"] = "initng",
- [".*%.properties_.."] = "jproperties",
- [".*%.properties_.._.."] = "jproperties",
- [".*lftp/rc"] = "lftp",
- [".*/%.libao"] = "libao",
- [".*/etc/libao%.conf"] = "libao",
- [".*/etc/.*limits%.conf"] = "limits",
- [".*/etc/limits"] = "limits",
- [".*/etc/.*limits%.d/.*%.conf"] = "limits",
- [".*/LiteStep/.*/.*%.rc"] = "litestep",
- [".*/etc/login%.access"] = "loginaccess",
- [".*/etc/login%.defs"] = "logindefs",
- [".*/etc/mail/aliases"] = "mailaliases",
- [".*/etc/aliases"] = "mailaliases",
- [".*[mM]akefile"] = "make",
- [".*/etc/man%.conf"] = "manconf",
- [".*/etc/modules%.conf"] = "modconf",
- [".*/etc/conf%.modules"] = "modconf",
- [".*/etc/modules"] = "modconf",
- [".*%.[mi][3g]"] = "modula3",
- [".*/%.mplayer/config"] = "mplayerconf",
- ["rndc.*%.conf"] = "named",
- ["rndc.*%.key"] = "named",
- ["named.*%.conf"] = "named",
- [".*/etc/nanorc"] = "nanorc",
- [".*%.NS[ACGLMNPS]"] = "natural",
- ["nginx.*%.conf"] = "nginx",
- [".*/etc/nginx/.*"] = "nginx",
- [".*nginx%.conf"] = "nginx",
- [".*/nginx/.*%.conf"] = "nginx",
- [".*/usr/local/nginx/conf/.*"] = "nginx",
- [".*%.ml%.cppo"] = "ocaml",
- [".*%.mli%.cppo"] = "ocaml",
- [".*%.opam%.template"] = "opam",
- [".*%.[Oo][Pp][Ll]"] = "opl",
- [".*/etc/pam%.conf"] = "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",
- [".*/%.pinforc"] = "pinfo",
- [".*/etc/pinforc"] = "pinfo",
- [".*/etc/protocols"] = "protocols",
- [".*baseq[2-3]/.*%.cfg"] = "quake",
- [".*quake[1-3]/.*%.cfg"] = "quake",
- [".*id1/.*%.cfg"] = "quake",
- ["[rR]antfile"] = "ruby",
- ["[rR]akefile"] = "ruby",
- [".*/etc/sensors%.conf"] = "sensors",
- [".*/etc/sensors3%.conf"] = "sensors",
- [".*/etc/services"] = "services",
- [".*/etc/serial%.conf"] = "setserial",
- [".*/etc/udev/cdsymlinks%.conf"] = "sh",
- [".*%._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",
- [".*/etc/ssh/sshd_config%.d/.*%.conf"] = "sshdconfig",
- [".*/etc/sudoers"] = "sudoers",
- ["svn%-commit.*%.tmp"] = "svn",
- [".*%.swift%.gyb"] = "swiftgyb",
- [".*/etc/sysctl%.conf"] = "sysctl",
- [".*/etc/sysctl%.d/.*%.conf"] = "sysctl",
- [".*/etc/systemd/.*%.conf%.d/.*%.conf"] = "systemd",
- [".*/%.config/systemd/user/.*%.d/.*%.conf"] = "systemd",
- [".*/etc/systemd/system/.*%.d/.*%.conf"] = "systemd",
- [".*%.t%.html"] = "tilde",
- [".*/%.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",
- [".*%.ws[fc]"] = "wsh",
- [".*/etc/xinetd%.conf"] = "xinetd",
- [".*/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",
- ["%.bash[_-]aliases"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- ["%.bash[_-]logout"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- ["%.bash[_-]profile"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- ["%.cshrc.*"] = function() vim.fn["dist#ft#CSH"]() end,
- ["%.gtkrc.*"] = starsetf('gtkrc'),
- ["%.kshrc.*"] = function() vim.fn["dist#ft#SetFileTypeSH"]("ksh") end,
- ["%.login.*"] = function() vim.fn["dist#ft#CSH"]() end,
- ["%.neomuttrc.*"] = starsetf('neomuttrc'),
- ["%.profile.*"] = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
- ["%.reminders.*"] = starsetf('remind'),
- ["%.tcshrc.*"] = function() vim.fn["dist#ft#SetFileTypeShell"]("tcsh") end,
- ["%.zcompdump.*"] = starsetf('zsh'),
- ["%.zlog.*"] = starsetf('zsh'),
- ["%.zsh.*"] = starsetf('zsh'),
- [".*%.[1-9]"] = function() vim.fn["dist#ft#FTnroff"]() end,
- [".*%.[aA]"] = function() vim.fn["dist#ft#FTasm"]() end,
- [".*%.[sS]"] = function() vim.fn["dist#ft#FTasm"]() end,
- [".*%.properties_.._.._.*"] = starsetf('jproperties'),
- [".*%.vhdl_[0-9].*"] = starsetf('vhdl'),
- [".*/%.fvwm/.*"] = starsetf('fvwm'),
- [".*/%.gitconfig%.d/.*"] = starsetf('gitconfig'),
- [".*/%.neomutt/neomuttrc.*"] = starsetf('neomuttrc'),
- [".*/Xresources/.*"] = starsetf('xdefaults'),
- [".*/app%-defaults/.*"] = starsetf('xdefaults'),
- [".*/bind/db%..*"] = starsetf('bindzone'),
- [".*/debian/patches/.*"] = function() vim.fn["dist#ft#Dep3patch"]() end,
- [".*/etc/Muttrc%.d/.*"] = starsetf('muttrc'),
- [".*/etc/apache2/.*%.conf.*"] = starsetf('apache'),
- [".*/etc/apache2/conf%..*/.*"] = starsetf('apache'),
- [".*/etc/apache2/mods%-.*/.*"] = starsetf('apache'),
- [".*/etc/apache2/sites%-.*/.*"] = starsetf('apache'),
- [".*/etc/cron%.d/.*"] = starsetf('crontab'),
- [".*/etc/dnsmasq%.d/.*"] = starsetf('dnsmasq'),
- [".*/etc/httpd/conf%..*/.*"] = starsetf('apache'),
- [".*/etc/httpd/conf%.d/.*%.conf.*"] = starsetf('apache'),
- [".*/etc/httpd/mods%-.*/.*"] = starsetf('apache'),
- [".*/etc/httpd/sites%-.*/.*"] = starsetf('apache'),
- [".*/etc/logcheck/.*%.d.*/.*"] = starsetf('logcheck'),
- [".*/etc/modprobe%..*"] = starsetf('modconf'),
- [".*/etc/pam%.d/.*"] = starsetf('pamconf'),
- [".*/etc/profile"] = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
- [".*/etc/proftpd/.*%.conf.*"] = starsetf('apachestyle'),
- [".*/etc/proftpd/conf%..*/.*"] = starsetf('apachestyle'),
- [".*/etc/sudoers%.d/.*"] = starsetf('sudoers'),
- [".*/etc/xinetd%.d/.*"] = starsetf('xinetd'),
- [".*/etc/yum%.repos%.d/.*"] = starsetf('dosini'),
- [".*/gitolite%-admin/conf/.*"] = starsetf('gitolite'),
- [".*/named/db%..*"] = starsetf('bindzone'),
- [".*/tmp/lltmp.*"] = starsetf('gedcom'),
- [".*asterisk.*/.*voicemail%.conf.*"] = starsetf('asteriskvm'),
- [".*asterisk/.*%.conf.*"] = starsetf('asterisk'),
- [".*vimrc.*"] = starsetf('vim'),
- [".*xmodmap.*"] = starsetf('xmodmap'),
- ["/etc/gitconfig%.d/.*"] = starsetf('gitconfig'),
- ["/etc/hostname%..*"] = starsetf('config'),
- ["Containerfile%..*"] = starsetf('dockerfile'),
- ["Dockerfile%..*"] = starsetf('dockerfile'),
- ["JAM.*%..*"] = starsetf('jam'),
- ["Kconfig%..*"] = starsetf('kconfig'),
- ["Neomuttrc.*"] = starsetf('neomuttrc'),
- ["Prl.*%..*"] = starsetf('jam'),
- ["Xresources.*"] = starsetf('xdefaults'),
- ["[mM]akefile.*"] = starsetf('make'),
- ["[rR]akefile.*"] = starsetf('ruby'),
- ["access%.conf.*"] = starsetf('apache'),
- ["apache%.conf.*"] = starsetf('apache'),
- ["apache2%.conf.*"] = starsetf('apache'),
- ["bash%-fc[-%.]"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
- ["cabal%.project%..*"] = starsetf('cabalproject'),
- ["crontab%..*"] = starsetf('crontab'),
- ["drac%..*"] = starsetf('dracula'),
- ["gtkrc.*"] = starsetf('gtkrc'),
- ["httpd%.conf.*"] = starsetf('apache'),
- ["lilo%.conf.*"] = starsetf('lilo'),
- ["neomuttrc.*"] = starsetf('neomuttrc'),
- ["proftpd%.conf.*"] = starsetf('apachestyle'),
- ["reportbug%-.*"] = starsetf('mail'),
- ["sgml%.catalog.*"] = starsetf('catalog'),
- ["srm%.conf.*"] = starsetf('apache'),
- ["tmac%..*"] = starsetf('nroff'),
- ["zlog.*"] = starsetf('zsh'),
- ["zsh.*"] = starsetf('zsh'),
- ["ae%d+%.txt"] = 'mail',
- ["[a-zA-Z0-9]*Dict"] = function() vim.fn["dist#ft#FTfoam"]() end,
- ["[a-zA-Z0-9]*Dict%..*"] = function() vim.fn["dist#ft#FTfoam"]() end,
- ["[a-zA-Z]*Properties"] = function() vim.fn["dist#ft#FTfoam"]() end,
- ["[a-zA-Z]*Properties%..*"] = function() vim.fn["dist#ft#FTfoam"]() end,
- [".*Transport%..*"] = function() vim.fn["dist#ft#FTfoam"]() end,
- [".*/constant/g"] = function() vim.fn["dist#ft#FTfoam"]() end,
- [".*/0/.*"] = function() vim.fn["dist#ft#FTfoam"]() end,
- [".*/0%.orig/.*"] = function() vim.fn["dist#ft#FTfoam"]() end,
+ ['.*/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.*'] = starsetf('apache'),
+ ['.*/etc/apache2/conf%..*/.*'] = starsetf('apache'),
+ ['.*/etc/apache2/mods%-.*/.*'] = starsetf('apache'),
+ ['.*/etc/apache2/sites%-.*/.*'] = starsetf('apache'),
+ ['access%.conf.*'] = starsetf('apache'),
+ ['apache%.conf.*'] = starsetf('apache'),
+ ['apache2%.conf.*'] = starsetf('apache'),
+ ['httpd%.conf.*'] = starsetf('apache'),
+ ['srm%.conf.*'] = starsetf('apache'),
+ ['.*/etc/httpd/conf%..*/.*'] = starsetf('apache'),
+ ['.*/etc/httpd/conf%.d/.*%.conf.*'] = starsetf('apache'),
+ ['.*/etc/httpd/mods%-.*/.*'] = starsetf('apache'),
+ ['.*/etc/httpd/sites%-.*/.*'] = starsetf('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]'] = function(path, bufnr)
+ return require('vim.filetype.detect').asm(bufnr)
+ end,
+ ['.*%.[sS]'] = function(path, bufnr)
+ return require('vim.filetype.detect').asm(bufnr)
+ end,
+ ['[mM]akefile%.am'] = 'automake',
+ ['.*/bind/db%..*'] = starsetf('bindzone'),
+ ['.*/named/db%..*'] = starsetf('bindzone'),
+ ['.*/build/conf/.*%.conf'] = 'bitbake',
+ ['.*/meta/conf/.*%.conf'] = 'bitbake',
+ ['.*/meta%-.*/conf/.*%.conf'] = 'bitbake',
+ ['.*bsd'] = 'bsdl',
+ ['bzr_log%..*'] = 'bzr',
+ ['.*enlightenment/.*%.cfg'] = 'c',
+ ['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]'] = {
+ function(path, bufnr)
+ return require('vim.filetype.detect').cfg(bufnr)
+ end,
+ -- Decrease priority to avoid conflicts with more specific patterns
+ -- such as '.*/etc/a2ps/.*%.cfg', '.*enlightenment/.*%.cfg', etc.
+ { priority = -1 },
+ },
+ ['[cC]hange[lL]og.*'] = starsetf(function(path, bufnr)
+ require('vim.filetype.detect').changelog(bufnr)
+ end),
+ ['.*%.%.ch'] = 'chill',
+ ['.*%.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.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['%.login.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').csh(path, bufnr)
+ end,
+ ['cvs%d+'] = 'cvs',
+ ['.*%.[Dd][Aa][Tt]'] = function(path, bufnr)
+ return require('vim.filetype.detect').dat(path, bufnr)
+ end,
+ ['.*/debian/patches/.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').dep3patch(path, bufnr)
+ end,
+ ['.*/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',
+ ['.*%.directory'] = 'desktop',
+ ['.*%.desktop'] = 'desktop',
+ ['dictd.*%.conf'] = 'dictdconf',
+ ['.*/etc/DIR_COLORS'] = 'dircolors',
+ ['.*/etc/dnsmasq%.conf'] = 'dnsmasq',
+ ['php%.ini%-.*'] = 'dosini',
+ ['.*/etc/pacman%.conf'] = 'confini',
+ ['.*/etc/yum%.conf'] = 'dosini',
+ ['.*lvs'] = 'dracula',
+ ['.*lpe'] = 'dracula',
+ ['.*/dtrace/.*%.d'] = 'dtrace',
+ ['.*esmtprc'] = 'esmtprc',
+ ['.*Eterm/.*%.cfg'] = 'eterm',
+ ['[a-zA-Z0-9].*Dict'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['[a-zA-Z0-9].*Dict%..*'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['[a-zA-Z].*Properties'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['[a-zA-Z].*Properties%..*'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['.*Transport%..*'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['.*/constant/g'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['.*/0/.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['.*/0%.orig/.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').foam(bufnr)
+ end,
+ ['.*/%.fvwm/.*'] = starsetf('fvwm'),
+ ['.*fvwmrc.*'] = starsetf(function(path, bufnr)
+ return 'fvwm', function(b)
+ vim.b[b].fvwm_version = 1
+ end
+ end),
+ ['.*fvwm95.*%.hook'] = starsetf(function(path, bufnr)
+ return 'fvwm', function(b)
+ vim.b[b].fvwm_version = 1
+ end
+ end),
+ ['.*fvwm2rc.*'] = starsetf(function(path, bufnr)
+ return require('vim.filetype.detect').fvwm(path)
+ end),
+ ['.*/tmp/lltmp.*'] = starsetf('gedcom'),
+ ['.*/etc/gitconfig%.d/.*'] = starsetf('gitconfig'),
+ ['.*/gitolite%-admin/conf/.*'] = starsetf('gitolite'),
+ ['tmac%..*'] = starsetf('nroff'),
+ ['.*/%.gitconfig%.d/.*'] = starsetf('gitconfig'),
+ ['.*%.git/.*'] = {
+ function(path, bufnr)
+ return require('vim.filetype.detect').git(bufnr)
+ end,
+ -- Decrease priority to run after simple pattern checks
+ { priority = -1 },
+ },
+ ['.*%.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',
+ ['.*/git/config'] = function(path, bufnr)
+ if vim.env.XDG_CONFIG_HOME and path:find(vim.env.XDG_CONFIG_HOME .. '/git/config') then
+ return 'gitconfig'
+ end
+ end,
+ ['%.gitsendemail%.msg%.......'] = 'gitsendemail',
+ ['gkrellmrc_.'] = 'gkrellmrc',
+ ['.*/usr/.*/gnupg/options%.skel'] = 'gpg',
+ ['.*/%.gnupg/options'] = 'gpg',
+ ['.*/%.gnupg/gpg%.conf'] = 'gpg',
+ ['.*/options'] = function(path, bufnr)
+ if vim.env.GNUPGHOME and path:find(vim.env.GNUPGHOME .. '/options') then
+ return 'gpg'
+ end
+ end,
+ ['.*/gpg%.conf'] = function(path, bufnr)
+ if vim.env.GNUPGHOME and path:find(vim.env.GNUPGHOME .. '/gpg%.conf') then
+ return 'gpg'
+ end
+ end,
+ ['.*/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'),
+ [vim.env.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',
+ ['.*/sway/config'] = 'i3config',
+ ['.*/i3/config'] = 'i3config',
+ ['.*/%.sway/config'] = 'i3config',
+ ['.*/%.icewm/menu'] = 'icemenu',
+ ['.*/etc/initng/.*/.*%.i'] = 'initng',
+ ['JAM.*%..*'] = starsetf('jam'),
+ ['Prl.*%..*'] = starsetf('jam'),
+ ['.*%.properties_..'] = 'jproperties',
+ ['.*%.properties_.._..'] = 'jproperties',
+ ['.*%.properties_.._.._.*'] = starsetf('jproperties'),
+ ['Kconfig%..*'] = starsetf('kconfig'),
+ ['.*%.[Ss][Uu][Bb]'] = 'krl',
+ ['lilo%.conf.*'] = starsetf('lilo'),
+ ['.*/etc/logcheck/.*%.d.*/.*'] = starsetf('logcheck'),
+ ['.*lftp/rc'] = 'lftp',
+ ['.*/%.libao'] = 'libao',
+ ['.*/etc/libao%.conf'] = 'libao',
+ ['.*/etc/.*limits%.conf'] = 'limits',
+ ['.*/etc/limits'] = 'limits',
+ ['.*/etc/.*limits%.d/.*%.conf'] = 'limits',
+ ['.*/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]'] = function(path, bufnr)
+ return require('vim.filetype.detect').mod(path, bufnr)
+ end,
+ ['.*/etc/modules%.conf'] = 'modconf',
+ ['.*/etc/conf%.modules'] = 'modconf',
+ ['.*/etc/modules'] = 'modconf',
+ ['.*/etc/modprobe%..*'] = starsetf('modconf'),
+ ['.*/etc/modutils/.*'] = starsetf(function(path, bufnr)
+ if vim.fn.executable(vim.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.*'] = starsetf('muttrc'),
+ ['Muttngrc.*'] = starsetf('muttrc'),
+ -- muttrc* and .muttrc*
+ ['%.?muttrc.*'] = starsetf('muttrc'),
+ -- muttngrc* and .muttngrc*
+ ['%.?muttngrc.*'] = starsetf('muttrc'),
+ ['.*/%.mutt/muttrc.*'] = starsetf('muttrc'),
+ ['.*/%.muttng/muttrc.*'] = starsetf('muttrc'),
+ ['.*/%.muttng/muttngrc.*'] = starsetf('muttrc'),
+ ['rndc.*%.conf'] = 'named',
+ ['rndc.*%.key'] = 'named',
+ ['named.*%.conf'] = 'named',
+ ['.*/etc/nanorc'] = 'nanorc',
+ ['.*%.NS[ACGLMNPS]'] = 'natural',
+ ['Neomuttrc.*'] = starsetf('neomuttrc'),
+ -- neomuttrc* and .neomuttrc*
+ ['%.?neomuttrc.*'] = starsetf('neomuttrc'),
+ ['.*/%.neomutt/neomuttrc.*'] = starsetf('neomuttrc'),
+ ['nginx.*%.conf'] = 'nginx',
+ ['.*/etc/nginx/.*'] = 'nginx',
+ ['.*nginx%.conf'] = 'nginx',
+ ['.*/nginx/.*%.conf'] = 'nginx',
+ ['.*/usr/local/nginx/conf/.*'] = 'nginx',
+ ['.*%.[1-9]'] = function(path, bufnr)
+ return require('vim.filetype.detect').nroff(bufnr)
+ end,
+ ['.*%.ml%.cppo'] = 'ocaml',
+ ['.*%.mli%.cppo'] = 'ocaml',
+ ['.*%.opam%.template'] = 'opam',
+ ['.*%.[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]'] = function(path, bufnr)
+ return require('vim.filetype.detect').prg(bufnr)
+ end,
+ ['.*/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', -- tree-sitter queries (Neovim only)
+ ['.*,v'] = 'rcs',
+ ['%.reminders.*'] = starsetf('remind'),
+ ['[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',
+ ['%.bash[_%-]aliases'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['%.bash[_%-]logout'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['%.bash[_%-]profile'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['%.kshrc.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'ksh')
+ end,
+ ['%.profile.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ ['.*/etc/profile'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr))
+ end,
+ ['bash%-fc[%-%.]'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash')
+ end,
+ ['%.tcshrc.*'] = function(path, bufnr)
+ return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'tcsh')
+ end,
+ ['.*/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]'] = function(path, bufnr)
+ return require('vim.filetype.detect').src(bufnr)
+ end,
+ ['.*/etc/sudoers'] = 'sudoers',
+ ['svn%-commit.*%.tmp'] = 'svn',
+ ['.*%.swift%.gyb'] = 'swiftgyb',
+ ['.*%.[Ss][Yy][Ss]'] = function(path, bufnr)
+ return require('vim.filetype.detect').sys(bufnr)
+ end,
+ ['.*/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),
+ ['.*%.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]'] = function(path, bufnr)
+ return require('vim.filetype.detect').log(path)
+ end,
+ ['.*%.vhdl_[0-9].*'] = starsetf('vhdl'),
+ ['.*%.ws[fc]'] = 'wsh',
+ ['.*/Xresources/.*'] = starsetf('xdefaults'),
+ ['.*/app%-defaults/.*'] = starsetf('xdefaults'),
+ ['.*/etc/xinetd%.conf'] = 'xinetd',
+ ['.*/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'] = function(path, bufnr)
+ return 'xf86config', function(b)
+ vim.b[b].xf86conf_xfree86_version = 4
+ end
+ end,
+ -- Increase priority to run before the pattern below
+ ['XF86Config%-4.*'] = starsetf(function(path, bufnr)
+ return 'xf86conf', function(b)
+ vim.b[b].xf86conf_xfree86_version = 4
+ end
+ end, { priority = -math.huge + 1 }),
+ ['XF86Config.*'] = starsetf(function(path, bufnr)
+ return require('vim.filetype.detect').xfree86()
+ end),
+ ['%.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 = vim.fn.fnameescape(short) })
+ end
+ end,
-- END PATTERN
}
-- luacheck: pop
+-- luacheck: pop
---@private
local function sort_by_priority(t)
local sorted = {}
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 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 {}
+ local opts = (type(v) == 'table' and type(v[2]) == 'table') and v[2] or {}
if not opts.priority then
opts.priority = 0
end
@@ -1372,8 +2198,18 @@ end
local pattern_sorted = sort_by_priority(pattern)
---@private
-local function normalize_path(path)
- return (path:gsub("\\", "/"))
+local function normalize_path(path, as_pattern)
+ local normal = path:gsub('\\', '/')
+ if normal:find('^~') then
+ if as_pattern then
+ -- Escape Lua's metacharacters when $HOME is used in a pattern.
+ -- The rest of path should already be properly escaped.
+ normal = vim.pesc(vim.env.HOME) .. normal:sub(2)
+ else
+ normal = vim.env.HOME .. normal:sub(2)
+ end
+ end
+ return normal
end
--- Add new filetype mappings.
@@ -1381,7 +2217,7 @@ end
--- Filetype mappings can be added either by extension or by filename (either
--- the "tail" or the full file path). The full file path is checked first,
--- followed by the file name. If a match is not found using the filename, then
---- the filename is matched against the list of patterns (sorted by priority)
+--- the filename is matched against the list of |lua-patterns| (sorted by priority)
--- until a match is found. Lastly, if pattern matching does not find a
--- filetype, then the file extension is used.
---
@@ -1389,7 +2225,9 @@ end
--- filetype directly) or a function. If a function, it takes the full path and
--- buffer number of the file as arguments (along with captures from the matched
--- pattern, if any) and should return a string that will be used as the
---- buffer's filetype.
+--- buffer's filetype. Optionally, the function can return a second function
+--- value which, when called, modifies the state of the buffer. This can be used
+--- to, for example, set filetype-specific buffer variables.
---
--- Filename patterns can specify an optional priority to resolve cases when a
--- file path matches multiple patterns. Higher priorities are matched first.
@@ -1397,8 +2235,7 @@ end
---
--- See $VIMRUNTIME/lua/vim/filetype.lua for more examples.
---
---- Note that Lua filetype detection is only enabled when |g:do_filetype_lua| is
---- set to 1.
+--- Note that Lua filetype detection is disabled when |g:do_legacy_filetype| is set.
---
--- Example:
--- <pre>
@@ -1407,7 +2244,10 @@ end
--- foo = "fooscript",
--- bar = function(path, bufnr)
--- if some_condition() then
---- return "barscript"
+--- return "barscript", function(bufnr)
+--- -- Set a buffer variable
+--- vim.b[bufnr].barscript_version = 2
+--- end
--- end
--- return "bar"
--- end,
@@ -1431,6 +2271,25 @@ end
--- })
--- </pre>
---
+--- To add a fallback match on contents (see |new-filetype-scripts|), use
+--- <pre>
+--- vim.filetype.add {
+--- pattern = {
+--- ['.*'] = {
+--- priority = -math.huge,
+--- function(path, bufnr)
+--- local content = vim.filetype.getlines(bufnr, 1)
+--- if vim.filetype.matchregex(content, { [[^#!.*\\<mine\\>]] }) then
+--- return 'mine'
+--- elseif vim.filetype.matchregex(content, { [[\\<drawing\\>]] }) then
+--- return 'drawing'
+--- end
+--- end,
+--- },
+--- },
+--- }
+--- </pre>
+---
---@param filetypes table A table containing new filetype maps (see example).
function M.add(filetypes)
for k, v in pairs(filetypes.extension or {}) do
@@ -1442,7 +2301,7 @@ function M.add(filetypes)
end
for k, v in pairs(filetypes.pattern or {}) do
- pattern[normalize_path(k)] = v
+ pattern[normalize_path(k, true)] = v
end
if filetypes.pattern then
@@ -1452,27 +2311,34 @@ end
---@private
local function dispatch(ft, path, bufnr, ...)
- if type(ft) == "function" then
- ft = ft(path, bufnr, ...)
+ local on_detect
+ if type(ft) == 'function' then
+ if bufnr then
+ ft, on_detect = ft(path, bufnr, ...)
+ else
+ -- If bufnr is nil (meaning we are matching only against the filename), set it to an invalid
+ -- value (-1) and catch any errors from the filetype detection function. If the function tries
+ -- to use the buffer then it will fail, but this enables functions which do not need a buffer
+ -- to still work.
+ local ok
+ ok, ft, on_detect = pcall(ft, path, -1, ...)
+ if not ok then
+ return
+ end
+ end
end
- if type(ft) == "string" then
- api.nvim_buf_set_option(bufnr, "filetype", ft)
- return true
+ if type(ft) == 'string' then
+ return ft, on_detect
end
-
- -- Any non-falsey value (that is, anything other than 'nil' or 'false') will
- -- end filetype matching. This is useful for e.g. the dist#ft functions that
- -- return 0, but set the buffer's filetype themselves
- return ft
end
---@private
local function match_pattern(name, path, tail, pat)
-- If the pattern contains a / match against the full path, otherwise just the tail
- local fullpat = "^" .. pat .. "$"
+ local fullpat = '^' .. pat .. '$'
local matches
- if pat:find("/") then
+ if pat:find('/') 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)
@@ -1483,28 +2349,87 @@ local function match_pattern(name, path, tail, pat)
return matches
end
---- Set the filetype for the given buffer from a file name.
+--- Perform filetype detection.
+---
+--- The filetype can be detected using one of three methods:
+--- 1. Using an existing buffer
+--- 2. Using only a file name
+--- 3. Using only file contents
+---
+--- Of these, option 1 provides the most accurate result as it uses both the buffer's filename and
+--- (optionally) the buffer contents. Options 2 and 3 can be used without an existing buffer, but
+--- may not always provide a match in cases where the filename (or contents) cannot unambiguously
+--- determine the filetype.
+---
+--- Each of the three options is specified using a key to the single argument of this function.
+--- Example:
+---
+--- <pre>
+--- -- Using a buffer number
+--- vim.filetype.match({ buf = 42 })
+---
+--- -- Override the filename of the given buffer
+--- vim.filetype.match({ buf = 42, filename = 'foo.c' })
---
----@param name string File name (can be an absolute or relative path)
----@param bufnr number|nil The buffer to set the filetype for. Defaults to the current buffer.
-function M.match(name, bufnr)
- -- When fired from the main filetypedetect autocommand the {bufnr} argument is omitted, so we use
- -- the current buffer. The {bufnr} argument is provided to allow extensibility in case callers
- -- wish to perform filetype detection on buffers other than the current one.
- bufnr = bufnr or api.nvim_get_current_buf()
+--- -- Using a filename without a buffer
+--- vim.filetype.match({ filename = 'main.lua' })
+---
+--- -- Using file contents
+--- vim.filetype.match({ contents = {'#!/usr/bin/env bash'} })
+--- </pre>
+---
+---@param args table Table specifying which matching strategy to use. Accepted keys are:
+--- * buf (number): Buffer number to use for matching. Mutually exclusive with
+--- {contents}
+--- * filename (string): Filename to use for matching. When {buf} is given,
+--- defaults to the filename of the given buffer number. The
+--- file need not actually exist in the filesystem. When used
+--- without {buf} only the name of the file is used for
+--- filetype matching. This may result in failure to detect
+--- the filetype in cases where the filename alone is not
+--- enough to disambiguate the filetype.
+--- * contents (table): An array of lines representing file contents to use for
+--- matching. Can be used with {filename}. Mutually exclusive
+--- with {buf}.
+---@return string|nil If a match was found, the matched filetype.
+---@return function|nil A function that modifies buffer state when called (for example, to set some
+--- filetype specific buffer variables). The function accepts a buffer number as
+--- its only argument.
+function M.match(args)
+ vim.validate({
+ arg = { args, 't' },
+ })
+
+ if not (args.buf or args.filename or args.contents) then
+ error('At least one of "buf", "filename", or "contents" must be given')
+ end
+
+ local bufnr = args.buf
+ local name = args.filename
+ local contents = args.contents
+
+ if bufnr and not name then
+ name = api.nvim_buf_get_name(bufnr)
+ end
- name = normalize_path(name)
+ if name then
+ name = normalize_path(name)
+ end
+
+ local ft, on_detect
-- First check for the simple case where the full path exists as a key
- local path = vim.fn.resolve(vim.fn.fnamemodify(name, ":p"))
- if dispatch(filename[path], path, bufnr) then
- return
+ local path = vim.fn.fnamemodify(name, ':p')
+ ft, on_detect = dispatch(filename[path], path, bufnr)
+ if ft then
+ return ft, on_detect
end
-- Next check against just the file name
- local tail = vim.fn.fnamemodify(name, ":t")
- if dispatch(filename[tail], path, bufnr) then
- return
+ local tail = vim.fn.fnamemodify(name, ':t')
+ ft, on_detect = dispatch(filename[tail], path, bufnr)
+ if ft then
+ return ft, on_detect
end
-- Next, check the file path against available patterns with non-negative priority
@@ -1517,34 +2442,50 @@ function M.match(name, bufnr)
break
end
- local ft = v[k][1]
+ local filetype = v[k][1]
local matches = match_pattern(name, path, tail, k)
if matches then
- if dispatch(ft, path, bufnr, matches) then
- return
+ ft, on_detect = dispatch(filetype, path, bufnr, matches)
+ if ft then
+ return ft, on_detect
end
end
end
-- Next, check file extension
- local ext = vim.fn.fnamemodify(name, ":e")
- if dispatch(extension[ext], path, bufnr) then
- return
+ local ext = vim.fn.fnamemodify(name, ':e')
+ ft, on_detect = dispatch(extension[ext], path, bufnr)
+ if ft then
+ return ft, on_detect
end
- -- Finally, check patterns with negative priority
+ -- Next, check patterns with negative priority
for i = j, #pattern_sorted do
local v = pattern_sorted[i]
local k = next(v)
- local ft = v[k][1]
+ local filetype = v[k][1]
local matches = match_pattern(name, path, tail, k)
if matches then
- if dispatch(ft, path, bufnr, matches) then
- return
+ ft, on_detect = dispatch(filetype, path, bufnr, matches)
+ if ft then
+ return ft, on_detect
end
end
end
+
+ -- Finally, check file contents
+ if contents or bufnr then
+ contents = contents or M.getlines(bufnr)
+ -- 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 = pcall(require('vim.filetype.detect').match_contents, contents, name)
+ if ok and ft then
+ return ft
+ end
+ end
end
return M
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
new file mode 100644
index 0000000000..8c10517687
--- /dev/null
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -0,0 +1,1630 @@
+-- Contains filetype detection functions for use in filetype.lua that are either:
+-- * used more than once or
+-- * complex (e.g. check more than one line or use conditionals).
+-- Simple one-line checks, such as a check for a string in the first line are better inlined in filetype.lua.
+
+-- A few guidelines to follow when porting a new function:
+-- * Sort the function alphabetically and omit 'ft' or 'check' from the new function name.
+-- * Use ':find' instead of ':match' / ':sub' if possible.
+-- * When '=~' is used to match a pattern, there are two possibilities:
+-- - If the pattern only contains lowercase characters, treat the comparison as case-insensitive.
+-- - Otherwise, treat it as case-sensitive.
+-- (Basically, we apply 'smartcase': if upper case characters are used in the original pattern, then
+-- it's likely that case does matter).
+-- * When '\k', '\<' or '\>' is used in a pattern, use the 'matchregex' function.
+-- Note that vim.regex is case-sensitive by default, so add the '\c' flag if only lowercase letters
+-- are present in the pattern:
+-- Example:
+-- `if line =~ '^\s*unwind_protect\>'` => `if matchregex(line, [[\c^\s*unwind_protect\>]])`
+
+local M = {}
+
+local getlines = vim.filetype.getlines
+local findany = vim.filetype.findany
+local nextnonblank = vim.filetype.nextnonblank
+local matchregex = vim.filetype.matchregex
+
+-- luacheck: push no unused args
+-- luacheck: push ignore 122
+
+-- This function checks for the kind of assembly that is wanted by the user, or
+-- can be detected from the first five lines of the file.
+function M.asm(bufnr)
+ local syntax = vim.b[bufnr].asmsyntax
+ if not syntax or syntax == '' then
+ syntax = M.asm_syntax(bufnr)
+ end
+
+ -- If b:asmsyntax still isn't set, default to asmsyntax or GNU
+ if not syntax or syntax == '' then
+ if vim.g.asmsyntax and vim.g.asmsyntax ~= 0 then
+ syntax = vim.g.asmsyntax
+ else
+ syntax = 'asm'
+ end
+ end
+ return syntax, function(b)
+ vim.b[b].asmsyntax = syntax
+ end
+end
+
+-- Active Server Pages (with Perl or Visual Basic Script)
+function M.asp(bufnr)
+ if vim.g.filetype_asp then
+ return vim.g.filetype_asp
+ elseif table.concat(getlines(bufnr, 1, 3)):lower():find('perlscript') then
+ return 'aspperl'
+ else
+ return 'aspvbs'
+ end
+end
+
+-- Checks the first 5 lines for a asmsyntax=foo override.
+-- Only whitespace characters can be present immediately before or after this statement.
+function M.asm_syntax(bufnr)
+ local lines = ' ' .. table.concat(getlines(bufnr, 1, 5), ' '):lower() .. ' '
+ local match = lines:match('%sasmsyntax=([a-zA-Z0-9]+)%s')
+ if match then
+ return match
+ elseif findany(lines, { '%.title', '%.ident', '%.macro', '%.subtitle', '%.library' }) then
+ return 'vmasm'
+ end
+end
+
+local visual_basic_content =
+ { 'vb_name', 'begin vb%.form', 'begin vb%.mdiform', 'begin vb%.usercontrol' }
+
+-- See frm() for Visual Basic form file detection
+function M.bas(bufnr)
+ if vim.g.filetype_bas then
+ return vim.g.filetype_bas
+ end
+
+ -- Most frequent FreeBASIC-specific keywords in distro files
+ local fb_keywords =
+ [[\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!]]
+ local fb_preproc =
+ [[\c^\s*\%(#\s*\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\|\%(''\|rem\)\s*\$lang\>\|def\%(byte\|longint\|short\|ubyte\|uint\|ulongint\|ushort\)\>\)]]
+
+ local fb_comment = "^%s*/'"
+ -- OPTION EXPLICIT, without the leading underscore, is common to many dialects
+ local qb64_preproc = [[\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)]]
+
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if findany(line:lower(), visual_basic_content) then
+ return 'vb'
+ elseif
+ line:find(fb_comment)
+ or matchregex(line, fb_preproc)
+ or matchregex(line, fb_keywords)
+ then
+ return 'freebasic'
+ elseif matchregex(line, qb64_preproc) then
+ return 'qb64'
+ end
+ end
+ return 'basic'
+end
+
+function M.bindzone(bufnr, default)
+ local lines = table.concat(getlines(bufnr, 1, 4))
+ if findany(lines, { '^; <<>> DiG [0-9%.]+.* <<>>', '%$ORIGIN', '%$TTL', 'IN%s+SOA' }) then
+ return 'bindzone'
+ end
+ return default
+end
+
+-- Returns true if file content looks like RAPID
+local function is_rapid(bufnr, extension)
+ if extension == 'cfg' then
+ local line = getlines(bufnr, 1):lower()
+ return findany(line, { 'eio:cfg', 'mmc:cfg', 'moc:cfg', 'proc:cfg', 'sio:cfg', 'sys:cfg' })
+ end
+ local line = nextnonblank(bufnr, 1)
+ if line then
+ -- Called from mod, prg or sys functions
+ return matchregex(line:lower(), [[\c\v^\s*%(\%{3}|module\s+\k+\s*%(\(|$))]])
+ end
+ return false
+end
+
+function M.cfg(bufnr)
+ if vim.g.filetype_cfg then
+ return vim.g.filetype_cfg
+ elseif is_rapid(bufnr, 'cfg') then
+ return 'rapid'
+ else
+ return 'cfg'
+ end
+end
+
+-- This function checks if one of the first ten lines start with a '@'. In
+-- that case it is probably a change file.
+-- If the first line starts with # or ! it's probably a ch file.
+-- If a line has "main", "include", "//" or "/*" it's probably ch.
+-- Otherwise CHILL is assumed.
+function M.change(bufnr)
+ local first_line = getlines(bufnr, 1)
+ if findany(first_line, { '^#', '^!' }) then
+ return 'ch'
+ end
+ for _, line in ipairs(getlines(bufnr, 1, 10)) do
+ if line:find('^@') then
+ return 'change'
+ end
+ if line:find('MODULE') then
+ return 'chill'
+ elseif findany(line:lower(), { 'main%s*%(', '#%s*include', '//' }) then
+ return 'ch'
+ end
+ end
+ return 'chill'
+end
+
+function M.changelog(bufnr)
+ local line = getlines(bufnr, 1):lower()
+ if line:find('; urgency=') then
+ return 'debchangelog'
+ end
+ return 'changelog'
+end
+
+function M.class(bufnr)
+ -- Check if not a Java class (starts with '\xca\xfe\xba\xbe')
+ if not getlines(bufnr, 1):find('^\202\254\186\190') then
+ return 'stata'
+ end
+end
+
+function M.cls(bufnr)
+ if vim.g.filetype_cls then
+ return vim.g.filetype_cls
+ end
+ local line = getlines(bufnr, 1)
+ if line:find('^%%') then
+ return 'tex'
+ elseif line:find('^#') and line:lower():find('rexx') then
+ return 'rexx'
+ elseif line == 'VERSION 1.0 CLASS' then
+ return 'vb'
+ else
+ return 'st'
+ end
+end
+
+function M.conf(path, bufnr)
+ if vim.fn.did_filetype() ~= 0 or path:find(vim.g.ft_ignore_pat) then
+ return
+ end
+ for _, line in ipairs(getlines(bufnr, 1, 5)) do
+ if line:find('^#') then
+ return 'conf'
+ end
+ end
+end
+
+-- Debian Control
+function M.control(bufnr)
+ if getlines(bufnr, 1):find('^Source:') then
+ return 'debcontrol'
+ end
+end
+
+-- Debian Copyright
+function M.copyright(bufnr)
+ if getlines(bufnr, 1):find('^Format:') then
+ return 'debcopyright'
+ end
+end
+
+function M.csh(path, bufnr)
+ if vim.fn.did_filetype() ~= 0 then
+ -- Filetype was already detected
+ return
+ end
+ local contents = getlines(bufnr)
+ if vim.g.filetype_csh then
+ return M.shell(path, contents, vim.g.filetype_csh)
+ elseif string.find(vim.o.shell, 'tcsh') then
+ return M.shell(path, contents, 'tcsh')
+ else
+ return M.shell(path, contents, 'csh')
+ end
+end
+
+local function cvs_diff(path, contents)
+ for _, line in ipairs(contents) do
+ if not line:find('^%? ') then
+ if matchregex(line, [[^Index:\s\+\f\+$]]) then
+ -- CVS diff
+ return 'diff'
+ elseif
+ -- Locale input files: Formal Definitions of Cultural Conventions
+ -- Filename must be like en_US, fr_FR@euro or en_US.UTF-8
+ findany(path, {
+ '%a%a_%a%a$',
+ '%a%a_%a%a[%.@]',
+ '%a%a_%a%ai18n$',
+ '%a%a_%a%aPOSIX$',
+ '%a%a_%a%atranslit_',
+ })
+ then
+ -- Only look at the first 100 lines
+ for line_nr = 1, 100 do
+ if not contents[line_nr] then
+ break
+ elseif
+ findany(contents[line_nr], {
+ '^LC_IDENTIFICATION$',
+ '^LC_CTYPE$',
+ '^LC_COLLATE$',
+ '^LC_MONETARY$',
+ '^LC_NUMERIC$',
+ '^LC_TIME$',
+ '^LC_MESSAGES$',
+ '^LC_PAPER$',
+ '^LC_TELEPHONE$',
+ '^LC_MEASUREMENT$',
+ '^LC_NAME$',
+ '^LC_ADDRESS$',
+ })
+ then
+ return 'fdcc'
+ end
+ end
+ end
+ end
+ end
+end
+
+function M.dat(path, bufnr)
+ local file_name = vim.fn.fnamemodify(path, ':t'):lower()
+ -- Innovation data processing
+ if findany(file_name, { '^upstream%.dat$', '^upstream%..*%.dat$', '^.*%.upstream%.dat$' }) then
+ return 'upstreamdat'
+ end
+ if vim.g.filetype_dat then
+ return vim.g.filetype_dat
+ end
+ -- Determine if a *.dat file is Kuka Robot Language
+ local line = nextnonblank(bufnr, 1)
+ if matchregex(line, [[\c\v^\s*%(\&\w+|defdat>)]]) then
+ return 'krl'
+ end
+end
+
+function M.decl(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 3)) do
+ if line:lower():find('^<!sgml') then
+ return 'sgmldecl'
+ end
+ end
+end
+
+-- This function is called for all files under */debian/patches/*, make sure not
+-- to non-dep3patch files, such as README and other text files.
+function M.dep3patch(path, bufnr)
+ local file_name = vim.fn.fnamemodify(path, ':t')
+ if file_name == 'series' then
+ return
+ end
+
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if
+ findany(line, {
+ '^Description:',
+ '^Subject:',
+ '^Origin:',
+ '^Bug:',
+ '^Forwarded:',
+ '^Author:',
+ '^From:',
+ '^Reviewed%-by:',
+ '^Acked%-by:',
+ '^Last%-Updated:',
+ '^Applied%-Upstream:',
+ })
+ then
+ return 'dep3patch'
+ elseif line:find('^%-%-%-') then
+ -- End of headers found. stop processing
+ return
+ end
+ end
+end
+
+local function diff(contents)
+ if
+ contents[1]:find('^%-%-%- ') and contents[2]:find('^%+%+%+ ')
+ or contents[1]:find('^%* looking for ') and contents[2]:find('^%* comparing to ')
+ or contents[1]:find('^%*%*%* ') and contents[2]:find('^%-%-%- ')
+ or contents[1]:find('^=== ') and ((contents[2]:find('^' .. string.rep('=', 66)) and contents[3]:find(
+ '^%-%-% '
+ ) and contents[4]:find('^%+%+%+')) or (contents[2]:find('^%-%-%- ') and contents[3]:find(
+ '^%+%+%+ '
+ )))
+ or findany(contents[1], { '^=== removed', '^=== added', '^=== renamed', '^=== modified' })
+ then
+ return 'diff'
+ end
+end
+
+function M.dns_zone(contents)
+ if
+ findany(
+ contents[1] .. contents[2] .. contents[3] .. contents[4],
+ { '^; <<>> DiG [0-9%.]+.* <<>>', '%$ORIGIN', '%$TTL', 'IN%s+SOA' }
+ )
+ then
+ return 'bindzone'
+ end
+ -- BAAN
+ if -- Check for 1 to 80 '*' characters
+ contents[1]:find('|%*' .. string.rep('%*?', 79)) and contents[2]:find('VRC ')
+ or contents[2]:find('|%*' .. string.rep('%*?', 79)) and contents[3]:find('VRC ')
+ then
+ return 'baan'
+ end
+end
+
+function M.dtrace(bufnr)
+ if vim.fn.did_filetype() ~= 0 then
+ -- Filetype was already detected
+ return
+ end
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if matchregex(line, [[\c^module\>\|^import\>]]) then
+ -- D files often start with a module and/or import statement.
+ return 'd'
+ elseif findany(line, { '^#!%S+dtrace', '#pragma%s+D%s+option', ':%S-:%S-:' }) then
+ return 'dtrace'
+ end
+ end
+ return 'd'
+end
+
+function M.e(bufnr)
+ if vim.g.filetype_euphoria then
+ return vim.g.filetype_euphoria
+ end
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if findany(line, { "^%s*<'%s*$", "^%s*'>%s*$" }) then
+ return 'specman'
+ end
+ end
+ return 'eiffel'
+end
+
+function M.edn(bufnr)
+ local line = getlines(bufnr, 1)
+ if matchregex(line, [[\c^\s*(\s*edif\>]]) then
+ return 'edif'
+ else
+ return 'clojure'
+ end
+end
+
+-- This function checks for valid cl syntax in the first five lines.
+-- Look for either an opening comment, '#', or a block start, '{'.
+-- If not found, assume SGML.
+function M.ent(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 5)) do
+ if line:find('^%s*[#{]') then
+ return 'cl'
+ elseif not line:find('^%s*$') then
+ -- Not a blank line, not a comment, and not a block start,
+ -- so doesn't look like valid cl code.
+ break
+ end
+ end
+ return 'dtd'
+end
+
+function M.ex(bufnr)
+ if vim.g.filetype_euphoria then
+ return vim.g.filetype_euphoria
+ else
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if matchregex(line, [[\c^--\|^ifdef\>\|^include\>]]) then
+ return 'euphoria3'
+ end
+ end
+ return 'elixir'
+ end
+end
+
+-- This function checks the first 15 lines for appearance of 'FoamFile'
+-- and then 'object' in a following line.
+-- In that case, it's probably an OpenFOAM file
+function M.foam(bufnr)
+ local foam_file = false
+ for _, line in ipairs(getlines(bufnr, 1, 15)) do
+ if line:find('^FoamFile') then
+ foam_file = true
+ elseif foam_file and line:find('^%s*object') then
+ return 'foam'
+ end
+ end
+end
+
+function M.frm(bufnr)
+ if vim.g.filetype_frm then
+ return vim.g.filetype_frm
+ end
+ local lines = table.concat(getlines(bufnr, 1, 5)):lower()
+ if findany(lines, visual_basic_content) then
+ return 'vb'
+ else
+ return 'form'
+ end
+end
+
+function M.fvwm(path)
+ if vim.fn.fnamemodify(path, ':e') == 'm4' then
+ return 'fvwm2m4'
+ end
+ return 'fvwm', function(bufnr)
+ vim.b[bufnr].fvwm_version = 2
+ end
+end
+
+-- Distinguish between Forth and F#.
+function M.fs(bufnr)
+ if vim.g.filetype_fs then
+ return vim.g.filetype_fs
+ end
+ local line = nextnonblank(bufnr, 1)
+ if findany(line, { '^%s*%.?%( ', '^%s*\\G? ', '^\\$', '^%s*: %S' }) then
+ return 'forth'
+ else
+ return 'fsharp'
+ end
+end
+
+function M.git(bufnr)
+ local line = getlines(bufnr, 1)
+ if matchregex(line, [[^\x\{40,\}\>\|^ref: ]]) then
+ return 'git'
+ end
+end
+
+function M.header(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 200)) do
+ if findany(line:lower(), { '^@interface', '^@end', '^@class' }) then
+ if vim.g.c_syntax_for_h then
+ return 'objc'
+ else
+ return 'objcpp'
+ end
+ end
+ end
+ if vim.g.c_syntax_for_h then
+ return 'c'
+ elseif vim.g.ch_syntax_for_h then
+ return 'ch'
+ else
+ return 'cpp'
+ end
+end
+
+function M.html(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 10)) do
+ if matchregex(line, [[\<DTD\s\+XHTML\s]]) then
+ return 'xhtml'
+ elseif matchregex(line, [[\c{%\s*\(extends\|block\|load\)\>\|{#\s\+]]) then
+ return 'htmldjango'
+ end
+ end
+ return 'html'
+end
+
+-- Virata Config Script File or Drupal module
+function M.hw(bufnr)
+ if getlines(bufnr, 1):lower():find('<%?php') then
+ return 'php'
+ end
+ return 'virata'
+end
+
+function M.idl(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 50)) do
+ if findany(line:lower(), { '^%s*import%s+"unknwn"%.idl', '^%s*import%s+"objidl"%.idl' }) then
+ return 'msidl'
+ end
+ end
+ return 'idl'
+end
+
+local pascal_comments = { '^%s*{', '^%s*%(%*', '^%s*//' }
+local pascal_keywords =
+ [[\c^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>]]
+
+function M.inc(bufnr)
+ if vim.g.filetype_inc then
+ return vim.g.filetype_inc
+ end
+ local lines = table.concat(getlines(bufnr, 1, 3))
+ if lines:lower():find('perlscript') then
+ return 'aspperl'
+ elseif lines:find('<%%') then
+ return 'aspvbs'
+ elseif lines:find('<%?') then
+ return 'php'
+ -- Pascal supports // comments but they're vary rarely used for file
+ -- headers so assume POV-Ray
+ elseif findany(lines, { '^%s{', '^%s%(%*' }) or matchregex(lines, pascal_keywords) then
+ return 'pascal'
+ elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%w+%s+= ' }) then
+ return 'bitbake'
+ else
+ local syntax = M.asm_syntax(bufnr)
+ if not syntax or syntax == '' then
+ return 'pov'
+ end
+ return syntax, function(b)
+ vim.b[b].asmsyntax = syntax
+ end
+ end
+end
+
+function M.inp(bufnr)
+ if getlines(bufnr, 1):find('^%*') then
+ return 'abaqus'
+ else
+ for _, line in ipairs(getlines(bufnr, 1, 500)) do
+ if line:lower():find('^header surface data') then
+ return 'trasys'
+ end
+ end
+ end
+end
+
+function M.install(path, bufnr)
+ if getlines(bufnr, 1):lower():find('<%?php') then
+ return 'php'
+ end
+ return M.sh(path, getlines(bufnr), 'bash')
+end
+
+-- Innovation Data Processing
+-- (refactor of filetype.vim since the patterns are case-insensitive)
+function M.log(path)
+ path = path:lower()
+ if
+ findany(
+ path,
+ { 'upstream%.log', 'upstream%..*%.log', '.*%.upstream%.log', 'upstream%-.*%.log' }
+ )
+ then
+ return 'upstreamlog'
+ elseif
+ findany(
+ path,
+ { 'upstreaminstall%.log', 'upstreaminstall%..*%.log', '.*%.upstreaminstall%.log' }
+ )
+ then
+ return 'upstreaminstalllog'
+ elseif findany(path, { 'usserver%.log', 'usserver%..*%.log', '.*%.usserver%.log' }) then
+ return 'usserverlog'
+ elseif findany(path, { 'usw2kagt%.log', 'usw2kagt%..*%.log', '.*%.usw2kagt%.log' }) then
+ return 'usw2kagtlog'
+ end
+end
+
+function M.lpc(bufnr)
+ if vim.g.lpc_syntax_for_c then
+ for _, line in ipairs(getlines(bufnr, 1, 12)) do
+ if
+ findany(line, {
+ '^//',
+ '^inherit',
+ '^private',
+ '^protected',
+ '^nosave',
+ '^string',
+ '^object',
+ '^mapping',
+ '^mixed',
+ })
+ then
+ return 'lpc'
+ end
+ end
+ end
+ return 'c'
+end
+
+function M.m(bufnr)
+ if vim.g.filetype_m then
+ return vim.g.filetype_m
+ end
+
+ -- Excluding end(for|function|if|switch|while) common to Murphi
+ local octave_block_terminators =
+ [[\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>]]
+ local objc_preprocessor =
+ [[\c^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>]]
+
+ -- Whether we've seen a multiline comment leader
+ local saw_comment = false
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if line:find('^%s*/%*') then
+ -- /* ... */ is a comment in Objective C and Murphi, so we can't conclude
+ -- it's either of them yet, but track this as a hint in case we don't see
+ -- anything more definitive.
+ saw_comment = true
+ end
+ if
+ line:find('^%s*//')
+ or matchregex(line, [[\c^\s*@import\>]])
+ or matchregex(line, objc_preprocessor)
+ then
+ return 'objc'
+ end
+ if
+ findany(line, { '^%s*#', '^%s*%%!' })
+ or matchregex(line, [[\c^\s*unwind_protect\>]])
+ or matchregex(line, [[\c\%(^\|;\)\s*]] .. octave_block_terminators)
+ then
+ return 'octave'
+ elseif line:find('^%s*%%') then
+ return 'matlab'
+ elseif line:find('^%s*%(%*') then
+ return 'mma'
+ elseif matchregex(line, [[\c^\s*\(\(type\|var\)\>\|--\)]]) then
+ return 'murphi'
+ end
+ end
+
+ if saw_comment then
+ -- We didn't see anything definitive, but this looks like either Objective C
+ -- or Murphi based on the comment leader. Assume the former as it is more
+ -- common.
+ return 'objc'
+ else
+ -- Default is Matlab
+ return 'matlab'
+ end
+end
+
+local function m4(contents)
+ for _, line in ipairs(contents) do
+ if matchregex(line, [[^\s*dnl\>]]) then
+ return 'm4'
+ end
+ end
+ if vim.env.TERM == 'amiga' and findany(contents[1]:lower(), { '^;', '^%.bra' }) then
+ -- AmigaDos scripts
+ return 'amiga'
+ end
+end
+
+-- Rely on the file to start with a comment.
+-- MS message text files use ';', Sendmail files use '#' or 'dnl'
+function M.mc(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 20)) do
+ if findany(line:lower(), { '^%s*#', '^%s*dnl' }) then
+ -- Sendmail .mc file
+ return 'm4'
+ elseif line:find('^%s*;') then
+ return 'msmessages'
+ end
+ end
+ -- Default: Sendmail .mc file
+ return 'm4'
+end
+
+function M.me(path)
+ local filename = vim.fn.fnamemodify(path, ':t'):lower()
+ if filename ~= 'read.me' and filename ~= 'click.me' then
+ return 'nroff'
+ end
+end
+
+function M.mm(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 20)) do
+ if matchregex(line, [[\c^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)]]) then
+ return 'objcpp'
+ end
+ end
+ return 'nroff'
+end
+
+function M.mms(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 20)) do
+ if findany(line, { '^%s*%%', '^%s*//', '^%*' }) then
+ return 'mmix'
+ elseif line:find('^%s*#') then
+ return 'make'
+ end
+ end
+ return 'mmix'
+end
+
+-- Returns true if file content looks like LambdaProlog
+local function is_lprolog(bufnr)
+ -- Skip apparent comments and blank lines, what looks like
+ -- LambdaProlog comment may be RAPID header
+ for _, line in ipairs(getlines(bufnr)) do
+ -- The second pattern matches a LambdaProlog comment
+ if not findany(line, { '^%s*$', '^%s*%%' }) then
+ -- The pattern must not catch a go.mod file
+ return matchregex(line, [[\c\<module\s\+\w\+\s*\.\s*\(%\|$\)]]) ~= nil
+ end
+ end
+end
+
+-- Determine if *.mod is ABB RAPID, LambdaProlog, Modula-2, Modsim III or go.mod
+function M.mod(path, bufnr)
+ if vim.g.filetype_mod then
+ return vim.g.filetype_mod
+ elseif is_lprolog(bufnr) then
+ return 'lprolog'
+ elseif matchregex(nextnonblank(bufnr, 1), [[\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)]]) then
+ return 'modula2'
+ elseif is_rapid(bufnr) then
+ return 'rapid'
+ elseif matchregex(path, [[\c\<go\.mod$]]) then
+ return 'gomod'
+ else
+ -- Nothing recognized, assume modsim3
+ return 'modsim3'
+ end
+end
+
+function M.news(bufnr)
+ if getlines(bufnr, 1):lower():find('; urgency=') then
+ return 'debchangelog'
+ end
+end
+
+-- This function checks if one of the first five lines start with a dot. In
+-- that case it is probably an nroff file.
+function M.nroff(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 5)) do
+ if line:find('^%.') then
+ return 'nroff'
+ end
+ end
+end
+
+function M.patch(bufnr)
+ local firstline = getlines(bufnr, 1)
+ if string.find(firstline, '^From ' .. string.rep('%x', 40) .. '+ Mon Sep 17 00:00:00 2001$') then
+ return 'gitsendemail'
+ else
+ return 'diff'
+ end
+end
+
+-- If the file has an extension of 't' and is in a directory 't' or 'xt' then
+-- it is almost certainly a Perl test file.
+-- If the first line starts with '#' and contains 'perl' it's probably a Perl file.
+-- (Slow test) If a file contains a 'use' statement then it is almost certainly a Perl file.
+function M.perl(path, bufnr)
+ local dir_name = vim.fs.dirname(path)
+ if vim.fn.expand(path, '%:e') == 't' and (dir_name == 't' or dir_name == 'xt') then
+ return 'perl'
+ end
+ local first_line = getlines(bufnr, 1)
+ if first_line:find('^#') and first_line:lower():find('perl') then
+ return 'perl'
+ end
+ for _, line in ipairs(getlines(bufnr, 1, 30)) do
+ if matchregex(line, [[\c^use\s\s*\k]]) then
+ return 'perl'
+ end
+ end
+end
+
+function M.pl(bufnr)
+ if vim.g.filetype_pl then
+ return vim.g.filetype_pl
+ end
+ -- 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
+ return 'prolog'
+ else
+ return 'perl'
+ end
+end
+
+function M.pm(bufnr)
+ local line = getlines(bufnr, 1)
+ if line:find('XPM2') then
+ return 'xpm2'
+ elseif line:find('XPM') then
+ return 'xpm'
+ else
+ return 'perl'
+ end
+end
+
+function M.pp(bufnr)
+ if vim.g.filetype_pp then
+ return vim.g.filetype_pp
+ end
+ local line = nextnonblank(bufnr, 1)
+ if findany(line, pascal_comments) or matchregex(line, pascal_keywords) then
+ return 'pascal'
+ else
+ return 'puppet'
+ end
+end
+
+function M.prg(bufnr)
+ if vim.g.filetype_prg then
+ return vim.g.filetype_prg
+ elseif is_rapid(bufnr) then
+ return 'rapid'
+ else
+ -- Nothing recognized, assume Clipper
+ return 'clipper'
+ end
+end
+
+function M.printcap(ptcap_type)
+ if vim.fn.did_filetype() == 0 then
+ return 'ptcap', function(bufnr)
+ vim.b[bufnr].ptcap_type = ptcap_type
+ end
+ end
+end
+
+-- This function checks for an assembly comment in the first ten lines.
+-- If not found, assume Progress.
+function M.progress_asm(bufnr)
+ if vim.g.filetype_i then
+ return vim.g.filetype_i
+ end
+
+ for _, line in ipairs(getlines(bufnr, 1, 10)) do
+ if line:find('^%s*;') or line:find('^/%*') then
+ return M.asm(bufnr)
+ elseif not line:find('^%s*$') or line:find('^/%*') then
+ -- Not an empty line: doesn't look like valid assembly code
+ -- or it looks like a Progress /* comment.
+ break
+ end
+ end
+ return 'progress'
+end
+
+function M.progress_cweb(bufnr)
+ if vim.g.filetype_w then
+ return vim.g.filetype_w
+ else
+ if
+ getlines(bufnr, 1):lower():find('^&analyze')
+ or getlines(bufnr, 3):lower():find('^&global%-define')
+ then
+ return 'progress'
+ else
+ return 'cweb'
+ end
+ end
+end
+
+-- This function checks for valid Pascal syntax in the first 10 lines.
+-- Look for either an opening comment or a program start.
+-- If not found, assume Progress.
+function M.progress_pascal(bufnr)
+ if vim.g.filetype_p then
+ return vim.g.filetype_p
+ end
+ for _, line in ipairs(getlines(bufnr, 1, 10)) do
+ if findany(line, pascal_comments) or matchregex(line, pascal_keywords) then
+ return 'pascal'
+ elseif not line:find('^%s*$') or line:find('^/%*') then
+ -- Not an empty line: Doesn't look like valid Pascal code.
+ -- Or it looks like a Progress /* comment
+ break
+ end
+ end
+ return 'progress'
+end
+
+-- Distinguish between "default" and Cproto prototype file.
+function M.proto(bufnr, default)
+ -- Cproto files have a comment in the first line and a function prototype in
+ -- the second line, it always ends in ";". Indent files may also have
+ -- comments, thus we can't match comments to see the difference.
+ -- IDL files can have a single ';' in the second line, require at least one
+ -- character before the ';'.
+ if getlines(bufnr, 2):find('.;$') then
+ return 'cpp'
+ else
+ return default
+ end
+end
+
+-- Software Distributor Product Specification File (POSIX 1387.2-1995)
+function M.psf(bufnr)
+ local line = getlines(bufnr, 1):lower()
+ if
+ findany(line, {
+ '^%s*distribution%s*$',
+ '^%s*installed_software%s*$',
+ '^%s*root%s*$',
+ '^%s*bundle%s*$',
+ '^%s*product%s*$',
+ })
+ then
+ return 'psf'
+ end
+end
+
+function M.r(bufnr)
+ local lines = getlines(bufnr, 1, 50)
+ -- Rebol is easy to recognize, check for that first
+ if matchregex(table.concat(lines), [[\c\<rebol\>]]) then
+ return 'rebol'
+ end
+
+ for _, line in ipairs(lines) do
+ -- R has # comments
+ if line:find('^%s*#') then
+ return 'r'
+ end
+ -- Rexx has /* comments */
+ if line:find('^%s*/%*') then
+ return 'rexx'
+ end
+ end
+
+ -- Nothing recognized, use user default or assume R
+ if vim.g.filetype_r then
+ return vim.g.filetype_r
+ else
+ -- Rexx used to be the default, but R appears to be much more popular.
+ return 'r'
+ end
+end
+
+function M.redif(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 5)) do
+ if line:lower():find('^template%-type:') then
+ return 'redif'
+ end
+ end
+end
+
+function M.reg(bufnr)
+ local line = getlines(bufnr, 1):lower()
+ if
+ line:find('^regedit[0-9]*%s*$') or line:find('^windows registry editor version %d*%.%d*%s*$')
+ then
+ return 'registry'
+ end
+end
+
+-- Diva (with Skill) or InstallShield
+function M.rul(bufnr)
+ if table.concat(getlines(bufnr, 1, 6)):lower():find('installshield') then
+ return 'ishd'
+ end
+ return 'diva'
+end
+
+local udev_rules_pattern = '^%s*udev_rules%s*=%s*"([%^"]+)/*".*'
+function M.rules(path)
+ path = path:lower()
+ if
+ findany(path, {
+ '/etc/udev/.*%.rules$',
+ '/etc/udev/rules%.d/.*$.rules$',
+ '/usr/lib/udev/.*%.rules$',
+ '/usr/lib/udev/rules%.d/.*%.rules$',
+ '/lib/udev/.*%.rules$',
+ '/lib/udev/rules%.d/.*%.rules$',
+ })
+ then
+ return 'udevrules'
+ elseif path:find('^/etc/ufw/') then
+ -- Better than hog
+ return 'conf'
+ elseif findany(path, { '^/etc/polkit%-1/rules%.d', '/usr/share/polkit%-1/rules%.d' }) then
+ return 'javascript'
+ else
+ local ok, config_lines = pcall(vim.fn.readfile, '/etc/udev/udev.conf')
+ if not ok then
+ return 'hog'
+ end
+ local dir = vim.fn.expand(path, ':h')
+ for _, line in ipairs(config_lines) do
+ local match = line:match(udev_rules_pattern)
+ if match then
+ local udev_rules = line:gsub(udev_rules_pattern, match, 1)
+ if dir == udev_rules then
+ return 'udevrules'
+ end
+ end
+ end
+ return 'hog'
+ end
+end
+
+-- LambdaProlog and Standard ML signature files
+function M.sig(bufnr)
+ if vim.g.filetype_sig then
+ return vim.g.filetype_sig
+ end
+
+ local line = nextnonblank(bufnr, 1)
+
+ -- LambdaProlog comment or keyword
+ if findany(line, { '^%s*/%*', '^%s*%%', '^%s*sig%s+%a' }) then
+ return 'lprolog'
+ -- SML comment or keyword
+ elseif findany(line, { '^%s*%(%*', '^%s*signature%s+%a', '^%s*structure%s+%a' }) then
+ return 'sml'
+ end
+end
+
+-- This function checks the first 25 lines of file extension "sc" to resolve
+-- detection between scala and SuperCollider
+function M.sc(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 25)) do
+ if
+ findany(line, {
+ '[A-Za-z0-9]*%s:%s[A-Za-z0-9]',
+ 'var%s<',
+ 'classvar%s<',
+ '%^this.*',
+ '|%w*|',
+ '%+%s%w*%s{',
+ '%*ar%s',
+ })
+ then
+ return 'supercollider'
+ end
+ end
+ return 'scala'
+end
+
+-- This function checks the first line of file extension "scd" to resolve
+-- detection between scdoc and SuperCollider
+function M.scd(bufnr)
+ local first = '^%S+%(%d[0-9A-Za-z]*%)'
+ local opt = [[%s+"[^"]*"]]
+ local line = getlines(bufnr, 1)
+ if findany(line, { first .. '$', first .. opt .. '$', first .. opt .. opt .. '$' }) then
+ return 'scdoc'
+ else
+ return 'supercollider'
+ end
+end
+
+function M.sgml(bufnr)
+ local lines = table.concat(getlines(bufnr, 1, 5))
+ if lines:find('linuxdoc') then
+ return 'smgllnx'
+ elseif lines:find('<!DOCTYPE.*DocBook') then
+ return 'docbk',
+ function(b)
+ vim.b[b].docbk_type = 'sgml'
+ vim.b[b].docbk_ver = 4
+ end
+ else
+ return 'sgml'
+ end
+end
+
+function M.sh(path, contents, name)
+ -- Path may be nil, do not fail in that case
+ if vim.fn.did_filetype() ~= 0 or (path or ''):find(vim.g.ft_ignore_pat) then
+ -- Filetype was already detected or detection should be skipped
+ return
+ end
+
+ local on_detect
+
+ -- Get the name from the first line if not specified
+ name = name or contents[1]
+ if matchregex(name, [[\<csh\>]]) then
+ -- Some .sh scripts contain #!/bin/csh.
+ return M.shell(path, contents, 'csh')
+ -- Some .sh scripts contain #!/bin/tcsh.
+ elseif matchregex(name, [[\<tcsh\>]]) then
+ return M.shell(path, contents, 'tcsh')
+ -- Some .sh scripts contain #!/bin/zsh.
+ elseif matchregex(name, [[\<zsh\>]]) then
+ return M.shell(path, contents, 'zsh')
+ elseif matchregex(name, [[\<ksh\>]]) then
+ on_detect = function(b)
+ vim.b[b].is_kornshell = 1
+ vim.b[b].is_bash = nil
+ vim.b[b].is_sh = nil
+ end
+ elseif vim.g.bash_is_sh or matchregex(name, [[\<bash\>]]) or matchregex(name, [[\<bash2\>]]) then
+ on_detect = function(b)
+ vim.b[b].is_bash = 1
+ vim.b[b].is_kornshell = nil
+ vim.b[b].is_sh = nil
+ end
+ elseif matchregex(name, [[\<sh\>]]) then
+ on_detect = function(b)
+ vim.b[b].is_sh = 1
+ vim.b[b].is_kornshell = nil
+ vim.b[b].is_bash = nil
+ end
+ end
+ return M.shell(path, contents, 'sh'), on_detect
+end
+
+-- For shell-like file types, check for an "exec" command hidden in a comment, as used for Tcl.
+function M.shell(path, contents, name)
+ if vim.fn.did_filetype() ~= 0 or matchregex(path, vim.g.ft_ignore_pat) then
+ -- Filetype was already detected or detection should be skipped
+ return
+ end
+
+ local prev_line = ''
+ for line_nr, line in ipairs(contents) do
+ -- Skip the first line
+ if line_nr ~= 1 then
+ line = line:lower()
+ if line:find('%s*exec%s') and not prev_line:find('^%s*#.*\\$') then
+ -- Found an "exec" line after a comment with continuation
+ local n = line:gsub('%s*exec%s+([^ ]*/)?', '', 1)
+ if matchregex(n, [[\c\<tclsh\|\<wish]]) then
+ return 'tcl'
+ end
+ end
+ prev_line = line
+ end
+ end
+ return name
+end
+
+-- SMIL or SNMP MIB file
+function M.smi(bufnr)
+ local line = getlines(bufnr, 1)
+ if matchregex(line, [[\c\<smil\>]]) then
+ return 'smil'
+ else
+ return 'mib'
+ end
+end
+
+-- Determine if a *.src file is Kuka Robot Language
+function M.src(bufnr)
+ if vim.g.filetype_src then
+ return vim.g.filetype_src
+ end
+ local line = nextnonblank(bufnr, 1)
+ if matchregex(line, [[\c\v^\s*%(\&\w+|%(global\s+)?def%(fct)?>)]]) then
+ return 'krl'
+ end
+end
+
+function M.sys(bufnr)
+ if vim.g.filetype_sys then
+ return vim.g.filetype_sys
+ elseif is_rapid(bufnr) then
+ return 'rapid'
+ else
+ return 'bat'
+ end
+end
+
+-- Choose context, plaintex, or tex (LaTeX) based on these rules:
+-- 1. Check the first line of the file for "%&<format>".
+-- 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
+-- 3. Default to "plain" or to g:tex_flavor, can be set in user's vimrc.
+function M.tex(path, bufnr)
+ local format = getlines(bufnr, 1):find('^%%&%s*(%a+)')
+ if format then
+ format = format:lower():gsub('pdf', '', 1)
+ if format == 'tex' then
+ return 'tex'
+ elseif format == 'plaintex' then
+ return 'plaintex'
+ end
+ elseif path:lower():find('tex/context/.*/.*%.tex') then
+ return 'context'
+ else
+ local lpat = [[documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>]]
+ local cpat =
+ [[start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>]]
+
+ for i, l in ipairs(getlines(bufnr, 1, 1000)) do
+ -- Find first non-comment line
+ if not l:find('^%s*%%%S') then
+ -- Check the next thousand lines for a LaTeX or ConTeXt keyword.
+ for _, line in ipairs(getlines(bufnr, i + 1, i + 1000)) do
+ local lpat_match, cpat_match =
+ matchregex(line, [[\c^\s*\\\%(]] .. lpat .. [[\)\|^\s*\\\(]] .. cpat .. [[\)]])
+ if lpat_match then
+ return 'tex'
+ elseif cpat_match then
+ return 'context'
+ end
+ end
+ end
+ end
+ -- TODO: add AMSTeX, RevTex, others?
+ if not vim.g.tex_flavor or vim.g.tex_flavor == 'plain' then
+ return 'plaintex'
+ elseif vim.g.tex_flavor == 'context' then
+ return 'context'
+ else
+ -- Probably LaTeX
+ return 'tex'
+ end
+ end
+end
+
+-- Determine if a *.tf file is TF mud client or terraform
+function M.tf(bufnr)
+ for _, line in ipairs(getlines(bufnr)) do
+ -- Assume terraform file on a non-empty line (not whitespace-only)
+ -- and when the first non-whitespace character is not a ; or /
+ if not line:find('^%s*$') and not line:find('^%s*[;/]') then
+ return 'terraform'
+ end
+ end
+ return 'tf'
+end
+
+function M.ttl(bufnr)
+ local line = getlines(bufnr, 1):lower()
+ if line:find('^@?prefix') or line:find('^@?base') then
+ return 'turtle'
+ end
+ return 'teraterm'
+end
+
+function M.txt(bufnr)
+ -- helpfiles match *.txt, but should have a modeline as last line
+ if not getlines(bufnr, -1):find('vim:.*ft=help') then
+ return 'text'
+ end
+end
+
+-- WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
+-- lines in a WEB file).
+function M.web(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 5)) do
+ if line:find('^%%') then
+ return 'web'
+ end
+ end
+ return 'winbatch'
+end
+
+-- XFree86 config
+function M.xfree86()
+ return 'xf86conf',
+ function(bufnr)
+ local line = getlines(bufnr, 1)
+ if matchregex(line, [[\<XConfigurator\>]]) then
+ vim.b[bufnr].xf86conf_xfree86_version = 3
+ end
+ end
+end
+
+function M.xml(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ local is_docbook4 = line:find('<!DOCTYPE.*DocBook')
+ line = line:lower()
+ local is_docbook5 = line:find([[ xmlns="http://docbook.org/ns/docbook"]])
+ if is_docbook4 or is_docbook5 then
+ return 'docbk',
+ function(b)
+ vim.b[b].docbk_type = 'xml'
+ vim.b[b].docbk_ver = is_docbook4 and 4 or 5
+ end
+ end
+ if line:find([[xmlns:xbl="http://www.mozilla.org/xbl"]]) then
+ return 'xbl'
+ end
+ end
+ return 'xml'
+end
+
+function M.y(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if line:find('^%s*%%') then
+ return 'yacc'
+ end
+ if matchregex(line, [[\c^\s*\(#\|class\>\)]]) and not line:lower():find('^%s*#%s*include') then
+ return 'racc'
+ end
+ end
+ return 'yacc'
+end
+
+-- luacheck: pop
+-- luacheck: pop
+
+local patterns_hashbang = {
+ ['^zsh\\>'] = { 'zsh', { vim_regex = true } },
+ ['^\\(tclsh\\|wish\\|expectk\\|itclsh\\|itkwish\\)\\>'] = { 'tcl', { vim_regex = true } },
+ ['^expect\\>'] = { 'expect', { vim_regex = true } },
+ ['^gnuplot\\>'] = { 'gnuplot', { vim_regex = true } },
+ ['make\\>'] = { 'make', { vim_regex = true } },
+ ['^pike\\%(\\>\\|[0-9]\\)'] = { 'pike', { vim_regex = true } },
+ lua = 'lua',
+ perl = 'perl',
+ php = 'php',
+ python = 'python',
+ ['^groovy\\>'] = { 'groovy', { vim_regex = true } },
+ raku = 'raku',
+ ruby = 'ruby',
+ ['node\\(js\\)\\=\\>\\|js\\>'] = { 'javascript', { vim_regex = true } },
+ ['rhino\\>'] = { 'javascript', { vim_regex = true } },
+ -- BC calculator
+ ['^bc\\>'] = { 'bc', { vim_regex = true } },
+ ['sed\\>'] = { 'sed', { vim_regex = true } },
+ ocaml = 'ocaml',
+ -- Awk scripts; also finds "gawk"
+ ['awk\\>'] = { 'awk', { vim_regex = true } },
+ wml = 'wml',
+ scheme = 'scheme',
+ cfengine = 'cfengine',
+ escript = 'erlang',
+ haskell = 'haskell',
+ clojure = 'clojure',
+ ['scala\\>'] = { 'scala', { vim_regex = true } },
+ -- Free Pascal
+ ['instantfpc\\>'] = { 'pascal', { vim_regex = true } },
+ ['fennel\\>'] = { 'fennel', { vim_regex = true } },
+ -- MikroTik RouterOS script
+ ['rsc\\>'] = { 'routeros', { vim_regex = true } },
+ ['fish\\>'] = { 'fish', { vim_regex = true } },
+ ['gforth\\>'] = { 'forth', { vim_regex = true } },
+ ['icon\\>'] = { 'icon', { vim_regex = true } },
+ guile = 'scheme',
+}
+
+---@private
+-- File starts with "#!".
+local function match_from_hashbang(contents, path)
+ local first_line = contents[1]
+ -- Check for a line like "#!/usr/bin/env {options} bash". Turn it into
+ -- "#!/usr/bin/bash" to make matching easier.
+ -- Recognize only a few {options} that are commonly used.
+ if matchregex(first_line, [[^#!\s*\S*\<env\s]]) then
+ first_line = first_line:gsub('%S+=%S+', '')
+ first_line = first_line
+ :gsub('%-%-ignore%-environment', '', 1)
+ :gsub('%-%-split%-string', '', 1)
+ :gsub('%-[iS]', '', 1)
+ first_line = vim.fn.substitute(first_line, [[\<env\s\+]], '', '')
+ end
+
+ -- Get the program name.
+ -- Only accept spaces in PC style paths: "#!c:/program files/perl [args]".
+ -- If the word env is used, use the first word after the space:
+ -- "#!/usr/bin/env perl [path/args]"
+ -- If there is no path use the first word: "#!perl [path/args]".
+ -- Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]".
+ local name
+ if first_line:find('^#!%s*%a:[/\\]') then
+ name = vim.fn.substitute(first_line, [[^#!.*[/\\]\(\i\+\).*]], '\\1', '')
+ elseif matchregex(first_line, [[^#!.*\<env\>]]) then
+ name = vim.fn.substitute(first_line, [[^#!.*\<env\>\s\+\(\i\+\).*]], '\\1', '')
+ elseif matchregex(first_line, [[^#!\s*[^/\\ ]*\>\([^/\\]\|$\)]]) then
+ name = vim.fn.substitute(first_line, [[^#!\s*\([^/\\ ]*\>\).*]], '\\1', '')
+ else
+ name = vim.fn.substitute(first_line, [[^#!\s*\S*[/\\]\(\i\+\).*]], '\\1', '')
+ end
+
+ -- tcl scripts may have #!/bin/sh in the first line and "exec wish" in the
+ -- third line. Suggested by Steven Atkinson.
+ if contents[3] and contents[3]:find('^exec wish') then
+ name = 'wish'
+ end
+
+ if matchregex(name, [[^\(bash\d*\|\|ksh\d*\|sh\)\>]]) then
+ -- Bourne-like shell scripts: bash bash2 ksh ksh93 sh
+ return require('vim.filetype.detect').sh(path, contents, first_line)
+ elseif matchregex(name, [[^csh\>]]) then
+ return require('vim.filetype.detect').shell(path, contents, vim.g.filetype_csh or 'csh')
+ elseif matchregex(name, [[^tcsh\>]]) then
+ return require('vim.filetype.detect').shell(path, contents, 'tcsh')
+ end
+
+ for k, v in pairs(patterns_hashbang) do
+ local ft = type(v) == 'table' and v[1] or v
+ local opts = type(v) == 'table' and v[2] or {}
+ if opts.vim_regex and matchregex(name, k) or name:find(k) then
+ return ft
+ end
+ end
+end
+
+local patterns_text = {
+ ['^#compdef\\>'] = { 'zsh', { vim_regex = true } },
+ ['^#autoload\\>'] = { 'zsh', { vim_regex = true } },
+ -- ELM Mail files
+ ['^From [a-zA-Z][a-zA-Z_0-9%.=%-]*(@[^ ]*)? .* 19%d%d$'] = 'mail',
+ ['^From [a-zA-Z][a-zA-Z_0-9%.=%-]*(@[^ ]*)? .* 20%d%d$'] = 'mail',
+ ['^From %- .* 19%d%d$'] = 'mail',
+ ['^From %- .* 20%d%d$'] = 'mail',
+ -- Mason
+ ['^<[%%&].*>'] = 'mason',
+ -- Vim scripts (must have '" vim' as the first line to trigger this)
+ ['^" *[vV]im$['] = 'vim',
+ -- libcxx and libstdc++ standard library headers like ["iostream["] do not have
+ -- an extension, recognize the Emacs file mode.
+ ['%-%*%-.*[cC]%+%+.*%-%*%-'] = 'cpp',
+ ['^\\*\\* LambdaMOO Database, Format Version \\%([1-3]\\>\\)\\@!\\d\\+ \\*\\*$'] = {
+ 'moo',
+ { vim_regex = true },
+ },
+ -- Diff file:
+ -- - "diff" in first line (context diff)
+ -- - "Only in " in first line
+ -- - "--- " in first line and "+++ " in second line (unified diff).
+ -- - "*** " in first line and "--- " in second line (context diff).
+ -- - "# It was generated by makepatch " in the second line (makepatch diff).
+ -- - "Index: <filename>" in the first line (CVS file)
+ -- - "=== ", line of "=", "---", "+++ " (SVK diff)
+ -- - "=== ", "--- ", "+++ " (bzr diff, common case)
+ -- - "=== (removed|added|renamed|modified)" (bzr diff, alternative)
+ -- - "# HG changeset patch" in first line (Mercurial export format)
+ ['^\\(diff\\>\\|Only in \\|\\d\\+\\(,\\d\\+\\)\\=[cda]\\d\\+\\>\\|# It was generated by makepatch \\|Index:\\s\\+\\f\\+\\r\\=$\\|===== \\f\\+ \\d\\+\\.\\d\\+ vs edited\\|==== //\\f\\+#\\d\\+\\|# HG changeset patch\\)'] = {
+ 'diff',
+ { vim_regex = true },
+ },
+ function(contents)
+ return diff(contents)
+ end,
+ -- PostScript Files (must have %!PS as the first line, like a2ps output)
+ ['^%%![ \t]*PS'] = 'postscr',
+ function(contents)
+ return m4(contents)
+ end,
+ -- SiCAD scripts (must have procn or procd as the first line to trigger this)
+ ['^ *proc[nd] *$'] = { 'sicad', { ignore_case = true } },
+ ['^%*%*%*%* Purify'] = 'purifylog',
+ -- XML
+ ['<%?%s*xml.*%?>'] = 'xml',
+ -- XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN")
+ ['\\<DTD\\s\\+XHTML\\s'] = 'xhtml',
+ -- HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
+ -- Avoid "doctype html", used by slim.
+ ['\\c<!DOCTYPE\\s\\+html\\>'] = { 'html', { vim_regex = true } },
+ -- PDF
+ ['^%%PDF%-'] = 'pdf',
+ -- XXD output
+ ['^%x%x%x%x%x%x%x: %x%x ?%x%x ?%x%x ?%x%x '] = 'xxd',
+ -- RCS/CVS log output
+ ['^RCS file:'] = { 'rcslog', { start_lnum = 1, end_lnum = 2 } },
+ -- CVS commit
+ ['^CVS:'] = { 'cvs', { start_lnum = 2 } },
+ ['^CVS: '] = { 'cvs', { start_lnum = -1 } },
+ -- Prescribe
+ ['^!R!'] = 'prescribe',
+ -- Send-pr
+ ['^SEND%-PR:'] = 'sendpr',
+ -- SNNS files
+ ['^SNNS network definition file'] = 'snnsnet',
+ ['^SNNS pattern definition file'] = 'snnspat',
+ ['^SNNS result file'] = 'snnsres',
+ ['^%%.-[Vv]irata'] = { 'virata', { start_lnum = 1, end_lnum = 5 } },
+ ['[0-9:%.]* *execve%('] = 'strace',
+ ['^__libc_start_main'] = 'strace',
+ -- VSE JCL
+ ['^\\* $$ JOB\\>'] = { 'vsejcl', { vim_regex = true } },
+ ['^// *JOB\\>'] = { 'vsejcl', { vim_regex = true } },
+ -- TAK and SINDA
+ ['K & K Associates'] = { 'takout', { start_lnum = 4 } },
+ ['TAK 2000'] = { 'takout', { start_lnum = 2 } },
+ ['S Y S T E M S I M P R O V E D '] = { 'syndaout', { start_lnum = 3 } },
+ ['Run Date: '] = { 'takcmp', { start_lnum = 6 } },
+ ['Node File 1'] = { 'sindacmp', { start_lnum = 9 } },
+ function(contents)
+ require('vim.filetype.detect').dns_zone(contents)
+ end,
+ -- Valgrind
+ ['^==%d+== valgrind'] = 'valgrind',
+ ['^==%d+== Using valgrind'] = { 'valgrind', { start_lnum = 3 } },
+ -- Go docs
+ ['PACKAGE DOCUMENTATION$'] = 'godoc',
+ -- Renderman Interface Bytestream
+ ['^##RenderMan'] = 'rib',
+ -- Scheme scripts
+ ['exec%s%+%S*scheme'] = { 'scheme', { start_lnum = 1, end_lnum = 2 } },
+ -- Git output
+ ['^\\(commit\\|tree\\|object\\) \\x\\{40,\\}\\>\\|^tag \\S\\+$'] = {
+ 'git',
+ { vim_regex = true },
+ },
+ function(lines)
+ -- Gprof (gnu profiler)
+ if
+ lines[1] == 'Flat profile:'
+ and lines[2] == ''
+ and lines[3]:find('^Each sample counts as .* seconds%.$')
+ then
+ return 'gprof'
+ end
+ end,
+ -- Erlang terms
+ -- (See also: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes)
+ ['%-%*%-.*erlang.*%-%*%-'] = { 'erlang', { ignore_case = true } },
+ -- YAML
+ ['^%%YAML'] = 'yaml',
+ -- MikroTik RouterOS script
+ ['^#.*by RouterOS'] = 'routeros',
+ -- Sed scripts
+ -- #ncomment is allowed but most likely a false positive so require a space before any trailing comment text
+ ['^#n%s'] = 'sed',
+ ['^#n$'] = 'sed',
+}
+
+---@private
+-- File does not start with "#!".
+local function match_from_text(contents, path)
+ if contents[1]:find('^:$') then
+ -- Bourne-like shell scripts: sh ksh bash bash2
+ return M.sh(path, contents)
+ elseif
+ matchregex(
+ '\n' .. table.concat(contents, '\n'),
+ [[\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>]]
+ )
+ then
+ -- Z shell scripts
+ return 'zsh'
+ end
+
+ for k, v in pairs(patterns_text) do
+ if type(v) == 'string' then
+ -- Check the first line only
+ if contents[1]:find(k) then
+ return v
+ end
+ elseif type(v) == 'function' then
+ -- If filetype detection fails, continue with the next pattern
+ local ok, ft = pcall(v, contents)
+ if ok and ft then
+ return ft
+ end
+ else
+ local opts = type(v) == 'table' and v[2] or {}
+ if opts.start_lnum and opts.end_lnum then
+ assert(
+ not opts.ignore_case,
+ 'ignore_case=true is ignored when start_lnum is also present, needs refactor'
+ )
+ for i = opts.start_lnum, opts.end_lnum do
+ if not contents[i] then
+ break
+ elseif contents[i]:find(k) then
+ return v[1]
+ end
+ end
+ else
+ local line_nr = opts.start_lnum == -1 and #contents or opts.start_lnum or 1
+ if contents[line_nr] then
+ local line = opts.ignore_case and contents[line_nr]:lower() or contents[line_nr]
+ if opts.vim_regex and matchregex(line, k) or line:find(k) then
+ return v[1]
+ end
+ end
+ end
+ end
+ end
+ return cvs_diff(path, contents)
+end
+
+M.match_contents = function(contents, path)
+ local first_line = contents[1]
+ if first_line:find('^#!') then
+ return match_from_hashbang(contents, path)
+ else
+ return match_from_text(contents, path)
+ end
+end
+
+return M
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
new file mode 100644
index 0000000000..ce845eda15
--- /dev/null
+++ b/runtime/lua/vim/fs.lua
@@ -0,0 +1,209 @@
+local M = {}
+
+--- Iterate over all the parents of the given file or directory.
+---
+--- Example:
+--- <pre>
+--- local root_dir
+--- for dir in vim.fs.parents(vim.api.nvim_buf_get_name(0)) do
+--- if vim.fn.isdirectory(dir .. "/.git") == 1 then
+--- root_dir = dir
+--- break
+--- end
+--- end
+---
+--- if root_dir then
+--- print("Found git repository at", root_dir)
+--- end
+--- </pre>
+---
+---@param start (string) Initial file or directory.
+---@return (function) Iterator
+function M.parents(start)
+ return function(_, dir)
+ local parent = M.dirname(dir)
+ if parent == dir then
+ return nil
+ end
+
+ return parent
+ end,
+ nil,
+ start
+end
+
+--- Return the parent directory of the given file or directory
+---
+---@param file (string) File or directory
+---@return (string) Parent directory of {file}
+function M.dirname(file)
+ if file == nil then
+ return nil
+ end
+ return vim.fn.fnamemodify(file, ':h')
+end
+
+--- Return the basename of the given file or directory
+---
+---@param file (string) File or directory
+---@return (string) Basename of {file}
+function M.basename(file)
+ return vim.fn.fnamemodify(file, ':t')
+end
+
+--- Return an iterator over the files and directories located in {path}
+---
+---@param path (string) An absolute or relative path to the directory to iterate
+--- over. The path is first normalized |vim.fs.normalize()|.
+---@return Iterator over files and directories in {path}. Each iteration yields
+--- two values: name and type. Each "name" is the basename of the file or
+--- directory relative to {path}. Type is one of "file" or "directory".
+function M.dir(path)
+ return function(fs)
+ return vim.loop.fs_scandir_next(fs)
+ end,
+ vim.loop.fs_scandir(M.normalize(path))
+end
+
+--- Find files or directories in the given path.
+---
+--- Finds any files or directories given in {names} starting from {path}. If
+--- {upward} is "true" then the search traverses upward through parent
+--- directories; otherwise, the search traverses downward. Note that downward
+--- searches are recursive and may search through many directories! If {stop}
+--- is non-nil, then the search stops when the directory given in {stop} is
+--- reached. The search terminates when {limit} (default 1) matches are found.
+--- The search can be narrowed to find only files or or only directories by
+--- specifying {type} to be "file" or "directory", respectively.
+---
+---@param names (string|table) Names of the files and directories to find. Must
+--- be base names, paths and globs are not supported.
+---@param opts (table) Optional keyword arguments:
+--- - path (string): Path to begin searching from. If
+--- omitted, the current working directory is used.
+--- - upward (boolean, default false): If true, search
+--- upward through parent directories. Otherwise,
+--- search through child directories
+--- (recursively).
+--- - stop (string): Stop searching when this directory is
+--- reached. The directory itself is not searched.
+--- - type (string): Find only files ("file") or
+--- directories ("directory"). If omitted, both
+--- files and directories that match {name} are
+--- included.
+--- - limit (number, default 1): Stop the search after
+--- finding this many matches. Use `math.huge` to
+--- place no limit on the number of matches.
+---@return (table) The paths of all matching files or directories
+function M.find(names, opts)
+ opts = opts or {}
+ vim.validate({
+ names = { names, { 's', 't' } },
+ path = { opts.path, 's', true },
+ upward = { opts.upward, 'b', true },
+ stop = { opts.stop, 's', true },
+ type = { opts.type, 's', true },
+ limit = { opts.limit, 'n', true },
+ })
+
+ names = type(names) == 'string' and { names } or names
+
+ local path = opts.path or vim.loop.cwd()
+ local stop = opts.stop
+ local limit = opts.limit or 1
+
+ local matches = {}
+
+ ---@private
+ local function add(match)
+ matches[#matches + 1] = match
+ if #matches == limit then
+ return true
+ end
+ end
+
+ if opts.upward then
+ ---@private
+ local function test(p)
+ local t = {}
+ for _, name in ipairs(names) do
+ local f = p .. '/' .. name
+ local stat = vim.loop.fs_stat(f)
+ if stat and (not opts.type or opts.type == stat.type) then
+ t[#t + 1] = f
+ end
+ end
+
+ return t
+ end
+
+ for _, match in ipairs(test(path)) do
+ if add(match) then
+ return matches
+ end
+ end
+
+ for parent in M.parents(path) do
+ if stop and parent == stop then
+ break
+ end
+
+ for _, match in ipairs(test(parent)) do
+ if add(match) then
+ return matches
+ end
+ end
+ end
+ else
+ local dirs = { path }
+ while #dirs > 0 do
+ local dir = table.remove(dirs, 1)
+ if stop and dir == stop then
+ break
+ end
+
+ for other, type in M.dir(dir) do
+ local f = dir .. '/' .. other
+ for _, name in ipairs(names) do
+ if name == other and (not opts.type or opts.type == type) then
+ if add(f) then
+ return matches
+ end
+ end
+ end
+
+ if type == 'directory' then
+ dirs[#dirs + 1] = f
+ end
+ end
+ end
+ end
+
+ return matches
+end
+
+--- Normalize a path to a standard format. A tilde (~) character at the
+--- beginning of the path is expanded to the user's home directory and any
+--- backslash (\\) characters are converted to forward slashes (/). Environment
+--- variables are also expanded.
+---
+--- Example:
+--- <pre>
+--- vim.fs.normalize('C:\\Users\\jdoe')
+--- => 'C:/Users/jdoe'
+---
+--- vim.fs.normalize('~/src/neovim')
+--- => '/home/jdoe/src/neovim'
+---
+--- vim.fs.normalize('$XDG_CONFIG_HOME/nvim/init.vim')
+--- => '/Users/jdoe/.config/nvim/init.vim'
+--- </pre>
+---
+---@param path (string) Path to normalize
+---@return (string) Normalized path
+function M.normalize(path)
+ vim.validate({ path = { path, 's' } })
+ return (path:gsub('^~/', vim.env.HOME .. '/'):gsub('%$([%w_]+)', vim.env):gsub('\\', '/'))
+end
+
+return M
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
new file mode 100644
index 0000000000..b875da0abc
--- /dev/null
+++ b/runtime/lua/vim/health.lua
@@ -0,0 +1,49 @@
+local M = {}
+
+function M.report_start(msg)
+ vim.fn['health#report_start'](msg)
+end
+
+function M.report_info(msg)
+ vim.fn['health#report_info'](msg)
+end
+
+function M.report_ok(msg)
+ vim.fn['health#report_ok'](msg)
+end
+
+function M.report_warn(msg, ...)
+ vim.fn['health#report_warn'](msg, ...)
+end
+
+function M.report_error(msg, ...)
+ vim.fn['health#report_error'](msg, ...)
+end
+
+local path2name = function(path)
+ if path:match('%.lua$') then
+ -- Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp"
+ return path:gsub('.-lua[%\\%/]', '', 1):gsub('[%\\%/]', '.'):gsub('%.health.-$', '')
+ else
+ -- Vim: transform "../autoload/health/provider.vim" into "provider"
+ return vim.fn.fnamemodify(path, ':t:r')
+ end
+end
+
+local PATTERNS = { '/autoload/health/*.vim', '/lua/**/**/health.lua', '/lua/**/**/health/init.lua' }
+-- :checkhealth completion function used by ex_getln.c get_healthcheck_names()
+M._complete = function()
+ local names = vim.tbl_flatten(vim.tbl_map(function(pattern)
+ return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true))
+ end, PATTERNS))
+ -- Remove duplicates
+ local unique = {}
+ vim.tbl_map(function(f)
+ unique[f] = true
+ end, names)
+ -- vim.health is this file, which is not a healthcheck
+ unique['vim'] = nil
+ return vim.tbl_keys(unique)
+end
+
+return M
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index 236f3165f2..ddd504a0e0 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -1,45 +1,79 @@
local api = vim.api
-local highlight = {}
+local M = {}
+
+M.priorities = {
+ syntax = 50,
+ treesitter = 100,
+ diagnostics = 150,
+ user = 200,
+}
---@private
-function highlight.create(higroup, hi_info, default)
+function M.create(higroup, hi_info, default)
+ vim.deprecate('vim.highlight.create', 'vim.api.nvim_set_hl', '0.9')
local options = {}
-- TODO: Add validation
for k, v in pairs(hi_info) do
- table.insert(options, string.format("%s=%s", k, v))
+ table.insert(options, string.format('%s=%s', k, v))
end
- vim.cmd(string.format([[highlight %s %s %s]], default and "default" or "", higroup, table.concat(options, " ")))
+ vim.cmd(
+ string.format(
+ [[highlight %s %s %s]],
+ default and 'default' or '',
+ higroup,
+ table.concat(options, ' ')
+ )
+ )
end
---@private
-function highlight.link(higroup, link_to, force)
- vim.cmd(string.format([[highlight%s link %s %s]], force and "!" or " default", higroup, link_to))
+function M.link(higroup, link_to, force)
+ vim.deprecate('vim.highlight.link', 'vim.api.nvim_set_hl', '0.9')
+ vim.cmd(string.format([[highlight%s link %s %s]], force and '!' or ' default', higroup, link_to))
end
-
--- Highlight range between two positions
---
---@param bufnr number of buffer to apply highlighting to
---@param ns namespace to add highlight to
---@param higroup highlight group to use for highlighting
----@param rtype type of range (:help setreg, default charwise)
----@param inclusive boolean indicating whether the range is end-inclusive (default false)
-function highlight.range(bufnr, ns, higroup, start, finish, rtype, inclusive)
- rtype = rtype or 'v'
- inclusive = inclusive or false
+---@param start first position (tuple {line,col})
+---@param finish second position (tuple {line,col})
+---@param opts table with options:
+-- - regtype type of range (:help setreg, default charwise)
+-- - inclusive boolean indicating whether the range is end-inclusive (default false)
+-- - priority number indicating priority of highlight (default priorities.user)
+function M.range(bufnr, ns, higroup, start, finish, opts)
+ opts = opts or {}
+ local regtype = opts.regtype or 'v'
+ local inclusive = opts.inclusive or false
+ local priority = opts.priority or M.priorities.user
-- sanity check
- if start[2] < 0 or finish[1] < start[1] then return end
+ if start[2] < 0 or finish[1] < start[1] then
+ return
+ end
- local region = vim.region(bufnr, start, finish, rtype, inclusive)
+ local region = vim.region(bufnr, start, finish, regtype, inclusive)
for linenr, cols in pairs(region) do
- api.nvim_buf_add_highlight(bufnr, ns, higroup, linenr, cols[1], cols[2])
+ local end_row
+ if cols[2] == -1 then
+ end_row = linenr + 1
+ cols[2] = 0
+ end
+ api.nvim_buf_set_extmark(bufnr, ns, linenr, cols[1], {
+ hl_group = higroup,
+ end_row = end_row,
+ end_col = cols[2],
+ priority = priority,
+ strict = false,
+ })
end
-
end
local yank_ns = api.nvim_create_namespace('hlyank')
+local yank_timer
--- Highlight the yanked region
---
--- use from init.vim via
@@ -49,49 +83,71 @@ local yank_ns = api.nvim_create_namespace('hlyank')
--- customize conditions (here: do not highlight a visual selection) via
--- au TextYankPost * lua vim.highlight.on_yank {on_visual=false}
---
--- @param opts dictionary with options controlling the highlight:
+-- @param opts table with options controlling the highlight:
-- - higroup highlight group for yanked region (default "IncSearch")
-- - timeout time in ms before highlight is cleared (default 150)
-- - on_macro highlight when executing macro (default false)
-- - on_visual highlight when yanking visual selection (default true)
-- - event event structure (default vim.v.event)
-function highlight.on_yank(opts)
- vim.validate {
- opts = { opts,
- function(t) if t == nil then return true else return type(t) == 'table' end end,
- 'a table or nil to configure options (see `:h highlight.on_yank`)',
- }}
+function M.on_yank(opts)
+ vim.validate({
+ opts = {
+ opts,
+ function(t)
+ if t == nil then
+ return true
+ else
+ return type(t) == 'table'
+ end
+ end,
+ 'a table or nil to configure options (see `:h highlight.on_yank`)',
+ },
+ })
opts = opts or {}
local event = opts.event or vim.v.event
local on_macro = opts.on_macro or false
local on_visual = (opts.on_visual ~= false)
- if (not on_macro) and vim.fn.reg_executing() ~= '' then return end
- if event.operator ~= 'y' or event.regtype == '' then return end
- if (not on_visual) and event.visual then return end
+ if not on_macro and vim.fn.reg_executing() ~= '' then
+ return
+ end
+ if event.operator ~= 'y' or event.regtype == '' then
+ return
+ end
+ if not on_visual and event.visual then
+ return
+ end
- local higroup = opts.higroup or "IncSearch"
+ local higroup = opts.higroup or 'IncSearch'
local timeout = opts.timeout or 150
local bufnr = api.nvim_get_current_buf()
api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1)
+ if yank_timer then
+ yank_timer:close()
+ end
local pos1 = vim.fn.getpos("'[")
local pos2 = vim.fn.getpos("']")
- pos1 = {pos1[2] - 1, pos1[3] - 1 + pos1[4]}
- pos2 = {pos2[2] - 1, pos2[3] - 1 + pos2[4]}
-
- highlight.range(bufnr, yank_ns, higroup, pos1, pos2, event.regtype, event.inclusive)
+ pos1 = { pos1[2] - 1, pos1[3] - 1 + pos1[4] }
+ pos2 = { pos2[2] - 1, pos2[3] - 1 + pos2[4] }
- vim.defer_fn(
- function()
- if api.nvim_buf_is_valid(bufnr) then
- api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1)
- end
- end,
- timeout
+ M.range(
+ bufnr,
+ yank_ns,
+ higroup,
+ pos1,
+ pos2,
+ { regtype = event.regtype, inclusive = event.inclusive, priority = M.priorities.user }
)
+
+ yank_timer = vim.defer_fn(function()
+ yank_timer = nil
+ if api.nvim_buf_is_valid(bufnr) then
+ api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1)
+ end
+ end, timeout)
end
-return highlight
+return M
diff --git a/runtime/lua/vim/inspect.lua b/runtime/lua/vim/inspect.lua
index 0448ea487f..0a53fb203b 100644
--- a/runtime/lua/vim/inspect.lua
+++ b/runtime/lua/vim/inspect.lua
@@ -1,6 +1,6 @@
-local inspect ={
+local inspect = {
_VERSION = 'inspect.lua 3.1.0',
- _URL = 'http://github.com/kikito/inspect.lua',
+ _URL = 'http://github.com/kikito/inspect.lua',
_DESCRIPTION = 'human-readable representations of tables',
_LICENSE = [[
MIT LICENSE
@@ -25,13 +25,26 @@ local inspect ={
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- ]]
+ ]],
}
-local tostring = tostring
+inspect.KEY = setmetatable({}, {
+ __tostring = function()
+ return 'inspect.KEY'
+ end,
+})
+inspect.METATABLE = setmetatable({}, {
+ __tostring = function()
+ return 'inspect.METATABLE'
+ end,
+})
-inspect.KEY = setmetatable({}, {__tostring = function() return 'inspect.KEY' end})
-inspect.METATABLE = setmetatable({}, {__tostring = function() return 'inspect.METATABLE' end})
+local tostring = tostring
+local rep = string.rep
+local match = string.match
+local char = string.char
+local gsub = string.gsub
+local fmt = string.format
local function rawpairs(t)
return next, t, nil
@@ -40,127 +53,130 @@ end
-- Apostrophizes the string if it has quotes, but not aphostrophes
-- Otherwise, it returns a regular quoted string
local function smartQuote(str)
- if str:match('"') and not str:match("'") then
+ if match(str, '"') and not match(str, "'") then
return "'" .. str .. "'"
end
- return '"' .. str:gsub('"', '\\"') .. '"'
+ return '"' .. gsub(str, '"', '\\"') .. '"'
end
-- \a => '\\a', \0 => '\\0', 31 => '\31'
local shortControlCharEscapes = {
- ["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n",
- ["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v"
+ ['\a'] = '\\a',
+ ['\b'] = '\\b',
+ ['\f'] = '\\f',
+ ['\n'] = '\\n',
+ ['\r'] = '\\r',
+ ['\t'] = '\\t',
+ ['\v'] = '\\v',
+ ['\127'] = '\\127',
}
-local longControlCharEscapes = {} -- \a => nil, \0 => \000, 31 => \031
-for i=0, 31 do
- local ch = string.char(i)
+local longControlCharEscapes = { ['\127'] = '\127' }
+for i = 0, 31 do
+ local ch = char(i)
if not shortControlCharEscapes[ch] then
- shortControlCharEscapes[ch] = "\\"..i
- longControlCharEscapes[ch] = string.format("\\%03d", i)
+ shortControlCharEscapes[ch] = '\\' .. i
+ longControlCharEscapes[ch] = fmt('\\%03d', i)
end
end
local function escape(str)
- return (str:gsub("\\", "\\\\")
- :gsub("(%c)%f[0-9]", longControlCharEscapes)
- :gsub("%c", shortControlCharEscapes))
+ return (
+ gsub(
+ gsub(gsub(str, '\\', '\\\\'), '(%c)%f[0-9]', longControlCharEscapes),
+ '%c',
+ shortControlCharEscapes
+ )
+ )
end
local function isIdentifier(str)
- return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" )
+ return type(str) == 'string' and not not str:match('^[_%a][_%a%d]*$')
end
+local flr = math.floor
local function isSequenceKey(k, sequenceLength)
- return type(k) == 'number'
- and 1 <= k
- and k <= sequenceLength
- and math.floor(k) == k
+ return type(k) == 'number' and flr(k) == k and 1 <= k and k <= sequenceLength
end
local defaultTypeOrders = {
- ['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4,
- ['function'] = 5, ['userdata'] = 6, ['thread'] = 7
+ ['number'] = 1,
+ ['boolean'] = 2,
+ ['string'] = 3,
+ ['table'] = 4,
+ ['function'] = 5,
+ ['userdata'] = 6,
+ ['thread'] = 7,
}
local function sortKeys(a, b)
local ta, tb = type(a), type(b)
-- strings and numbers are sorted numerically/alphabetically
- if ta == tb and (ta == 'string' or ta == 'number') then return a < b end
+ if ta == tb and (ta == 'string' or ta == 'number') then
+ return a < b
+ end
- local dta, dtb = defaultTypeOrders[ta], defaultTypeOrders[tb]
+ local dta = defaultTypeOrders[ta] or 100
+ local dtb = defaultTypeOrders[tb] or 100
-- Two default types are compared according to the defaultTypeOrders table
- if dta and dtb then return defaultTypeOrders[ta] < defaultTypeOrders[tb]
- elseif dta then return true -- default types before custom ones
- elseif dtb then return false -- custom types after default ones
- end
-- custom types are sorted out alphabetically
- return ta < tb
+ return dta == dtb and ta < tb or dta < dtb
end
--- For implementation reasons, the behavior of rawlen & # is "undefined" when
--- tables aren't pure sequences. So we implement our own # operator.
-local function getSequenceLength(t)
- local len = 1
- local v = rawget(t,len)
- while v ~= nil do
- len = len + 1
- v = rawget(t,len)
+local function getKeys(t)
+ local seqLen = 1
+ while rawget(t, seqLen) ~= nil do
+ seqLen = seqLen + 1
end
- return len - 1
-end
+ seqLen = seqLen - 1
-local function getNonSequentialKeys(t)
- local keys, keysLength = {}, 0
- local sequenceLength = getSequenceLength(t)
- for k,_ in rawpairs(t) do
- if not isSequenceKey(k, sequenceLength) then
- keysLength = keysLength + 1
- keys[keysLength] = k
+ local keys, keysLen = {}, 0
+ for k in rawpairs(t) do
+ if not isSequenceKey(k, seqLen) then
+ keysLen = keysLen + 1
+ keys[keysLen] = k
end
end
table.sort(keys, sortKeys)
- return keys, keysLength, sequenceLength
+ return keys, keysLen, seqLen
end
-local function countTableAppearances(t, tableAppearances)
- tableAppearances = tableAppearances or {}
-
- if type(t) == 'table' then
- if not tableAppearances[t] then
- tableAppearances[t] = 1
- for k,v in rawpairs(t) do
- countTableAppearances(k, tableAppearances)
- countTableAppearances(v, tableAppearances)
- end
- countTableAppearances(getmetatable(t), tableAppearances)
+local function countCycles(x, cycles)
+ if type(x) == 'table' then
+ if cycles[x] then
+ cycles[x] = cycles[x] + 1
else
- tableAppearances[t] = tableAppearances[t] + 1
+ cycles[x] = 1
+ for k, v in rawpairs(x) do
+ countCycles(k, cycles)
+ countCycles(v, cycles)
+ end
+ countCycles(getmetatable(x), cycles)
end
end
-
- return tableAppearances
-end
-
-local copySequence = function(s)
- local copy, len = {}, #s
- for i=1, len do copy[i] = s[i] end
- return copy, len
end
-local function makePath(path, ...)
- local keys = {...}
- local newPath, len = copySequence(path)
- for i=1, #keys do
- newPath[len + i] = keys[i]
+local function makePath(path, a, b)
+ local newPath = {}
+ local len = #path
+ for i = 1, len do
+ newPath[i] = path[i]
end
+
+ newPath[len + 1] = a
+ newPath[len + 2] = b
+
return newPath
end
local function processRecursive(process, item, path, visited)
- if item == nil then return nil end
- if visited[item] then return visited[item] end
+ if item == nil then
+ return nil
+ end
+ if visited[item] then
+ return visited[item]
+ end
local processed = process(item, path)
if type(processed) == 'table' then
@@ -168,171 +184,166 @@ local function processRecursive(process, item, path, visited)
visited[item] = processedCopy
local processedKey
- for k,v in rawpairs(processed) do
+ for k, v in rawpairs(processed) do
processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY), visited)
if processedKey ~= nil then
- processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey), visited)
+ processedCopy[processedKey] =
+ processRecursive(process, v, makePath(path, processedKey), visited)
end
end
- local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited)
- if type(mt) ~= 'table' then mt = nil end -- ignore not nil/table __metatable field
+ local mt =
+ processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited)
+ if type(mt) ~= 'table' then
+ mt = nil
+ end
setmetatable(processedCopy, mt)
processed = processedCopy
end
return processed
end
-
-
--------------------------------------------------------------------
-
-local Inspector = {}
-local Inspector_mt = {__index = Inspector}
-
-function Inspector:puts(...)
- local args = {...}
- local buffer = self.buffer
- local len = #buffer
- for i=1, #args do
- len = len + 1
- buffer[len] = args[i]
- end
+local function puts(buf, str)
+ buf.n = buf.n + 1
+ buf[buf.n] = str
end
-function Inspector:down(f)
- self.level = self.level + 1
- f()
- self.level = self.level - 1
-end
+local Inspector = {}
-function Inspector:tabify()
- self:puts(self.newline, string.rep(self.indent, self.level))
-end
+local Inspector_mt = { __index = Inspector }
-function Inspector:alreadyVisited(v)
- return self.ids[v] ~= nil
+local function tabify(inspector)
+ puts(inspector.buf, inspector.newline .. rep(inspector.indent, inspector.level))
end
function Inspector:getId(v)
local id = self.ids[v]
+ local ids = self.ids
if not id then
local tv = type(v)
- id = (self.maxIds[tv] or 0) + 1
- self.maxIds[tv] = id
- self.ids[v] = id
+ id = (ids[tv] or 0) + 1
+ ids[v], ids[tv] = id, id
end
return tostring(id)
end
-function Inspector:putKey(k)
- if isIdentifier(k) then return self:puts(k) end
- self:puts("[")
- self:putValue(k)
- self:puts("]")
-end
+function Inspector:putValue(v)
+ local buf = self.buf
+ local tv = type(v)
+ if tv == 'string' then
+ puts(buf, smartQuote(escape(v)))
+ elseif
+ tv == 'number'
+ or tv == 'boolean'
+ or tv == 'nil'
+ or tv == 'cdata'
+ or tv == 'ctype'
+ or (vim and v == vim.NIL)
+ then
+ puts(buf, tostring(v))
+ elseif tv == 'table' and not self.ids[v] then
+ local t = v
+
+ if t == inspect.KEY or t == inspect.METATABLE then
+ puts(buf, tostring(t))
+ elseif self.level >= self.depth then
+ puts(buf, '{...}')
+ else
+ if self.cycles[t] > 1 then
+ puts(buf, fmt('<%d>', self:getId(t)))
+ end
-function Inspector:putTable(t)
- if t == inspect.KEY or t == inspect.METATABLE then
- self:puts(tostring(t))
- elseif self:alreadyVisited(t) then
- self:puts('<table ', self:getId(t), '>')
- elseif self.level >= self.depth then
- self:puts('{...}')
- else
- if self.tableAppearances[t] > 1 then self:puts('<', self:getId(t), '>') end
-
- local nonSequentialKeys, nonSequentialKeysLength, sequenceLength = getNonSequentialKeys(t)
- local mt = getmetatable(t)
- if (vim and sequenceLength == 0 and nonSequentialKeysLength == 0
- and mt == vim._empty_dict_mt) then
- self:puts(tostring(t))
- return
- end
+ local keys, keysLen, seqLen = getKeys(t)
+ local mt = getmetatable(t)
- self:puts('{')
- self:down(function()
- local count = 0
- for i=1, sequenceLength do
- if count > 0 then self:puts(',') end
- self:puts(' ')
- self:putValue(t[i])
- count = count + 1
+ if vim and seqLen == 0 and keysLen == 0 and mt == vim._empty_dict_mt then
+ puts(buf, tostring(t))
+ return
end
- for i=1, nonSequentialKeysLength do
- local k = nonSequentialKeys[i]
- if count > 0 then self:puts(',') end
- self:tabify()
- self:putKey(k)
- self:puts(' = ')
- self:putValue(t[k])
- count = count + 1
+ puts(buf, '{')
+ self.level = self.level + 1
+
+ for i = 1, seqLen + keysLen do
+ if i > 1 then
+ puts(buf, ',')
+ end
+ if i <= seqLen then
+ puts(buf, ' ')
+ self:putValue(t[i])
+ else
+ local k = keys[i - seqLen]
+ tabify(self)
+ if isIdentifier(k) then
+ puts(buf, k)
+ else
+ puts(buf, '[')
+ self:putValue(k)
+ puts(buf, ']')
+ end
+ puts(buf, ' = ')
+ self:putValue(t[k])
+ end
end
if type(mt) == 'table' then
- if count > 0 then self:puts(',') end
- self:tabify()
- self:puts('<metatable> = ')
+ if seqLen + keysLen > 0 then
+ puts(buf, ',')
+ end
+ tabify(self)
+ puts(buf, '<metatable> = ')
self:putValue(mt)
end
- end)
- if nonSequentialKeysLength > 0 or type(mt) == 'table' then -- result is multi-lined. Justify closing }
- self:tabify()
- elseif sequenceLength > 0 then -- array tables have one extra space before closing }
- self:puts(' ')
- end
+ self.level = self.level - 1
- self:puts('}')
- end
-end
-
-function Inspector:putValue(v)
- local tv = type(v)
+ if keysLen > 0 or type(mt) == 'table' then
+ tabify(self)
+ elseif seqLen > 0 then
+ puts(buf, ' ')
+ end
- if tv == 'string' then
- self:puts(smartQuote(escape(v)))
- elseif tv == 'number' or tv == 'boolean' or tv == 'nil' or
- tv == 'cdata' or tv == 'ctype' or (vim and v == vim.NIL) then
- self:puts(tostring(v))
- elseif tv == 'table' then
- self:putTable(v)
+ puts(buf, '}')
+ end
else
- self:puts('<', tv, ' ', self:getId(v), '>')
+ puts(buf, fmt('<%s %d>', tv, self:getId(v)))
end
end
--------------------------------------------------------------------
-
function inspect.inspect(root, options)
- options = options or {}
+ options = options or {}
- local depth = options.depth or math.huge
+ local depth = options.depth or math.huge
local newline = options.newline or '\n'
- local indent = options.indent or ' '
+ local indent = options.indent or ' '
local process = options.process
if process then
root = processRecursive(process, root, {}, {})
end
+ local cycles = {}
+ countCycles(root, cycles)
+
local inspector = setmetatable({
- depth = depth,
- level = 0,
- buffer = {},
- ids = {},
- maxIds = {},
- newline = newline,
- indent = indent,
- tableAppearances = countTableAppearances(root)
+ buf = { n = 0 },
+ ids = {},
+ cycles = cycles,
+ depth = depth,
+ level = 0,
+ newline = newline,
+ indent = indent,
}, Inspector_mt)
inspector:putValue(root)
- return table.concat(inspector.buffer)
+ return table.concat(inspector.buf)
end
-setmetatable(inspect, { __call = function(_, ...) return inspect.inspect(...) end })
+setmetatable(inspect, {
+ __call = function(_, root, options)
+ return inspect.inspect(root, options)
+ end,
+})
return inspect
diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua
index d53b790746..f4c2b507a9 100644
--- a/runtime/lua/vim/keymap.lua
+++ b/runtime/lua/vim/keymap.lua
@@ -25,8 +25,8 @@ local keymap = {}
--- vim.keymap.set('n', 'asdf', require('jkl').my_fun)
--- </pre>
---
---- the require('jkl') gets evaluated during this call in order to access the function. If you want to
---- avoid this cost at startup you can wrap it in a function, for example:
+--- the ``require('jkl')`` gets evaluated during this call in order to access the function.
+--- If you want to avoid this cost at startup you can wrap it in a function, for example:
--- <pre>
--- vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end)
--- </pre>
@@ -35,39 +35,51 @@ local keymap = {}
--- Can also be list of modes to create mapping on multiple modes.
---@param lhs string Left-hand side |{lhs}| of the mapping.
---@param rhs string|function Right-hand side |{rhs}| of the mapping. Can also be a Lua function.
+--- If a Lua function and `opts.expr == true`, returning `nil` is
+--- equivalent to an empty string.
--
---@param opts table A table of |:map-arguments| such as "silent". In addition to the options
--- listed in |nvim_set_keymap()|, this table also accepts the following keys:
+--- - buffer: (number or boolean) Add a mapping to the given buffer. When "true"
+--- or 0, use the current buffer.
--- - replace_keycodes: (boolean, default true) When both this and expr is "true",
--- |nvim_replace_termcodes()| is applied to the result of Lua expr maps.
--- - remap: (boolean) Make the mapping recursive. This is the
--- inverse of the "noremap" option from |nvim_set_keymap()|.
---- Default `true` if `lhs` is a string starting with `<plug>` (case-insensitive), `false` otherwise.
+--- Default `false`.
---@see |nvim_set_keymap()|
function keymap.set(mode, lhs, rhs, opts)
- vim.validate {
- mode = {mode, {'s', 't'}},
- lhs = {lhs, 's'},
- rhs = {rhs, {'s', 'f'}},
- opts = {opts, 't', true}
- }
+ vim.validate({
+ mode = { mode, { 's', 't' } },
+ lhs = { lhs, 's' },
+ rhs = { rhs, { 's', 'f' } },
+ opts = { opts, 't', true },
+ })
opts = vim.deepcopy(opts) or {}
- local is_rhs_luaref = type(rhs) == "function"
- mode = type(mode) == 'string' and {mode} or mode
+ local is_rhs_luaref = type(rhs) == 'function'
+ mode = type(mode) == 'string' and { mode } or mode
- if is_rhs_luaref and opts.expr and opts.replace_keycodes ~= false then
+ if is_rhs_luaref and opts.expr then
local user_rhs = rhs
- rhs = function ()
- return vim.api.nvim_replace_termcodes(user_rhs(), true, true, true)
+ rhs = function()
+ local res = user_rhs()
+ if res == nil then
+ -- TODO(lewis6991): Handle this in C?
+ return ''
+ elseif opts.replace_keycodes ~= false then
+ return vim.api.nvim_replace_termcodes(res, true, true, true)
+ else
+ return res
+ end
end
end
-- clear replace_keycodes from opts table
opts.replace_keycodes = nil
if opts.remap == nil then
- -- remap by default on <plug> mappings and don't otherwise.
- opts.noremap = is_rhs_luaref or rhs:lower():match("^<plug>") == nil
+ -- default remap value is false
+ opts.noremap = true
else
-- remaps behavior is opposite of noremap option.
opts.noremap = not opts.remap
@@ -106,19 +118,18 @@ end
---@see |vim.keymap.set()|
---
function keymap.del(modes, lhs, opts)
- vim.validate {
- mode = {modes, {'s', 't'}},
- lhs = {lhs, 's'},
- opts = {opts, 't', true}
- }
+ vim.validate({
+ mode = { modes, { 's', 't' } },
+ lhs = { lhs, 's' },
+ opts = { opts, 't', true },
+ })
opts = opts or {}
- modes = type(modes) == 'string' and {modes} or modes
+ modes = type(modes) == 'string' and { modes } or modes
local buffer = false
if opts.buffer ~= nil then
buffer = opts.buffer == true and 0 or opts.buffer
- opts.buffer = nil
end
if buffer == false then
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 8b7eb4ac90..61586ca44f 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1,58 +1,62 @@
-local if_nil = vim.F.if_nil
-
-local default_handlers = require 'vim.lsp.handlers'
-local log = require 'vim.lsp.log'
-local lsp_rpc = require 'vim.lsp.rpc'
-local protocol = require 'vim.lsp.protocol'
-local util = require 'vim.lsp.util'
-local sync = require 'vim.lsp.sync'
+local default_handlers = require('vim.lsp.handlers')
+local log = require('vim.lsp.log')
+local lsp_rpc = require('vim.lsp.rpc')
+local protocol = require('vim.lsp.protocol')
+local util = require('vim.lsp.util')
+local sync = require('vim.lsp.sync')
local vim = vim
-local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_buf_get_option
- = vim.api.nvim_err_writeln, vim.api.nvim_buf_get_lines, vim.api.nvim_command, vim.api.nvim_buf_get_option
+local api = vim.api
+local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_buf_get_option, nvim_exec_autocmds =
+ api.nvim_err_writeln,
+ api.nvim_buf_get_lines,
+ api.nvim_command,
+ api.nvim_buf_get_option,
+ api.nvim_exec_autocmds
local uv = vim.loop
local tbl_isempty, tbl_extend = vim.tbl_isempty, vim.tbl_extend
local validate = vim.validate
+local if_nil = vim.F.if_nil
local lsp = {
- protocol = protocol;
+ protocol = protocol,
- handlers = default_handlers;
+ handlers = default_handlers,
- buf = require'vim.lsp.buf';
- diagnostic = require'vim.lsp.diagnostic';
- codelens = require'vim.lsp.codelens';
- util = util;
+ buf = require('vim.lsp.buf'),
+ diagnostic = require('vim.lsp.diagnostic'),
+ codelens = require('vim.lsp.codelens'),
+ util = util,
-- Allow raw RPC access.
- rpc = lsp_rpc;
+ rpc = lsp_rpc,
-- Export these directly from rpc.
- rpc_response_error = lsp_rpc.rpc_response_error;
+ rpc_response_error = lsp_rpc.rpc_response_error,
}
--- maps request name to the required resolved_capability in the client.
+-- maps request name to the required server_capability in the client.
lsp._request_name_to_capability = {
- ['textDocument/hover'] = 'hover';
- ['textDocument/signatureHelp'] = 'signature_help';
- ['textDocument/definition'] = 'goto_definition';
- ['textDocument/implementation'] = 'implementation';
- ['textDocument/declaration'] = 'declaration';
- ['textDocument/typeDefinition'] = 'type_definition';
- ['textDocument/documentSymbol'] = 'document_symbol';
- ['textDocument/prepareCallHierarchy'] = 'call_hierarchy';
- ['textDocument/rename'] = 'rename';
- ['textDocument/prepareRename'] = 'rename';
- ['textDocument/codeAction'] = 'code_action';
- ['textDocument/codeLens'] = 'code_lens';
- ['codeLens/resolve'] = 'code_lens_resolve';
- ['workspace/executeCommand'] = 'execute_command';
- ['workspace/symbol'] = 'workspace_symbol';
- ['textDocument/references'] = 'find_references';
- ['textDocument/rangeFormatting'] = 'document_range_formatting';
- ['textDocument/formatting'] = 'document_formatting';
- ['textDocument/completion'] = 'completion';
- ['textDocument/documentHighlight'] = 'document_highlight';
+ ['textDocument/hover'] = { 'hoverProvider' },
+ ['textDocument/signatureHelp'] = { 'signatureHelpProvider' },
+ ['textDocument/definition'] = { 'definitionProvider' },
+ ['textDocument/implementation'] = { 'implementationProvider' },
+ ['textDocument/declaration'] = { 'declarationProvider' },
+ ['textDocument/typeDefinition'] = { 'typeDefinitionProvider' },
+ ['textDocument/documentSymbol'] = { 'documentSymbolProvider' },
+ ['textDocument/prepareCallHierarchy'] = { 'callHierarchyProvider' },
+ ['textDocument/rename'] = { 'renameProvider' },
+ ['textDocument/prepareRename'] = { 'renameProvider', 'prepareProvider' },
+ ['textDocument/codeAction'] = { 'codeActionProvider' },
+ ['textDocument/codeLens'] = { 'codeLensProvider' },
+ ['codeLens/resolve'] = { 'codeLensProvider', 'resolveProvider' },
+ ['workspace/executeCommand'] = { 'executeCommandProvider' },
+ ['workspace/symbol'] = { 'workspaceSymbolProvider' },
+ ['textDocument/references'] = { 'referencesProvider' },
+ ['textDocument/rangeFormatting'] = { 'documentRangeFormattingProvider' },
+ ['textDocument/formatting'] = { 'documentFormattingProvider' },
+ ['textDocument/completion'] = { 'completionProvider' },
+ ['textDocument/documentHighlight'] = { 'documentHighlightProvider' },
}
-- TODO improve handling of scratch buffers with LSP attached.
@@ -62,8 +66,8 @@ lsp._request_name_to_capability = {
---
---@param {...} (List of strings) List to write to the buffer
local function err_message(...)
- nvim_err_writeln(table.concat(vim.tbl_flatten{...}))
- nvim_command("redraw")
+ nvim_err_writeln(table.concat(vim.tbl_flatten({ ... })))
+ nvim_command('redraw')
end
---@private
@@ -73,9 +77,9 @@ end
---buffer if not given.
---@returns bufnr (number) Number of requested buffer
local function resolve_bufnr(bufnr)
- validate { bufnr = { bufnr, 'n', true } }
+ validate({ bufnr = { bufnr, 'n', true } })
if bufnr == nil or bufnr == 0 then
- return vim.api.nvim_get_current_buf()
+ return api.nvim_get_current_buf()
end
return bufnr
end
@@ -85,7 +89,10 @@ end
--- supported in any of the servers registered for the current buffer.
---@param method (string) name of the method
function lsp._unsupported_method(method)
- local msg = string.format("method %s is not supported by any of the servers registered for the current buffer", method)
+ local msg = string.format(
+ 'method %s is not supported by any of the servers registered for the current buffer',
+ method
+ )
log.warn(msg)
return msg
end
@@ -96,23 +103,29 @@ end
---@param filename (string) path to check
---@returns true if {filename} exists and is a directory, false otherwise
local function is_dir(filename)
- validate{filename={filename,'s'}}
+ validate({ filename = { filename, 's' } })
local stat = uv.fs_stat(filename)
return stat and stat.type == 'directory' or false
end
-local wait_result_reason = { [-1] = "timeout"; [-2] = "interrupted"; [-3] = "error" }
+local wait_result_reason = { [-1] = 'timeout', [-2] = 'interrupted', [-3] = 'error' }
local valid_encodings = {
- ["utf-8"] = 'utf-8'; ["utf-16"] = 'utf-16'; ["utf-32"] = 'utf-32';
- ["utf8"] = 'utf-8'; ["utf16"] = 'utf-16'; ["utf32"] = 'utf-32';
- UTF8 = 'utf-8'; UTF16 = 'utf-16'; UTF32 = 'utf-32';
+ ['utf-8'] = 'utf-8',
+ ['utf-16'] = 'utf-16',
+ ['utf-32'] = 'utf-32',
+ ['utf8'] = 'utf-8',
+ ['utf16'] = 'utf-16',
+ ['utf32'] = 'utf-32',
+ UTF8 = 'utf-8',
+ UTF16 = 'utf-16',
+ UTF32 = 'utf-32',
}
local format_line_ending = {
- ["unix"] = '\n',
- ["dos"] = '\r\n',
- ["mac"] = '\r',
+ ['unix'] = '\n',
+ ['dos'] = '\r\n',
+ ['mac'] = '\r',
}
---@private
@@ -138,10 +151,10 @@ local uninitialized_clients = {}
---@private
local function for_each_buffer_client(bufnr, fn, restrict_client_ids)
- validate {
- fn = { fn, 'f' };
- restrict_client_ids = { restrict_client_ids, 't' , true};
- }
+ validate({
+ fn = { fn, 'f' },
+ restrict_client_ids = { restrict_client_ids, 't', true },
+ })
bufnr = resolve_bufnr(bufnr)
local client_ids = all_buffer_active_clients[bufnr]
if not client_ids or tbl_isempty(client_ids) then
@@ -169,9 +182,13 @@ end
-- Error codes to be used with `on_error` from |vim.lsp.start_client|.
-- Can be used to look up the string from a the number or the number
-- from the string.
-lsp.client_errors = tbl_extend("error", lsp_rpc.client_errors, vim.tbl_add_reverse_lookup {
- ON_INIT_CALLBACK_ERROR = table.maxn(lsp_rpc.client_errors) + 1;
-})
+lsp.client_errors = tbl_extend(
+ 'error',
+ lsp_rpc.client_errors,
+ vim.tbl_add_reverse_lookup({
+ ON_INIT_CALLBACK_ERROR = table.maxn(lsp_rpc.client_errors) + 1,
+ })
+)
---@private
--- Normalizes {encoding} to valid LSP encoding names.
@@ -179,11 +196,16 @@ lsp.client_errors = tbl_extend("error", lsp_rpc.client_errors, vim.tbl_add_rever
---@param encoding (string) Encoding to normalize
---@returns (string) normalized encoding name
local function validate_encoding(encoding)
- validate {
- encoding = { encoding, 's' };
- }
+ validate({
+ encoding = { encoding, 's' },
+ })
return valid_encodings[encoding:lower()]
- or error(string.format("Invalid offset encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'", encoding))
+ or error(
+ string.format(
+ "Invalid offset encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'",
+ encoding
+ )
+ )
end
---@internal
@@ -194,16 +216,21 @@ end
---@returns (string) the command
---@returns (list of strings) its arguments
function lsp._cmd_parts(input)
- vim.validate{cmd={
- input,
- function() return vim.tbl_islist(input) end,
- "list"}}
+ validate({
+ cmd = {
+ input,
+ function()
+ return vim.tbl_islist(input)
+ end,
+ 'list',
+ },
+ })
local cmd = input[1]
local cmd_args = {}
-- Don't mutate our input.
for i, v in ipairs(input) do
- vim.validate{["cmd argument"]={v, "s"}}
+ validate({ ['cmd argument'] = { v, 's' } })
if i > 1 then
table.insert(cmd_args, v)
end
@@ -233,30 +260,33 @@ end
---
---@see |vim.lsp.start_client()|
local function validate_client_config(config)
- validate {
- config = { config, 't' };
- }
- validate {
- handlers = { config.handlers, "t", true };
- capabilities = { config.capabilities, "t", true };
- cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), "directory" };
- cmd_env = { config.cmd_env, "t", true };
- name = { config.name, 's', true };
- on_error = { config.on_error, "f", true };
- on_exit = { config.on_exit, "f", true };
- on_init = { config.on_init, "f", true };
- settings = { config.settings, "t", true };
- commands = { config.commands, 't', true };
- before_init = { config.before_init, "f", true };
- offset_encoding = { config.offset_encoding, "s", true };
- flags = { config.flags, "t", true };
- get_language_id = { config.get_language_id, "f", true };
- }
+ validate({
+ config = { config, 't' },
+ })
+ validate({
+ handlers = { config.handlers, 't', true },
+ capabilities = { config.capabilities, 't', true },
+ cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), 'directory' },
+ cmd_env = { config.cmd_env, 't', true },
+ detached = { config.detached, 'b', true },
+ name = { config.name, 's', true },
+ on_error = { config.on_error, 'f', true },
+ on_exit = { config.on_exit, 'f', true },
+ on_init = { config.on_init, 'f', true },
+ settings = { config.settings, 't', true },
+ commands = { config.commands, 't', true },
+ before_init = { config.before_init, 'f', true },
+ offset_encoding = { config.offset_encoding, 's', true },
+ flags = { config.flags, 't', true },
+ get_language_id = { config.get_language_id, 'f', true },
+ })
assert(
- (not config.flags
+ (
+ not config.flags
or not config.flags.debounce_text_changes
- or type(config.flags.debounce_text_changes) == 'number'),
- "flags.debounce_text_changes must be a number with the debounce time in milliseconds"
+ or type(config.flags.debounce_text_changes) == 'number'
+ ),
+ 'flags.debounce_text_changes must be a number with the debounce time in milliseconds'
)
local cmd, cmd_args = lsp._cmd_parts(config.cmd)
@@ -266,9 +296,9 @@ local function validate_client_config(config)
end
return {
- cmd = cmd;
- cmd_args = cmd_args;
- offset_encoding = offset_encoding;
+ cmd = cmd,
+ cmd_args = cmd_args,
+ offset_encoding = offset_encoding,
}
end
@@ -328,14 +358,15 @@ do
function changetracking.init(client, bufnr)
local use_incremental_sync = (
if_nil(client.config.flags.allow_incremental_sync, true)
- and client.resolved_capabilities.text_document_did_change == protocol.TextDocumentSyncKind.Incremental
+ and vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change')
+ == protocol.TextDocumentSyncKind.Incremental
)
local state = state_by_client[client.id]
if not state then
state = {
- buffers = {};
+ buffers = {},
debounce = client.config.flags.debounce_text_changes or 150,
- use_incremental_sync = use_incremental_sync;
+ use_incremental_sync = use_incremental_sync,
}
state_by_client[client.id] = state
end
@@ -344,6 +375,7 @@ do
state.buffers[bufnr] = buf_state
if use_incremental_sync then
buf_state.lines = nvim_buf_get_lines(bufnr, 0, -1, true)
+ buf_state.lines_tmp = {}
buf_state.pending_changes = {}
end
end
@@ -403,21 +435,59 @@ do
---@private
function changetracking.prepare(bufnr, firstline, lastline, new_lastline)
local incremental_changes = function(client, buf_state)
- local curr_lines = nvim_buf_get_lines(bufnr, 0, -1, true)
+ local prev_lines = buf_state.lines
+ local curr_lines = buf_state.lines_tmp
+
+ local changed_lines = nvim_buf_get_lines(bufnr, firstline, new_lastline, true)
+ for i = 1, firstline do
+ curr_lines[i] = prev_lines[i]
+ end
+ for i = firstline + 1, new_lastline do
+ curr_lines[i] = changed_lines[i - firstline]
+ end
+ for i = lastline + 1, #prev_lines do
+ curr_lines[i - lastline + new_lastline] = prev_lines[i]
+ end
+ if tbl_isempty(curr_lines) then
+ -- Can happen when deleting the entire contents of a buffer, see https://github.com/neovim/neovim/issues/16259.
+ curr_lines[1] = ''
+ end
+
local line_ending = buf_get_line_ending(bufnr)
local incremental_change = sync.compute_diff(
- buf_state.lines, curr_lines, firstline, lastline, new_lastline, client.offset_encoding or 'utf-16', line_ending)
+ buf_state.lines,
+ curr_lines,
+ firstline,
+ lastline,
+ new_lastline,
+ client.offset_encoding or 'utf-16',
+ line_ending
+ )
+
+ -- Double-buffering of lines tables is used to reduce the load on the garbage collector.
+ -- At this point the prev_lines table is useless, but its internal storage has already been allocated,
+ -- so let's keep it around for the next didChange event, in which it will become the next
+ -- curr_lines table. Note that setting elements to nil doesn't actually deallocate slots in the
+ -- internal storage - it merely marks them as free, for the GC to deallocate them.
+ for i in ipairs(prev_lines) do
+ prev_lines[i] = nil
+ end
buf_state.lines = curr_lines
+ buf_state.lines_tmp = prev_lines
+
return incremental_change
end
local full_changes = once(function()
return {
- text = buf_get_full_text(bufnr);
- };
+ text = buf_get_full_text(bufnr),
+ }
end)
local uri = vim.uri_from_bufnr(bufnr)
return function(client)
- if client.resolved_capabilities.text_document_did_change == protocol.TextDocumentSyncKind.None then
+ if
+ vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change')
+ == protocol.TextDocumentSyncKind.None
+ then
return
end
local state = state_by_client[client.id]
@@ -430,13 +500,17 @@ do
table.insert(buf_state.pending_changes, incremental_changes(client, buf_state))
end
buf_state.pending_change = function()
+ if buf_state.pending_change == nil then
+ return
+ end
buf_state.pending_change = nil
buf_state.last_flush = uv.hrtime()
- if client.is_stopped() or not vim.api.nvim_buf_is_valid(bufnr) then
+ if client.is_stopped() or not api.nvim_buf_is_valid(bufnr) then
return
end
- local changes = state.use_incremental_sync and buf_state.pending_changes or { full_changes() }
- client.notify("textDocument/didChange", {
+ local changes = state.use_incremental_sync and buf_state.pending_changes
+ or { full_changes() }
+ client.notify('textDocument/didChange', {
textDocument = {
uri = uri,
version = util.buf_versions[bufnr],
@@ -448,7 +522,7 @@ do
if debounce == 0 then
buf_state.pending_change()
else
- local timer = vim.loop.new_timer()
+ local timer = uv.new_timer()
buf_state.timer = timer
-- Must use schedule_wrap because `full_changes()` calls nvim_buf_get_lines
timer:start(debounce, 0, vim.schedule_wrap(buf_state.pending_change))
@@ -488,29 +562,28 @@ do
end
end
-
---@private
--- Default handler for the 'textDocument/didOpen' LSP notification.
---
----@param bufnr (Number) Number of the buffer, or 0 for current
+---@param bufnr number Number of the buffer, or 0 for current
---@param client Client object
local function text_document_did_open_handler(bufnr, client)
changetracking.init(client, bufnr)
- if not client.resolved_capabilities.text_document_open_close then
+ if not vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
return
end
- if not vim.api.nvim_buf_is_loaded(bufnr) then
+ if not api.nvim_buf_is_loaded(bufnr) then
return
end
local filetype = nvim_buf_get_option(bufnr, 'filetype')
local params = {
textDocument = {
- version = 0;
- uri = vim.uri_from_bufnr(bufnr);
- languageId = client.config.get_language_id(bufnr, filetype);
- text = buf_get_full_text(bufnr);
- }
+ version = 0,
+ uri = vim.uri_from_bufnr(bufnr),
+ languageId = client.config.get_language_id(bufnr, filetype),
+ text = buf_get_full_text(bufnr),
+ },
}
client.notify('textDocument/didOpen', params)
util.buf_versions[bufnr] = params.textDocument.version
@@ -519,7 +592,7 @@ local function text_document_did_open_handler(bufnr, client)
vim.schedule(function()
-- Protect against a race where the buffer disappears
-- between `did_open_handler` and the scheduled function firing.
- if vim.api.nvim_buf_is_valid(bufnr) then
+ if api.nvim_buf_is_valid(bufnr) then
local namespace = vim.lsp.diagnostic.get_namespace(client.id)
vim.diagnostic.show(namespace, bufnr)
end
@@ -602,14 +675,86 @@ end
---
--- - {server_capabilities} (table): Response from the server sent on
--- `initialize` describing the server's capabilities.
----
---- - {resolved_capabilities} (table): Normalized table of
---- capabilities that we have detected based on the initialize
---- response from the server in `server_capabilities`.
function lsp.client()
error()
end
+--- Create a new LSP client and start a language server or reuses an already
+--- running client if one is found matching `name` and `root_dir`.
+--- Attaches the current buffer to the client.
+---
+--- Example:
+---
+--- <pre>
+--- vim.lsp.start({
+--- name = 'my-server-name',
+--- cmd = {'name-of-language-server-executable'},
+--- root_dir = vim.fs.dirname(vim.fs.find({'pyproject.toml', 'setup.py'}, { upward = true })[1]),
+--- })
+--- </pre>
+---
+--- See |lsp.start_client| for all available options. The most important are:
+---
+--- `name` is an arbitrary name for the LSP client. It should be unique per
+--- language server.
+---
+--- `cmd` the command as list - used to start the language server.
+--- The command must be present in the `$PATH` environment variable or an
+--- absolute path to the executable. Shell constructs like `~` are *NOT* expanded.
+---
+--- `root_dir` path to the project root.
+--- By default this is used to decide if an existing client should be re-used.
+--- The example above uses |vim.fs.find| and |vim.fs.dirname| to detect the
+--- root by traversing the file system upwards starting
+--- from the current directory until either a `pyproject.toml` or `setup.py`
+--- file is found.
+---
+--- `workspace_folders` a list of { uri:string, name: string } tables.
+--- The project root folders used by the language server.
+--- If `nil` the property is derived from the `root_dir` for convenience.
+---
+--- Language servers use this information to discover metadata like the
+--- dependencies of your project and they tend to index the contents within the
+--- project folder.
+---
+---
+--- To ensure a language server is only started for languages it can handle,
+--- make sure to call |vim.lsp.start| within a |FileType| autocmd.
+--- Either use |:au|, |nvim_create_autocmd()| or put the call in a
+--- `ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
+---
+---@param config table Same configuration as documented in |lsp.start_client()|
+---@param opts nil|table Optional keyword arguments:
+--- - reuse_client (fun(client: client, config: table): boolean)
+--- Predicate used to decide if a client should be re-used.
+--- Used on all running clients.
+--- The default implementation re-uses a client if name
+--- and root_dir matches.
+---@return number client_id
+function lsp.start(config, opts)
+ opts = opts or {}
+ local reuse_client = opts.reuse_client
+ or function(client, conf)
+ return client.config.root_dir == conf.root_dir and client.name == conf.name
+ end
+ config.name = config.name or (config.cmd[1] and vim.fs.basename(config.cmd[1])) or nil
+ local bufnr = api.nvim_get_current_buf()
+ for _, clients in ipairs({ uninitialized_clients, lsp.get_active_clients() }) do
+ for _, client in pairs(clients) do
+ if reuse_client(client, config) then
+ lsp.buf_attach_client(bufnr, client.id)
+ return client.id
+ end
+ end
+ end
+ local client_id = lsp.start_client(config)
+ if client_id == nil then
+ return nil -- lsp.start_client will have printed an error
+ end
+ lsp.buf_attach_client(bufnr, client_id)
+ return client_id
+end
+
-- FIXME: DOC: Currently all methods on the `vim.lsp.client` object are
-- documented twice: Here, and on the methods themselves (e.g.
-- `client.request()`). This is a workaround for the vimdoc generator script
@@ -637,6 +782,10 @@ end
--- { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; }
--- </pre>
---
+---@param detached: (boolean, default true) Daemonize the server process so that it runs in a
+--- separate process group from Nvim. Nvim will shutdown the process on exit, but if Nvim fails to
+--- exit cleanly this could leave behind orphaned server processes.
+---
---@param workspace_folders (table) List of workspace folders passed to the
--- language server. For backwards compatibility rootUri and rootPath will be
--- derived from the first workspace folder in this list. See `workspaceFolders` in
@@ -708,7 +857,7 @@ end
--- server in the initialize request. Invalid/empty values will default to "off"
---@param flags: A table with flags for the client. The current (experimental) flags are:
--- - allow_incremental_sync (bool, default true): Allow using incremental sync for buffer edits
---- - debounce_text_changes (number, default nil): Debounce didChange
+--- - debounce_text_changes (number, default 150): Debounce didChange
--- notifications to the server by the given number in milliseconds. No debounce
--- occurs if nil
--- - exit_timeout (number, default 500): Milliseconds to wait for server to
@@ -724,7 +873,8 @@ end
--- the client has been initialized.
function lsp.start_client(config)
local cleaned_config = validate_client_config(config)
- local cmd, cmd_args, offset_encoding = cleaned_config.cmd, cleaned_config.cmd_args, cleaned_config.offset_encoding
+ local cmd, cmd_args, offset_encoding =
+ cleaned_config.cmd, cleaned_config.cmd_args, cleaned_config.offset_encoding
config.flags = config.flags or {}
config.settings = config.settings or {}
@@ -732,13 +882,15 @@ function lsp.start_client(config)
-- By default, get_language_id just returns the exact filetype it is passed.
-- It is possible to pass in something that will calculate a different filetype,
-- to be sent by the client.
- config.get_language_id = config.get_language_id or function(_, filetype) return filetype end
+ config.get_language_id = config.get_language_id or function(_, filetype)
+ return filetype
+ end
local client_id = next_client_id()
local handlers = config.handlers or {}
local name = config.name or tostring(client_id)
- local log_prefix = string.format("LSP[%s]", name)
+ local log_prefix = string.format('LSP[%s]', name)
local dispatch = {}
@@ -763,7 +915,7 @@ function lsp.start_client(config)
local handler = resolve_handler(method)
if handler then
-- Method name is provided here for convenience.
- handler(nil, params, {method=method, client_id=client_id})
+ handler(nil, params, { method = method, client_id = client_id })
end
end
@@ -776,10 +928,10 @@ function lsp.start_client(config)
local _ = log.trace() and log.trace('server_request', method, params)
local handler = resolve_handler(method)
if handler then
- local _ = log.trace() and log.trace("server_request: found handler for", method)
- return handler(nil, params, {method=method, client_id=client_id})
+ local _ = log.trace() and log.trace('server_request: found handler for', method)
+ return handler(nil, params, { method = method, client_id = client_id })
end
- local _ = log.warn() and log.warn("server_request: no handler found for", method)
+ local _ = log.warn() and log.warn('server_request: no handler found for', method)
return nil, lsp.rpc_response_error(protocol.ErrorCodes.MethodNotFound)
end
@@ -791,18 +943,41 @@ function lsp.start_client(config)
---@see |vim.lsp.rpc.client_errors| for possible errors. Use
---`vim.lsp.rpc.client_errors[code]` to get a human-friendly name.
function dispatch.on_error(code, err)
- local _ = log.error() and log.error(log_prefix, "on_error", { code = lsp.client_errors[code], err = err })
+ local _ = log.error()
+ and log.error(log_prefix, 'on_error', { code = lsp.client_errors[code], err = err })
err_message(log_prefix, ': Error ', lsp.client_errors[code], ': ', vim.inspect(err))
if config.on_error then
local status, usererr = pcall(config.on_error, code, err)
if not status then
- local _ = log.error() and log.error(log_prefix, "user on_error failed", { err = usererr })
+ local _ = log.error() and log.error(log_prefix, 'user on_error failed', { err = usererr })
err_message(log_prefix, ' user on_error failed: ', tostring(usererr))
end
end
end
---@private
+ local function set_defaults(client, bufnr)
+ if client.server_capabilities.definitionProvider and vim.bo[bufnr].tagfunc == '' then
+ vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
+ end
+ if client.server_capabilities.completionProvider and vim.bo[bufnr].omnifunc == '' then
+ vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
+ end
+ end
+
+ ---@private
+ --- Reset defaults set by `set_defaults`.
+ --- Must only be called if the last client attached to a buffer exits.
+ local function unset_defaults(bufnr)
+ if vim.bo[bufnr].tagfunc == 'v:lua.vim.lsp.tagfunc' then
+ vim.bo[bufnr].tagfunc = nil
+ end
+ if vim.bo[bufnr].omnifunc == 'v:lua.vim.lsp.omnifunc' then
+ vim.bo[bufnr].omnifunc = nil
+ end
+ end
+
+ ---@private
--- Invoked on client exit.
---
---@param code (number) exit code of the process
@@ -812,17 +987,35 @@ function lsp.start_client(config)
pcall(config.on_exit, code, signal, client_id)
end
+ for bufnr, client_ids in pairs(all_buffer_active_clients) do
+ if client_ids[client_id] then
+ vim.schedule(function()
+ nvim_exec_autocmds('LspDetach', {
+ buffer = bufnr,
+ modeline = false,
+ data = { client_id = client_id },
+ })
+
+ local namespace = vim.lsp.diagnostic.get_namespace(client_id)
+ vim.diagnostic.reset(namespace, bufnr)
+ end)
+
+ client_ids[client_id] = nil
+ end
+ if vim.tbl_isempty(client_ids) then
+ vim.schedule(function()
+ unset_defaults(bufnr)
+ end)
+ end
+ end
+
active_clients[client_id] = nil
uninitialized_clients[client_id] = nil
- lsp.diagnostic.reset(client_id, all_buffer_active_clients)
changetracking.reset(client_id)
- for _, client_ids in pairs(all_buffer_active_clients) do
- client_ids[client_id] = nil
- end
-
if code ~= 0 or (signal ~= 0 and signal ~= 15) then
- local msg = string.format("Client %s quit with exit code %s and signal %s", client_id, code, signal)
+ local msg =
+ string.format('Client %s quit with exit code %s and signal %s', client_id, code, signal)
vim.schedule(function()
vim.notify(msg, vim.log.levels.WARN)
end)
@@ -831,36 +1024,41 @@ function lsp.start_client(config)
-- Start the RPC client.
local rpc = lsp_rpc.start(cmd, cmd_args, dispatch, {
- cwd = config.cmd_cwd;
- env = config.cmd_env;
+ cwd = config.cmd_cwd,
+ env = config.cmd_env,
+ detached = config.detached,
})
-- Return nil if client fails to start
- if not rpc then return end
+ if not rpc then
+ return
+ end
local client = {
- id = client_id;
- name = name;
- rpc = rpc;
- offset_encoding = offset_encoding;
- config = config;
- attached_buffers = {};
+ id = client_id,
+ name = name,
+ rpc = rpc,
+ offset_encoding = offset_encoding,
+ config = config,
+ attached_buffers = {},
- handlers = handlers;
- commands = config.commands or {};
+ handlers = handlers,
+ commands = config.commands or {},
- requests = {};
+ requests = {},
-- for $/progress report
- messages = { name = name, messages = {}, progress = {}, status = {} };
+ messages = { name = name, messages = {}, progress = {}, status = {} },
}
-- Store the uninitialized_clients for cleanup in case we exit before initialize finishes.
- uninitialized_clients[client_id] = client;
+ uninitialized_clients[client_id] = client
---@private
local function initialize()
local valid_traces = {
- off = 'off'; messages = 'messages'; verbose = 'verbose';
+ off = 'off',
+ messages = 'messages',
+ verbose = 'verbose',
}
local version = vim.version()
@@ -869,10 +1067,12 @@ function lsp.start_client(config)
local root_path
if config.workspace_folders or config.root_dir then
if config.root_dir and not config.workspace_folders then
- workspace_folders = {{
- uri = vim.uri_from_fname(config.root_dir);
- name = string.format("%s", config.root_dir);
- }};
+ workspace_folders = {
+ {
+ uri = vim.uri_from_fname(config.root_dir),
+ name = string.format('%s', config.root_dir),
+ },
+ }
else
workspace_folders = config.workspace_folders
end
@@ -889,68 +1089,102 @@ function lsp.start_client(config)
-- the process has not been started by another process. If the parent
-- process is not alive then the server should exit (see exit notification)
-- its process.
- processId = uv.getpid();
+ processId = uv.getpid(),
-- Information about the client
-- since 3.15.0
clientInfo = {
- name = "Neovim",
- version = string.format("%s.%s.%s", version.major, version.minor, version.patch)
- };
+ name = 'Neovim',
+ version = string.format('%s.%s.%s', version.major, version.minor, version.patch),
+ },
-- The rootPath of the workspace. Is null if no folder is open.
--
-- @deprecated in favour of rootUri.
- rootPath = root_path or vim.NIL;
+ rootPath = root_path or vim.NIL,
-- The rootUri of the workspace. Is null if no folder is open. If both
-- `rootPath` and `rootUri` are set `rootUri` wins.
- rootUri = root_uri or vim.NIL;
+ rootUri = root_uri or vim.NIL,
-- The workspace folders configured in the client when the server starts.
-- This property is only available if the client supports workspace folders.
-- It can be `null` if the client supports workspace folders but none are
-- configured.
- workspaceFolders = workspace_folders or vim.NIL;
+ workspaceFolders = workspace_folders or vim.NIL,
-- User provided initialization options.
- initializationOptions = config.init_options;
+ initializationOptions = config.init_options,
-- The capabilities provided by the client (editor or tool)
- capabilities = config.capabilities or protocol.make_client_capabilities();
+ capabilities = config.capabilities or protocol.make_client_capabilities(),
-- The initial trace setting. If omitted trace is disabled ("off").
-- trace = "off" | "messages" | "verbose";
- trace = valid_traces[config.trace] or 'off';
+ trace = valid_traces[config.trace] or 'off',
}
if config.before_init then
-- TODO(ashkan) handle errors here.
pcall(config.before_init, initialize_params, config)
end
- local _ = log.trace() and log.trace(log_prefix, "initialize_params", initialize_params)
+ local _ = log.trace() and log.trace(log_prefix, 'initialize_params', initialize_params)
rpc.request('initialize', initialize_params, function(init_err, result)
assert(not init_err, tostring(init_err))
- assert(result, "server sent empty result")
+ assert(result, 'server sent empty result')
rpc.notify('initialized', vim.empty_dict())
client.initialized = true
uninitialized_clients[client_id] = nil
client.workspace_folders = workspace_folders
-- TODO(mjlbach): Backwards compatibility, to be removed in 0.7
client.workspaceFolders = client.workspace_folders
- client.server_capabilities = assert(result.capabilities, "initialize result doesn't contain capabilities")
+
-- These are the cleaned up capabilities we use for dynamically deciding
-- when to send certain events to clients.
- client.resolved_capabilities = protocol.resolve_capabilities(client.server_capabilities)
+ client.server_capabilities =
+ assert(result.capabilities, "initialize result doesn't contain capabilities")
+ client.server_capabilities = protocol.resolve_capabilities(client.server_capabilities)
+
+ -- Deprecation wrapper: this will be removed in 0.8
+ local mt = {}
+ mt.__index = function(table, key)
+ if key == 'resolved_capabilities' then
+ vim.notify_once(
+ '[LSP] Accessing client.resolved_capabilities is deprecated, '
+ .. 'update your plugins or configuration to access client.server_capabilities instead.'
+ .. 'The new key/value pairs in server_capabilities directly match those '
+ .. 'defined in the language server protocol',
+ vim.log.levels.WARN
+ )
+ rawset(table, key, protocol._resolve_capabilities_compat(client.server_capabilities))
+ return rawget(table, key)
+ else
+ return rawget(table, key)
+ end
+ end
+ setmetatable(client, mt)
+
client.supports_method = function(method)
local required_capability = lsp._request_name_to_capability[method]
-- if we don't know about the method, assume that the client supports it.
if not required_capability then
return true
end
+ if vim.tbl_get(client.server_capabilities, unpack(required_capability)) then
+ return true
+ else
+ return false
+ end
+ end
- return client.resolved_capabilities[required_capability]
+ if next(config.settings) then
+ client.notify('workspace/didChangeConfiguration', { settings = config.settings })
end
+
if config.on_init then
local status, err = pcall(config.on_init, client, result)
if not status then
pcall(handlers.on_error, lsp.client_errors.ON_INIT_CALLBACK_ERROR, err)
end
end
- local _ = log.debug() and log.debug(log_prefix, "server_capabilities", client.server_capabilities)
- local _ = log.info() and log.info(log_prefix, "initialized", { resolved_capabilities = client.resolved_capabilities })
+ local _ = log.info()
+ and log.info(
+ log_prefix,
+ 'server_capabilities',
+ { server_capabilities = client.server_capabilities }
+ )
-- Only assign after initialized.
active_clients[client_id] = client
@@ -985,22 +1219,27 @@ function lsp.start_client(config)
function client.request(method, params, handler, bufnr)
if not handler then
handler = resolve_handler(method)
- or error(string.format("not found: %q request handler for client %q.", method, client.name))
+ or error(string.format('not found: %q request handler for client %q.', method, client.name))
end
-- Ensure pending didChange notifications are sent so that the server doesn't operate on a stale state
changetracking.flush(client, bufnr)
bufnr = resolve_bufnr(bufnr)
- local _ = log.debug() and log.debug(log_prefix, "client.request", client_id, method, params, handler, bufnr)
+ local _ = log.debug()
+ and log.debug(log_prefix, 'client.request', client_id, method, params, handler, bufnr)
local success, request_id = rpc.request(method, params, function(err, result)
- handler(err, result, {method=method, client_id=client_id, bufnr=bufnr, params=params})
+ handler(
+ err,
+ result,
+ { method = method, client_id = client_id, bufnr = bufnr, params = params }
+ )
end, function(request_id)
client.requests[request_id] = nil
- nvim_command("doautocmd <nomodeline> User LspRequest")
+ nvim_exec_autocmds('User', { pattern = 'LspRequest', modeline = false })
end)
if success then
- client.requests[request_id] = { type='pending', bufnr=bufnr, method=method }
- nvim_command("doautocmd <nomodeline> User LspRequest")
+ client.requests[request_id] = { type = 'pending', bufnr = bufnr, method = method }
+ nvim_exec_autocmds('User', { pattern = 'LspRequest', modeline = false })
end
return success, request_id
@@ -1027,9 +1266,10 @@ function lsp.start_client(config)
request_result = { err = err, result = result }
end
- local success, request_id = client.request(method, params, _sync_handler,
- bufnr)
- if not success then return nil end
+ local success, request_id = client.request(method, params, _sync_handler, bufnr)
+ if not success then
+ return nil
+ end
local wait_result, reason = vim.wait(timeout_ms or 1000, function()
return request_result ~= nil
@@ -1064,13 +1304,13 @@ function lsp.start_client(config)
---@returns true if any client returns true; false otherwise
---@see |vim.lsp.client.notify()|
function client.cancel_request(id)
- validate{id = {id, 'n'}}
+ validate({ id = { id, 'n' } })
local request = client.requests[id]
if request and request.type == 'pending' then
request.type = 'cancel'
- nvim_command("doautocmd <nomodeline> User LspRequest")
+ nvim_exec_autocmds('User', { pattern = 'LspRequest', modeline = false })
end
- return rpc.notify("$/cancelRequest", { id = id })
+ return rpc.notify('$/cancelRequest', { id = id })
end
-- Track this so that we can escalate automatically if we've already tried a
@@ -1085,18 +1325,11 @@ function lsp.start_client(config)
---
---@param force (bool, optional)
function client.stop(force)
-
- lsp.diagnostic.reset(client_id, all_buffer_active_clients)
- changetracking.reset(client_id)
- for _, client_ids in pairs(all_buffer_active_clients) do
- client_ids[client_id] = nil
- end
-
local handle = rpc.handle
if handle:is_closing() then
return
end
- if force or (not client.initialized) or graceful_shutdown_failed then
+ if force or not client.initialized or graceful_shutdown_failed then
handle:kill(15)
return
end
@@ -1126,6 +1359,15 @@ function lsp.start_client(config)
---@param bufnr (number) Buffer number
function client._on_attach(bufnr)
text_document_did_open_handler(bufnr, client)
+
+ set_defaults(client, bufnr)
+
+ nvim_exec_autocmds('LspAttach', {
+ buffer = bufnr,
+ modeline = false,
+ data = { client_id = client.id },
+ })
+
if config.on_attach then
-- TODO(ashkan) handle errors.
pcall(config.on_attach, client, bufnr)
@@ -1143,34 +1385,37 @@ end
--- Notify all attached clients that a buffer has changed.
local text_document_did_change_handler
do
- text_document_did_change_handler = function(_, bufnr, changedtick, firstline, lastline, new_lastline)
-
- -- Detach (nvim_buf_attach) via returning True to on_lines if no clients are attached
- if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
- return true
+ text_document_did_change_handler =
+ function(_, bufnr, changedtick, firstline, lastline, new_lastline)
+ -- Detach (nvim_buf_attach) via returning True to on_lines if no clients are attached
+ if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
+ return true
+ end
+ util.buf_versions[bufnr] = changedtick
+ local compute_change_and_notify =
+ changetracking.prepare(bufnr, firstline, lastline, new_lastline)
+ for_each_buffer_client(bufnr, compute_change_and_notify)
end
- util.buf_versions[bufnr] = changedtick
- local compute_change_and_notify = changetracking.prepare(bufnr, firstline, lastline, new_lastline)
- for_each_buffer_client(bufnr, compute_change_and_notify)
- end
end
--- Buffer lifecycle handler for textDocument/didSave
-function lsp._text_document_did_save_handler(bufnr)
+---@private
+---Buffer lifecycle handler for textDocument/didSave
+local function text_document_did_save_handler(bufnr)
bufnr = resolve_bufnr(bufnr)
local uri = vim.uri_from_bufnr(bufnr)
local text = once(buf_get_full_text)
- for_each_buffer_client(bufnr, function(client, _client_id)
- if client.resolved_capabilities.text_document_save then
+ for_each_buffer_client(bufnr, function(client)
+ local save_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'save')
+ if save_capability then
local included_text
- if client.resolved_capabilities.text_document_save_include_text then
+ if type(save_capability) == 'table' and save_capability.includeText then
included_text = text(bufnr)
end
client.notify('textDocument/didSave', {
textDocument = {
- uri = uri;
- };
- text = included_text;
+ uri = uri,
+ },
+ text = included_text,
})
end
end)
@@ -1184,15 +1429,14 @@ end
---@param bufnr (number) Buffer handle, or 0 for current
---@param client_id (number) Client id
function lsp.buf_attach_client(bufnr, client_id)
- validate {
- bufnr = {bufnr, 'n', true};
- client_id = {client_id, 'n'};
- }
+ validate({
+ bufnr = { bufnr, 'n', true },
+ client_id = { client_id, 'n' },
+ })
bufnr = resolve_bufnr(bufnr)
- if not vim.api.nvim_buf_is_loaded(bufnr) then
- local _ = log.warn() and log.warn(
- string.format("buf_attach_client called on unloaded buffer (id: %d): ", bufnr)
- )
+ if not api.nvim_buf_is_loaded(bufnr) then
+ local _ = log.warn()
+ and log.warn(string.format('buf_attach_client called on unloaded buffer (id: %d): ', bufnr))
return false
end
local buffer_client_ids = all_buffer_active_clients[bufnr]
@@ -1202,45 +1446,49 @@ function lsp.buf_attach_client(bufnr, client_id)
all_buffer_active_clients[bufnr] = buffer_client_ids
local uri = vim.uri_from_bufnr(bufnr)
- local buf_did_save_autocommand = [=[
- augroup lsp_c_%d_b_%d_did_save
- au!
- au BufWritePost <buffer=%d> lua vim.lsp._text_document_did_save_handler(0)
- augroup END
- ]=]
- vim.api.nvim_exec(string.format(buf_did_save_autocommand, client_id, bufnr, bufnr), false)
+ local augroup = ('lsp_c_%d_b_%d_did_save'):format(client_id, bufnr)
+ api.nvim_create_autocmd('BufWritePost', {
+ group = api.nvim_create_augroup(augroup, { clear = true }),
+ buffer = bufnr,
+ desc = 'vim.lsp: textDocument/didSave handler',
+ callback = function(ctx)
+ text_document_did_save_handler(ctx.buf)
+ end,
+ })
-- First time, so attach and set up stuff.
- vim.api.nvim_buf_attach(bufnr, false, {
- on_lines = text_document_did_change_handler;
+ api.nvim_buf_attach(bufnr, false, {
+ on_lines = text_document_did_change_handler,
on_reload = function()
- local params = { textDocument = { uri = uri; } }
+ local params = { textDocument = { uri = uri } }
for_each_buffer_client(bufnr, function(client, _)
changetracking.reset_buf(client, bufnr)
- if client.resolved_capabilities.text_document_open_close then
+ if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify('textDocument/didClose', params)
end
text_document_did_open_handler(bufnr, client)
end)
- end;
+ end,
on_detach = function()
- local params = { textDocument = { uri = uri; } }
+ local params = { textDocument = { uri = uri } }
for_each_buffer_client(bufnr, function(client, _)
changetracking.reset_buf(client, bufnr)
- if client.resolved_capabilities.text_document_open_close then
+ if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify('textDocument/didClose', params)
end
end)
util.buf_versions[bufnr] = nil
all_buffer_active_clients[bufnr] = nil
- end;
+ end,
-- TODO if we know all of the potential clients ahead of time, then we
-- could conditionally set this.
-- utf_sizes = size_index > 1;
- utf_sizes = true;
+ utf_sizes = true,
})
end
- if buffer_client_ids[client_id] then return end
+ if buffer_client_ids[client_id] then
+ return
+ end
-- This is our first time attaching this client to this buffer.
buffer_client_ids[client_id] = true
@@ -1260,25 +1508,35 @@ end
---@param bufnr number Buffer handle, or 0 for current
---@param client_id number Client id
function lsp.buf_detach_client(bufnr, client_id)
- validate {
- bufnr = {bufnr, 'n', true};
- client_id = {client_id, 'n'};
- }
+ validate({
+ bufnr = { bufnr, 'n', true },
+ client_id = { client_id, 'n' },
+ })
bufnr = resolve_bufnr(bufnr)
local client = lsp.get_client_by_id(client_id)
if not client or not client.attached_buffers[bufnr] then
vim.notify(
- string.format('Buffer (id: %d) is not attached to client (id: %d). Cannot detach.', client_id, bufnr)
+ string.format(
+ 'Buffer (id: %d) is not attached to client (id: %d). Cannot detach.',
+ client_id,
+ bufnr
+ )
)
return
end
+ nvim_exec_autocmds('LspDetach', {
+ buffer = bufnr,
+ modeline = false,
+ data = { client_id = client_id },
+ })
+
changetracking.reset_buf(client, bufnr)
- if client.resolved_capabilities.text_document_open_close then
+ if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
local uri = vim.uri_from_bufnr(bufnr)
- local params = { textDocument = { uri = uri; } }
+ local params = { textDocument = { uri = uri } }
client.notify('textDocument/didClose', params)
end
@@ -1294,7 +1552,6 @@ function lsp.buf_detach_client(bufnr, client_id)
vim.diagnostic.reset(namespace, bufnr)
vim.notify(string.format('Detached buffer (id: %d) from client (id: %d)', bufnr, client_id))
-
end
--- Checks if a buffer is attached for a particular client.
@@ -1339,7 +1596,7 @@ end
---@param client_id client id or |vim.lsp.client| object, or list thereof
---@param force boolean (optional) shutdown forcefully
function lsp.stop_client(client_id, force)
- local ids = type(client_id) == 'table' and client_id or {client_id}
+ local ids = type(client_id) == 'table' and client_id or { client_id }
for _, id in ipairs(ids) do
if type(id) == 'table' and id.stop ~= nil then
id.stop(force)
@@ -1351,68 +1608,90 @@ function lsp.stop_client(client_id, force)
end
end
---- Gets all active clients.
+--- Get active clients.
---
----@returns Table of |vim.lsp.client| objects
-function lsp.get_active_clients()
- return vim.tbl_values(active_clients)
-end
+---@param filter (table|nil) A table with key-value pairs used to filter the
+--- returned clients. The available keys are:
+--- - id (number): Only return clients with the given id
+--- - bufnr (number): Only return clients attached to this buffer
+--- - name (string): Only return clients with the given name
+---@returns (table) List of |vim.lsp.client| objects
+function lsp.get_active_clients(filter)
+ validate({ filter = { filter, 't', true } })
-function lsp._vim_exit_handler()
- log.info("exit_handler", active_clients)
- for _, client in pairs(uninitialized_clients) do
- client.stop(true)
- end
- -- TODO handle v:dying differently?
- if tbl_isempty(active_clients) then
- return
- end
- for _, client in pairs(active_clients) do
- client.stop()
- end
+ filter = filter or {}
- local timeouts = {}
- local max_timeout = 0
- local send_kill = false
+ local clients = {}
- for client_id, client in pairs(active_clients) do
- local timeout = if_nil(client.config.flags.exit_timeout, 500)
- if timeout then
- send_kill = true
- timeouts[client_id] = timeout
- max_timeout = math.max(timeout, max_timeout)
+ local t = filter.bufnr and (all_buffer_active_clients[resolve_bufnr(filter.bufnr)] or {})
+ or active_clients
+ for client_id in pairs(t) do
+ local client = active_clients[client_id]
+ if
+ (filter.id == nil or client.id == filter.id)
+ and (filter.name == nil or client.name == filter.name)
+ then
+ clients[#clients + 1] = client
end
end
+ return clients
+end
- local poll_time = 50
-
- ---@private
- local function check_clients_closed()
- for client_id, timeout in pairs(timeouts) do
- timeouts[client_id] = timeout - poll_time
+api.nvim_create_autocmd('VimLeavePre', {
+ desc = 'vim.lsp: exit handler',
+ callback = function()
+ log.info('exit_handler', active_clients)
+ for _, client in pairs(uninitialized_clients) do
+ client.stop(true)
+ end
+ -- TODO handle v:dying differently?
+ if tbl_isempty(active_clients) then
+ return
end
+ for _, client in pairs(active_clients) do
+ client.stop()
+ end
+
+ local timeouts = {}
+ local max_timeout = 0
+ local send_kill = false
- for client_id, _ in pairs(active_clients) do
- if timeouts[client_id] ~= nil and timeouts[client_id] > 0 then
- return false
+ for client_id, client in pairs(active_clients) do
+ local timeout = if_nil(client.config.flags.exit_timeout, 500)
+ if timeout then
+ send_kill = true
+ timeouts[client_id] = timeout
+ max_timeout = math.max(timeout, max_timeout)
end
end
- return true
- end
- if send_kill then
- if not vim.wait(max_timeout, check_clients_closed, poll_time) then
- for client_id, client in pairs(active_clients) do
- if timeouts[client_id] ~= nil then
- client.stop(true)
+ local poll_time = 50
+
+ ---@private
+ local function check_clients_closed()
+ for client_id, timeout in pairs(timeouts) do
+ timeouts[client_id] = timeout - poll_time
+ end
+
+ for client_id, _ in pairs(active_clients) do
+ if timeouts[client_id] ~= nil and timeouts[client_id] > 0 then
+ return false
end
end
+ return true
end
- end
-end
-
-nvim_command("autocmd VimLeavePre * lua vim.lsp._vim_exit_handler()")
+ if send_kill then
+ if not vim.wait(max_timeout, check_clients_closed, poll_time) then
+ for client_id, client in pairs(active_clients) do
+ if timeouts[client_id] ~= nil then
+ client.stop(true)
+ end
+ end
+ end
+ end
+ end,
+})
--- Sends an async request for all active clients attached to the
--- buffer.
@@ -1428,11 +1707,11 @@ nvim_command("autocmd VimLeavePre * lua vim.lsp._vim_exit_handler()")
--- - 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)
- validate {
- bufnr = { bufnr, 'n', true };
- method = { method, 's' };
- handler = { handler, 'f', true };
- }
+ validate({
+ bufnr = { bufnr, 'n', true },
+ method = { method, 's' },
+ handler = { handler, 'f', true },
+ })
local supported_clients = {}
local method_supported = false
@@ -1444,20 +1723,22 @@ function lsp.buf_request(bufnr, method, params, handler)
end)
-- if has client but no clients support the given method, notify the user
- if not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported then
+ if
+ not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported
+ then
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
- vim.api.nvim_command("redraw")
+ nvim_command('redraw')
return {}, function() end
end
local client_request_ids = {}
for_each_buffer_client(bufnr, function(client, client_id, resolved_bufnr)
- local request_success, request_id = client.request(method, params, handler, resolved_bufnr)
- -- This could only fail if the client shut down in the time since we looked
- -- it up and we did the request, which should be rare.
- if request_success then
- client_request_ids[client_id] = request_id
- end
+ local request_success, request_id = client.request(method, params, handler, resolved_bufnr)
+ -- This could only fail if the client shut down in the time since we looked
+ -- it up and we did the request, which should be rare.
+ if request_success then
+ client_request_ids[client_id] = request_id
+ end
end, supported_clients)
local function _cancel_all_requests()
@@ -1488,7 +1769,7 @@ function lsp.buf_request_all(bufnr, method, params, callback)
local result_count = 0
local expected_result_count = 0
- local set_expected_result_count = once(function ()
+ local set_expected_result_count = once(function()
for_each_buffer_client(bufnr, function(client)
if client.supports_method(method) then
expected_result_count = expected_result_count + 1
@@ -1552,23 +1833,24 @@ end
---
---@returns true if any client returns true; false otherwise
function lsp.buf_notify(bufnr, method, params)
- validate {
- bufnr = { bufnr, 'n', true };
- method = { method, 's' };
- }
+ validate({
+ bufnr = { bufnr, 'n', true },
+ method = { method, 's' },
+ })
local resp = false
for_each_buffer_client(bufnr, function(client, _client_id, _resolved_bufnr)
- if client.rpc.notify(method, params) then resp = true end
+ if client.rpc.notify(method, params) then
+ resp = true
+ end
end)
return resp
end
-
---@private
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 - 1 then
+ if item.filterText == nil and item.textEdit and item.textEdit.range.start.line == lnum - 1 then
if min_start_char and min_start_char ~= item.textEdit.range.start.character then
return nil
end
@@ -1595,7 +1877,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)
- local _ = log.debug() and log.debug("omnifunc.findstart", { findstart = findstart, base = base })
+ local _ = log.debug() and log.debug('omnifunc.findstart', { findstart = findstart, base = base })
local bufnr = resolve_bufnr()
local has_buffer_clients = not tbl_isempty(all_buffer_active_clients[bufnr] or {})
@@ -1608,12 +1890,12 @@ function lsp.omnifunc(findstart, base)
end
-- Then, perform standard completion request
- local _ = log.info() and log.info("base ", base)
+ local _ = log.info() and log.info('base ', base)
- local pos = vim.api.nvim_win_get_cursor(0)
- local line = vim.api.nvim_get_current_line()
+ local pos = api.nvim_win_get_cursor(0)
+ local line = api.nvim_get_current_line()
local line_to_cursor = line:sub(1, pos[2])
- local _ = log.trace() and log.trace("omnifunc.line", pos, line)
+ local _ = log.trace() and log.trace('omnifunc.line', pos, line)
-- Get the start position of the current keyword
local textMatch = vim.fn.match(line_to_cursor, '\\k*$')
@@ -1622,7 +1904,9 @@ function lsp.omnifunc(findstart, base)
local items = {}
lsp.buf_request(bufnr, 'textDocument/completion', params, function(err, result, ctx)
- if err or not result or vim.fn.mode() ~= "i" then return end
+ if err or not result or vim.fn.mode() ~= 'i' then
+ return
+ end
-- Completion response items may be relative to a position different than `textMatch`.
-- Concrete example, with sumneko/lua-language-server:
@@ -1659,7 +1943,7 @@ end
---
--- Currently only supports a single client. This can be set via
--- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in `on_attach`
---- via `vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
+--- via ``vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')``.
---
---@param opts table options for customizing the formatting expression which takes the
--- following optional keys:
@@ -1668,7 +1952,7 @@ function lsp.formatexpr(opts)
opts = opts or {}
local timeout_ms = opts.timeout_ms or 500
- if vim.tbl_contains({'i', 'R', 'ic', 'ix'}, vim.fn.mode()) then
+ if vim.tbl_contains({ 'i', 'R', 'ic', 'ix' }, vim.fn.mode()) then
-- `formatexpr` is also called when exceeding `textwidth` in insert mode
-- fall back to internal formatting
return 1
@@ -1679,19 +1963,24 @@ function lsp.formatexpr(opts)
if start_line > 0 and end_line > 0 then
local params = {
- textDocument = util.make_text_document_params();
+ textDocument = util.make_text_document_params(),
range = {
- start = { line = start_line - 1; character = 0; };
- ["end"] = { line = end_line - 1; character = 0; };
- };
- };
+ start = { line = start_line - 1, character = 0 },
+ ['end'] = { line = end_line - 1, character = 0 },
+ },
+ }
params.options = util.make_formatting_params().options
- local client_results = vim.lsp.buf_request_sync(0, "textDocument/rangeFormatting", params, timeout_ms)
+ local client_results =
+ vim.lsp.buf_request_sync(0, 'textDocument/rangeFormatting', params, timeout_ms)
-- Apply the text edits from one and only one of the clients.
- for _, response in pairs(client_results) do
+ for client_id, response in pairs(client_results) do
if response.result then
- vim.lsp.util.apply_text_edits(response.result, 0)
+ vim.lsp.util.apply_text_edits(
+ response.result,
+ 0,
+ vim.lsp.get_client_by_id(client_id).offset_encoding
+ )
return 0
end
end
@@ -1728,26 +2017,28 @@ end
--- is a |vim.lsp.client| object.
---
---@param bufnr (optional, number): Buffer handle, or 0 for current
+---@returns (table) Table of (client_id, client) pairs
+---@deprecated Use |vim.lsp.get_active_clients()| instead.
function lsp.buf_get_clients(bufnr)
- bufnr = resolve_bufnr(bufnr)
- local result = {}
- for_each_buffer_client(bufnr, function(client, client_id)
- result[client_id] = client
- end)
- return result
+ local result = {}
+ for _, client in ipairs(lsp.get_active_clients({ bufnr = resolve_bufnr(bufnr) })) do
+ result[client.id] = client
+ end
+ return result
end
-- Log level dictionary with reverse lookup as well.
--
-- Can be used to lookup the number from the name or the
-- name from the number.
--- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR"
+-- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
-- Level numbers begin with "TRACE" at 0
lsp.log_levels = log.levels
--- Sets the global log level for LSP logging.
---
---- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR"
+--- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
+---
--- Level numbers begin with "TRACE" at 0
---
--- Use `lsp.log_levels` for reverse lookup.
@@ -1759,7 +2050,7 @@ function lsp.set_log_level(level)
if type(level) == 'string' or type(level) == 'number' then
log.set_level(level)
else
- error(string.format("Invalid log level: %q", level))
+ error(string.format('Invalid log level: %q', level))
end
end
@@ -1789,7 +2080,7 @@ end
---@param override_config (table) Table containing the keys to override behavior of the {handler}
function lsp.with(handler, override_config)
return function(err, result, ctx, config)
- return handler(err, result, ctx, vim.tbl_deep_extend("force", config or {}, override_config))
+ return handler(err, result, ctx, vim.tbl_deep_extend('force', config or {}, override_config))
end
end
@@ -1804,12 +2095,16 @@ function lsp._with_extend(name, options, user_config)
local resulting_config = {}
for k, v in pairs(user_config) do
if options[k] == nil then
- error(debug.traceback(string.format(
- "Invalid option for `%s`: %s. Valid options are:\n%s",
- name,
- k,
- vim.inspect(vim.tbl_keys(options))
- )))
+ error(
+ debug.traceback(
+ string.format(
+ 'Invalid option for `%s`: %s. Valid options are:\n%s',
+ name,
+ k,
+ vim.inspect(vim.tbl_keys(options))
+ )
+ )
+ )
end
resulting_config[k] = v
@@ -1824,7 +2119,6 @@ function lsp._with_extend(name, options, user_config)
return resulting_config
end
-
--- Registry for client side commands.
--- This is an extension point for plugins to handle custom commands which are
--- not part of the core language server protocol specification.
@@ -1846,12 +2140,11 @@ end
--- The second argument is the `ctx` of |lsp-handler|
lsp.commands = setmetatable({}, {
__newindex = function(tbl, key, value)
- assert(type(key) == 'string', "The key for commands in `vim.lsp.commands` must be a string")
- assert(type(value) == 'function', "Command added to `vim.lsp.commands` must be a function")
+ assert(type(key) == 'string', 'The key for commands in `vim.lsp.commands` must be a string')
+ assert(type(value) == 'function', 'Command added to `vim.lsp.commands` must be a function')
rawset(tbl, key, value)
- end;
+ end,
})
-
return lsp
-- vim:sw=2 ts=2 et
diff --git a/runtime/lua/vim/lsp/_snippet.lua b/runtime/lua/vim/lsp/_snippet.lua
index 0140b0aee3..3488639fb4 100644
--- a/runtime/lua/vim/lsp/_snippet.lua
+++ b/runtime/lua/vim/lsp/_snippet.lua
@@ -41,7 +41,7 @@ P.take_until = function(targets, specials)
parsed = true,
value = {
raw = table.concat(raw, ''),
- esc = table.concat(esc, '')
+ esc = table.concat(esc, ''),
},
pos = new_pos,
}
@@ -156,10 +156,10 @@ P.seq = function(...)
return function(input, pos)
local values = {}
local new_pos = pos
- for _, parser in ipairs(parsers) do
+ for i, parser in ipairs(parsers) do
local result = parser(input, new_pos)
if result.parsed then
- table.insert(values, result.value)
+ values[i] = result.value
new_pos = result.pos
else
return P.unmatch(pos)
@@ -248,49 +248,122 @@ S.format = P.any(
capture_index = values[3],
}, Node)
end),
- P.map(P.seq(S.dollar, S.open, S.int, S.colon, S.slash, P.any(
- P.token('upcase'),
- P.token('downcase'),
- P.token('capitalize'),
- P.token('camelcase'),
- P.token('pascalcase')
- ), S.close), function(values)
- return setmetatable({
- type = Node.Type.FORMAT,
- capture_index = values[3],
- modifier = values[6],
- }, Node)
- end),
- P.map(P.seq(S.dollar, S.open, S.int, S.colon, P.any(
- P.seq(S.question, P.take_until({ ':' }, { '\\' }), S.colon, P.take_until({ '}' }, { '\\' })),
- P.seq(S.plus, P.take_until({ '}' }, { '\\' })),
- P.seq(S.minus, P.take_until({ '}' }, { '\\' }))
- ), S.close), function(values)
+ P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.int,
+ S.colon,
+ S.slash,
+ P.any(
+ P.token('upcase'),
+ P.token('downcase'),
+ P.token('capitalize'),
+ P.token('camelcase'),
+ P.token('pascalcase')
+ ),
+ S.close
+ ),
+ function(values)
+ return setmetatable({
+ type = Node.Type.FORMAT,
+ capture_index = values[3],
+ modifier = values[6],
+ }, Node)
+ end
+ ),
+ P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.int,
+ S.colon,
+ P.seq(
+ S.question,
+ P.opt(P.take_until({ ':' }, { '\\' })),
+ S.colon,
+ P.opt(P.take_until({ '}' }, { '\\' }))
+ ),
+ S.close
+ ),
+ function(values)
+ return setmetatable({
+ type = Node.Type.FORMAT,
+ capture_index = values[3],
+ if_text = values[5][2] and values[5][2].esc or '',
+ else_text = values[5][4] and values[5][4].esc or '',
+ }, Node)
+ end
+ ),
+ P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.int,
+ S.colon,
+ P.seq(S.plus, P.opt(P.take_until({ '}' }, { '\\' }))),
+ S.close
+ ),
+ function(values)
+ return setmetatable({
+ type = Node.Type.FORMAT,
+ capture_index = values[3],
+ if_text = values[5][2] and values[5][2].esc or '',
+ else_text = '',
+ }, Node)
+ end
+ ),
+ P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.int,
+ S.colon,
+ S.minus,
+ P.opt(P.take_until({ '}' }, { '\\' })),
+ S.close
+ ),
+ function(values)
+ return setmetatable({
+ type = Node.Type.FORMAT,
+ capture_index = values[3],
+ if_text = '',
+ else_text = values[6] and values[6].esc or '',
+ }, Node)
+ end
+ ),
+ P.map(
+ P.seq(S.dollar, S.open, S.int, S.colon, P.opt(P.take_until({ '}' }, { '\\' })), S.close),
+ function(values)
+ return setmetatable({
+ type = Node.Type.FORMAT,
+ capture_index = values[3],
+ if_text = '',
+ else_text = values[5] and values[5].esc or '',
+ }, Node)
+ end
+ )
+)
+
+S.transform = P.map(
+ P.seq(
+ S.slash,
+ P.take_until({ '/' }, { '\\' }),
+ S.slash,
+ P.many(P.any(S.format, S.text({ '$', '/' }, { '\\' }))),
+ S.slash,
+ P.opt(P.pattern('[ig]+'))
+ ),
+ function(values)
return setmetatable({
- type = Node.Type.FORMAT,
- capture_index = values[3],
- if_text = values[5][2].esc,
- else_text = (values[5][4] or {}).esc,
+ type = Node.Type.TRANSFORM,
+ pattern = values[2].raw,
+ format = values[4],
+ option = values[6],
}, Node)
- end)
+ end
)
-S.transform = P.map(P.seq(
- S.slash,
- P.take_until({ '/' }, { '\\' }),
- S.slash,
- P.many(P.any(S.format, S.text({ '$', '/' }, { '\\' }))),
- S.slash,
- P.opt(P.pattern('[ig]+'))
-), function(values)
- return setmetatable({
- type = Node.Type.TRANSFORM,
- pattern = values[2].raw,
- format = values[4],
- option = values[6],
- }, Node)
-end)
-
S.tabstop = P.any(
P.map(P.seq(S.dollar, S.int), function(values)
return setmetatable({
@@ -314,34 +387,52 @@ S.tabstop = P.any(
)
S.placeholder = P.any(
- P.map(P.seq(S.dollar, S.open, S.int, S.colon, P.many(P.any(S.toplevel, S.text({ '$', '}' }, { '\\' }))), S.close), function(values)
- return setmetatable({
- type = Node.Type.PLACEHOLDER,
- tabstop = values[3],
- children = values[5],
- }, Node)
- end)
+ P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.int,
+ S.colon,
+ P.opt(P.many(P.any(S.toplevel, S.text({ '$', '}' }, { '\\' })))),
+ S.close
+ ),
+ function(values)
+ return setmetatable({
+ type = Node.Type.PLACEHOLDER,
+ tabstop = values[3],
+ -- insert empty text if opt did not match.
+ children = values[5] or {
+ setmetatable({
+ type = Node.Type.TEXT,
+ raw = '',
+ esc = '',
+ }, Node),
+ },
+ }, Node)
+ end
+ )
)
-S.choice = P.map(P.seq(
- S.dollar,
- S.open,
- S.int,
- S.pipe,
- P.many(
- P.map(P.seq(S.text({ ',', '|' }), P.opt(S.comma)), function(values)
+S.choice = P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.int,
+ S.pipe,
+ P.many(P.map(P.seq(S.text({ ',', '|' }), P.opt(S.comma)), function(values)
return values[1].esc
- end)
+ end)),
+ S.pipe,
+ S.close
),
- S.pipe,
- S.close
-), function(values)
- return setmetatable({
- type = Node.Type.CHOICE,
- tabstop = values[3],
- items = values[5],
- }, Node)
-end)
+ function(values)
+ return setmetatable({
+ type = Node.Type.CHOICE,
+ tabstop = values[3],
+ items = values[5],
+ }, Node)
+ end
+)
S.variable = P.any(
P.map(P.seq(S.dollar, S.var), function(values)
@@ -363,13 +454,23 @@ S.variable = P.any(
transform = values[4],
}, Node)
end),
- P.map(P.seq(S.dollar, S.open, S.var, S.colon, P.many(P.any(S.toplevel, S.text({ '$', '}' }, { '\\' }))), S.close), function(values)
- return setmetatable({
- type = Node.Type.VARIABLE,
- name = values[3],
- children = values[5],
- }, Node)
- end)
+ P.map(
+ P.seq(
+ S.dollar,
+ S.open,
+ S.var,
+ S.colon,
+ P.many(P.any(S.toplevel, S.text({ '$', '}' }, { '\\' }))),
+ S.close
+ ),
+ function(values)
+ return setmetatable({
+ type = Node.Type.VARIABLE,
+ name = values[3],
+ children = values[5],
+ }, Node)
+ end
+ )
)
S.snippet = P.map(P.many(P.any(S.toplevel, S.text({ '$' }, { '}', '\\' }))), function(values)
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index c1d777ae6c..50a51e897c 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -1,30 +1,12 @@
local vim = vim
+local api = vim.api
local validate = vim.validate
-local vfn = vim.fn
-local util = require 'vim.lsp.util'
+local util = require('vim.lsp.util')
+local npcall = vim.F.npcall
local M = {}
---@private
---- Returns nil if {status} is false or nil, otherwise returns the rest of the
---- arguments.
-local function ok_or_nil(status, ...)
- if not status then return end
- return ...
-end
-
----@private
---- Swallows errors.
----
----@param fn Function to run
----@param ... Function arguments
----@returns Result of `fn(...)` if there are no errors, otherwise nil.
---- Returns nil if errors occur during {fn}, otherwise returns
-local function npcall(fn, ...)
- return ok_or_nil(pcall(fn, ...))
-end
-
----@private
--- Sends an async request to all active clients attached to the current
--- buffer.
---
@@ -39,10 +21,10 @@ end
---
---@see |vim.lsp.buf_request()|
local function request(method, params, handler)
- validate {
- method = {method, 's'};
- handler = {handler, 'f', true};
- }
+ validate({
+ method = { method, 's' },
+ handler = { handler, 'f', true },
+ })
return vim.lsp.buf_request(0, method, params, handler)
end
@@ -51,7 +33,7 @@ end
---
---@returns `true` if server responds.
function M.server_ready()
- return not not vim.lsp.buf_notify(0, "window/progress", {})
+ return not not vim.lsp.buf_notify(0, 'window/progress', {})
end
--- Displays hover information about the symbol under the cursor in a floating
@@ -61,26 +43,45 @@ function M.hover()
request('textDocument/hover', params)
end
+---@private
+local function request_with_options(name, params, options)
+ local req_handler
+ if options then
+ req_handler = function(err, result, ctx, config)
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local handler = client.handlers[name] or vim.lsp.handlers[name]
+ handler(err, result, ctx, vim.tbl_extend('force', config or {}, options))
+ end
+ end
+ request(name, params, req_handler)
+end
+
--- Jumps to the declaration of the symbol under the cursor.
---@note Many servers do not implement this method. Generally, see |vim.lsp.buf.definition()| instead.
---
-function M.declaration()
+---@param options table|nil additional options
+--- - reuse_win: (boolean) Jump to existing window if buffer is already open.
+function M.declaration(options)
local params = util.make_position_params()
- request('textDocument/declaration', params)
+ request_with_options('textDocument/declaration', params, options)
end
--- Jumps to the definition of the symbol under the cursor.
---
-function M.definition()
+---@param options table|nil additional options
+--- - reuse_win: (boolean) Jump to existing window if buffer is already open.
+function M.definition(options)
local params = util.make_position_params()
- request('textDocument/definition', params)
+ request_with_options('textDocument/definition', params, options)
end
--- Jumps to the definition of the type of the symbol under the cursor.
---
-function M.type_definition()
+---@param options table|nil additional options
+--- - reuse_win: (boolean) Jump to existing window if buffer is already open.
+function M.type_definition(options)
local params = util.make_position_params()
- request('textDocument/typeDefinition', params)
+ request_with_options('textDocument/typeDefinition', params, options)
end
--- Lists all the implementations for the symbol under the cursor in the
@@ -117,9 +118,9 @@ end
--
---@returns The client that the user selected or nil
local function select_client(method, on_choice)
- validate {
+ validate({
on_choice = { on_choice, 'function', false },
- }
+ })
local clients = vim.tbl_values(vim.lsp.buf_get_clients())
clients = vim.tbl_filter(function(client)
return client.supports_method(method)
@@ -143,16 +144,105 @@ local function select_client(method, on_choice)
end
end
+--- Formats a buffer using the attached (and optionally filtered) language
+--- server clients.
+---
+--- @param options table|nil Optional table which holds the following optional fields:
+--- - formatting_options (table|nil):
+--- Can be used to specify FormattingOptions. Some unspecified options will be
+--- automatically derived from the current Neovim options.
+--- @see https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
+--- - timeout_ms (integer|nil, default 1000):
+--- Time in milliseconds to block for formatting requests. No effect if async=true
+--- - bufnr (number|nil):
+--- Restrict formatting to the clients attached to the given buffer, defaults to the current
+--- buffer (0).
+---
+--- - filter (function|nil):
+--- Predicate used to filter clients. Receives a client as argument and must return a
+--- boolean. Clients matching the predicate are included. Example:
+---
+--- <pre>
+--- -- Never request typescript-language-server for formatting
+--- vim.lsp.buf.format {
+--- filter = function(client) return client.name ~= "tsserver" end
+--- }
+--- </pre>
+---
+--- - async boolean|nil
+--- If true the method won't block. Defaults to false.
+--- Editing the buffer while formatting asynchronous can lead to unexpected
+--- changes.
+---
+--- - id (number|nil):
+--- Restrict formatting to the client with ID (client.id) matching this field.
+--- - name (string|nil):
+--- Restrict formatting to the client with name (client.name) matching this field.
+
+function M.format(options)
+ options = options or {}
+ local bufnr = options.bufnr or api.nvim_get_current_buf()
+ local clients = vim.lsp.get_active_clients({
+ id = options.id,
+ bufnr = bufnr,
+ name = options.name,
+ })
+
+ if options.filter then
+ clients = vim.tbl_filter(options.filter, clients)
+ end
+
+ clients = vim.tbl_filter(function(client)
+ return client.supports_method('textDocument/formatting')
+ end, clients)
+
+ if #clients == 0 then
+ vim.notify('[LSP] Format request failed, no matching language servers.')
+ end
+
+ if options.async then
+ local do_format
+ do_format = function(idx, client)
+ if not client then
+ return
+ end
+ local params = util.make_formatting_params(options.formatting_options)
+ client.request('textDocument/formatting', params, function(...)
+ local handler = client.handlers['textDocument/formatting']
+ or vim.lsp.handlers['textDocument/formatting']
+ handler(...)
+ do_format(next(clients, idx))
+ end, bufnr)
+ end
+ do_format(next(clients))
+ else
+ local timeout_ms = options.timeout_ms or 1000
+ for _, client in pairs(clients) do
+ local params = util.make_formatting_params(options.formatting_options)
+ local result, err = client.request_sync('textDocument/formatting', params, timeout_ms, bufnr)
+ if result and result.result then
+ util.apply_text_edits(result.result, bufnr, client.offset_encoding)
+ elseif err then
+ vim.notify(string.format('[LSP][%s] %s', client.name, err), vim.log.levels.WARN)
+ end
+ end
+ end
+end
+
--- Formats the current buffer.
---
----@param options (optional, table) Can be used to specify FormattingOptions.
+---@param options (table|nil) Can be used to specify FormattingOptions.
--- Some unspecified options will be automatically derived from the current
--- Neovim options.
--
---@see https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
function M.formatting(options)
+ vim.notify_once(
+ 'vim.lsp.buf.formatting is deprecated. Use vim.lsp.buf.format { async = true } instead',
+ vim.log.levels.WARN
+ )
local params = util.make_formatting_params(options)
- local bufnr = vim.api.nvim_get_current_buf()
+ local bufnr = api.nvim_get_current_buf()
select_client('textDocument/formatting', function(client)
if client == nil then
return
@@ -171,12 +261,16 @@ end
--- autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
--- </pre>
---
----@param options Table with valid `FormattingOptions` entries
+---@param options table|nil with valid `FormattingOptions` entries
---@param timeout_ms (number) Request timeout
---@see |vim.lsp.buf.formatting_seq_sync|
function M.formatting_sync(options, timeout_ms)
+ vim.notify_once(
+ 'vim.lsp.buf.formatting_sync is deprecated. Use vim.lsp.buf.format instead',
+ vim.log.levels.WARN
+ )
local params = util.make_formatting_params(options)
- local bufnr = vim.api.nvim_get_current_buf()
+ local bufnr = api.nvim_get_current_buf()
select_client('textDocument/formatting', function(client)
if client == nil then
return
@@ -184,7 +278,7 @@ function M.formatting_sync(options, timeout_ms)
local result, err = client.request_sync('textDocument/formatting', params, timeout_ms, bufnr)
if result and result.result then
- util.apply_text_edits(result.result, bufnr)
+ util.apply_text_edits(result.result, bufnr, client.offset_encoding)
elseif err then
vim.notify('vim.lsp.buf.formatting_sync: ' .. err, vim.log.levels.WARN)
end
@@ -202,14 +296,18 @@ end
--- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]]
--- </pre>
---
----@param options (optional, table) `FormattingOptions` entries
----@param timeout_ms (optional, number) Request timeout
----@param order (optional, table) List of client names. Formatting is requested from clients
+---@param options (table|nil) `FormattingOptions` entries
+---@param timeout_ms (number|nil) Request timeout
+---@param order (table|nil) List of client names. Formatting is requested from clients
---in the following order: first all clients that are not in the `order` list, then
---the remaining clients in the order as they occur in the `order` list.
function M.formatting_seq_sync(options, timeout_ms, order)
- local clients = vim.tbl_values(vim.lsp.buf_get_clients());
- local bufnr = vim.api.nvim_get_current_buf()
+ vim.notify_once(
+ 'vim.lsp.buf.formatting_seq_sync is deprecated. Use vim.lsp.buf.format instead',
+ vim.log.levels.WARN
+ )
+ local clients = vim.tbl_values(vim.lsp.buf_get_clients())
+ local bufnr = api.nvim_get_current_buf()
-- sort the clients according to `order`
for _, client_name in pairs(order or {}) do
@@ -224,13 +322,21 @@ function M.formatting_seq_sync(options, timeout_ms, order)
-- loop through the clients and make synchronous formatting requests
for _, client in pairs(clients) do
- if client.resolved_capabilities.document_formatting then
+ if vim.tbl_get(client.server_capabilities, 'documentFormattingProvider') then
local params = util.make_formatting_params(options)
- local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, vim.api.nvim_get_current_buf())
+ local result, err = client.request_sync(
+ 'textDocument/formatting',
+ params,
+ timeout_ms,
+ api.nvim_get_current_buf()
+ )
if result and result.result then
- util.apply_text_edits(result.result, bufnr)
+ util.apply_text_edits(result.result, bufnr, client.offset_encoding)
elseif err then
- vim.notify(string.format("vim.lsp.buf.formatting_seq_sync: (%s) %s", client.name, err), vim.log.levels.WARN)
+ vim.notify(
+ string.format('vim.lsp.buf.formatting_seq_sync: (%s) %s', client.name, err),
+ vim.log.levels.WARN
+ )
end
end
end
@@ -257,50 +363,133 @@ end
--- Renames all references to the symbol under the cursor.
---
----@param new_name (string) If not provided, the user will be prompted for a new
----name using |vim.ui.input()|.
-function M.rename(new_name)
- local opts = {
- prompt = "New Name: "
- }
+---@param new_name string|nil If not provided, the user will be prompted for a new
+--- name using |vim.ui.input()|.
+---@param options table|nil additional options
+--- - filter (function|nil):
+--- Predicate used to filter clients. Receives a client as argument and
+--- must return a boolean. Clients matching the predicate are included.
+--- - name (string|nil):
+--- Restrict clients used for rename to ones where client.name matches
+--- this field.
+function M.rename(new_name, options)
+ options = options or {}
+ local bufnr = options.bufnr or api.nvim_get_current_buf()
+ local clients = vim.lsp.get_active_clients({
+ bufnr = bufnr,
+ name = options.name,
+ })
+ if options.filter then
+ clients = vim.tbl_filter(options.filter, clients)
+ end
- ---@private
- local function on_confirm(input)
- if not (input and #input > 0) then return end
- local params = util.make_position_params()
- params.newName = input
- request('textDocument/rename', params)
+ -- Clients must at least support rename, prepareRename is optional
+ clients = vim.tbl_filter(function(client)
+ return client.supports_method('textDocument/rename')
+ end, clients)
+
+ if #clients == 0 then
+ vim.notify('[LSP] Rename, no matching language servers with rename capability.')
end
+ local win = api.nvim_get_current_win()
+
+ -- Compute early to account for cursor movements after going async
+ local cword = vim.fn.expand('<cword>')
+
---@private
- local function prepare_rename(err, result)
- if err == nil and result == nil then
- vim.notify('nothing to rename', vim.log.levels.INFO)
+ local function get_text_at_range(range, offset_encoding)
+ return api.nvim_buf_get_text(
+ bufnr,
+ range.start.line,
+ util._get_line_byte_from_position(bufnr, range.start, offset_encoding),
+ range['end'].line,
+ util._get_line_byte_from_position(bufnr, range['end'], offset_encoding),
+ {}
+ )[1]
+ end
+
+ local try_use_client
+ try_use_client = function(idx, client)
+ if not client then
return
end
- if result and result.placeholder then
- opts.default = result.placeholder
- if not new_name then npcall(vim.ui.input, opts, on_confirm) end
- elseif result and result.start and result['end'] and
- result.start.line == result['end'].line then
- local line = vfn.getline(result.start.line+1)
- local start_char = result.start.character+1
- local end_char = result['end'].character
- opts.default = string.sub(line, start_char, end_char)
- if not new_name then npcall(vim.ui.input, opts, on_confirm) end
+
+ ---@private
+ local function rename(name)
+ local params = util.make_position_params(win, client.offset_encoding)
+ params.newName = name
+ local handler = client.handlers['textDocument/rename']
+ or vim.lsp.handlers['textDocument/rename']
+ client.request('textDocument/rename', params, function(...)
+ handler(...)
+ try_use_client(next(clients, idx))
+ end, bufnr)
+ end
+
+ if client.supports_method('textDocument/prepareRename') then
+ local params = util.make_position_params(win, client.offset_encoding)
+ client.request('textDocument/prepareRename', params, function(err, result)
+ if err or result == nil then
+ if next(clients, idx) then
+ try_use_client(next(clients, idx))
+ else
+ local msg = err and ('Error on prepareRename: ' .. (err.message or ''))
+ or 'Nothing to rename'
+ vim.notify(msg, vim.log.levels.INFO)
+ end
+ return
+ end
+
+ if new_name then
+ rename(new_name)
+ return
+ end
+
+ local prompt_opts = {
+ prompt = 'New Name: ',
+ }
+ -- result: Range | { range: Range, placeholder: string }
+ if result.placeholder then
+ prompt_opts.default = result.placeholder
+ elseif result.start then
+ prompt_opts.default = get_text_at_range(result, client.offset_encoding)
+ elseif result.range then
+ prompt_opts.default = get_text_at_range(result.range, client.offset_encoding)
+ else
+ prompt_opts.default = cword
+ end
+ vim.ui.input(prompt_opts, function(input)
+ if not input or #input == 0 then
+ return
+ end
+ rename(input)
+ end)
+ end, bufnr)
else
- -- fallback to guessing symbol using <cword>
- --
- -- this can happen if the language server does not support prepareRename,
- -- returns an unexpected response, or requests for "default behavior"
- --
- -- see https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareRename
- opts.default = vfn.expand('<cword>')
- if not new_name then npcall(vim.ui.input, opts, on_confirm) end
+ assert(
+ client.supports_method('textDocument/rename'),
+ 'Client must support textDocument/rename'
+ )
+ if new_name then
+ rename(new_name)
+ return
+ end
+
+ local prompt_opts = {
+ prompt = 'New Name: ',
+ default = cword,
+ }
+ vim.ui.input(prompt_opts, function(input)
+ if not input or #input == 0 then
+ return
+ end
+ rename(input)
+ end)
end
- if new_name then on_confirm(new_name) end
end
- request('textDocument/prepareRename', util.make_position_params(), prepare_rename)
+
+ try_use_client(next(clients))
end
--- Lists all the references to the symbol under the cursor in the quickfix window.
@@ -308,10 +497,10 @@ end
---@param context (table) Context for the request
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
function M.references(context)
- validate { context = { context, 't', true } }
+ validate({ context = { context, 't', true } })
local params = util.make_position_params()
params.context = context or {
- includeDeclaration = true;
+ includeDeclaration = true,
}
request('textDocument/references', params)
end
@@ -325,14 +514,16 @@ end
---@private
local function pick_call_hierarchy_item(call_hierarchy_items)
- if not call_hierarchy_items then return end
+ if not call_hierarchy_items then
+ return
+ end
if #call_hierarchy_items == 1 then
return call_hierarchy_items[1]
end
local items = {}
for i, item in pairs(call_hierarchy_items) do
local entry = item.detail or item.name
- table.insert(items, string.format("%d. %s", i, entry))
+ table.insert(items, string.format('%d. %s', i, entry))
end
local choice = vim.fn.inputlist(items)
if choice < 1 or choice > #items then
@@ -354,8 +545,8 @@ local function call_hierarchy(method)
if client then
client.request(method, { item = call_hierarchy_item }, nil, ctx.bufnr)
else
- vim.notify(string.format(
- 'Client with id=%d disappeared during call hierarchy request', ctx.client_id),
+ vim.notify(
+ string.format('Client with id=%d disappeared during call hierarchy request', ctx.client_id),
vim.log.levels.WARN
)
end
@@ -391,20 +582,26 @@ end
--- Add the folder at path to the workspace folders. If {path} is
--- not provided, the user will be prompted for a path using |input()|.
function M.add_workspace_folder(workspace_folder)
- workspace_folder = workspace_folder or npcall(vfn.input, "Workspace Folder: ", vfn.expand('%:p:h'), 'dir')
- vim.api.nvim_command("redraw")
- if not (workspace_folder and #workspace_folder > 0) then return end
+ workspace_folder = workspace_folder
+ or npcall(vim.fn.input, 'Workspace Folder: ', vim.fn.expand('%:p:h'), 'dir')
+ api.nvim_command('redraw')
+ if not (workspace_folder and #workspace_folder > 0) then
+ return
+ end
if vim.fn.isdirectory(workspace_folder) == 0 then
- print(workspace_folder, " is not a valid directory")
+ print(workspace_folder, ' is not a valid directory')
return
end
- local params = util.make_workspace_params({{uri = vim.uri_from_fname(workspace_folder); name = workspace_folder}}, {{}})
+ local params = util.make_workspace_params(
+ { { uri = vim.uri_from_fname(workspace_folder), name = workspace_folder } },
+ { {} }
+ )
for _, client in pairs(vim.lsp.buf_get_clients()) do
local found = false
for _, folder in pairs(client.workspace_folders or {}) do
if folder.name == workspace_folder then
found = true
- print(workspace_folder, "is already part of this workspace")
+ print(workspace_folder, 'is already part of this workspace')
break
end
end
@@ -422,10 +619,16 @@ end
--- {path} is not provided, the user will be prompted for
--- a path using |input()|.
function M.remove_workspace_folder(workspace_folder)
- workspace_folder = workspace_folder or npcall(vfn.input, "Workspace Folder: ", vfn.expand('%:p:h'))
- vim.api.nvim_command("redraw")
- if not (workspace_folder and #workspace_folder > 0) then return end
- local params = util.make_workspace_params({{}}, {{uri = vim.uri_from_fname(workspace_folder); name = workspace_folder}})
+ workspace_folder = workspace_folder
+ or npcall(vim.fn.input, 'Workspace Folder: ', vim.fn.expand('%:p:h'))
+ api.nvim_command('redraw')
+ if not (workspace_folder and #workspace_folder > 0) then
+ return
+ end
+ local params = util.make_workspace_params(
+ { {} },
+ { { uri = vim.uri_from_fname(workspace_folder), name = workspace_folder } }
+ )
for _, client in pairs(vim.lsp.buf_get_clients()) do
for idx, folder in pairs(client.workspace_folders) do
if folder.name == workspace_folder then
@@ -435,7 +638,7 @@ function M.remove_workspace_folder(workspace_folder)
end
end
end
- print(workspace_folder, "is not currently part of the workspace")
+ print(workspace_folder, 'is not currently part of the workspace')
end
--- Lists all symbols in the current workspace in the quickfix window.
@@ -446,8 +649,11 @@ end
---
---@param query (string, optional)
function M.workspace_symbol(query)
- query = query or npcall(vfn.input, "Query: ")
- local params = {query = query}
+ query = query or npcall(vim.fn.input, 'Query: ')
+ if query == nil then
+ return
+ end
+ local params = { query = query }
request('workspace/symbol', params)
end
@@ -477,7 +683,6 @@ function M.clear_references()
util.buf_clear_references()
end
-
---@private
--
--- This is not public because the main extension point is
@@ -488,11 +693,42 @@ end
--- from multiple clients to have 1 single UI prompt for the user, yet we still
--- need to be able to link a `CodeAction|Command` to the right client for
--- `codeAction/resolve`
-local function on_code_action_results(results, ctx)
+local function on_code_action_results(results, ctx, options)
local action_tuples = {}
+
+ ---@private
+ local function action_filter(a)
+ -- filter by specified action kind
+ if options and options.context and options.context.only then
+ if not a.kind then
+ return false
+ end
+ local found = false
+ for _, o in ipairs(options.context.only) do
+ -- action kinds are hierarchical with . as a separator: when requesting only
+ -- 'quickfix' this filter allows both 'quickfix' and 'quickfix.foo', for example
+ if a.kind:find('^' .. o .. '$') or a.kind:find('^' .. o .. '%.') then
+ found = true
+ break
+ end
+ end
+ if not found then
+ return false
+ end
+ end
+ -- filter by user function
+ if options and options.filter and not options.filter(a) then
+ return false
+ end
+ -- no filter removed this action
+ return true
+ end
+
for client_id, result in pairs(results) do
for _, action in pairs(result.result or {}) do
- table.insert(action_tuples, { client_id, action })
+ if action_filter(action) then
+ table.insert(action_tuples, { client_id, action })
+ end
end
end
if #action_tuples == 0 then
@@ -503,7 +739,7 @@ local function on_code_action_results(results, ctx)
---@private
local function apply_action(action, client)
if action.edit then
- util.apply_workspace_edit(action.edit)
+ util.apply_workspace_edit(action.edit, client.offset_encoding)
end
if action.command then
local command = type(action.command) == 'table' and action.command or action
@@ -513,7 +749,14 @@ local function on_code_action_results(results, ctx)
enriched_ctx.client_id = client.id
fn(command, enriched_ctx)
else
- M.execute_command(command)
+ -- Not using command directly to exclude extra properties,
+ -- see https://github.com/python-lsp/python-lsp-server/issues/146
+ local params = {
+ command = command.command,
+ arguments = command.arguments,
+ workDoneToken = command.workDoneToken,
+ }
+ client.request('workspace/executeCommand', params, nil, ctx.bufnr)
end
end
end
@@ -537,11 +780,11 @@ local function on_code_action_results(results, ctx)
--
local client = vim.lsp.get_client_by_id(action_tuple[1])
local action = action_tuple[2]
- if not action.edit
- and client
- and type(client.resolved_capabilities.code_action) == 'table'
- and client.resolved_capabilities.code_action.resolveProvider then
-
+ if
+ not action.edit
+ and client
+ and vim.tbl_get(client.server_capabilities, 'codeActionProvider', 'resolveProvider')
+ then
client.request('codeAction/resolve', action, function(err, resolved_action)
if err then
vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
@@ -554,6 +797,13 @@ local function on_code_action_results(results, ctx)
end
end
+ -- If options.apply is given, and there are just one remaining code action,
+ -- apply it directly without querying the user.
+ if options and options.apply and #action_tuples == 1 then
+ on_user_choice(action_tuples[1])
+ return
+ end
+
vim.ui.select(action_tuples, {
prompt = 'Code actions:',
kind = 'codeaction',
@@ -564,39 +814,53 @@ local function on_code_action_results(results, ctx)
}, on_user_choice)
end
-
--- Requests code actions from all clients and calls the handler exactly once
--- with all aggregated results
---@private
-local function code_action_request(params)
- local bufnr = vim.api.nvim_get_current_buf()
+local function code_action_request(params, options)
+ local bufnr = api.nvim_get_current_buf()
local method = 'textDocument/codeAction'
vim.lsp.buf_request_all(bufnr, method, params, function(results)
- on_code_action_results(results, { bufnr = bufnr, method = method, params = params })
+ local ctx = { bufnr = bufnr, method = method, params = params }
+ on_code_action_results(results, ctx, options)
end)
end
--- Selects a code action available at the current
--- cursor position.
---
----@param context table|nil `CodeActionContext` of the LSP specification:
---- - diagnostics: (table|nil)
---- LSP `Diagnostic[]`. Inferred from the current
---- position if not provided.
---- - only: (string|nil)
---- LSP `CodeActionKind` used to filter the code actions.
---- Most language servers support values like `refactor`
---- or `quickfix`.
+---@param options table|nil Optional table which holds the following optional fields:
+--- - context (table|nil):
+--- Corresponds to `CodeActionContext` of the LSP specification:
+--- - diagnostics (table|nil):
+--- LSP `Diagnostic[]`. Inferred from the current
+--- position if not provided.
+--- - only (table|nil):
+--- List of LSP `CodeActionKind`s used to filter the code actions.
+--- Most language servers support values like `refactor`
+--- or `quickfix`.
+--- - filter (function|nil):
+--- Predicate function taking an `CodeAction` and returning a boolean.
+--- - apply (boolean|nil):
+--- When set to `true`, and there is just one remaining action
+--- (after filtering), the action is applied without user query.
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
-function M.code_action(context)
- validate { context = { context, 't', true } }
- context = context or {}
+function M.code_action(options)
+ validate({ options = { options, 't', true } })
+ options = options or {}
+ -- Detect old API call code_action(context) which should now be
+ -- code_action({ context = context} )
+ if options.diagnostics or options.only then
+ options = { options = options }
+ end
+ local context = options.context or {}
if not context.diagnostics then
- context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics()
+ local bufnr = api.nvim_get_current_buf()
+ context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics(bufnr)
end
local params = util.make_range_params()
params.context = context
- code_action_request(params)
+ code_action_request(params, options)
end
--- Performs |vim.lsp.buf.code_action()| for a given range.
@@ -606,8 +870,8 @@ end
--- - diagnostics: (table|nil)
--- LSP `Diagnostic[]`. Inferred from the current
--- position if not provided.
---- - only: (string|nil)
---- LSP `CodeActionKind` used to filter the code actions.
+--- - only: (table|nil)
+--- List of LSP `CodeActionKind`s used to filter the code actions.
--- Most language servers support values like `refactor`
--- or `quickfix`.
---@param start_pos ({number, number}, optional) mark-indexed position.
@@ -615,10 +879,11 @@ end
---@param end_pos ({number, number}, optional) mark-indexed position.
---Defaults to the end of the last visual selection.
function M.range_code_action(context, start_pos, end_pos)
- validate { context = { context, 't', true } }
+ validate({ context = { context, 't', true } })
context = context or {}
if not context.diagnostics then
- context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics()
+ local bufnr = api.nvim_get_current_buf()
+ context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics(bufnr)
end
local params = util.make_given_range_params(start_pos, end_pos)
params.context = context
@@ -630,16 +895,16 @@ end
---@param command_params table A valid `ExecuteCommandParams` object
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
function M.execute_command(command_params)
- validate {
+ validate({
command = { command_params.command, 's' },
- arguments = { command_params.arguments, 't', true }
- }
+ arguments = { command_params.arguments, 't', true },
+ })
command_params = {
- command=command_params.command,
- arguments=command_params.arguments,
- workDoneToken=command_params.workDoneToken,
+ command = command_params.command,
+ arguments = command_params.arguments,
+ workDoneToken = command_params.workDoneToken,
}
- request('workspace/executeCommand', command_params )
+ request('workspace/executeCommand', command_params)
end
return M
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index 9eb64c9a2e..4fa02c8db2 100644
--- a/runtime/lua/vim/lsp/codelens.lua
+++ b/runtime/lua/vim/lsp/codelens.lua
@@ -1,4 +1,5 @@
local util = require('vim.lsp.util')
+local log = require('vim.lsp.log')
local api = vim.api
local M = {}
@@ -11,7 +12,7 @@ local lens_cache_by_buf = setmetatable({}, {
__index = function(t, b)
local key = b > 0 and b or api.nvim_get_current_buf()
return rawget(t, key)
- end
+ end,
})
local namespaces = setmetatable({}, {
@@ -19,13 +20,12 @@ local namespaces = setmetatable({}, {
local value = api.nvim_create_namespace('vim_lsp_codelens:' .. key)
rawset(t, key, value)
return value
- end;
+ end,
})
---@private
M.__namespaces = namespaces
-
---@private
local function execute_lens(lens, bufnr, client_id)
local line = lens.range.start.line
@@ -43,10 +43,14 @@ local function execute_lens(lens, bufnr, client_id)
local command_provider = client.server_capabilities.executeCommandProvider
local commands = type(command_provider) == 'table' and command_provider.commands or {}
if not vim.tbl_contains(commands, command.command) then
- vim.notify(string.format(
- "Language server does not support command `%s`. This command may require a client extension.", command.command),
- vim.log.levels.WARN)
- return
+ vim.notify(
+ string.format(
+ 'Language server does not support command `%s`. This command may require a client extension.',
+ command.command
+ ),
+ vim.log.levels.WARN
+ )
+ return
end
client.request('workspace/executeCommand', command, function(...)
local result = vim.lsp.handlers['workspace/executeCommand'](...)
@@ -55,14 +59,15 @@ local function execute_lens(lens, bufnr, client_id)
end, bufnr)
end
-
--- Return all lenses for the given buffer
---
---@param bufnr number Buffer number. 0 can be used for the current buffer.
---@return table (`CodeLens[]`)
function M.get(bufnr)
local lenses_by_client = lens_cache_by_buf[bufnr or 0]
- if not lenses_by_client then return {} end
+ if not lenses_by_client then
+ return {}
+ end
local lenses = {}
for _, client_lenses in pairs(lenses_by_client) do
vim.list_extend(lenses, client_lenses)
@@ -70,7 +75,6 @@ function M.get(bufnr)
return lenses
end
-
--- Run the code lens in the current line
---
function M.run()
@@ -81,7 +85,7 @@ function M.run()
for client, lenses in pairs(lenses_by_client) do
for _, lens in pairs(lenses) do
if lens.range.start.line == (line - 1) then
- table.insert(options, {client=client, lens=lens})
+ table.insert(options, { client = client, lens = lens })
end
end
end
@@ -104,7 +108,6 @@ function M.run()
end
end
-
--- Display the lenses using virtual text
---
---@param lenses table of lenses to display (`CodeLens[] | null`)
@@ -130,21 +133,25 @@ function M.display(lenses, bufnr, client_id)
api.nvim_buf_clear_namespace(bufnr, ns, i, i + 1)
local chunks = {}
local num_line_lenses = #line_lenses
+ table.sort(line_lenses, function(a, b)
+ return a.range.start.character < b.range.start.character
+ end)
for j, lens in ipairs(line_lenses) do
local text = lens.command and lens.command.title or 'Unresolved lens ...'
- table.insert(chunks, {text, 'LspCodeLens' })
+ table.insert(chunks, { text, 'LspCodeLens' })
if j < num_line_lenses then
- table.insert(chunks, {' | ', 'LspCodeLensSeparator' })
+ table.insert(chunks, { ' | ', 'LspCodeLensSeparator' })
end
end
if #chunks > 0 then
- api.nvim_buf_set_extmark(bufnr, ns, i, 0, { virt_text = chunks,
- hl_mode="combine" })
+ api.nvim_buf_set_extmark(bufnr, ns, i, 0, {
+ virt_text = chunks,
+ hl_mode = 'combine',
+ })
end
end
end
-
--- Store lenses for a specific buffer and client
---
---@param lenses table of lenses to store (`CodeLens[] | null`)
@@ -157,16 +164,17 @@ function M.save(lenses, bufnr, client_id)
lens_cache_by_buf[bufnr] = lenses_by_client
local ns = namespaces[client_id]
api.nvim_buf_attach(bufnr, false, {
- on_detach = function(b) lens_cache_by_buf[b] = nil end,
+ on_detach = function(b)
+ lens_cache_by_buf[b] = nil
+ end,
on_lines = function(_, b, _, first_lnum, last_lnum)
api.nvim_buf_clear_namespace(b, ns, first_lnum, last_lnum)
- end
+ end,
})
end
lenses_by_client[client_id] = lenses
end
-
---@private
local function resolve_lenses(lenses, bufnr, client_id, callback)
lenses = lenses or {}
@@ -200,8 +208,7 @@ local function resolve_lenses(lenses, bufnr, client_id, callback)
ns,
lens.range.start.line,
0,
- { virt_text = {{ lens.command.title, 'LspCodeLens' }},
- hl_mode="combine" }
+ { virt_text = { { lens.command.title, 'LspCodeLens' } }, hl_mode = 'combine' }
)
end
countdown()
@@ -210,11 +217,14 @@ local function resolve_lenses(lenses, bufnr, client_id, callback)
end
end
-
--- |lsp-handler| for the method `textDocument/codeLens`
---
function M.on_codelens(err, result, ctx, _)
- assert(not err, vim.inspect(err))
+ if err then
+ active_refreshes[ctx.bufnr] = nil
+ local _ = log.error() and log.error('codelens', err)
+ return
+ end
M.save(result, ctx.bufnr, ctx.client_id)
@@ -222,12 +232,11 @@ function M.on_codelens(err, result, ctx, _)
-- once resolved.
M.display(result, ctx.bufnr, ctx.client_id)
resolve_lenses(result, ctx.bufnr, ctx.client_id, function()
- M.display(result, ctx.bufnr, ctx.client_id)
active_refreshes[ctx.bufnr] = nil
+ M.display(result, ctx.bufnr, ctx.client_id)
end)
end
-
--- Refresh the codelens for the current buffer
---
--- It is recommended to trigger this using an autocmd or via keymap.
@@ -238,15 +247,14 @@ end
---
function M.refresh()
local params = {
- textDocument = util.make_text_document_params()
+ textDocument = util.make_text_document_params(),
}
local bufnr = api.nvim_get_current_buf()
if active_refreshes[bufnr] then
return
end
active_refreshes[bufnr] = true
- vim.lsp.buf_request(0, 'textDocument/codeLens', params)
+ vim.lsp.buf_request(0, 'textDocument/codeLens', params, M.on_codelens)
end
-
return M
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index f38b469f3c..1f9d084e2b 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -22,17 +22,6 @@ local function get_client_id(client_id)
end
---@private
-local function get_bufnr(bufnr)
- if not bufnr then
- return vim.api.nvim_get_current_buf()
- elseif bufnr == 0 then
- return vim.api.nvim_get_current_buf()
- end
-
- return bufnr
-end
-
----@private
local function severity_lsp_to_vim(severity)
if type(severity) == 'string' then
severity = vim.lsp.protocol.DiagnosticSeverity[severity]
@@ -50,12 +39,12 @@ end
---@private
local function line_byte_from_position(lines, lnum, col, offset_encoding)
- if not lines or offset_encoding == "utf-8" then
+ if not lines or offset_encoding == 'utf-8' then
return col
end
local line = lines[lnum + 1]
- local ok, result = pcall(vim.str_byteindex, line, col, offset_encoding == "utf-16")
+ local ok, result = pcall(vim.str_byteindex, line, col, offset_encoding == 'utf-16')
if ok then
return result
end
@@ -75,7 +64,7 @@ local function get_buf_lines(bufnr)
return
end
- local content = f:read("*a")
+ local content = f:read('*a')
if not content then
-- Some LSP servers report diagnostics at a directory level, in which case
-- io.read() returns nil
@@ -83,7 +72,7 @@ local function get_buf_lines(bufnr)
return
end
- local lines = vim.split(content, "\n")
+ local lines = vim.split(content, '\n')
f:close()
return lines
end
@@ -92,10 +81,10 @@ end
local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
local buf_lines = get_buf_lines(bufnr)
local client = vim.lsp.get_client_by_id(client_id)
- local offset_encoding = client and client.offset_encoding or "utf-16"
+ local offset_encoding = client and client.offset_encoding or 'utf-16'
return vim.tbl_map(function(diagnostic)
local start = diagnostic.range.start
- local _end = diagnostic.range["end"]
+ local _end = diagnostic.range['end']
return {
lnum = start.line,
col = line_byte_from_position(buf_lines, start.line, start.character, offset_encoding),
@@ -104,8 +93,10 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
severity = severity_lsp_to_vim(diagnostic.severity),
message = diagnostic.message,
source = diagnostic.source,
+ code = diagnostic.code,
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,
tags = diagnostic.tags,
@@ -120,13 +111,14 @@ end
---@private
local function diagnostic_vim_to_lsp(diagnostics)
return vim.tbl_map(function(diagnostic)
- return vim.tbl_extend("error", {
+ return vim.tbl_extend('keep', {
+ -- "keep" the below fields over any duplicate fields in diagnostic.user_data.lsp
range = {
start = {
line = diagnostic.lnum,
character = diagnostic.col,
},
- ["end"] = {
+ ['end'] = {
line = diagnostic.end_lnum,
character = diagnostic.end_col,
},
@@ -134,6 +126,7 @@ local function diagnostic_vim_to_lsp(diagnostics)
severity = severity_vim_to_lsp(diagnostic.severity),
message = diagnostic.message,
source = diagnostic.source,
+ code = diagnostic.code,
}, diagnostic.user_data and (diagnostic.user_data.lsp or {}) or {})
end, diagnostics)
end
@@ -144,10 +137,10 @@ local _client_namespaces = {}
---
---@param client_id number The id of the LSP client
function M.get_namespace(client_id)
- vim.validate { client_id = { client_id, 'n' } }
+ vim.validate({ client_id = { client_id, 'n' } })
if not _client_namespaces[client_id] then
local client = vim.lsp.get_client_by_id(client_id)
- local name = string.format("vim.lsp.%s.%d", client and client.name or "unknown", client_id)
+ local name = string.format('vim.lsp.%s.%d', client and client.name or 'unknown', client_id)
_client_namespaces[client_id] = vim.api.nvim_create_namespace(name)
end
return _client_namespaces[client_id]
@@ -168,8 +161,8 @@ end
--- },
--- -- Use a function to dynamically turn signs off
--- -- and on, using buffer local variables
---- signs = function(bufnr, client_id)
---- return vim.bo[bufnr].show_signs == false
+--- signs = function(namespace, bufnr)
+--- return vim.b[bufnr].show_signs == true
--- end,
--- -- Disable a feature
--- update_in_insert = false,
@@ -181,7 +174,12 @@ end
function M.on_publish_diagnostics(_, result, ctx, config)
local client_id = ctx.client_id
local uri = result.uri
- local bufnr = vim.uri_to_bufnr(uri)
+ local fname = vim.uri_to_fname(uri)
+ local diagnostics = result.diagnostics
+ if #diagnostics == 0 and vim.fn.bufexists(fname) == 0 then
+ return
+ end
+ local bufnr = vim.fn.bufadd(fname)
if not bufnr then
return
@@ -189,13 +187,12 @@ function M.on_publish_diagnostics(_, result, ctx, config)
client_id = get_client_id(client_id)
local namespace = M.get_namespace(client_id)
- local diagnostics = result.diagnostics
if config then
for _, opt in pairs(config) do
if type(opt) == 'table' then
if not opt.severity and opt.severity_limit then
- opt.severity = {min=severity_lsp_to_vim(opt.severity_limit)}
+ opt.severity = { min = severity_lsp_to_vim(opt.severity_limit) }
end
end
end
@@ -230,72 +227,6 @@ function M.reset(client_id, buffer_client_map)
end)
end
--- Deprecated Functions {{{
-
-
---- Save diagnostics to the current buffer.
----
----@deprecated Prefer |vim.diagnostic.set()|
----
---- Handles saving diagnostics from multiple clients in the same buffer.
----@param diagnostics Diagnostic[]
----@param bufnr number
----@param client_id number
----@private
-function M.save(diagnostics, bufnr, client_id)
- vim.notify_once('vim.lsp.diagnostic.save is deprecated. See :h deprecated', vim.log.levels.WARN)
- local namespace = M.get_namespace(client_id)
- vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id))
-end
--- }}}
-
---- Get all diagnostics for clients
----
----@deprecated Prefer |vim.diagnostic.get()|
----
----@param client_id number Restrict included diagnostics to the client
---- If nil, diagnostics of all clients are included.
----@return table with diagnostics grouped by bufnr (bufnr: Diagnostic[])
-function M.get_all(client_id)
- vim.notify_once('vim.lsp.diagnostic.get_all is deprecated. See :h deprecated', vim.log.levels.WARN)
- local result = {}
- local namespace
- if client_id then
- namespace = M.get_namespace(client_id)
- end
- for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
- local diagnostics = diagnostic_vim_to_lsp(vim.diagnostic.get(bufnr, {namespace = namespace}))
- result[bufnr] = diagnostics
- end
- return result
-end
-
---- Return associated diagnostics for bufnr
----
----@deprecated Prefer |vim.diagnostic.get()|
----
----@param bufnr number
----@param client_id number|nil If nil, then return all of the diagnostics.
---- Else, return just the diagnostics associated with the client_id.
----@param predicate function|nil Optional function for filtering diagnostics
-function M.get(bufnr, client_id, predicate)
- vim.notify_once('vim.lsp.diagnostic.get is deprecated. See :h deprecated', vim.log.levels.WARN)
- predicate = predicate or function() return true end
- if client_id == nil then
- local all_diagnostics = {}
- vim.lsp.for_each_buffer_client(bufnr, function(_, iter_client_id, _)
- local iter_diagnostics = vim.tbl_filter(predicate, M.get(bufnr, iter_client_id))
- for _, diagnostic in ipairs(iter_diagnostics) do
- table.insert(all_diagnostics, diagnostic)
- end
- end)
- return all_diagnostics
- end
-
- local namespace = M.get_namespace(client_id)
- return diagnostic_vim_to_lsp(vim.tbl_filter(predicate, vim.diagnostic.get(bufnr, {namespace=namespace})))
-end
-
--- Get the diagnostics by line
---
--- Marked private as this is used internally by the LSP subsystem, but
@@ -317,7 +248,7 @@ function M.get_line_diagnostics(bufnr, line_nr, opts, client_id)
if opts.severity then
opts.severity = severity_lsp_to_vim(opts.severity)
elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
+ opts.severity = { min = severity_lsp_to_vim(opts.severity_limit) }
end
if client_id then
@@ -333,390 +264,4 @@ function M.get_line_diagnostics(bufnr, line_nr, opts, client_id)
return diagnostic_vim_to_lsp(vim.diagnostic.get(bufnr, opts))
end
---- Get the counts for a particular severity
----
----@deprecated Prefer |vim.diagnostic.get_count()|
----
----@param bufnr number The buffer number
----@param severity DiagnosticSeverity
----@param client_id number the client id
-function M.get_count(bufnr, severity, client_id)
- vim.notify_once('vim.lsp.diagnostic.get_count is deprecated. See :h deprecated', vim.log.levels.WARN)
- severity = severity_lsp_to_vim(severity)
- local opts = { severity = severity }
- if client_id ~= nil then
- opts.namespace = M.get_namespace(client_id)
- end
-
- return #vim.diagnostic.get(bufnr, opts)
-end
-
---- Get the previous diagnostic closest to the cursor_position
----
----@deprecated Prefer |vim.diagnostic.get_prev()|
----
----@param opts table See |vim.lsp.diagnostic.goto_next()|
----@return table Previous diagnostic
-function M.get_prev(opts)
- vim.notify_once('vim.lsp.diagnostic.get_prev is deprecated. See :h deprecated', vim.log.levels.WARN)
- if opts then
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- end
- return diagnostic_vim_to_lsp({vim.diagnostic.get_prev(opts)})[1]
-end
-
---- Return the pos, {row, col}, for the prev diagnostic in the current buffer.
----
----@deprecated Prefer |vim.diagnostic.get_prev_pos()|
----
----@param opts table See |vim.lsp.diagnostic.goto_next()|
----@return table Previous diagnostic position
-function M.get_prev_pos(opts)
- vim.notify_once('vim.lsp.diagnostic.get_prev_pos is deprecated. See :h deprecated', vim.log.levels.WARN)
- if opts then
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- end
- return vim.diagnostic.get_prev_pos(opts)
-end
-
---- Move to the previous diagnostic
----
----@deprecated Prefer |vim.diagnostic.goto_prev()|
----
----@param opts table See |vim.lsp.diagnostic.goto_next()|
-function M.goto_prev(opts)
- vim.notify_once('vim.lsp.diagnostic.goto_prev is deprecated. See :h deprecated', vim.log.levels.WARN)
- if opts then
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- end
- return vim.diagnostic.goto_prev(opts)
-end
-
---- Get the next diagnostic closest to the cursor_position
----
----@deprecated Prefer |vim.diagnostic.get_next()|
----
----@param opts table See |vim.lsp.diagnostic.goto_next()|
----@return table Next diagnostic
-function M.get_next(opts)
- vim.notify_once('vim.lsp.diagnostic.get_next is deprecated. See :h deprecated', vim.log.levels.WARN)
- if opts then
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- end
- return diagnostic_vim_to_lsp({vim.diagnostic.get_next(opts)})[1]
-end
-
---- Return the pos, {row, col}, for the next diagnostic in the current buffer.
----
----@deprecated Prefer |vim.diagnostic.get_next_pos()|
----
----@param opts table See |vim.lsp.diagnostic.goto_next()|
----@return table Next diagnostic position
-function M.get_next_pos(opts)
- vim.notify_once('vim.lsp.diagnostic.get_next_pos is deprecated. See :h deprecated', vim.log.levels.WARN)
- if opts then
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- end
- return vim.diagnostic.get_next_pos(opts)
-end
-
---- Move to the next diagnostic
----
----@deprecated Prefer |vim.diagnostic.goto_next()|
-function M.goto_next(opts)
- vim.notify_once('vim.lsp.diagnostic.goto_next is deprecated. See :h deprecated', vim.log.levels.WARN)
- if opts then
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- end
- return vim.diagnostic.goto_next(opts)
-end
-
---- Set signs for given diagnostics
----
----@deprecated Prefer |vim.diagnostic._set_signs()|
----
----@param diagnostics Diagnostic[]
----@param bufnr number The buffer number
----@param client_id number the client id
----@param sign_ns number|nil
----@param opts table Configuration for signs. Keys:
---- - priority: Set the priority of the signs.
---- - severity_limit (DiagnosticSeverity):
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
-function M.set_signs(diagnostics, bufnr, client_id, _, opts)
- vim.notify_once('vim.lsp.diagnostic.set_signs is deprecated. See :h deprecated', vim.log.levels.WARN)
- local namespace = M.get_namespace(client_id)
- if opts and not opts.severity and opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
-
- vim.diagnostic._set_signs(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id), opts)
-end
-
---- Set underline for given diagnostics
----
----@deprecated Prefer |vim.diagnostic._set_underline()|
----
----@param diagnostics Diagnostic[]
----@param bufnr number: The buffer number
----@param client_id number: The client id
----@param diagnostic_ns number|nil: The namespace
----@param opts table: Configuration table:
---- - severity_limit (DiagnosticSeverity):
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
-function M.set_underline(diagnostics, bufnr, client_id, _, opts)
- vim.notify_once('vim.lsp.diagnostic.set_underline is deprecated. See :h deprecated', vim.log.levels.WARN)
- local namespace = M.get_namespace(client_id)
- if opts and not opts.severity and opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- return vim.diagnostic._set_underline(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id), opts)
-end
-
---- Set virtual text given diagnostics
----
----@deprecated Prefer |vim.diagnostic._set_virtual_text()|
----
----@param diagnostics Diagnostic[]
----@param bufnr number
----@param client_id number
----@param diagnostic_ns number
----@param opts table Options on how to display virtual text. Keys:
---- - prefix (string): Prefix to display before virtual text on line
---- - spacing (number): Number of spaces to insert before virtual text
---- - severity_limit (DiagnosticSeverity):
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
-function M.set_virtual_text(diagnostics, bufnr, client_id, _, opts)
- vim.notify_once('vim.lsp.diagnostic.set_virtual_text is deprecated. See :h deprecated', vim.log.levels.WARN)
- local namespace = M.get_namespace(client_id)
- if opts and not opts.severity and opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- return vim.diagnostic._set_virtual_text(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id), opts)
-end
-
---- Default function to get text chunks to display using |nvim_buf_set_extmark()|.
----
----@deprecated Prefer |vim.diagnostic.get_virt_text_chunks()|
----
----@param bufnr number The buffer to display the virtual text in
----@param line number The line number to display the virtual text on
----@param line_diags Diagnostic[] The diagnostics associated with the line
----@param opts table See {opts} from |vim.lsp.diagnostic.set_virtual_text()|
----@return an array of [text, hl_group] arrays. This can be passed directly to
---- the {virt_text} option of |nvim_buf_set_extmark()|.
-function M.get_virtual_text_chunks_for_line(bufnr, _, line_diags, opts)
- vim.notify_once('vim.lsp.diagnostic.get_virtual_text_chunks_for_line is deprecated. See :h deprecated', vim.log.levels.WARN)
- return vim.diagnostic._get_virt_text_chunks(diagnostic_lsp_to_vim(line_diags, bufnr), opts)
-end
-
---- Open a floating window with the diagnostics from {position}
----
----@deprecated Prefer |vim.diagnostic.show_position_diagnostics()|
----
----@param opts table|nil Configuration keys
---- - severity: (DiagnosticSeverity, default nil)
---- - Only return diagnostics with this severity. Overrides severity_limit
---- - severity_limit: (DiagnosticSeverity, default nil)
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
---- - all opts for |show_diagnostics()| can be used here
----@param buf_nr number|nil The buffer number
----@param position table|nil The (0,0)-indexed position
----@return table {popup_bufnr, win_id}
-function M.show_position_diagnostics(opts, buf_nr, position)
- vim.notify_once('vim.lsp.diagnostic.show_position_diagnostics is deprecated. See :h deprecated', vim.log.levels.WARN)
- opts = opts or {}
- opts.scope = "cursor"
- opts.pos = position
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- return vim.diagnostic.open_float(buf_nr, opts)
-end
-
---- Open a floating window with the diagnostics from {line_nr}
----
----@deprecated Prefer |vim.diagnostic.open_float()|
----
----@param opts table Configuration table
---- - all opts for |vim.lsp.diagnostic.get_line_diagnostics()| and
---- |show_diagnostics()| can be used here
----@param buf_nr number|nil The buffer number
----@param line_nr number|nil The line number
----@param client_id number|nil the client id
----@return table {popup_bufnr, win_id}
-function M.show_line_diagnostics(opts, buf_nr, line_nr, client_id)
- vim.notify_once('vim.lsp.diagnostic.show_line_diagnostics is deprecated. See :h deprecated', vim.log.levels.WARN)
- opts = opts or {}
- opts.scope = "line"
- opts.pos = line_nr
- if client_id then
- opts.namespace = M.get_namespace(client_id)
- end
- return vim.diagnostic.open_float(buf_nr, opts)
-end
-
---- Redraw diagnostics for the given buffer and client
----
----@deprecated Prefer |vim.diagnostic.show()|
----
---- This calls the "textDocument/publishDiagnostics" handler manually using
---- the cached diagnostics already received from the server. This can be useful
---- for redrawing diagnostics after making changes in diagnostics
---- configuration. |lsp-handler-configuration|
----
----@param bufnr (optional, number): Buffer handle, defaults to current
----@param client_id (optional, number): Redraw diagnostics for the given
---- client. The default is to redraw diagnostics for all attached
---- clients.
-function M.redraw(bufnr, client_id)
- vim.notify_once('vim.lsp.diagnostic.redraw is deprecated. See :h deprecated', vim.log.levels.WARN)
- bufnr = get_bufnr(bufnr)
- if not client_id then
- return vim.lsp.for_each_buffer_client(bufnr, function(client)
- M.redraw(bufnr, client.id)
- end)
- end
-
- local namespace = M.get_namespace(client_id)
- return vim.diagnostic.show(namespace, bufnr)
-end
-
---- Sets the quickfix list
----
----@deprecated Prefer |vim.diagnostic.setqflist()|
----
----@param opts table|nil Configuration table. Keys:
---- - {open}: (boolean, default true)
---- - Open quickfix list after set
---- - {client_id}: (number)
---- - If nil, will consider all clients attached to buffer.
---- - {severity}: (DiagnosticSeverity)
---- - Exclusive severity to consider. Overrides {severity_limit}
---- - {severity_limit}: (DiagnosticSeverity)
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
---- - {workspace}: (boolean, default true)
---- - Set the list with workspace diagnostics
-function M.set_qflist(opts)
- vim.notify_once('vim.lsp.diagnostic.set_qflist is deprecated. See :h deprecated', vim.log.levels.WARN)
- opts = opts or {}
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- if opts.client_id then
- opts.client_id = nil
- opts.namespace = M.get_namespace(opts.client_id)
- end
- local workspace = vim.F.if_nil(opts.workspace, true)
- opts.bufnr = not workspace and 0
- return vim.diagnostic.setqflist(opts)
-end
-
---- Sets the location list
----
----@deprecated Prefer |vim.diagnostic.setloclist()|
----
----@param opts table|nil Configuration table. Keys:
---- - {open}: (boolean, default true)
---- - Open loclist after set
---- - {client_id}: (number)
---- - If nil, will consider all clients attached to buffer.
---- - {severity}: (DiagnosticSeverity)
---- - Exclusive severity to consider. Overrides {severity_limit}
---- - {severity_limit}: (DiagnosticSeverity)
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
---- - {workspace}: (boolean, default false)
---- - Set the list with workspace diagnostics
-function M.set_loclist(opts)
- vim.notify_once('vim.lsp.diagnostic.set_loclist is deprecated. See :h deprecated', vim.log.levels.WARN)
- opts = opts or {}
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = {min=severity_lsp_to_vim(opts.severity_limit)}
- end
- if opts.client_id then
- opts.client_id = nil
- opts.namespace = M.get_namespace(opts.client_id)
- end
- local workspace = vim.F.if_nil(opts.workspace, false)
- opts.bufnr = not workspace and 0
- return vim.diagnostic.setloclist(opts)
-end
-
---- Disable diagnostics for the given buffer and client
----
----@deprecated Prefer |vim.diagnostic.disable()|
----
----@param bufnr (optional, number): Buffer handle, defaults to current
----@param client_id (optional, number): Disable diagnostics for the given
---- client. The default is to disable diagnostics for all attached
---- clients.
--- Note that when diagnostics are disabled for a buffer, the server will still
--- send diagnostic information and the client will still process it. The
--- diagnostics are simply not displayed to the user.
-function M.disable(bufnr, client_id)
- vim.notify_once('vim.lsp.diagnostic.disable is deprecated. See :h deprecated', vim.log.levels.WARN)
- if not client_id then
- return vim.lsp.for_each_buffer_client(bufnr, function(client)
- M.disable(bufnr, client.id)
- end)
- end
-
- bufnr = get_bufnr(bufnr)
- local namespace = M.get_namespace(client_id)
- return vim.diagnostic.disable(bufnr, namespace)
-end
-
---- Enable diagnostics for the given buffer and client
----
----@deprecated Prefer |vim.diagnostic.enable()|
----
----@param bufnr (optional, number): Buffer handle, defaults to current
----@param client_id (optional, number): Enable diagnostics for the given
---- client. The default is to enable diagnostics for all attached
---- clients.
-function M.enable(bufnr, client_id)
- vim.notify_once('vim.lsp.diagnostic.enable is deprecated. See :h deprecated', vim.log.levels.WARN)
- if not client_id then
- return vim.lsp.for_each_buffer_client(bufnr, function(client)
- M.enable(bufnr, client.id)
- end)
- end
-
- bufnr = get_bufnr(bufnr)
- local namespace = M.get_namespace(client_id)
- return vim.diagnostic.enable(bufnr, namespace)
-end
-
--- }}}
-
return M
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index a48302cc4b..3b869d8f5c 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -1,6 +1,6 @@
-local log = require 'vim.lsp.log'
-local protocol = require 'vim.lsp.protocol'
-local util = require 'vim.lsp.util'
+local log = require('vim.lsp.log')
+local protocol = require('vim.lsp.protocol')
+local util = require('vim.lsp.util')
local vim = vim
local api = vim.api
@@ -12,8 +12,8 @@ local M = {}
--- Writes to error buffer.
---@param ... (table of strings) Will be concatenated before being written
local function err_message(...)
- vim.notify(table.concat(vim.tbl_flatten{...}), vim.log.levels.ERROR)
- api.nvim_command("redraw")
+ vim.notify(table.concat(vim.tbl_flatten({ ... })), vim.log.levels.ERROR)
+ api.nvim_command('redraw')
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
@@ -25,51 +25,56 @@ end
local function progress_handler(_, result, ctx, _)
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
- local client_name = client and client.name or string.format("id=%d", client_id)
+ local client_name = client and client.name or string.format('id=%d', client_id)
if not client then
- err_message("LSP[", client_name, "] client has shut down after sending the message")
+ err_message('LSP[', client_name, '] client has shut down during progress update')
return vim.NIL
end
- local val = result.value -- unspecified yet
- local token = result.token -- string or number
-
+ local val = result.value -- unspecified yet
+ local token = result.token -- string or number
+ if type(val) ~= 'table' then
+ val = { content = val }
+ end
if val.kind then
if val.kind == 'begin' then
client.messages.progress[token] = {
title = val.title,
+ cancellable = val.cancellable,
message = val.message,
percentage = val.percentage,
}
elseif val.kind == 'report' then
- client.messages.progress[token].message = val.message;
- client.messages.progress[token].percentage = val.percentage;
+ client.messages.progress[token].cancellable = val.cancellable
+ client.messages.progress[token].message = val.message
+ client.messages.progress[token].percentage = val.percentage
elseif val.kind == 'end' then
if client.messages.progress[token] == nil then
- err_message("LSP[", client_name, "] received `end` message with no corresponding `begin`")
+ err_message('LSP[', client_name, '] received `end` message with no corresponding `begin`')
else
client.messages.progress[token].message = val.message
client.messages.progress[token].done = true
end
end
else
- table.insert(client.messages, {content = val, show_once = true, shown = 0})
+ client.messages.progress[token] = val
+ client.messages.progress[token].done = true
end
- vim.api.nvim_command("doautocmd <nomodeline> User LspProgressUpdate")
+ api.nvim_exec_autocmds('User', { pattern = 'LspProgressUpdate', modeline = false })
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress
M['$/progress'] = progress_handler
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create
-M['window/workDoneProgress/create'] = function(_, result, ctx)
+M['window/workDoneProgress/create'] = function(_, result, ctx)
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
- local token = result.token -- string or number
- local client_name = client and client.name or string.format("id=%d", client_id)
+ local token = result.token -- string or number
+ local client_name = client and client.name or string.format('id=%d', client_id)
if not client then
- err_message("LSP[", client_name, "] client has shut down after sending the message")
+ err_message('LSP[', client_name, '] client has shut down while creating progress report')
return vim.NIL
end
client.messages.progress[token] = {}
@@ -78,20 +83,19 @@ end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessageRequest
M['window/showMessageRequest'] = function(_, result)
-
local actions = result.actions
print(result.message)
- local option_strings = {result.message, "\nRequest Actions:"}
+ local option_strings = { result.message, '\nRequest Actions:' }
for i, action in ipairs(actions) do
local title = action.title:gsub('\r\n', '\\r\\n')
title = title:gsub('\n', '\\n')
- table.insert(option_strings, string.format("%d. %s", i, title))
+ table.insert(option_strings, string.format('%d. %s', i, title))
end
-- window/showMessageRequest can return either MessageActionItem[] or null.
local choice = vim.fn.inputlist(option_strings)
if choice < 1 or choice > #actions then
- return vim.NIL
+ return vim.NIL
else
return actions[choice]
end
@@ -100,27 +104,32 @@ end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability
M['client/registerCapability'] = function(_, _, ctx)
local client_id = ctx.client_id
- local warning_tpl = "The language server %s triggers a registerCapability "..
- "handler despite dynamicRegistration set to false. "..
- "Report upstream, this warning is harmless"
+ local warning_tpl = 'The language server %s triggers a registerCapability '
+ .. 'handler despite dynamicRegistration set to false. '
+ .. 'Report upstream, this warning is harmless'
local client = vim.lsp.get_client_by_id(client_id)
- local client_name = client and client.name or string.format("id=%d", client_id)
+ local client_name = client and client.name or string.format('id=%d', client_id)
local warning = string.format(warning_tpl, client_name)
log.warn(warning)
return vim.NIL
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
-M['workspace/applyEdit'] = function(_, workspace_edit)
- if not workspace_edit then return end
+M['workspace/applyEdit'] = function(_, workspace_edit, ctx)
+ if not workspace_edit then
+ return
+ end
-- TODO(ashkan) Do something more with label?
+ local client_id = ctx.client_id
+ local client = vim.lsp.get_client_by_id(client_id)
if workspace_edit.label then
- print("Workspace edit", workspace_edit.label)
+ print('Workspace edit', workspace_edit.label)
end
- local status, result = pcall(util.apply_workspace_edit, workspace_edit.edit)
+ local status, result =
+ pcall(util.apply_workspace_edit, workspace_edit.edit, client.offset_encoding)
return {
- applied = status;
- failureReason = result;
+ applied = status,
+ failureReason = result,
}
end
@@ -129,7 +138,11 @@ M['workspace/configuration'] = function(_, result, ctx)
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
if not client then
- err_message("LSP[id=", client_id, "] client has shut down after sending the message")
+ err_message(
+ 'LSP[',
+ client_id,
+ '] client has shut down after sending a workspace/configuration request'
+ )
return
end
if not result.items then
@@ -139,7 +152,7 @@ M['workspace/configuration'] = function(_, result, ctx)
local response = {}
for _, item in ipairs(result.items) do
if item.section then
- local value = util.lookup_section(client.config.settings, item.section) or vim.NIL
+ local value = util.lookup_section(client.config.settings, item.section)
-- For empty sections with no explicit '' key, return settings as is
if value == vim.NIL and item.section == '' then
value = client.config.settings or vim.NIL
@@ -150,6 +163,17 @@ M['workspace/configuration'] = function(_, result, ctx)
return response
end
+--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_workspaceFolders
+M['workspace/workspaceFolders'] = function(_, _, ctx)
+ local client_id = ctx.client_id
+ local client = vim.lsp.get_client_by_id(client_id)
+ if not client then
+ err_message('LSP[id=', client_id, '] client has shut down after sending the message')
+ return
+ end
+ return client.workspace_folders or vim.NIL
+end
+
M['textDocument/publishDiagnostics'] = function(...)
return require('vim.lsp.diagnostic').on_publish_diagnostics(...)
end
@@ -158,7 +182,30 @@ M['textDocument/codeLens'] = function(...)
return require('vim.lsp.codelens').on_codelens(...)
end
-
+--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
+M['textDocument/references'] = function(_, result, ctx, config)
+ if not result or vim.tbl_isempty(result) then
+ vim.notify('No references found')
+ else
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ config = config or {}
+ if config.loclist then
+ vim.fn.setloclist(0, {}, ' ', {
+ title = 'References',
+ items = util.locations_to_items(result, client.offset_encoding),
+ context = ctx,
+ })
+ api.nvim_command('lopen')
+ else
+ vim.fn.setqflist({}, ' ', {
+ title = 'References',
+ items = util.locations_to_items(result, client.offset_encoding),
+ context = ctx,
+ })
+ api.nvim_command('botright copen')
+ end
+ end
+end
---@private
--- Return a function that converts LSP responses to list items and opens the list
@@ -169,69 +216,88 @@ end
--- loclist: (boolean) use the location list (default is to use the quickfix list)
---
---@param map_result function `((resp, bufnr) -> list)` to convert the response
----@param entity name of the resource used in a `not found` error message
-local function response_to_list(map_result, entity)
- return function(_,result, ctx, config)
+---@param entity string name of the resource used in a `not found` error message
+---@param title_fn function Function to call to generate list title
+local function response_to_list(map_result, entity, title_fn)
+ return function(_, result, ctx, config)
if not result or vim.tbl_isempty(result) then
vim.notify('No ' .. entity .. ' found')
else
config = config or {}
if config.loclist then
vim.fn.setloclist(0, {}, ' ', {
- title = 'Language Server';
- items = map_result(result, ctx.bufnr);
+ title = title_fn(ctx),
+ items = map_result(result, ctx.bufnr),
+ context = ctx,
})
- api.nvim_command("lopen")
+ api.nvim_command('lopen')
else
vim.fn.setqflist({}, ' ', {
- title = 'Language Server';
- items = map_result(result, ctx.bufnr);
+ title = title_fn(ctx),
+ items = map_result(result, ctx.bufnr),
+ context = ctx,
})
- api.nvim_command("botright copen")
+ api.nvim_command('botright copen')
end
end
end
end
-
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
-M['textDocument/references'] = response_to_list(util.locations_to_items, 'references')
-
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
-M['textDocument/documentSymbol'] = response_to_list(util.symbols_to_items, 'document symbols')
+M['textDocument/documentSymbol'] = response_to_list(
+ util.symbols_to_items,
+ 'document symbols',
+ function(ctx)
+ local fname = vim.fn.fnamemodify(vim.uri_to_fname(ctx.params.textDocument.uri), ':.')
+ return string.format('Symbols in %s', fname)
+ end
+)
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol
-M['workspace/symbol'] = response_to_list(util.symbols_to_items, 'symbols')
+M['workspace/symbol'] = response_to_list(util.symbols_to_items, 'symbols', function(ctx)
+ return string.format("Symbols matching '%s'", ctx.params.query)
+end)
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename
-M['textDocument/rename'] = function(_, result, _)
- if not result then return end
- util.apply_workspace_edit(result)
+M['textDocument/rename'] = function(_, result, ctx, _)
+ if not result then
+ return
+ end
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ util.apply_workspace_edit(result, client.offset_encoding)
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting
M['textDocument/rangeFormatting'] = function(_, result, ctx, _)
- if not result then return end
- util.apply_text_edits(result, ctx.bufnr)
+ if not result then
+ return
+ end
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ util.apply_text_edits(result, ctx.bufnr, client.offset_encoding)
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
M['textDocument/formatting'] = function(_, result, ctx, _)
- if not result then return end
- util.apply_text_edits(result, ctx.bufnr)
+ if not result then
+ return
+ end
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ util.apply_text_edits(result, ctx.bufnr, client.offset_encoding)
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
M['textDocument/completion'] = function(_, result, _, _)
- if vim.tbl_isempty(result or {}) then return end
+ if vim.tbl_isempty(result or {}) then
+ return
+ end
local row, col = unpack(api.nvim_win_get_cursor(0))
- local line = assert(api.nvim_buf_get_lines(0, row-1, row, false)[1])
- local line_to_cursor = line:sub(col+1)
+ local line = assert(api.nvim_buf_get_lines(0, row - 1, row, false)[1])
+ local line_to_cursor = line:sub(col + 1)
local textMatch = vim.fn.match(line_to_cursor, '\\k*$')
- local prefix = line_to_cursor:sub(textMatch+1)
+ local prefix = line_to_cursor:sub(textMatch + 1)
local matches = util.text_document_completion_list_to_complete_items(result, prefix)
- vim.fn.complete(textMatch+1, matches)
+ vim.fn.complete(textMatch + 1, matches)
end
--- |lsp-handler| for the method "textDocument/hover"
@@ -251,16 +317,16 @@ function M.hover(_, result, ctx, config)
config = config or {}
config.focus_id = ctx.method
if not (result and result.contents) then
- -- return { 'No information available' }
+ vim.notify('No information available')
return
end
local markdown_lines = util.convert_input_to_markdown_lines(result.contents)
markdown_lines = util.trim_empty_lines(markdown_lines)
if vim.tbl_isempty(markdown_lines) then
- -- return { 'No information available' }
+ vim.notify('No information available')
return
end
- return util.open_floating_preview(markdown_lines, "markdown", config)
+ return util.open_floating_preview(markdown_lines, 'markdown', config)
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
@@ -272,24 +338,30 @@ M['textDocument/hover'] = M.hover
---@param result (table) result of LSP method; a location or a list of locations.
---@param ctx (table) table containing the context of the request, including the method
---(`textDocument/definition` can return `Location` or `Location[]`
-local function location_handler(_, result, ctx, _)
+local function location_handler(_, result, ctx, config)
if result == nil or vim.tbl_isempty(result) then
local _ = log.info() and log.info(ctx.method, 'No location found')
return nil
end
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+
+ config = config or {}
-- textDocument/definition can return Location or Location[]
-- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition
if vim.tbl_islist(result) then
- util.jump_to_location(result[1])
+ util.jump_to_location(result[1], client.offset_encoding, config.reuse_win)
if #result > 1 then
- vim.fn.setqflist({}, ' ', {title = 'LSP locations', items = util.locations_to_items(result)})
- api.nvim_command("copen")
+ vim.fn.setqflist({}, ' ', {
+ title = 'LSP locations',
+ items = util.locations_to_items(result, client.offset_encoding),
+ })
+ api.nvim_command('botright copen')
end
else
- util.jump_to_location(result)
+ util.jump_to_location(result, client.offset_encoding, config.reuse_win)
end
end
@@ -328,7 +400,8 @@ function M.signature_help(_, result, ctx, config)
return
end
local client = vim.lsp.get_client_by_id(ctx.client_id)
- local triggers = client.resolved_capabilities.signature_help_trigger_characters
+ local triggers =
+ vim.tbl_get(client.server_capabilities, 'signatureHelpProvider', 'triggerCharacters')
local ft = api.nvim_buf_get_option(ctx.bufnr, 'filetype')
local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft, triggers)
lines = util.trim_empty_lines(lines)
@@ -338,9 +411,9 @@ function M.signature_help(_, result, ctx, config)
end
return
end
- local fbuf, fwin = util.open_floating_preview(lines, "markdown", config)
+ local fbuf, fwin = util.open_floating_preview(lines, 'markdown', config)
if hl then
- api.nvim_buf_add_highlight(fbuf, -1, "LspSignatureActiveParameter", 0, unpack(hl))
+ api.nvim_buf_add_highlight(fbuf, -1, 'LspSignatureActiveParameter', 0, unpack(hl))
end
return fbuf, fwin
end
@@ -350,10 +423,14 @@ M['textDocument/signatureHelp'] = M.signature_help
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight
M['textDocument/documentHighlight'] = function(_, result, ctx, _)
- if not result then return end
+ if not result then
+ return
+ end
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
- if not client then return end
+ if not client then
+ return
+ end
util.buf_highlight_references(ctx.bufnr, result, client.offset_encoding)
end
@@ -366,7 +443,9 @@ end
---@returns `CallHierarchyOutgoingCall[]` if {direction} is `"to"`,
local make_call_hierarchy_handler = function(direction)
return function(_, result)
- if not result then return end
+ if not result then
+ return
+ end
local items = {}
for _, call_hierarchy_call in pairs(result) do
local call_hierarchy_item = call_hierarchy_call[direction]
@@ -379,8 +458,8 @@ local make_call_hierarchy_handler = function(direction)
})
end
end
- vim.fn.setqflist({}, ' ', {title = 'LSP call hierarchy', items = items})
- api.nvim_command("copen")
+ vim.fn.setqflist({}, ' ', { title = 'LSP call hierarchy', items = items })
+ api.nvim_command('botright copen')
end
end
@@ -396,15 +475,15 @@ M['window/logMessage'] = function(_, result, ctx, _)
local message = result.message
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
- local client_name = client and client.name or string.format("id=%d", client_id)
+ local client_name = client and client.name or string.format('id=%d', client_id)
if not client then
- err_message("LSP[", client_name, "] client has shut down after sending the message")
+ err_message('LSP[', client_name, '] client has shut down after sending ', message)
end
if message_type == protocol.MessageType.Error then
log.error(message)
elseif message_type == protocol.MessageType.Warning then
log.warn(message)
- elseif message_type == protocol.MessageType.Info or message_type == protocol.MessageType.Log then
+ elseif message_type == protocol.MessageType.Info or message_type == protocol.MessageType.Log then
log.info(message)
else
log.debug(message)
@@ -418,15 +497,15 @@ M['window/showMessage'] = function(_, result, ctx, _)
local message = result.message
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
- local client_name = client and client.name or string.format("id=%d", client_id)
+ local client_name = client and client.name or string.format('id=%d', client_id)
if not client then
- err_message("LSP[", client_name, "] client has shut down after sending the message")
+ err_message('LSP[', client_name, '] client has shut down after sending ', message)
end
if message_type == protocol.MessageType.Error then
- err_message("LSP[", client_name, "] ", message)
+ err_message('LSP[', client_name, '] ', message)
else
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))
+ api.nvim_out_write(string.format('LSP[%s][%s] %s\n', client_name, message_type_name, message))
end
return result
end
@@ -434,9 +513,13 @@ end
-- Add boilerplate error validation and logging for all of these.
for k, fn in pairs(M) do
M[k] = function(err, result, ctx, config)
- local _ = log.trace() and log.trace('default_handler', ctx.method, {
- err = err, result = result, ctx=vim.inspect(ctx), config = config
- })
+ local _ = log.trace()
+ and log.trace('default_handler', ctx.method, {
+ err = err,
+ result = result,
+ ctx = vim.inspect(ctx),
+ config = config,
+ })
if err then
-- LSP spec:
@@ -448,7 +531,7 @@ for k, fn in pairs(M) do
-- Per LSP, don't show ContentModified error to the user.
if err.code ~= protocol.ErrorCodes.ContentModified then
local client = vim.lsp.get_client_by_id(ctx.client_id)
- local client_name = client and client.name or string.format("client_id=%d", ctx.client_id)
+ local client_name = client and client.name or string.format('client_id=%d', ctx.client_id)
err_message(client_name .. ': ' .. tostring(err.code) .. ': ' .. err.message)
end
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index ed3eea59df..ba730e3d6d 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -8,20 +8,25 @@ function M.check()
local log = require('vim.lsp.log')
local current_log_level = log.get_level()
local log_level_string = log.levels[current_log_level]
- report_info(string.format("LSP log level : %s", log_level_string))
+ report_info(string.format('LSP log level : %s', log_level_string))
if current_log_level < log.levels.WARN then
- report_warn(string.format("Log level %s will cause degraded performance and high disk usage", log_level_string))
+ report_warn(
+ string.format(
+ 'Log level %s will cause degraded performance and high disk usage',
+ log_level_string
+ )
+ )
end
local log_path = vim.lsp.get_log_path()
- report_info(string.format("Log path: %s", log_path))
+ report_info(string.format('Log path: %s', log_path))
- local log_size = vim.loop.fs_stat(log_path).size
+ local log_file = vim.loop.fs_stat(log_path)
+ local log_size = log_file and log_file.size or 0
local report_fn = (log_size / 1000000 > 100 and report_warn or report_info)
- report_fn(string.format("Log size: %d KB", log_size / 1000 ))
+ report_fn(string.format('Log size: %d KB', log_size / 1000))
end
return M
-
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index e0b5653587..6c6ba0f206 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -8,22 +8,29 @@ local log = {}
-- Log level dictionary with reverse lookup as well.
--
-- Can be used to lookup the number from the name or the name from the number.
--- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR"
+-- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
-- Level numbers begin with "TRACE" at 0
log.levels = vim.deepcopy(vim.log.levels)
-- Default log level is warn.
local current_log_level = log.levels.WARN
-local log_date_format = "%F %H:%M:%S"
-local format_func = function(arg) return vim.inspect(arg, {newline=''}) end
+local log_date_format = '%F %H:%M:%S'
+local format_func = function(arg)
+ return vim.inspect(arg, { newline = '' })
+end
do
- local path_sep = vim.loop.os_uname().version:match("Windows") and "\\" or "/"
+ local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/'
---@private
local function path_join(...)
- return table.concat(vim.tbl_flatten{...}, path_sep)
+ return table.concat(vim.tbl_flatten({ ... }), path_sep)
end
- local logfilename = path_join(vim.fn.stdpath('cache'), 'lsp.log')
+ local logfilename = path_join(vim.fn.stdpath('log'), 'lsp.log')
+
+ -- TODO: Ideally the directory should be created in open_logfile(), right
+ -- before opening the log file, but open_logfile() can be called from libuv
+ -- callbacks, where using fn.mkdir() is not allowed.
+ vim.fn.mkdir(vim.fn.stdpath('log'), 'p')
--- Returns the log filename.
---@returns (string) log filename
@@ -31,21 +38,40 @@ do
return logfilename
end
- vim.fn.mkdir(vim.fn.stdpath('cache'), "p")
- local logfile = assert(io.open(logfilename, "a+"))
-
- local log_info = vim.loop.fs_stat(logfilename)
- if log_info and log_info.size > 1e9 then
- local warn_msg = string.format(
- "LSP client log is large (%d MB): %s",
- log_info.size / (1000 * 1000),
- logfilename
- )
- vim.notify(warn_msg)
+ local logfile, openerr
+ ---@private
+ --- Opens log file. Returns true if file is open, false on error
+ local function open_logfile()
+ -- Try to open file only once
+ if logfile then
+ return true
+ end
+ if openerr then
+ return false
+ end
+
+ logfile, openerr = io.open(logfilename, 'a+')
+ if not logfile then
+ local err_msg = string.format('Failed to open LSP client log file: %s', openerr)
+ vim.notify(err_msg, vim.log.levels.ERROR)
+ return false
+ end
+
+ local log_info = vim.loop.fs_stat(logfilename)
+ if log_info and log_info.size > 1e9 then
+ local warn_msg = string.format(
+ 'LSP client log is large (%d MB): %s',
+ log_info.size / (1000 * 1000),
+ logfilename
+ )
+ vim.notify(warn_msg)
+ end
+
+ -- Start message for logging
+ logfile:write(string.format('[START][%s] LSP logging initiated\n', os.date(log_date_format)))
+ return true
end
- -- Start message for logging
- logfile:write(string.format("[START][%s] LSP logging initiated\n", os.date(log_date_format)))
for level, levelnr in pairs(log.levels) do
-- Also export the log level on the root object.
log[level] = levelnr
@@ -63,23 +89,38 @@ do
-- ```
--
-- This way you can avoid string allocations if the log level isn't high enough.
- log[level:lower()] = function(...)
- local argc = select("#", ...)
- if levelnr < current_log_level then return false end
- if argc == 0 then return true end
- local info = debug.getinfo(2, "Sl")
- local header = string.format("[%s][%s] ...%s:%s", level, os.date(log_date_format), string.sub(info.short_src, #info.short_src - 15), info.currentline)
- local parts = { header }
- for i = 1, argc do
- local arg = select(i, ...)
- if arg == nil then
- table.insert(parts, "nil")
- else
- table.insert(parts, format_func(arg))
+ if level ~= 'OFF' then
+ log[level:lower()] = function(...)
+ local argc = select('#', ...)
+ if levelnr < current_log_level then
+ return false
+ end
+ if argc == 0 then
+ return true
+ end
+ if not open_logfile() then
+ return false
+ end
+ local info = debug.getinfo(2, 'Sl')
+ local header = string.format(
+ '[%s][%s] ...%s:%s',
+ level,
+ os.date(log_date_format),
+ string.sub(info.short_src, #info.short_src - 15),
+ info.currentline
+ )
+ local parts = { header }
+ for i = 1, argc do
+ local arg = select(i, ...)
+ if arg == nil then
+ table.insert(parts, 'nil')
+ else
+ table.insert(parts, format_func(arg))
+ end
end
+ logfile:write(table.concat(parts, '\t'), '\n')
+ logfile:flush()
end
- logfile:write(table.concat(parts, '\t'), "\n")
- logfile:flush()
end
end
end
@@ -92,10 +133,11 @@ vim.tbl_add_reverse_lookup(log.levels)
---@param level (string or number) One of `vim.lsp.log.levels`
function log.set_level(level)
if type(level) == 'string' then
- current_log_level = assert(log.levels[level:upper()], string.format("Invalid log level: %q", level))
+ current_log_level =
+ assert(log.levels[level:upper()], string.format('Invalid log level: %q', level))
else
- assert(type(level) == 'number', "level must be a number or string")
- assert(log.levels[level], string.format("Invalid log level: %d", level))
+ assert(type(level) == 'number', 'level must be a number or string')
+ assert(log.levels[level], string.format('Invalid log level: %d', level))
current_log_level = level
end
end
@@ -109,7 +151,7 @@ end
--- Sets formatting function used to format logs
---@param handle function function to apply to logging arguments, pass vim.inspect for multi-line formatting
function log.set_format_func(handle)
- assert(handle == vim.inspect or type(handle) == 'function', "handle must be a function")
+ assert(handle == vim.inspect or type(handle) == 'function', 'handle must be a function')
format_func = handle
end
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 86c9e2fd58..6ecb9959d5 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -1,7 +1,5 @@
-- Protocol for the Microsoft Language Server Protocol (mslsp)
-local if_nil = vim.F.if_nil
-
local protocol = {}
--[=[
@@ -25,150 +23,150 @@ end
local constants = {
DiagnosticSeverity = {
-- Reports an error.
- Error = 1;
+ Error = 1,
-- Reports a warning.
- Warning = 2;
+ Warning = 2,
-- Reports an information.
- Information = 3;
+ Information = 3,
-- Reports a hint.
- Hint = 4;
- };
+ Hint = 4,
+ },
DiagnosticTag = {
-- Unused or unnecessary code
- Unnecessary = 1;
+ Unnecessary = 1,
-- Deprecated or obsolete code
- Deprecated = 2;
- };
+ Deprecated = 2,
+ },
MessageType = {
-- An error message.
- Error = 1;
+ Error = 1,
-- A warning message.
- Warning = 2;
+ Warning = 2,
-- An information message.
- Info = 3;
+ Info = 3,
-- A log message.
- Log = 4;
- };
+ Log = 4,
+ },
-- The file event type.
FileChangeType = {
-- The file got created.
- Created = 1;
+ Created = 1,
-- The file got changed.
- Changed = 2;
+ Changed = 2,
-- The file got deleted.
- Deleted = 3;
- };
+ Deleted = 3,
+ },
-- The kind of a completion entry.
CompletionItemKind = {
- Text = 1;
- Method = 2;
- Function = 3;
- Constructor = 4;
- Field = 5;
- Variable = 6;
- Class = 7;
- Interface = 8;
- Module = 9;
- Property = 10;
- Unit = 11;
- Value = 12;
- Enum = 13;
- Keyword = 14;
- Snippet = 15;
- Color = 16;
- File = 17;
- Reference = 18;
- Folder = 19;
- EnumMember = 20;
- Constant = 21;
- Struct = 22;
- Event = 23;
- Operator = 24;
- TypeParameter = 25;
- };
+ Text = 1,
+ Method = 2,
+ Function = 3,
+ Constructor = 4,
+ Field = 5,
+ Variable = 6,
+ Class = 7,
+ Interface = 8,
+ Module = 9,
+ Property = 10,
+ Unit = 11,
+ Value = 12,
+ Enum = 13,
+ Keyword = 14,
+ Snippet = 15,
+ Color = 16,
+ File = 17,
+ Reference = 18,
+ Folder = 19,
+ EnumMember = 20,
+ Constant = 21,
+ Struct = 22,
+ Event = 23,
+ Operator = 24,
+ TypeParameter = 25,
+ },
-- How a completion was triggered
CompletionTriggerKind = {
-- Completion was triggered by typing an identifier (24x7 code
-- complete), manual invocation (e.g Ctrl+Space) or via API.
- Invoked = 1;
+ Invoked = 1,
-- Completion was triggered by a trigger character specified by
-- the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
- TriggerCharacter = 2;
+ TriggerCharacter = 2,
-- Completion was re-triggered as the current completion list is incomplete.
- TriggerForIncompleteCompletions = 3;
- };
+ TriggerForIncompleteCompletions = 3,
+ },
-- A document highlight kind.
DocumentHighlightKind = {
-- A textual occurrence.
- Text = 1;
+ Text = 1,
-- Read-access of a symbol, like reading a variable.
- Read = 2;
+ Read = 2,
-- Write-access of a symbol, like writing to a variable.
- Write = 3;
- };
+ Write = 3,
+ },
-- A symbol kind.
SymbolKind = {
- File = 1;
- Module = 2;
- Namespace = 3;
- Package = 4;
- Class = 5;
- Method = 6;
- Property = 7;
- Field = 8;
- Constructor = 9;
- Enum = 10;
- Interface = 11;
- Function = 12;
- Variable = 13;
- Constant = 14;
- String = 15;
- Number = 16;
- Boolean = 17;
- Array = 18;
- Object = 19;
- Key = 20;
- Null = 21;
- EnumMember = 22;
- Struct = 23;
- Event = 24;
- Operator = 25;
- TypeParameter = 26;
- };
+ File = 1,
+ Module = 2,
+ Namespace = 3,
+ Package = 4,
+ Class = 5,
+ Method = 6,
+ Property = 7,
+ Field = 8,
+ Constructor = 9,
+ Enum = 10,
+ Interface = 11,
+ Function = 12,
+ Variable = 13,
+ Constant = 14,
+ String = 15,
+ Number = 16,
+ Boolean = 17,
+ Array = 18,
+ Object = 19,
+ Key = 20,
+ Null = 21,
+ EnumMember = 22,
+ Struct = 23,
+ Event = 24,
+ Operator = 25,
+ TypeParameter = 26,
+ },
-- Represents reasons why a text document is saved.
TextDocumentSaveReason = {
-- Manually triggered, e.g. by the user pressing save, by starting debugging,
-- or by an API call.
- Manual = 1;
+ Manual = 1,
-- Automatic after a delay.
- AfterDelay = 2;
+ AfterDelay = 2,
-- When the editor lost focus.
- FocusOut = 3;
- };
+ FocusOut = 3,
+ },
ErrorCodes = {
-- Defined by JSON RPC
- ParseError = -32700;
- InvalidRequest = -32600;
- MethodNotFound = -32601;
- InvalidParams = -32602;
- InternalError = -32603;
- serverErrorStart = -32099;
- serverErrorEnd = -32000;
- ServerNotInitialized = -32002;
- UnknownErrorCode = -32001;
+ ParseError = -32700,
+ InvalidRequest = -32600,
+ MethodNotFound = -32601,
+ InvalidParams = -32602,
+ InternalError = -32603,
+ serverErrorStart = -32099,
+ serverErrorEnd = -32000,
+ ServerNotInitialized = -32002,
+ UnknownErrorCode = -32001,
-- Defined by the protocol.
- RequestCancelled = -32800;
- ContentModified = -32801;
- };
+ RequestCancelled = -32800,
+ ContentModified = -32801,
+ },
-- Describes the content type that a client supports in various
-- result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
@@ -177,88 +175,88 @@ local constants = {
-- are reserved for internal usage.
MarkupKind = {
-- Plain text is supported as a content format
- PlainText = 'plaintext';
+ PlainText = 'plaintext',
-- Markdown is supported as a content format
- Markdown = 'markdown';
- };
+ Markdown = 'markdown',
+ },
ResourceOperationKind = {
-- Supports creating new files and folders.
- Create = 'create';
+ Create = 'create',
-- Supports renaming existing files and folders.
- Rename = 'rename';
+ Rename = 'rename',
-- Supports deleting existing files and folders.
- Delete = 'delete';
- };
+ Delete = 'delete',
+ },
FailureHandlingKind = {
-- Applying the workspace change is simply aborted if one of the changes provided
-- fails. All operations executed before the failing operation stay executed.
- Abort = 'abort';
+ Abort = 'abort',
-- All operations are executed transactionally. That means they either all
-- succeed or no changes at all are applied to the workspace.
- Transactional = 'transactional';
+ Transactional = 'transactional',
-- If the workspace edit contains only textual file changes they are executed transactionally.
-- If resource changes (create, rename or delete file) are part of the change the failure
-- handling strategy is abort.
- TextOnlyTransactional = 'textOnlyTransactional';
+ TextOnlyTransactional = 'textOnlyTransactional',
-- The client tries to undo the operations already executed. But there is no
-- guarantee that this succeeds.
- Undo = 'undo';
- };
+ Undo = 'undo',
+ },
-- Known error codes for an `InitializeError`;
InitializeError = {
-- If the protocol version provided by the client can't be handled by the server.
-- @deprecated This initialize error got replaced by client capabilities. There is
-- no version handshake in version 3.0x
- unknownProtocolVersion = 1;
- };
+ unknownProtocolVersion = 1,
+ },
-- Defines how the host (editor) should sync document changes to the language server.
TextDocumentSyncKind = {
-- Documents should not be synced at all.
- None = 0;
+ None = 0,
-- Documents are synced by always sending the full content
-- of the document.
- Full = 1;
+ Full = 1,
-- Documents are synced by sending the full content on open.
-- After that only incremental updates to the document are
-- send.
- Incremental = 2;
- };
+ Incremental = 2,
+ },
WatchKind = {
-- Interested in create events.
- Create = 1;
+ Create = 1,
-- Interested in change events
- Change = 2;
+ Change = 2,
-- Interested in delete events
- Delete = 4;
- };
+ Delete = 4,
+ },
-- Defines whether the insert text in a completion item should be interpreted as
-- plain text or a snippet.
InsertTextFormat = {
-- The primary text to be inserted is treated as a plain string.
- PlainText = 1;
+ PlainText = 1,
-- The primary text to be inserted is treated as a snippet.
--
-- 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.
- Snippet = 2;
- };
+ Snippet = 2,
+ },
-- A set of predefined code action kinds
CodeActionKind = {
-- Empty kind.
- Empty = '';
+ Empty = '',
-- Base kind for quickfix actions
- QuickFix = 'quickfix';
+ QuickFix = 'quickfix',
-- Base kind for refactoring actions
- Refactor = 'refactor';
+ Refactor = 'refactor',
-- Base kind for refactoring extraction actions
--
-- Example extract actions:
@@ -268,7 +266,7 @@ local constants = {
-- - Extract variable
-- - Extract interface from class
-- - ...
- RefactorExtract = 'refactor.extract';
+ RefactorExtract = 'refactor.extract',
-- Base kind for refactoring inline actions
--
-- Example inline actions:
@@ -277,7 +275,7 @@ local constants = {
-- - Inline variable
-- - Inline constant
-- - ...
- RefactorInline = 'refactor.inline';
+ RefactorInline = 'refactor.inline',
-- Base kind for refactoring rewrite actions
--
-- Example rewrite actions:
@@ -288,14 +286,14 @@ local constants = {
-- - Make method static
-- - Move method to base class
-- - ...
- RefactorRewrite = 'refactor.rewrite';
+ RefactorRewrite = 'refactor.rewrite',
-- Base kind for source actions
--
-- Source code actions apply to the entire file.
- Source = 'source';
+ Source = 'source',
-- Base kind for an organize imports source action
- SourceOrganizeImports = 'source.organizeImports';
- };
+ SourceOrganizeImports = 'source.organizeImports',
+ },
}
for k, v in pairs(constants) do
@@ -622,19 +620,19 @@ function protocol.make_client_capabilities()
return {
textDocument = {
synchronization = {
- dynamicRegistration = false;
+ dynamicRegistration = false,
-- TODO(ashkan) Send textDocument/willSave before saving (BufWritePre)
- willSave = false;
+ willSave = false,
-- TODO(ashkan) Implement textDocument/willSaveWaitUntil
- willSaveWaitUntil = false;
+ willSaveWaitUntil = false,
-- Send textDocument/didSave after saving (BufWritePost)
- didSave = true;
- };
+ didSave = true,
+ },
codeAction = {
- dynamicRegistration = false;
+ dynamicRegistration = false,
codeActionLiteralSupport = {
codeActionKind = {
@@ -642,144 +640,193 @@ function protocol.make_client_capabilities()
local res = vim.tbl_values(protocol.CodeActionKind)
table.sort(res)
return res
- end)();
- };
- };
- dataSupport = true;
+ end)(),
+ },
+ },
+ isPreferredSupport = true,
+ dataSupport = true,
resolveSupport = {
- properties = { 'edit', }
- };
- };
+ properties = { 'edit' },
+ },
+ },
completion = {
- dynamicRegistration = false;
+ 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 = false,
- commitCharactersSupport = false;
- preselectSupport = false;
- deprecatedSupport = false;
- documentationFormat = { protocol.MarkupKind.Markdown; protocol.MarkupKind.PlainText };
- };
+ commitCharactersSupport = false,
+ preselectSupport = false,
+ deprecatedSupport = false,
+ documentationFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText },
+ },
completionItemKind = {
valueSet = (function()
local res = {}
for k in ipairs(protocol.CompletionItemKind) do
- if type(k) == 'number' then table.insert(res, k) end
+ if type(k) == 'number' then
+ table.insert(res, k)
+ end
end
return res
- end)();
- };
+ end)(),
+ },
-- TODO(tjdevries): Implement this
- contextSupport = false;
- };
+ contextSupport = false,
+ },
declaration = {
- linkSupport = true;
- };
+ linkSupport = true,
+ },
definition = {
- linkSupport = true;
- };
+ linkSupport = true,
+ },
implementation = {
- linkSupport = true;
- };
+ linkSupport = true,
+ },
typeDefinition = {
- linkSupport = true;
- };
+ linkSupport = true,
+ },
hover = {
- dynamicRegistration = false;
- contentFormat = { protocol.MarkupKind.Markdown; protocol.MarkupKind.PlainText };
- };
+ dynamicRegistration = false,
+ contentFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText },
+ },
signatureHelp = {
- dynamicRegistration = false;
+ dynamicRegistration = false,
signatureInformation = {
- activeParameterSupport = true;
- documentationFormat = { protocol.MarkupKind.Markdown; protocol.MarkupKind.PlainText };
+ activeParameterSupport = true,
+ documentationFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText },
parameterInformation = {
- labelOffsetSupport = true;
- };
- };
- };
+ labelOffsetSupport = true,
+ },
+ },
+ },
references = {
- dynamicRegistration = false;
- };
+ dynamicRegistration = false,
+ },
documentHighlight = {
- dynamicRegistration = false
- };
+ dynamicRegistration = false,
+ },
documentSymbol = {
- dynamicRegistration = false;
+ dynamicRegistration = false,
symbolKind = {
valueSet = (function()
local res = {}
for k in ipairs(protocol.SymbolKind) do
- if type(k) == 'number' then table.insert(res, k) end
+ if type(k) == 'number' then
+ table.insert(res, k)
+ end
end
return res
- end)();
- };
- hierarchicalDocumentSymbolSupport = true;
- };
+ end)(),
+ },
+ hierarchicalDocumentSymbolSupport = true,
+ },
rename = {
- dynamicRegistration = false;
- prepareSupport = true;
- };
+ dynamicRegistration = false,
+ prepareSupport = true,
+ },
publishDiagnostics = {
- relatedInformation = true;
+ relatedInformation = true,
tagSupport = {
valueSet = (function()
local res = {}
for k in ipairs(protocol.DiagnosticTag) do
- if type(k) == 'number' then table.insert(res, k) end
+ if type(k) == 'number' then
+ table.insert(res, k)
+ end
end
return res
- end)();
- };
- };
- };
+ end)(),
+ },
+ },
+ },
workspace = {
symbol = {
- dynamicRegistration = false;
+ dynamicRegistration = false,
symbolKind = {
valueSet = (function()
local res = {}
for k in ipairs(protocol.SymbolKind) do
- if type(k) == 'number' then table.insert(res, k) end
+ if type(k) == 'number' then
+ table.insert(res, k)
+ end
end
return res
- end)();
- };
- hierarchicalWorkspaceSymbolSupport = true;
- };
- workspaceFolders = true;
- applyEdit = true;
+ end)(),
+ },
+ hierarchicalWorkspaceSymbolSupport = true,
+ },
+ workspaceFolders = true,
+ applyEdit = true,
workspaceEdit = {
- resourceOperations = {'rename', 'create', 'delete',},
- };
- };
+ resourceOperations = { 'rename', 'create', 'delete' },
+ },
+ },
callHierarchy = {
- dynamicRegistration = false;
- };
- experimental = nil;
+ dynamicRegistration = false,
+ },
+ experimental = nil,
window = {
- workDoneProgress = true;
+ workDoneProgress = true,
showMessage = {
messageActionItem = {
- additionalPropertiesSupport = false;
- };
- };
+ additionalPropertiesSupport = false,
+ },
+ },
showDocument = {
- support = false;
- };
- };
+ support = false,
+ },
+ },
}
end
+local if_nil = vim.F.if_nil
--- Creates a normalized object describing LSP server capabilities.
---@param server_capabilities table Table of capabilities supported by the server
---@return table Normalized table of capabilities
function protocol.resolve_capabilities(server_capabilities)
+ local TextDocumentSyncKind = protocol.TextDocumentSyncKind
+ local textDocumentSync = server_capabilities.textDocumentSync
+ if textDocumentSync == nil then
+ -- Defaults if omitted.
+ server_capabilities.textDocumentSync = {
+ openClose = false,
+ change = TextDocumentSyncKind.None,
+ willSave = false,
+ willSaveWaitUntil = false,
+ save = {
+ includeText = false,
+ },
+ }
+ elseif type(textDocumentSync) == 'number' then
+ -- Backwards compatibility
+ if not TextDocumentSyncKind[textDocumentSync] then
+ return nil, 'Invalid server TextDocumentSyncKind for textDocumentSync'
+ end
+ server_capabilities.textDocumentSync = {
+ openClose = true,
+ change = textDocumentSync,
+ willSave = false,
+ willSaveWaitUntil = false,
+ save = {
+ includeText = false,
+ },
+ }
+ elseif type(textDocumentSync) ~= 'table' then
+ return nil, string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync))
+ end
+ return server_capabilities
+end
+
+---@private
+--- Creates a normalized object describing LSP server capabilities.
+-- @deprecated access resolved_capabilities instead
+---@param server_capabilities table Table of capabilities supported by the server
+---@return table Normalized table of capabilities
+function protocol._resolve_capabilities_compat(server_capabilities)
local general_properties = {}
local text_document_sync_properties
do
@@ -788,39 +835,41 @@ function protocol.resolve_capabilities(server_capabilities)
if textDocumentSync == nil then
-- Defaults if omitted.
text_document_sync_properties = {
- text_document_open_close = false;
- text_document_did_change = TextDocumentSyncKind.None;
--- text_document_did_change = false;
- text_document_will_save = false;
- text_document_will_save_wait_until = false;
- text_document_save = false;
- text_document_save_include_text = false;
+ text_document_open_close = false,
+ text_document_did_change = TextDocumentSyncKind.None,
+ -- text_document_did_change = false;
+ text_document_will_save = false,
+ text_document_will_save_wait_until = false,
+ text_document_save = false,
+ text_document_save_include_text = false,
}
elseif type(textDocumentSync) == 'number' then
-- Backwards compatibility
if not TextDocumentSyncKind[textDocumentSync] then
- return nil, "Invalid server TextDocumentSyncKind for textDocumentSync"
+ return nil, 'Invalid server TextDocumentSyncKind for textDocumentSync'
end
text_document_sync_properties = {
- text_document_open_close = true;
- text_document_did_change = textDocumentSync;
- text_document_will_save = false;
- text_document_will_save_wait_until = false;
- text_document_save = true;
- text_document_save_include_text = false;
+ text_document_open_close = true,
+ text_document_did_change = textDocumentSync,
+ text_document_will_save = false,
+ text_document_will_save_wait_until = false,
+ text_document_save = true,
+ text_document_save_include_text = false,
}
elseif type(textDocumentSync) == 'table' then
text_document_sync_properties = {
- text_document_open_close = if_nil(textDocumentSync.openClose, false);
- text_document_did_change = if_nil(textDocumentSync.change, TextDocumentSyncKind.None);
- text_document_will_save = if_nil(textDocumentSync.willSave, false);
- text_document_will_save_wait_until = if_nil(textDocumentSync.willSaveWaitUntil, false);
- text_document_save = if_nil(textDocumentSync.save, false);
- text_document_save_include_text = if_nil(type(textDocumentSync.save) == 'table'
- and textDocumentSync.save.includeText, false);
+ text_document_open_close = if_nil(textDocumentSync.openClose, false),
+ text_document_did_change = if_nil(textDocumentSync.change, TextDocumentSyncKind.None),
+ text_document_will_save = if_nil(textDocumentSync.willSave, false),
+ text_document_will_save_wait_until = if_nil(textDocumentSync.willSaveWaitUntil, false),
+ text_document_save = if_nil(textDocumentSync.save, false),
+ text_document_save_include_text = if_nil(
+ type(textDocumentSync.save) == 'table' and textDocumentSync.save.includeText,
+ false
+ ),
}
else
- return nil, string.format("Invalid type for textDocumentSync: %q", type(textDocumentSync))
+ return nil, string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync))
end
end
general_properties.completion = server_capabilities.completionProvider ~= nil
@@ -831,7 +880,8 @@ function protocol.resolve_capabilities(server_capabilities)
general_properties.document_symbol = server_capabilities.documentSymbolProvider or false
general_properties.workspace_symbol = server_capabilities.workspaceSymbolProvider or false
general_properties.document_formatting = server_capabilities.documentFormattingProvider or false
- general_properties.document_range_formatting = server_capabilities.documentRangeFormattingProvider or false
+ general_properties.document_range_formatting = server_capabilities.documentRangeFormattingProvider
+ or false
general_properties.call_hierarchy = server_capabilities.callHierarchyProvider or false
general_properties.execute_command = server_capabilities.executeCommandProvider ~= nil
@@ -848,18 +898,21 @@ function protocol.resolve_capabilities(server_capabilities)
general_properties.code_lens_resolve = false
elseif type(server_capabilities.codeLensProvider) == 'table' then
general_properties.code_lens = true
- general_properties.code_lens_resolve = server_capabilities.codeLensProvider.resolveProvider or false
+ general_properties.code_lens_resolve = server_capabilities.codeLensProvider.resolveProvider
+ or false
else
- error("The server sent invalid codeLensProvider")
+ error('The server sent invalid codeLensProvider')
end
if server_capabilities.codeActionProvider == nil then
general_properties.code_action = false
- elseif type(server_capabilities.codeActionProvider) == 'boolean'
- or type(server_capabilities.codeActionProvider) == 'table' then
+ elseif
+ type(server_capabilities.codeActionProvider) == 'boolean'
+ or type(server_capabilities.codeActionProvider) == 'table'
+ then
general_properties.code_action = server_capabilities.codeActionProvider
else
- error("The server sent invalid codeActionProvider")
+ error('The server sent invalid codeActionProvider')
end
if server_capabilities.declarationProvider == nil then
@@ -869,7 +922,7 @@ function protocol.resolve_capabilities(server_capabilities)
elseif type(server_capabilities.declarationProvider) == 'table' then
general_properties.declaration = server_capabilities.declarationProvider
else
- error("The server sent invalid declarationProvider")
+ error('The server sent invalid declarationProvider')
end
if server_capabilities.typeDefinitionProvider == nil then
@@ -879,7 +932,7 @@ function protocol.resolve_capabilities(server_capabilities)
elseif type(server_capabilities.typeDefinitionProvider) == 'table' then
general_properties.type_definition = server_capabilities.typeDefinitionProvider
else
- error("The server sent invalid typeDefinitionProvider")
+ error('The server sent invalid typeDefinitionProvider')
end
if server_capabilities.implementationProvider == nil then
@@ -889,7 +942,7 @@ function protocol.resolve_capabilities(server_capabilities)
elseif type(server_capabilities.implementationProvider) == 'table' then
general_properties.implementation = server_capabilities.implementationProvider
else
- error("The server sent invalid implementationProvider")
+ error('The server sent invalid implementationProvider')
end
local workspace = server_capabilities.workspace
@@ -897,45 +950,48 @@ function protocol.resolve_capabilities(server_capabilities)
if workspace == nil or workspace.workspaceFolders == nil then
-- Defaults if omitted.
workspace_properties = {
- workspace_folder_properties = {
- supported = false;
- changeNotifications=false;
- }
+ workspace_folder_properties = {
+ supported = false,
+ changeNotifications = false,
+ },
}
elseif type(workspace.workspaceFolders) == 'table' then
workspace_properties = {
workspace_folder_properties = {
- supported = if_nil(workspace.workspaceFolders.supported, false);
- changeNotifications = if_nil(workspace.workspaceFolders.changeNotifications, false);
-
- }
+ supported = if_nil(workspace.workspaceFolders.supported, false),
+ changeNotifications = if_nil(workspace.workspaceFolders.changeNotifications, false),
+ },
}
else
- error("The server sent invalid workspace")
+ error('The server sent invalid workspace')
end
local signature_help_properties
if server_capabilities.signatureHelpProvider == nil then
signature_help_properties = {
- signature_help = false;
- signature_help_trigger_characters = {};
+ signature_help = false,
+ signature_help_trigger_characters = {},
}
elseif type(server_capabilities.signatureHelpProvider) == 'table' then
signature_help_properties = {
- signature_help = true;
+ signature_help = true,
-- The characters that trigger signature help automatically.
- signature_help_trigger_characters = server_capabilities.signatureHelpProvider.triggerCharacters or {};
+ signature_help_trigger_characters = server_capabilities.signatureHelpProvider.triggerCharacters
+ or {},
}
else
- error("The server sent invalid signatureHelpProvider")
+ error('The server sent invalid signatureHelpProvider')
end
- return vim.tbl_extend("error"
- , text_document_sync_properties
- , signature_help_properties
- , workspace_properties
- , general_properties
- )
+ local capabilities = vim.tbl_extend(
+ 'error',
+ text_document_sync_properties,
+ signature_help_properties,
+ workspace_properties,
+ general_properties
+ )
+
+ return capabilities
end
return protocol
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 1ecac50df4..913eee19a2 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -4,12 +4,14 @@ 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')
+
---@private
--- Checks whether a given path exists and is a directory.
---@param filename (string) path to check
---@returns (bool)
local function is_dir(filename)
- local stat = vim.loop.fs_stat(filename)
+ local stat = uv.fs_stat(filename)
return stat and stat.type == 'directory' or false
end
@@ -32,9 +34,9 @@ local function env_merge(env)
-- Merge.
env = vim.tbl_extend('force', vim.fn.environ(), env)
local final_env = {}
- for k,v in pairs(env) do
+ for k, v in pairs(env) do
assert(type(k) == 'string', 'env must be a dict')
- table.insert(final_env, k..'='..tostring(v))
+ table.insert(final_env, k .. '=' .. tostring(v))
end
return final_env
end
@@ -45,10 +47,12 @@ end
---@param encoded_message (string)
---@returns (table) table containing encoded message and `Content-Length` attribute
local function format_message_with_content_length(encoded_message)
- return table.concat {
- 'Content-Length: '; tostring(#encoded_message); '\r\n\r\n';
- encoded_message;
- }
+ return table.concat({
+ 'Content-Length: ',
+ tostring(#encoded_message),
+ '\r\n\r\n',
+ encoded_message,
+ })
end
---@private
@@ -65,23 +69,25 @@ local function parse_headers(header)
if line == '' then
break
end
- local key, value = line:match("^%s*(%S+)%s*:%s*(.+)%s*$")
+ local key, value = line:match('^%s*(%S+)%s*:%s*(.+)%s*$')
if key then
key = key:lower():gsub('%-', '_')
headers[key] = value
else
- local _ = log.error() and log.error("invalid header line %q", line)
- error(string.format("invalid header line %q", line))
+ local _ = log.error() and log.error('invalid header line %q', line)
+ error(string.format('invalid header line %q', line))
end
end
headers.content_length = tonumber(headers.content_length)
- or error(string.format("Content-Length not found in headers. %q", header))
+ or error(string.format('Content-Length not found in headers. %q', header))
return headers
end
-- This is the start of any possible header patterns. The gsub converts it to a
-- case insensitive pattern.
-local header_start_pattern = ("content"):gsub("%w", function(c) return "["..c..c:upper().."]" end)
+local header_start_pattern = ('content'):gsub('%w', function(c)
+ return '[' .. c .. c:upper() .. ']'
+end)
---@private
--- The actual workhorse.
@@ -100,17 +106,17 @@ local function request_parser_loop()
-- be searching for.
-- TODO(ashkan) I'd like to remove this, but it seems permanent :(
local buffer_start = buffer:find(header_start_pattern)
- local headers = parse_headers(buffer:sub(buffer_start, start-1))
+ local headers = parse_headers(buffer:sub(buffer_start, start - 1))
local content_length = headers.content_length
-- Use table instead of just string to buffer the message. It prevents
-- a ton of strings allocating.
-- ref. http://www.lua.org/pil/11.6.html
- local body_chunks = {buffer:sub(finish+1)}
+ local body_chunks = { buffer:sub(finish + 1) }
local body_length = #body_chunks[1]
-- Keep waiting for data until we have enough.
while body_length < content_length do
local chunk = coroutine.yield()
- or error("Expected more data for the body. The server may have died.") -- TODO hmm.
+ or error('Expected more data for the body. The server may have died.') -- TODO hmm.
table.insert(body_chunks, chunk)
body_length = body_length + #chunk
end
@@ -123,25 +129,30 @@ local function request_parser_loop()
end
local body = table.concat(body_chunks)
-- Yield our data.
- buffer = rest..(coroutine.yield(headers, body)
- or error("Expected more data for the body. The server may have died.")) -- TODO hmm.
+ buffer = rest
+ .. (
+ coroutine.yield(headers, body)
+ or error('Expected more data for the body. The server may have died.')
+ ) -- TODO hmm.
else
-- Get more data since we don't have enough.
- buffer = buffer..(coroutine.yield()
- or error("Expected more data for the header. The server may have died.")) -- TODO hmm.
+ buffer = buffer
+ .. (
+ coroutine.yield() or error('Expected more data for the header. The server may have died.')
+ ) -- TODO hmm.
end
end
end
--- Mapping of error codes used by the client
local client_errors = {
- INVALID_SERVER_MESSAGE = 1;
- INVALID_SERVER_JSON = 2;
- NO_RESULT_CALLBACK_FOUND = 3;
- READ_ERROR = 4;
- NOTIFICATION_HANDLER_ERROR = 5;
- SERVER_REQUEST_HANDLER_ERROR = 6;
- SERVER_RESULT_CALLBACK_ERROR = 7;
+ INVALID_SERVER_MESSAGE = 1,
+ INVALID_SERVER_JSON = 2,
+ NO_RESULT_CALLBACK_FOUND = 3,
+ READ_ERROR = 4,
+ NOTIFICATION_HANDLER_ERROR = 5,
+ SERVER_REQUEST_HANDLER_ERROR = 6,
+ SERVER_RESULT_CALLBACK_ERROR = 7,
}
client_errors = vim.tbl_add_reverse_lookup(client_errors)
@@ -151,26 +162,26 @@ client_errors = vim.tbl_add_reverse_lookup(client_errors)
---@param err (table) The error object
---@returns (string) The formatted error message
local function format_rpc_error(err)
- validate {
- err = { err, 't' };
- }
+ validate({
+ err = { err, 't' },
+ })
-- There is ErrorCodes in the LSP specification,
-- but in ResponseError.code it is not used and the actual type is number.
local code
if protocol.ErrorCodes[err.code] then
- code = string.format("code_name = %s,", protocol.ErrorCodes[err.code])
+ code = string.format('code_name = %s,', protocol.ErrorCodes[err.code])
else
- code = string.format("code_name = unknown, code = %s,", err.code)
+ code = string.format('code_name = unknown, code = %s,', err.code)
end
- local message_parts = {"RPC[Error]", code}
+ local message_parts = { 'RPC[Error]', code }
if err.message then
- table.insert(message_parts, "message =")
- table.insert(message_parts, string.format("%q", err.message))
+ table.insert(message_parts, 'message =')
+ table.insert(message_parts, string.format('%q', err.message))
end
if err.data then
- table.insert(message_parts, "data =")
+ table.insert(message_parts, 'data =')
table.insert(message_parts, vim.inspect(err.data))
end
return table.concat(message_parts, ' ')
@@ -185,11 +196,11 @@ local function rpc_response_error(code, message, data)
-- TODO should this error or just pick a sane error (like InternalError)?
local code_name = assert(protocol.ErrorCodes[code], 'Invalid RPC error code')
return setmetatable({
- code = code;
- message = message or code_name;
- data = data;
+ code = code,
+ message = message or code_name,
+ data = data,
}, {
- __tostring = format_rpc_error;
+ __tostring = format_rpc_error,
})
end
@@ -220,7 +231,7 @@ end
---@param signal (number): Number describing the signal used to terminate (if
---any)
function default_dispatchers.on_exit(code, signal)
- local _ = log.info() and log.info("client_exit", { code = code, signal = signal })
+ local _ = log.info() and log.info('client_exit', { code = code, signal = signal })
end
---@private
--- Default dispatcher for client errors.
@@ -258,15 +269,16 @@ end
--- - {handle} A handle for low-level interaction with the LSP server process
--- |vim.loop|.
local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
- local _ = log.info() and log.info("Starting RPC client", {cmd = cmd, args = cmd_args, extra = extra_spawn_params})
- validate {
- cmd = { cmd, 's' };
- cmd_args = { cmd_args, 't' };
- dispatchers = { dispatchers, 't', true };
- }
+ local _ = log.info()
+ and log.info('Starting RPC client', { cmd = cmd, args = cmd_args, extra = extra_spawn_params })
+ validate({
+ cmd = { cmd, 's' },
+ cmd_args = { cmd_args, 't' },
+ dispatchers = { dispatchers, 't', true },
+ })
if extra_spawn_params and extra_spawn_params.cwd then
- assert(is_dir(extra_spawn_params.cwd), "cwd must be a directory")
+ assert(is_dir(extra_spawn_params.cwd), 'cwd must be a directory')
end
if dispatchers then
local user_dispatchers = dispatchers
@@ -275,11 +287,11 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
local user_dispatcher = user_dispatchers[dispatch_name]
if user_dispatcher then
if type(user_dispatcher) ~= 'function' then
- error(string.format("dispatcher.%s must be a function", dispatch_name))
+ error(string.format('dispatcher.%s must be a function', dispatch_name))
end
-- server_request is wrapped elsewhere.
- if not (dispatch_name == 'server_request'
- or dispatch_name == 'on_exit') -- TODO this blocks the loop exiting for some reason.
+ if
+ not (dispatch_name == 'server_request' or dispatch_name == 'on_exit') -- TODO this blocks the loop exiting for some reason.
then
user_dispatcher = schedule_wrap(user_dispatcher)
end
@@ -317,20 +329,25 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
dispatchers.on_exit(code, signal)
end
local spawn_params = {
- args = cmd_args;
- stdio = {stdin, stdout, stderr};
+ args = cmd_args,
+ stdio = { stdin, stdout, stderr },
+ detached = not is_win,
}
if extra_spawn_params then
spawn_params.cwd = extra_spawn_params.cwd
spawn_params.env = env_merge(extra_spawn_params.env)
+ if extra_spawn_params.detached ~= nil then
+ spawn_params.detached = extra_spawn_params.detached
+ end
end
handle, pid = uv.spawn(cmd, spawn_params, onexit)
if handle == nil then
- local msg = string.format("Spawning language server with cmd: `%s` failed", cmd)
- if string.match(pid, "ENOENT") then
- msg = msg .. ". The language server is either not installed, missing from PATH, or not executable."
+ local msg = string.format('Spawning language server with cmd: `%s` failed', cmd)
+ if string.match(pid, 'ENOENT') then
+ msg = msg
+ .. '. The language server is either not installed, missing from PATH, or not executable.'
else
- msg = msg .. string.format(" with error message: %s", pid)
+ msg = msg .. string.format(' with error message: %s', pid)
end
vim.notify(msg, vim.log.levels.WARN)
return
@@ -344,8 +361,10 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
---@param payload table
---@returns true if the payload could be scheduled, false if the main event-loop is in the process of closing.
local function encode_and_send(payload)
- local _ = log.debug() and log.debug("rpc.send", payload)
- if handle == nil or handle:is_closing() then return false end
+ local _ = log.debug() and log.debug('rpc.send', payload)
+ if handle == nil or handle:is_closing() then
+ return false
+ end
local encoded = vim.json.encode(payload)
stdin:write(format_message_with_content_length(encoded))
return true
@@ -359,22 +378,22 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
---@param params (table): Parameters for the invoked LSP method
---@returns (bool) `true` if notification could be sent, `false` if not
local function notify(method, params)
- return encode_and_send {
- jsonrpc = "2.0";
- method = method;
- params = params;
- }
+ return encode_and_send({
+ jsonrpc = '2.0',
+ method = method,
+ params = params,
+ })
end
---@private
--- sends an error object to the remote LSP process.
local function send_response(request_id, err, result)
- return encode_and_send {
- id = request_id;
- jsonrpc = "2.0";
- error = err;
- result = result;
- }
+ return encode_and_send({
+ id = request_id,
+ jsonrpc = '2.0',
+ error = err,
+ result = result,
+ })
end
-- FIXME: DOC: Should be placed on the RPC client object returned by
@@ -385,21 +404,21 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
---@param method (string) The invoked LSP method
---@param params (table) Parameters for the invoked LSP method
---@param callback (function) Callback to invoke
- ---@param notify_reply_callback (function) Callback to invoke as soon as a request is no longer pending
+ ---@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending
---@returns (bool, number) `(true, message_id)` if request could be sent, `false` if not
local function request(method, params, callback, notify_reply_callback)
- validate {
- callback = { callback, 'f' };
- notify_reply_callback = { notify_reply_callback, 'f', true };
- }
+ validate({
+ callback = { callback, 'f' },
+ notify_reply_callback = { notify_reply_callback, 'f', true },
+ })
message_index = message_index + 1
local message_id = message_index
- local result = encode_and_send {
- id = message_id;
- jsonrpc = "2.0";
- method = method;
- params = params;
- }
+ local result = encode_and_send({
+ id = message_id,
+ jsonrpc = '2.0',
+ method = method,
+ params = params,
+ })
if result then
if message_callbacks then
message_callbacks[message_id] = schedule_wrap(callback)
@@ -417,7 +436,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
stderr:read_start(function(_err, chunk)
if chunk then
- local _ = log.error() and log.error("rpc", cmd, "stderr", chunk)
+ local _ = log.error() and log.error('rpc', cmd, 'stderr', chunk)
end
end)
@@ -451,7 +470,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
on_error(client_errors.INVALID_SERVER_JSON, decoded)
return
end
- local _ = log.debug() and log.debug("rpc.receive", decoded)
+ local _ = log.debug() and log.debug('rpc.receive', decoded)
if type(decoded.method) == 'string' and decoded.id then
local err
@@ -459,17 +478,36 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
-- we can still use the result.
schedule(function()
local status, result
- status, result, err = try_call(client_errors.SERVER_REQUEST_HANDLER_ERROR,
- dispatchers.server_request, decoded.method, decoded.params)
- local _ = log.debug() and log.debug("server_request: callback result", { status = status, result = result, err = err })
+ status, result, err = try_call(
+ client_errors.SERVER_REQUEST_HANDLER_ERROR,
+ dispatchers.server_request,
+ decoded.method,
+ decoded.params
+ )
+ local _ = log.debug()
+ and log.debug(
+ 'server_request: callback result',
+ { status = status, result = result, err = err }
+ )
if status then
if not (result or err) then
-- TODO this can be a problem if `null` is sent for result. needs vim.NIL
- error(string.format("method %q: either a result or an error must be sent to the server in response", decoded.method))
+ error(
+ string.format(
+ 'method %q: either a result or an error must be sent to the server in response',
+ decoded.method
+ )
+ )
end
if err then
- assert(type(err) == 'table', "err must be a table. Use rpc_response_error to help format errors.")
- local code_name = assert(protocol.ErrorCodes[err.code], "Errors must use protocol.ErrorCodes. Use rpc_response_error to help format errors.")
+ assert(
+ type(err) == 'table',
+ 'err must be a table. Use rpc_response_error to help format errors.'
+ )
+ local code_name = assert(
+ protocol.ErrorCodes[err.code],
+ 'Errors must use protocol.ErrorCodes. Use rpc_response_error to help format errors.'
+ )
err.message = err.message or code_name
end
else
@@ -479,18 +517,17 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
end
send_response(decoded.id, err, result)
end)
- -- This works because we are expecting vim.NIL here
+ -- This works because we are expecting vim.NIL here
elseif decoded.id and (decoded.result ~= vim.NIL or decoded.error ~= vim.NIL) then
-
-- We sent a number, so we expect a number.
local result_id = tonumber(decoded.id)
-- Notify the user that a response was received for the request
local notify_reply_callback = notify_reply_callbacks and notify_reply_callbacks[result_id]
if notify_reply_callback then
- validate {
- notify_reply_callback = { notify_reply_callback, 'f' };
- }
+ validate({
+ notify_reply_callback = { notify_reply_callback, 'f' },
+ })
notify_reply_callback(result_id)
notify_reply_callbacks[result_id] = nil
end
@@ -499,7 +536,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
if decoded.error then
local mute_error = false
if decoded.error.code == protocol.ErrorCodes.RequestCancelled then
- local _ = log.debug() and log.debug("Received cancellation ack", decoded)
+ local _ = log.debug() and log.debug('Received cancellation ack', decoded)
mute_error = true
end
@@ -519,24 +556,33 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
local callback = message_callbacks and message_callbacks[result_id]
if callback then
message_callbacks[result_id] = nil
- validate {
- callback = { callback, 'f' };
- }
+ validate({
+ callback = { callback, 'f' },
+ })
if decoded.error then
decoded.error = setmetatable(decoded.error, {
- __tostring = format_rpc_error;
+ __tostring = format_rpc_error,
})
end
- try_call(client_errors.SERVER_RESULT_CALLBACK_ERROR,
- callback, decoded.error, decoded.result)
+ try_call(
+ client_errors.SERVER_RESULT_CALLBACK_ERROR,
+ callback,
+ decoded.error,
+ decoded.result
+ )
else
on_error(client_errors.NO_RESULT_CALLBACK_FOUND, decoded)
- local _ = log.error() and log.error("No callback found for server response id "..result_id)
+ local _ = log.error()
+ and log.error('No callback found for server response id ' .. result_id)
end
elseif type(decoded.method) == 'string' then
-- Notification
- try_call(client_errors.NOTIFICATION_HANDLER_ERROR,
- dispatchers.notification, decoded.method, decoded.params)
+ try_call(
+ client_errors.NOTIFICATION_HANDLER_ERROR,
+ dispatchers.notification,
+ decoded.method,
+ decoded.params
+ )
else
-- Invalid server message
on_error(client_errors.INVALID_SERVER_MESSAGE, decoded)
@@ -552,7 +598,9 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
return
end
-- This should signal that we are done reading from the client.
- if not chunk then return end
+ if not chunk then
+ return
+ end
-- Flush anything in the parser by looping until we don't get a result
-- anymore.
while true do
@@ -570,17 +618,17 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
end)
return {
- pid = pid;
- handle = handle;
- request = request;
- notify = notify
+ pid = pid,
+ handle = handle,
+ request = request,
+ notify = notify,
}
end
return {
- start = start;
- rpc_response_error = rpc_response_error;
- format_rpc_error = format_rpc_error;
- client_errors = client_errors;
+ start = start,
+ rpc_response_error = rpc_response_error,
+ format_rpc_error = format_rpc_error,
+ client_errors = client_errors,
}
-- vim:sw=2 ts=2 et
diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua
index 0f4e5b572b..0d65e86b55 100644
--- a/runtime/lua/vim/lsp/sync.lua
+++ b/runtime/lua/vim/lsp/sync.lua
@@ -79,7 +79,7 @@ local function compute_line_length(line, offset_encoding)
local length
local _
if offset_encoding == 'utf-16' then
- _, length = str_utfindex(line)
+ _, length = str_utfindex(line)
elseif offset_encoding == 'utf-32' then
length, _ = str_utfindex(line)
else
@@ -100,7 +100,7 @@ local function align_end_position(line, byte, offset_encoding)
-- If on the first byte, or an empty string: the trivial case
if byte == 1 or #line == 0 then
char = byte
- -- Called in the case of extending an empty line "" -> "a"
+ -- Called in the case of extending an empty line "" -> "a"
elseif byte == #line + 1 then
char = compute_line_length(line, offset_encoding) + 1
else
@@ -130,14 +130,38 @@ end
---@param new_lastline integer new_lastline from on_lines, adjusted to 1-index
---@param offset_encoding string utf-8|utf-16|utf-32|nil (fallback to utf-8)
---@returns table<int, int> line_idx, byte_idx, and char_idx of first change position
-local function compute_start_range(prev_lines, curr_lines, firstline, lastline, new_lastline, offset_encoding)
+local function compute_start_range(
+ prev_lines,
+ curr_lines,
+ firstline,
+ lastline,
+ new_lastline,
+ offset_encoding
+)
+ local char_idx
+ local byte_idx
-- If firstline == lastline, no existing text is changed. All edit operations
-- occur on a new line pointed to by lastline. This occurs during insertion of
-- new lines(O), the new newline is inserted at the line indicated by
-- new_lastline.
+ if firstline == lastline then
+ local line_idx
+ local line = prev_lines[firstline - 1]
+ if line then
+ line_idx = firstline - 1
+ byte_idx = #line + 1
+ char_idx = compute_line_length(line, offset_encoding) + 1
+ else
+ line_idx = firstline
+ byte_idx = 1
+ char_idx = 1
+ end
+ return { line_idx = line_idx, byte_idx = byte_idx, char_idx = char_idx }
+ end
+
-- If firstline == new_lastline, the first change occurred on a line that was deleted.
-- In this case, the first byte change is also at the first byte of firstline
- if firstline == new_lastline or firstline == lastline then
+ if firstline == new_lastline then
return { line_idx = firstline, byte_idx = 1, char_idx = 1 }
end
@@ -158,14 +182,12 @@ local function compute_start_range(prev_lines, curr_lines, firstline, lastline,
end
-- Convert byte to codepoint if applicable
- local char_idx
- local byte_idx
- if start_byte_idx == 1 or (#prev_line == 0 and start_byte_idx == 1)then
+ if start_byte_idx == 1 or (#prev_line == 0 and start_byte_idx == 1) then
byte_idx = start_byte_idx
char_idx = 1
elseif start_byte_idx == #prev_line + 1 then
byte_idx = start_byte_idx
- char_idx = compute_line_length(prev_line, offset_encoding) + 1
+ char_idx = compute_line_length(prev_line, offset_encoding) + 1
else
byte_idx = start_byte_idx + str_utf_start(prev_line, start_byte_idx)
char_idx = byte_to_utf(prev_line, byte_idx, offset_encoding)
@@ -188,14 +210,30 @@ end
---@param new_lastline integer
---@param offset_encoding string
---@returns (int, int) end_line_idx and end_col_idx of range
-local function compute_end_range(prev_lines, curr_lines, start_range, firstline, lastline, new_lastline, offset_encoding)
+local function compute_end_range(
+ prev_lines,
+ curr_lines,
+ start_range,
+ firstline,
+ lastline,
+ new_lastline,
+ offset_encoding
+)
-- 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
- return { line_idx = (lastline - new_lastline + firstline), byte_idx = 1, char_idx = 1 }, { line_idx = firstline, byte_idx = 1, char_idx = 1 }
+ return { line_idx = (lastline - new_lastline + firstline), byte_idx = 1, char_idx = 1 }, {
+ line_idx = firstline,
+ byte_idx = 1,
+ char_idx = 1,
+ }
end
if firstline == lastline then
- return { line_idx = firstline, byte_idx = 1, char_idx = 1 }, { line_idx = new_lastline - lastline + firstline, byte_idx = 1, char_idx = 1 }
+ return { line_idx = firstline, byte_idx = 1, char_idx = 1 }, {
+ line_idx = new_lastline - lastline + firstline,
+ byte_idx = 1,
+ char_idx = 1,
+ }
end
-- Compare on last line, at minimum will be the start range
local start_line_idx = start_range.line_idx
@@ -218,14 +256,18 @@ local function compute_end_range(prev_lines, curr_lines, start_range, firstline,
local max_length
if start_line_idx == prev_line_idx then
-- Search until beginning of difference
- max_length = min(prev_line_length - start_range.byte_idx, curr_line_length - start_range.byte_idx) + 1
+ max_length = min(
+ prev_line_length - start_range.byte_idx,
+ curr_line_length - start_range.byte_idx
+ ) + 1
else
max_length = min(prev_line_length, curr_line_length) + 1
end
for idx = 0, max_length do
byte_offset = idx
if
- str_byte(prev_line, prev_line_length - byte_offset) ~= str_byte(curr_line, curr_line_length - byte_offset)
+ str_byte(prev_line, prev_line_length - byte_offset)
+ ~= str_byte(curr_line, curr_line_length - byte_offset)
then
break
end
@@ -239,8 +281,10 @@ local function compute_end_range(prev_lines, curr_lines, start_range, firstline,
if prev_end_byte_idx == 0 then
prev_end_byte_idx = 1
end
- local prev_byte_idx, prev_char_idx = align_end_position(prev_line, prev_end_byte_idx, offset_encoding)
- local prev_end_range = { line_idx = prev_line_idx, byte_idx = prev_byte_idx, char_idx = prev_char_idx }
+ local prev_byte_idx, prev_char_idx =
+ align_end_position(prev_line, prev_end_byte_idx, offset_encoding)
+ local prev_end_range =
+ { line_idx = prev_line_idx, byte_idx = prev_byte_idx, char_idx = prev_char_idx }
local curr_end_range
-- Deletion event, new_range cannot be before start
@@ -252,8 +296,10 @@ local function compute_end_range(prev_lines, curr_lines, start_range, firstline,
if curr_end_byte_idx == 0 then
curr_end_byte_idx = 1
end
- local curr_byte_idx, curr_char_idx = align_end_position(curr_line, curr_end_byte_idx, offset_encoding)
- curr_end_range = { line_idx = curr_line_idx, byte_idx = curr_byte_idx, char_idx = curr_char_idx }
+ local curr_byte_idx, curr_char_idx =
+ align_end_position(curr_line, curr_end_byte_idx, offset_encoding)
+ curr_end_range =
+ { line_idx = curr_line_idx, byte_idx = curr_byte_idx, char_idx = curr_char_idx }
end
return prev_end_range, curr_end_range
@@ -266,14 +312,13 @@ end
---@param end_range table new_end_range returned by last_difference
---@returns string text extracted from defined region
local function extract_text(lines, start_range, end_range, line_ending)
- if not lines[start_range.line_idx] then
- return ""
- end
+ if not lines[start_range.line_idx] then
+ return ''
+ end
-- Trivial case: start and end range are the same line, directly grab changed text
if start_range.line_idx == end_range.line_idx then
-- string.sub is inclusive, end_range is not
return string.sub(lines[start_range.line_idx], start_range.byte_idx, end_range.byte_idx - 1)
-
else
-- Handle deletion case
-- Collect the changed portion of the first changed line
@@ -288,7 +333,7 @@ local function extract_text(lines, start_range, end_range, line_ending)
-- Collect the changed portion of the last changed line.
table.insert(result, string.sub(lines[end_range.line_idx], 1, end_range.byte_idx - 1))
else
- table.insert(result, "")
+ table.insert(result, '')
end
-- Add line ending between all lines
@@ -313,7 +358,10 @@ local function compute_range_length(lines, start_range, end_range, offset_encodi
local start_line = lines[start_range.line_idx]
local range_length
if start_line and #start_line > 0 then
- range_length = compute_line_length(start_line, offset_encoding) - start_range.char_idx + 1 + line_ending_length
+ range_length = compute_line_length(start_line, offset_encoding)
+ - start_range.char_idx
+ + 1
+ + line_ending_length
else
-- Length of newline character
range_length = line_ending_length
@@ -345,7 +393,15 @@ end
---@param new_lastline number line to begin search in new_lines for last difference
---@param offset_encoding string encoding requested by language server
---@returns table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent
-function M.compute_diff(prev_lines, curr_lines, firstline, lastline, new_lastline, offset_encoding, line_ending)
+function M.compute_diff(
+ prev_lines,
+ curr_lines,
+ firstline,
+ lastline,
+ new_lastline,
+ offset_encoding,
+ line_ending
+)
-- Find the start of changes between the previous and current buffer. Common between both.
-- Sent to the server as the start of the changed range.
-- Used to grab the changed text from the latest buffer.
@@ -375,7 +431,8 @@ function M.compute_diff(prev_lines, curr_lines, firstline, lastline, new_lastlin
local text = extract_text(curr_lines, start_range, curr_end_range, line_ending)
-- Compute the range of the replaced text. Deprecated but still required for certain language servers
- local range_length = compute_range_length(prev_lines, start_range, prev_end_range, offset_encoding, line_ending)
+ local range_length =
+ compute_range_length(prev_lines, start_range, prev_end_range, offset_encoding, line_ending)
-- convert to 0 based indexing
local result = {
diff --git a/runtime/lua/vim/lsp/tagfunc.lua b/runtime/lua/vim/lsp/tagfunc.lua
index 5c55e8559f..49029f8599 100644
--- a/runtime/lua/vim/lsp/tagfunc.lua
+++ b/runtime/lua/vim/lsp/tagfunc.lua
@@ -1,5 +1,5 @@
local lsp = vim.lsp
-local util = vim.lsp.util
+local util = lsp.util
---@private
local function mk_tag_item(name, range, uri, offset_encoding)
@@ -15,7 +15,7 @@ end
---@private
local function query_definition(pattern)
- local params = lsp.util.make_position_params()
+ local params = util.make_position_params()
local results_by_client, err = lsp.buf_request_sync(0, 'textDocument/definition', params, 1000)
if err then
return {}
@@ -44,7 +44,8 @@ end
---@private
local function query_workspace_symbols(pattern)
- local results_by_client, err = lsp.buf_request_sync(0, 'workspace/symbol', { query = pattern }, 1000)
+ local results_by_client, err =
+ lsp.buf_request_sync(0, 'workspace/symbol', { query = pattern }, 1000)
if err then
return {}
end
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 89c5ebe8f7..70f5010256 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -1,10 +1,10 @@
-local protocol = require 'vim.lsp.protocol'
-local snippet = require 'vim.lsp._snippet'
+local protocol = require('vim.lsp.protocol')
+local snippet = require('vim.lsp._snippet')
local vim = vim
local validate = vim.validate
local api = vim.api
local list_extend = vim.list_extend
-local highlight = require 'vim.highlight'
+local highlight = require('vim.highlight')
local uv = vim.loop
local npcall = vim.F.npcall
@@ -13,14 +13,14 @@ local split = vim.split
local M = {}
local default_border = {
- {"", "NormalFloat"},
- {"", "NormalFloat"},
- {"", "NormalFloat"},
- {" ", "NormalFloat"},
- {"", "NormalFloat"},
- {"", "NormalFloat"},
- {"", "NormalFloat"},
- {" ", "NormalFloat"},
+ { '', 'NormalFloat' },
+ { '', 'NormalFloat' },
+ { '', 'NormalFloat' },
+ { ' ', 'NormalFloat' },
+ { '', 'NormalFloat' },
+ { '', 'NormalFloat' },
+ { '', 'NormalFloat' },
+ { ' ', 'NormalFloat' },
}
---@private
@@ -35,43 +35,70 @@ local function get_border_size(opts)
local width = 0
if type(border) == 'string' then
- local border_size = {none = {0, 0}, single = {2, 2}, double = {2, 2}, rounded = {2, 2}, solid = {2, 2}, shadow = {1, 1}}
+ local border_size = {
+ none = { 0, 0 },
+ single = { 2, 2 },
+ double = { 2, 2 },
+ rounded = { 2, 2 },
+ solid = { 2, 2 },
+ shadow = { 1, 1 },
+ }
if border_size[border] == nil then
- error(string.format("invalid floating preview border: %s. :help vim.api.nvim_open_win()", vim.inspect(border)))
+ error(
+ string.format(
+ 'invalid floating preview border: %s. :help vim.api.nvim_open_win()',
+ vim.inspect(border)
+ )
+ )
end
height, width = unpack(border_size[border])
else
if 8 % #border ~= 0 then
- error(string.format("invalid floating preview border: %s. :help vim.api.nvim_open_win()", vim.inspect(border)))
+ error(
+ string.format(
+ 'invalid floating preview border: %s. :help vim.api.nvim_open_win()',
+ vim.inspect(border)
+ )
+ )
end
---@private
local function border_width(id)
id = (id - 1) % #border + 1
- if type(border[id]) == "table" then
+ if type(border[id]) == 'table' then
-- border specified as a table of <character, highlight group>
return vim.fn.strdisplaywidth(border[id][1])
- elseif type(border[id]) == "string" then
+ elseif type(border[id]) == 'string' then
-- border specified as a list of border characters
return vim.fn.strdisplaywidth(border[id])
end
- error(string.format("invalid floating preview border: %s. :help vim.api.nvim_open_win()", vim.inspect(border)))
+ error(
+ string.format(
+ 'invalid floating preview border: %s. :help vim.api.nvim_open_win()',
+ vim.inspect(border)
+ )
+ )
end
---@private
local function border_height(id)
id = (id - 1) % #border + 1
- if type(border[id]) == "table" then
+ if type(border[id]) == 'table' then
-- border specified as a table of <character, highlight group>
return #border[id][1] > 0 and 1 or 0
- elseif type(border[id]) == "string" then
+ elseif type(border[id]) == 'string' then
-- border specified as a list of border characters
return #border[id] > 0 and 1 or 0
end
- error(string.format("invalid floating preview border: %s. :help vim.api.nvim_open_win()", vim.inspect(border)))
+ error(
+ string.format(
+ 'invalid floating preview border: %s. :help vim.api.nvim_open_win()',
+ vim.inspect(border)
+ )
+ )
end
- height = height + border_height(2) -- top
- height = height + border_height(6) -- bottom
- width = width + border_width(4) -- right
- width = width + border_width(8) -- left
+ height = height + border_height(2) -- top
+ height = height + border_height(6) -- bottom
+ width = width + border_width(4) -- right
+ width = width + border_width(8) -- left
end
return { height = height, width = width }
@@ -89,9 +116,15 @@ end
---@param encoding string utf-8|utf-16|utf-32|nil defaults to utf-16
---@return number `encoding` index of `index` in `line`
function M._str_utfindex_enc(line, index, encoding)
- if not encoding then encoding = 'utf-16' end
+ if not encoding then
+ encoding = 'utf-16'
+ end
if encoding == 'utf-8' then
- if index then return index else return #line end
+ if index then
+ return index
+ else
+ return #line
+ end
elseif encoding == 'utf-16' then
local _, col16 = vim.str_utfindex(line, index)
return col16
@@ -99,7 +132,7 @@ function M._str_utfindex_enc(line, index, encoding)
local col32, _ = vim.str_utfindex(line, index)
return col32
else
- error("Invalid encoding: " .. vim.inspect(encoding))
+ error('Invalid encoding: ' .. vim.inspect(encoding))
end
end
@@ -111,15 +144,21 @@ end
---@param encoding string utf-8|utf-16|utf-32|nil defaults to utf-16
---@return number byte (utf-8) index of `encoding` index `index` in `line`
function M._str_byteindex_enc(line, index, encoding)
- if not encoding then encoding = 'utf-16' end
+ if not encoding then
+ encoding = 'utf-16'
+ end
if encoding == 'utf-8' then
- if index then return index else return #line end
+ if index then
+ return index
+ else
+ return #line
+ end
elseif encoding == 'utf-16' then
return vim.str_byteindex(line, index, true)
elseif encoding == 'utf-32' then
return vim.str_byteindex(line, index)
else
- error("Invalid encoding: " .. vim.inspect(encoding))
+ error('Invalid encoding: ' .. vim.inspect(encoding))
end
end
@@ -142,34 +181,38 @@ function M.set_lines(lines, A, B, new_lines)
-- specifying a line number after what we would call the last line.
local i_n = math.min(B[1] + 1, #lines)
if not (i_0 >= 1 and i_0 <= #lines + 1 and i_n >= 1 and i_n <= #lines) then
- error("Invalid range: "..vim.inspect{A = A; B = B; #lines, new_lines})
+ error('Invalid range: ' .. vim.inspect({ A = A, B = B, #lines, new_lines }))
end
- local prefix = ""
- local suffix = lines[i_n]:sub(B[2]+1)
+ local prefix = ''
+ local suffix = lines[i_n]:sub(B[2] + 1)
if A[2] > 0 then
prefix = lines[i_0]:sub(1, A[2])
end
local n = i_n - i_0 + 1
if n ~= #new_lines then
- for _ = 1, n - #new_lines do table.remove(lines, i_0) end
- for _ = 1, #new_lines - n do table.insert(lines, i_0, '') end
+ for _ = 1, n - #new_lines do
+ table.remove(lines, i_0)
+ end
+ for _ = 1, #new_lines - n do
+ table.insert(lines, i_0, '')
+ end
end
for i = 1, #new_lines do
lines[i - 1 + i_0] = new_lines[i]
end
if #suffix > 0 then
local i = i_0 + #new_lines - 1
- lines[i] = lines[i]..suffix
+ lines[i] = lines[i] .. suffix
end
if #prefix > 0 then
- lines[i_0] = prefix..lines[i_0]
+ lines[i_0] = prefix .. lines[i_0]
end
return lines
end
---@private
local function sort_by_key(fn)
- return function(a,b)
+ return function(a, b)
local ka, kb = fn(a), fn(b)
assert(#ka == #kb)
for i = 1, #ka do
@@ -191,18 +234,18 @@ end
---@param rows number[] zero-indexed line numbers
---@return table<number string> a table mapping rows to lines
local function get_lines(bufnr, rows)
- rows = type(rows) == "table" and rows or { rows }
+ rows = type(rows) == 'table' and rows or { rows }
-- This is needed for bufload and bufloaded
if bufnr == 0 then
- bufnr = vim.api.nvim_get_current_buf()
+ bufnr = api.nvim_get_current_buf()
end
---@private
local function buf_lines()
local lines = {}
for _, row in pairs(rows) do
- lines[row] = (vim.api.nvim_buf_get_lines(bufnr, row, row + 1, false) or { "" })[1]
+ lines[row] = (api.nvim_buf_get_lines(bufnr, row, row + 1, false) or { '' })[1]
end
return lines
end
@@ -211,7 +254,7 @@ local function get_lines(bufnr, rows)
-- load the buffer if this is not a file uri
-- Custom language server protocol extensions can result in servers sending URIs with custom schemes. Plugins are able to load these via `BufReadCmd` autocmds.
- if uri:sub(1, 4) ~= "file" then
+ if uri:sub(1, 4) ~= 'file' then
vim.fn.bufload(bufnr)
return buf_lines()
end
@@ -224,8 +267,10 @@ local function get_lines(bufnr, rows)
local filename = api.nvim_buf_get_name(bufnr)
-- get the data from the file
- local fd = uv.fs_open(filename, "r", 438)
- if not fd then return "" end
+ 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)
uv.fs_close(fd)
@@ -242,11 +287,13 @@ local function get_lines(bufnr, rows)
local found = 0
local lnum = 0
- for line in string.gmatch(data, "([^\n]*)\n?") do
+ for line in string.gmatch(data, '([^\n]*)\n?') do
if lines[lnum] == true then
lines[lnum] = line
found = found + 1
- if found == need then break end
+ if found == need then
+ break
+ end
end
lnum = lnum + 1
end
@@ -254,13 +301,12 @@ local function get_lines(bufnr, rows)
-- change any lines we didn't find to the empty string
for i, line in pairs(lines) do
if line == true then
- lines[i] = ""
+ lines[i] = ''
end
end
return lines
end
-
---@private
--- Gets the zero-indexed line from the given buffer.
--- Works on unloaded buffers by reading the file using libuv to bypass buf reading events.
@@ -273,11 +319,10 @@ local function get_line(bufnr, row)
return get_lines(bufnr, { row })[row]
end
-
---@private
--- Position is a https://microsoft.github.io/language-server-protocol/specifications/specification-current/#position
--- Returns a zero-indexed column, since set_lines() does the conversion to
----@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to utf-16
+---@param offset_encoding string utf-8|utf-16|utf-32
--- 1-indexed
local function get_line_byte_from_position(bufnr, position, offset_encoding)
-- LSP's line and characters are 0-indexed
@@ -286,7 +331,7 @@ local function get_line_byte_from_position(bufnr, position, offset_encoding)
-- When on the first character, we can ignore the difference between byte and
-- character
if col > 0 then
- local line = get_line(bufnr, position.line)
+ local line = get_line(bufnr, position.line) or ''
local ok, result
ok, result = pcall(_str_byteindex_enc, line, col, offset_encoding)
if ok then
@@ -300,54 +345,27 @@ end
--- Process and return progress reports from lsp server
---@private
function M.get_progress_messages()
-
local new_messages = {}
- local msg_remove = {}
local progress_remove = {}
for _, client in ipairs(vim.lsp.get_active_clients()) do
- local messages = client.messages
- local data = messages
- for token, ctx in pairs(data.progress) do
-
- local new_report = {
- name = data.name,
- title = ctx.title or "empty title",
- message = ctx.message,
- percentage = ctx.percentage,
- done = ctx.done,
- progress = true,
- }
- table.insert(new_messages, new_report)
-
- if ctx.done then
- table.insert(progress_remove, {client = client, token = token})
- end
- end
-
- for i, msg in ipairs(data.messages) do
- if msg.show_once then
- msg.shown = msg.shown + 1
- if msg.shown > 1 then
- table.insert(msg_remove, {client = client, idx = i})
- end
- end
-
- table.insert(new_messages, {name = data.name, content = msg.content})
- end
+ local messages = client.messages
+ local data = messages
+ for token, ctx in pairs(data.progress) do
+ local new_report = {
+ name = data.name,
+ title = ctx.title or 'empty title',
+ message = ctx.message,
+ percentage = ctx.percentage,
+ done = ctx.done,
+ progress = true,
+ }
+ table.insert(new_messages, new_report)
- if next(data.status) ~= nil then
- table.insert(new_messages, {
- name = data.name,
- content = data.status.content,
- uri = data.status.uri,
- status = true
- })
+ if ctx.done then
+ table.insert(progress_remove, { client = client, token = token })
end
- for _, item in ipairs(msg_remove) do
- table.remove(client.messages, item.idx)
end
-
end
for _, item in ipairs(progress_remove) do
@@ -360,16 +378,17 @@ end
--- Applies a list of text edits to a buffer.
---@param text_edits table list of `TextEdit` objects
---@param bufnr number Buffer id
----@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to encoding of first client of `bufnr`
+---@param offset_encoding string utf-8|utf-16|utf-32
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
function M.apply_text_edits(text_edits, bufnr, offset_encoding)
- validate {
- text_edits = { text_edits, 't', false };
- bufnr = { bufnr, 'number', false };
- offset_encoding = { offset_encoding, 'string', true };
- }
- offset_encoding = offset_encoding or M._get_offset_encoding(bufnr)
- if not next(text_edits) then return end
+ validate({
+ text_edits = { text_edits, 't', false },
+ bufnr = { bufnr, 'number', false },
+ offset_encoding = { offset_encoding, 'string', false },
+ })
+ if not next(text_edits) then
+ return
+ end
if not api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end
@@ -381,7 +400,11 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
index = index + 1
text_edit._index = index
- if text_edit.range.start.line > text_edit.range['end'].line or text_edit.range.start.line == text_edit.range['end'].line and text_edit.range.start.character > text_edit.range['end'].character then
+ if
+ text_edit.range.start.line > text_edit.range['end'].line
+ or text_edit.range.start.line == text_edit.range['end'].line
+ and text_edit.range.start.character > text_edit.range['end'].character
+ then
local start = text_edit.range.start
text_edit.range.start = text_edit.range['end']
text_edit.range['end'] = start
@@ -402,28 +425,9 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
end
end)
- -- Some LSP servers may return +1 range of the buffer content but nvim_buf_set_text can't accept it so we should fix it here.
- local has_eol_text_edit = false
- local max = vim.api.nvim_buf_line_count(bufnr)
- local len = _str_utfindex_enc(vim.api.nvim_buf_get_lines(bufnr, -2, -1, false)[1] or '', nil, offset_encoding)
- text_edits = vim.tbl_map(function(text_edit)
- if max <= text_edit.range.start.line then
- text_edit.range.start.line = max - 1
- text_edit.range.start.character = len
- text_edit.newText = '\n' .. text_edit.newText
- has_eol_text_edit = true
- end
- if max <= text_edit.range['end'].line then
- text_edit.range['end'].line = max - 1
- text_edit.range['end'].character = len
- has_eol_text_edit = true
- end
- return text_edit
- end, text_edits)
-
-- Some LSP servers are depending on the VSCode behavior.
-- The VSCode will re-locate the cursor position after applying TextEdit so we also do it.
- local is_current_buf = vim.api.nvim_get_current_buf() == bufnr
+ local is_current_buf = api.nvim_get_current_buf() == bufnr
local cursor = (function()
if not is_current_buf then
return {
@@ -431,7 +435,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
col = -1,
}
end
- local cursor = vim.api.nvim_win_get_cursor(0)
+ local cursor = api.nvim_win_get_cursor(0)
return {
row = cursor[1] - 1,
col = cursor[2],
@@ -440,16 +444,38 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
-- Apply text edits.
local is_cursor_fixed = false
+ local has_eol_text_edit = false
for _, text_edit in ipairs(text_edits) do
+ -- Normalize line ending
+ text_edit.newText, _ = string.gsub(text_edit.newText, '\r\n?', '\n')
+
+ -- Convert from LSP style ranges to Neovim style ranges.
local e = {
start_row = text_edit.range.start.line,
- start_col = get_line_byte_from_position(bufnr, text_edit.range.start),
+ start_col = get_line_byte_from_position(bufnr, text_edit.range.start, offset_encoding),
end_row = text_edit.range['end'].line,
- end_col = get_line_byte_from_position(bufnr, text_edit.range['end']),
- text = vim.split(text_edit.newText, '\n', true),
+ end_col = get_line_byte_from_position(bufnr, text_edit.range['end'], offset_encoding),
+ text = split(text_edit.newText, '\n', true),
}
- vim.api.nvim_buf_set_text(bufnr, e.start_row, e.start_col, e.end_row, e.end_col, e.text)
+ -- Some LSP servers may return +1 range of the buffer content but nvim_buf_set_text can't accept it so we should fix it here.
+ local max = api.nvim_buf_line_count(bufnr)
+ if max <= e.start_row or max <= e.end_row then
+ local len = #(get_line(bufnr, max - 1) or '')
+ if max <= e.start_row then
+ e.start_row = max - 1
+ e.start_col = len
+ table.insert(e.text, 1, '')
+ end
+ if max <= e.end_row then
+ e.end_row = max - 1
+ e.end_col = len
+ end
+ has_eol_text_edit = true
+ end
+ api.nvim_buf_set_text(bufnr, e.start_row, e.start_col, e.end_row, e.end_col, e.text)
+
+ -- Fix cursor position.
local row_count = (e.end_row - e.start_row) + 1
if e.end_row < cursor.row then
cursor.row = cursor.row + (#e.text - row_count)
@@ -464,21 +490,28 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
end
end
+ local max = api.nvim_buf_line_count(bufnr)
+
+ -- Apply fixed cursor position.
if is_cursor_fixed then
local is_valid_cursor = true
- is_valid_cursor = is_valid_cursor and cursor.row < vim.api.nvim_buf_line_count(bufnr)
- is_valid_cursor = is_valid_cursor and cursor.col <= #(vim.api.nvim_buf_get_lines(bufnr, cursor.row, cursor.row + 1, false)[1] or '')
+ is_valid_cursor = is_valid_cursor and cursor.row < max
+ is_valid_cursor = is_valid_cursor and cursor.col <= #(get_line(bufnr, max - 1) or '')
if is_valid_cursor then
- vim.api.nvim_win_set_cursor(0, { cursor.row + 1, cursor.col })
+ api.nvim_win_set_cursor(0, { cursor.row + 1, cursor.col })
end
end
-- Remove final line if needed
local fix_eol = has_eol_text_edit
- fix_eol = fix_eol and api.nvim_buf_get_option(bufnr, 'fixeol')
- fix_eol = fix_eol and (vim.api.nvim_buf_get_lines(bufnr, -2, -1, false)[1] or '') == ''
+ fix_eol = fix_eol
+ and (
+ api.nvim_buf_get_option(bufnr, 'eol')
+ or (api.nvim_buf_get_option(bufnr, 'fixeol') and not api.nvim_buf_get_option(bufnr, 'binary'))
+ )
+ fix_eol = fix_eol and get_line(bufnr, max - 1) == ''
if fix_eol then
- vim.api.nvim_buf_set_lines(bufnr, -2, -1, false, {})
+ api.nvim_buf_set_lines(bufnr, -2, -1, false, {})
end
end
@@ -514,9 +547,15 @@ end
---@param text_document_edit table: a `TextDocumentEdit` object
---@param index number: Optional index of the edit, if from a list of edits (or nil, if not from a list)
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
-function M.apply_text_document_edit(text_document_edit, index)
+function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
local text_document = text_document_edit.textDocument
local bufnr = vim.uri_to_bufnr(text_document.uri)
+ if offset_encoding == nil then
+ vim.notify_once(
+ 'apply_text_document_edit must be called with valid offset encoding',
+ vim.log.levels.WARN
+ )
+ end
-- For lists of text document edits,
-- do not check the version after the first edit.
@@ -527,15 +566,20 @@ function M.apply_text_document_edit(text_document_edit, index)
-- `VersionedTextDocumentIdentifier`s version may be null
-- https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
- if should_check_version and (text_document.version
+ if
+ should_check_version
+ and (
+ text_document.version
and text_document.version > 0
and M.buf_versions[bufnr]
- and M.buf_versions[bufnr] > text_document.version) then
- print("Buffer ", text_document.uri, " newer than edits.")
+ and M.buf_versions[bufnr] > text_document.version
+ )
+ then
+ print('Buffer ', text_document.uri, ' newer than edits.')
return
end
- M.apply_text_edits(text_document_edit.edits, bufnr)
+ M.apply_text_edits(text_document_edit.edits, bufnr, offset_encoding)
end
--- Parses snippets in a completion entry.
@@ -567,16 +611,16 @@ end
--- precedence is as follows: textEdit.newText > insertText > label
--see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
local function get_completion_word(item)
- if item.textEdit ~= nil and item.textEdit.newText ~= nil and item.textEdit.newText ~= "" then
+ if item.textEdit ~= nil and item.textEdit.newText ~= nil and item.textEdit.newText ~= '' then
local insert_text_format = protocol.InsertTextFormat[item.insertTextFormat]
- if insert_text_format == "PlainText" or insert_text_format == nil then
+ if insert_text_format == 'PlainText' or insert_text_format == nil then
return item.textEdit.newText
else
return M.parse_snippet(item.textEdit.newText)
end
- elseif item.insertText ~= nil and item.insertText ~= "" then
+ elseif item.insertText ~= nil and item.insertText ~= '' then
local insert_text_format = protocol.InsertTextFormat[item.insertTextFormat]
- if insert_text_format == "PlainText" or insert_text_format == nil then
+ if insert_text_format == 'PlainText' or insert_text_format == nil then
return item.insertText
else
return M.parse_snippet(item.insertText)
@@ -604,7 +648,7 @@ end
---@returns (`vim.lsp.protocol.completionItemKind`)
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
function M._get_completion_item_kind_name(completion_item_kind)
- return protocol.CompletionItemKind[completion_item_kind] or "Unknown"
+ return protocol.CompletionItemKind[completion_item_kind] or 'Unknown'
end
--- Turns the result of a `textDocument/completion` request into vim-compatible
@@ -635,7 +679,7 @@ function M.text_document_completion_list_to_complete_items(result, prefix)
info = documentation
elseif type(documentation) == 'table' and type(documentation.value) == 'string' then
info = documentation.value
- -- else
+ -- else
-- TODO(ashkan) Validation handling here?
end
end
@@ -653,9 +697,9 @@ function M.text_document_completion_list_to_complete_items(result, prefix)
user_data = {
nvim = {
lsp = {
- completion_item = completion_item
- }
- }
+ completion_item = completion_item,
+ },
+ },
},
})
end
@@ -663,6 +707,15 @@ function M.text_document_completion_list_to_complete_items(result, prefix)
return matches
end
+---@private
+--- Like vim.fn.bufwinid except it works across tabpages.
+local function bufwinid(bufnr)
+ for _, win in ipairs(api.nvim_list_wins()) do
+ if api.nvim_win_get_buf(win) == bufnr then
+ return win
+ end
+ end
+end
--- Rename old_fname to new_fname
---
@@ -671,7 +724,7 @@ end
-- ignoreIfExists? bool
function M.rename(old_fname, new_fname, opts)
opts = opts or {}
- local target_exists = vim.loop.fs_stat(new_fname) ~= nil
+ local target_exists = uv.fs_stat(new_fname) ~= nil
if target_exists and not opts.overwrite or opts.ignoreIfExists then
vim.notify('Rename target already exists. Skipping rename.')
return
@@ -688,10 +741,9 @@ function M.rename(old_fname, new_fname, opts)
assert(ok, err)
local newbuf = vim.fn.bufadd(new_fname)
- for _, win in pairs(api.nvim_list_wins()) do
- if api.nvim_win_get_buf(win) == oldbuf then
- api.nvim_win_set_buf(win, newbuf)
- end
+ local win = bufwinid(oldbuf)
+ if win then
+ api.nvim_win_set_buf(win, newbuf)
end
api.nvim_buf_delete(oldbuf, { force = true })
end
@@ -712,11 +764,11 @@ end
local function delete_file(change)
local opts = change.options or {}
local fname = vim.uri_to_fname(change.uri)
- local stat = vim.loop.fs_stat(fname)
+ 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)
+ 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'
@@ -729,28 +781,30 @@ local function delete_file(change)
api.nvim_buf_delete(bufnr, { force = true })
end
-
--- Applies a `WorkspaceEdit`.
---
----@param workspace_edit (table) `WorkspaceEdit`
+---@param workspace_edit table `WorkspaceEdit`
+---@param offset_encoding string utf-8|utf-16|utf-32 (required)
--see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
-function M.apply_workspace_edit(workspace_edit)
+function M.apply_workspace_edit(workspace_edit, offset_encoding)
+ if offset_encoding == nil then
+ vim.notify_once(
+ 'apply_workspace_edit must be called with valid offset encoding',
+ vim.log.levels.WARN
+ )
+ end
if workspace_edit.documentChanges then
for idx, change in ipairs(workspace_edit.documentChanges) do
- if change.kind == "rename" then
- M.rename(
- vim.uri_to_fname(change.oldUri),
- vim.uri_to_fname(change.newUri),
- change.options
- )
+ if change.kind == 'rename' then
+ M.rename(vim.uri_to_fname(change.oldUri), vim.uri_to_fname(change.newUri), change.options)
elseif change.kind == 'create' then
create_file(change)
elseif change.kind == 'delete' then
delete_file(change)
elseif change.kind then
- error(string.format("Unsupported change: %q", vim.inspect(change)))
+ error(string.format('Unsupported change: %q', vim.inspect(change)))
else
- M.apply_text_document_edit(change, idx)
+ M.apply_text_document_edit(change, idx, offset_encoding)
end
end
return
@@ -763,7 +817,7 @@ function M.apply_workspace_edit(workspace_edit)
for uri, changes in pairs(all_changes) do
local bufnr = vim.uri_to_bufnr(uri)
- M.apply_text_edits(changes, bufnr)
+ M.apply_text_edits(changes, bufnr, offset_encoding)
end
end
@@ -782,7 +836,7 @@ function M.convert_input_to_markdown_lines(input, contents)
if type(input) == 'string' then
list_extend(contents, split_lines(input))
else
- assert(type(input) == 'table', "Expected a table for Hover.contents")
+ assert(type(input) == 'table', 'Expected a table for Hover.contents')
-- MarkupContent
if input.kind then
-- The kind can be either plaintext or markdown.
@@ -791,22 +845,22 @@ function M.convert_input_to_markdown_lines(input, contents)
-- Some servers send input.value as empty, so let's ignore this :(
local value = input.value or ''
- if input.kind == "plaintext" then
+ if input.kind == 'plaintext' then
-- wrap this in a <text></text> block so that stylize_markdown
-- can properly process it as plaintext
- value = string.format("<text>\n%s\n</text>", value)
+ value = string.format('<text>\n%s\n</text>', value)
end
-- assert(type(value) == 'string')
list_extend(contents, split_lines(value))
- -- MarkupString variation 2
+ -- MarkupString variation 2
elseif input.language then
-- Some servers send input.value as empty, so let's ignore this :(
-- assert(type(input.value) == 'string')
- table.insert(contents, "```"..input.language)
+ table.insert(contents, '```' .. input.language)
list_extend(contents, split_lines(input.value or ''))
- table.insert(contents, "```")
- -- By deduction, this must be MarkedString[]
+ table.insert(contents, '```')
+ -- By deduction, this must be MarkedString[]
else
-- Use our existing logic to handle MarkedString
for _, marked_string in ipairs(input) do
@@ -839,7 +893,8 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers
local active_hl
local active_signature = signature_help.activeSignature or 0
-- If the activeSignature is not inside the valid range, then clip it.
- if active_signature >= #signature_help.signatures then
+ -- In 3.15 of the protocol, activeSignature was allowed to be negative
+ if active_signature >= #signature_help.signatures or active_signature < 0 then
active_signature = 0
end
local signature = signature_help.signatures[active_signature + 1]
@@ -849,16 +904,16 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers
local label = signature.label
if ft then
-- wrap inside a code block so stylize_markdown can render it properly
- label = ("```%s\n%s\n```"):format(ft, label)
+ label = ('```%s\n%s\n```'):format(ft, label)
end
- vim.list_extend(contents, vim.split(label, '\n', true))
+ list_extend(contents, split(label, '\n', true))
if signature.documentation then
M.convert_input_to_markdown_lines(signature.documentation, contents)
end
if signature.parameters and #signature.parameters > 0 then
local active_parameter = (signature.activeParameter or signature_help.activeParameter or 0)
- if active_parameter < 0
- then active_parameter = 0
+ if active_parameter < 0 then
+ active_parameter = 0
end
-- If the activeParameter is > #parameters, then set it to the last
@@ -888,7 +943,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers
}
--]=]
if parameter.label then
- if type(parameter.label) == "table" then
+ if type(parameter.label) == 'table' then
active_hl = parameter.label
else
local offset = 1
@@ -901,9 +956,11 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers
end
for p, param in pairs(signature.parameters) do
offset = signature.label:find(param.label, offset, true)
- if not offset then break end
+ if not offset then
+ break
+ end
if p == active_parameter + 1 then
- active_hl = {offset - 1, offset + #parameter.label - 1}
+ active_hl = { offset - 1, offset + #parameter.label - 1 }
break
end
offset = offset + #param.label + 1
@@ -931,14 +988,14 @@ end
--- - zindex (string or table) override `zindex`, defaults to 50
---@returns (table) Options
function M.make_floating_popup_options(width, height, opts)
- validate {
- opts = { opts, 't', true };
- }
+ validate({
+ opts = { opts, 't', true },
+ })
opts = opts or {}
- validate {
- ["opts.offset_x"] = { opts.offset_x, 'n', true };
- ["opts.offset_y"] = { opts.offset_y, 'n', true };
- }
+ validate({
+ ['opts.offset_x'] = { opts.offset_x, 'n', true },
+ ['opts.offset_y'] = { opts.offset_y, 'n', true },
+ })
local anchor = ''
local row, col
@@ -947,20 +1004,20 @@ function M.make_floating_popup_options(width, height, opts)
local lines_below = vim.fn.winheight(0) - lines_above
if lines_above < lines_below then
- anchor = anchor..'N'
+ anchor = anchor .. 'N'
height = math.min(lines_below, height)
row = 1
else
- anchor = anchor..'S'
+ anchor = anchor .. 'S'
height = math.min(lines_above, height)
row = 0
end
if vim.fn.wincol() + width + (opts.offset_x or 0) <= api.nvim_get_option('columns') then
- anchor = anchor..'W'
+ anchor = anchor .. 'W'
col = 0
else
- anchor = anchor..'E'
+ anchor = anchor .. 'E'
col = 1
end
@@ -980,30 +1037,45 @@ end
--- Jumps to a location.
---
----@param location (`Location`|`LocationLink`)
+---@param location table (`Location`|`LocationLink`)
+---@param offset_encoding string utf-8|utf-16|utf-32 (required)
+---@param reuse_win boolean Jump to existing window if buffer is already opened.
---@returns `true` if the jump succeeded
-function M.jump_to_location(location)
+function M.jump_to_location(location, offset_encoding, reuse_win)
-- location may be Location or LocationLink
local uri = location.uri or location.targetUri
- if uri == nil then return end
+ if uri == nil then
+ return
+ end
+ if offset_encoding == nil then
+ vim.notify_once(
+ 'jump_to_location must be called with valid offset encoding',
+ vim.log.levels.WARN
+ )
+ end
local bufnr = vim.uri_to_bufnr(uri)
-- Save position in jumplist
- vim.cmd "normal! m'"
+ vim.cmd("normal! m'")
-- Push a new item into tagstack
- local from = {vim.fn.bufnr('%'), vim.fn.line('.'), vim.fn.col('.'), 0}
- local items = {{tagname=vim.fn.expand('<cword>'), from=from}}
- vim.fn.settagstack(vim.fn.win_getid(), {items=items}, 't')
+ local from = { vim.fn.bufnr('%'), vim.fn.line('.'), vim.fn.col('.'), 0 }
+ local items = { { tagname = vim.fn.expand('<cword>'), from = from } }
+ vim.fn.settagstack(vim.fn.win_getid(), { items = items }, 't')
--- Jump to new location (adjusting for UTF-16 encoding of characters)
- api.nvim_set_current_buf(bufnr)
- api.nvim_buf_set_option(bufnr, 'buflisted', true)
+ local win = reuse_win and bufwinid(bufnr)
+ if win then
+ api.nvim_set_current_win(win)
+ else
+ api.nvim_buf_set_option(bufnr, 'buflisted', true)
+ api.nvim_set_current_buf(bufnr)
+ end
local range = location.range or location.targetSelectionRange
local row = range.start.line
- local col = get_line_byte_from_position(bufnr, range.start)
- api.nvim_win_set_cursor(0, {row + 1, col})
+ local col = get_line_byte_from_position(bufnr, range.start, offset_encoding)
+ api.nvim_win_set_cursor(0, { row + 1, col })
-- Open folds under the cursor
- vim.cmd("normal! zv")
+ vim.cmd('normal! zv')
return true
end
@@ -1018,22 +1090,24 @@ end
function M.preview_location(location, opts)
-- location may be LocationLink or Location (more useful for the former)
local uri = location.targetUri or location.uri
- if uri == nil then return end
+ if uri == nil then
+ return
+ end
local bufnr = vim.uri_to_bufnr(uri)
if not api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end
local range = location.targetRange or location.range
- local contents = api.nvim_buf_get_lines(bufnr, range.start.line, range["end"].line+1, false)
+ local contents = api.nvim_buf_get_lines(bufnr, range.start.line, range['end'].line + 1, false)
local syntax = api.nvim_buf_get_option(bufnr, 'syntax')
- if syntax == "" then
+ if syntax == '' then
-- When no syntax is set, we use filetype as fallback. This might not result
-- in a valid syntax definition. See also ft detection in stylize_markdown.
-- An empty syntax is more common now with TreeSitter, since TS disables syntax.
syntax = api.nvim_buf_get_option(bufnr, 'filetype')
end
opts = opts or {}
- opts.focus_id = "location"
+ opts.focus_id = 'location'
return M.open_floating_preview(contents, syntax, opts)
end
@@ -1054,20 +1128,20 @@ end
--- - pad_bottom number of lines to pad contents at bottom (default 0)
---@return contents table of trimmed and padded lines
function M._trim(contents, opts)
- validate {
- contents = { contents, 't' };
- opts = { opts, 't', true };
- }
+ validate({
+ contents = { contents, 't' },
+ opts = { opts, 't', true },
+ })
opts = opts or {}
contents = M.trim_empty_lines(contents)
if opts.pad_top then
for _ = 1, opts.pad_top do
- table.insert(contents, 1, "")
+ table.insert(contents, 1, '')
end
end
if opts.pad_bottom then
for _ = 1, opts.pad_bottom do
- table.insert(contents, "")
+ table.insert(contents, '')
end
end
return contents
@@ -1080,7 +1154,7 @@ end
local function get_markdown_fences()
local fences = {}
for _, fence in pairs(vim.g.markdown_fenced_languages or {}) do
- local lang, syntax = fence:match("^(.*)=(.*)$")
+ local lang, syntax = fence:match('^(.*)=(.*)$')
if lang then
fences[lang] = syntax
end
@@ -1109,28 +1183,28 @@ end
--- - separator insert separator after code block
---@returns width,height size of float
function M.stylize_markdown(bufnr, contents, opts)
- validate {
- contents = { contents, 't' };
- opts = { opts, 't', true };
- }
+ validate({
+ contents = { contents, 't' },
+ opts = { opts, 't', true },
+ })
opts = opts or {}
-- table of fence types to {ft, begin, end}
-- when ft is nil, we get the ft from the regex match
local matchers = {
- block = {nil, "```+([a-zA-Z0-9_]*)", "```+"},
- pre = {"", "<pre>", "</pre>"},
- code = {"", "<code>", "</code>"},
- text = {"plaintex", "<text>", "</text>"},
+ block = { nil, '```+([a-zA-Z0-9_]*)', '```+' },
+ pre = { '', '<pre>', '</pre>' },
+ code = { '', '<code>', '</code>' },
+ text = { 'text', '<text>', '</text>' },
}
local match_begin = function(line)
for type, pattern in pairs(matchers) do
- local ret = line:match(string.format("^%%s*%s%%s*$", pattern[2]))
+ local ret = line:match(string.format('^%%s*%s%%s*$', pattern[2]))
if ret then
return {
type = type,
- ft = pattern[1] or ret
+ ft = pattern[1] or ret,
}
end
end
@@ -1138,7 +1212,7 @@ function M.stylize_markdown(bufnr, contents, opts)
local match_end = function(line, match)
local pattern = matchers[match.type]
- return line:match(string.format("^%%s*%s%%s*$", pattern[3]))
+ return line:match(string.format('^%%s*%s%%s*$', pattern[3]))
end
-- Clean up
@@ -1168,25 +1242,34 @@ function M.stylize_markdown(bufnr, contents, opts)
i = i + 1
end
table.insert(highlights, {
- ft = match.ft;
- start = start + 1;
- finish = #stripped;
+ ft = match.ft,
+ start = start + 1,
+ finish = #stripped,
})
-- add a separator, but not on the last line
if add_sep and i < #contents then
- table.insert(stripped, "---")
+ table.insert(stripped, '---')
markdown_lines[#stripped] = true
end
else
-- strip any empty lines or separators prior to this separator in actual markdown
- if line:match("^---+$") then
- while markdown_lines[#stripped] and (stripped[#stripped]:match("^%s*$") or stripped[#stripped]:match("^---+$")) do
+ if line:match('^---+$') then
+ while
+ markdown_lines[#stripped]
+ and (stripped[#stripped]:match('^%s*$') or stripped[#stripped]:match('^---+$'))
+ do
markdown_lines[#stripped] = false
table.remove(stripped, #stripped)
end
end
-- add the line if its not an empty line following a separator
- if not (line:match("^%s*$") and markdown_lines[#stripped] and stripped[#stripped]:match("^---+$")) then
+ if
+ not (
+ line:match('^%s*$')
+ and markdown_lines[#stripped]
+ and stripped[#stripped]:match('^---+$')
+ )
+ then
table.insert(stripped, line)
markdown_lines[#stripped] = true
end
@@ -1196,18 +1279,18 @@ function M.stylize_markdown(bufnr, contents, opts)
end
-- Compute size of float needed to show (wrapped) lines
- opts.wrap_at = opts.wrap_at or (vim.wo["wrap"] and api.nvim_win_get_width(0))
+ opts.wrap_at = opts.wrap_at or (vim.wo['wrap'] and api.nvim_win_get_width(0))
local width = M._make_floating_popup_size(stripped, opts)
- local sep_line = string.rep("─", math.min(width, opts.wrap_at or width))
+ local sep_line = string.rep('─', math.min(width, opts.wrap_at or width))
for l in pairs(markdown_lines) do
- if stripped[l]:match("^---+$") then
+ if stripped[l]:match('^---+$') then
stripped[l] = sep_line
end
end
- vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, stripped)
+ api.nvim_buf_set_lines(bufnr, 0, -1, false, stripped)
local idx = 1
---@private
@@ -1216,24 +1299,38 @@ function M.stylize_markdown(bufnr, contents, opts)
local langs = {}
local fences = get_markdown_fences()
local function apply_syntax_to_region(ft, start, finish)
- if ft == "" then
- vim.cmd(string.format("syntax region markdownCode start=+\\%%%dl+ end=+\\%%%dl+ keepend extend", start, finish + 1))
+ if ft == '' then
+ vim.cmd(
+ string.format(
+ 'syntax region markdownCode start=+\\%%%dl+ end=+\\%%%dl+ keepend extend',
+ start,
+ finish + 1
+ )
+ )
return
end
ft = fences[ft] or ft
- local name = ft..idx
+ local name = ft .. idx
idx = idx + 1
- local lang = "@"..ft:upper()
+ local lang = '@' .. ft:upper()
if not langs[lang] then
-- HACK: reset current_syntax, since some syntax files like markdown won't load if it is already set
- pcall(vim.api.nvim_buf_del_var, bufnr, "current_syntax")
+ pcall(api.nvim_buf_del_var, bufnr, 'current_syntax')
-- TODO(ashkan): better validation before this.
- if not pcall(vim.cmd, string.format("syntax include %s syntax/%s.vim", lang, ft)) then
+ if not pcall(vim.cmd, string.format('syntax include %s syntax/%s.vim', lang, ft)) then
return
end
langs[lang] = true
end
- vim.cmd(string.format("syntax region %s start=+\\%%%dl+ end=+\\%%%dl+ contains=%s keepend", name, start, finish + 1, lang))
+ vim.cmd(
+ string.format(
+ 'syntax region %s start=+\\%%%dl+ end=+\\%%%dl+ contains=%s keepend',
+ name,
+ start,
+ finish + 1,
+ lang
+ )
+ )
end
-- needs to run in the buffer for the regions to work
@@ -1244,13 +1341,13 @@ function M.stylize_markdown(bufnr, contents, opts)
local last = 1
for _, h in ipairs(highlights) do
if last < h.start then
- apply_syntax_to_region("lsp_markdown", last, h.start - 1)
+ apply_syntax_to_region('lsp_markdown', last, h.start - 1)
end
apply_syntax_to_region(h.ft, h.start, h.finish)
last = h.finish + 1
end
if last <= #stripped then
- apply_syntax_to_region("lsp_markdown", last, #stripped)
+ apply_syntax_to_region('lsp_markdown', last, #stripped)
end
end)
@@ -1258,6 +1355,24 @@ function M.stylize_markdown(bufnr, contents, opts)
end
---@private
+--- Closes the preview window
+---
+---@param winnr number window id of preview window
+---@param bufnrs table|nil optional list of ignored buffers
+local function close_preview_window(winnr, bufnrs)
+ vim.schedule(function()
+ -- exit if we are in one of ignored buffers
+ if bufnrs and vim.tbl_contains(bufnrs, api.nvim_get_current_buf()) then
+ return
+ end
+
+ local augroup = 'preview_window_' .. winnr
+ pcall(api.nvim_del_augroup_by_name, augroup)
+ pcall(api.nvim_win_close, winnr, true)
+ end)
+end
+
+---@private
--- Creates autocommands to close a preview window when events happen.
---
---@param events table list of events
@@ -1265,49 +1380,30 @@ end
---@param bufnrs table list of buffers where the preview window will remain visible
---@see |autocmd-events|
local function close_preview_autocmd(events, winnr, bufnrs)
- local augroup = 'preview_window_'..winnr
+ local augroup = api.nvim_create_augroup('preview_window_' .. winnr, {
+ clear = true,
+ })
-- close the preview window when entered a buffer that is not
-- the floating window buffer or the buffer that spawned it
- vim.cmd(string.format([[
- augroup %s
- autocmd!
- autocmd BufEnter * lua vim.lsp.util._close_preview_window(%d, {%s})
- augroup end
- ]], augroup, winnr, table.concat(bufnrs, ',')))
+ api.nvim_create_autocmd('BufEnter', {
+ group = augroup,
+ callback = function()
+ close_preview_window(winnr, bufnrs)
+ end,
+ })
if #events > 0 then
- vim.cmd(string.format([[
- augroup %s
- autocmd %s <buffer> lua vim.lsp.util._close_preview_window(%d)
- augroup end
- ]], augroup, table.concat(events, ','), winnr))
+ api.nvim_create_autocmd(events, {
+ group = augroup,
+ buffer = bufnrs[2],
+ callback = function()
+ close_preview_window(winnr)
+ end,
+ })
end
end
----@private
---- Closes the preview window
----
----@param winnr number window id of preview window
----@param bufnrs table|nil optional list of ignored buffers
-function M._close_preview_window(winnr, bufnrs)
- vim.schedule(function()
- -- exit if we are in one of ignored buffers
- if bufnrs and vim.tbl_contains(bufnrs, api.nvim_get_current_buf()) then
- return
- end
-
- local augroup = 'preview_window_'..winnr
- vim.cmd(string.format([[
- augroup %s
- autocmd!
- augroup end
- augroup! %s
- ]], augroup, augroup))
- pcall(vim.api.nvim_win_close, winnr, true)
- end)
-end
-
---@internal
--- Computes size of float needed to show contents (with optional wrapping)
---
@@ -1320,10 +1416,10 @@ end
--- - max_height maximal height of floating window
---@returns width,height size of float
function M._make_floating_popup_size(contents, opts)
- validate {
- contents = { contents, 't' };
- opts = { opts, 't', true };
- }
+ validate({
+ contents = { contents, 't' },
+ opts = { opts, 't', true },
+ })
opts = opts or {}
local width = opts.width
@@ -1367,11 +1463,11 @@ function M._make_floating_popup_size(contents, opts)
if vim.tbl_isempty(line_widths) then
for _, line in ipairs(contents) do
local line_width = vim.fn.strdisplaywidth(line)
- height = height + math.ceil(line_width/wrap_at)
+ height = height + math.ceil(line_width / wrap_at)
end
else
for i = 1, #contents do
- height = height + math.max(1, math.ceil(line_widths[i]/wrap_at))
+ height = height + math.max(1, math.ceil(line_widths[i] / wrap_at))
end
end
end
@@ -1391,7 +1487,7 @@ end
--- - height: (number) height of floating window
--- - width: (number) width of floating window
--- - wrap: (boolean, default true) wrap long lines
---- - wrap_at: (string) character to wrap at for computing height when wrap is enabled
+--- - wrap_at: (number) character to wrap at for computing height when wrap is enabled
--- - max_width: (number) maximal width of floating window
--- - max_height: (number) maximal height of floating window
--- - pad_top: (number) number of lines to pad contents at top
@@ -1405,16 +1501,16 @@ end
---@returns bufnr,winnr buffer and window number of the newly created floating
---preview window
function M.open_floating_preview(contents, syntax, opts)
- validate {
- contents = { contents, 't' };
- syntax = { syntax, 's', true };
- opts = { opts, 't', true };
- }
+ validate({
+ contents = { contents, 't' },
+ syntax = { syntax, 's', true },
+ opts = { opts, 't', true },
+ })
opts = opts or {}
opts.wrap = opts.wrap ~= false -- wrapping by default
- opts.stylize_markdown = opts.stylize_markdown ~= false
+ opts.stylize_markdown = opts.stylize_markdown ~= false and vim.g.syntax_on ~= nil
opts.focus = opts.focus ~= false
- opts.close_events = opts.close_events or {"CursorMoved", "CursorMovedI", "InsertCharPre"}
+ opts.close_events = opts.close_events or { 'CursorMoved', 'CursorMovedI', 'InsertCharPre' }
local bufnr = api.nvim_get_current_buf()
@@ -1423,7 +1519,7 @@ function M.open_floating_preview(contents, syntax, opts)
-- Go back to previous window if we are in a focusable one
local current_winnr = api.nvim_get_current_win()
if npcall(api.nvim_win_get_var, current_winnr, opts.focus_id) then
- api.nvim_command("wincmd p")
+ api.nvim_command('wincmd p')
return bufnr, current_winnr
end
do
@@ -1431,7 +1527,7 @@ function M.open_floating_preview(contents, syntax, opts)
if win and api.nvim_win_is_valid(win) and vim.fn.pumvisible() == 0 then
-- focus and return the existing buf, win
api.nvim_set_current_win(win)
- api.nvim_command("stopinsert")
+ api.nvim_command('stopinsert')
return api.nvim_win_get_buf(win), win
end
end
@@ -1439,14 +1535,13 @@ function M.open_floating_preview(contents, syntax, opts)
-- check if another floating preview already exists for this buffer
-- and close it if needed
- local existing_float = npcall(api.nvim_buf_get_var, bufnr, "lsp_floating_preview")
+ local existing_float = npcall(api.nvim_buf_get_var, bufnr, 'lsp_floating_preview')
if existing_float and api.nvim_win_is_valid(existing_float) then
api.nvim_win_close(existing_float, true)
end
local floating_bufnr = api.nvim_create_buf(false, true)
- local do_stylize = syntax == "markdown" and opts.stylize_markdown
-
+ local do_stylize = syntax == 'markdown' and opts.stylize_markdown
-- Clean up input: trim empty lines from the end, pad
contents = M._trim(contents, opts)
@@ -1482,26 +1577,32 @@ function M.open_floating_preview(contents, syntax, opts)
api.nvim_buf_set_option(floating_bufnr, 'modifiable', false)
api.nvim_buf_set_option(floating_bufnr, 'bufhidden', 'wipe')
- api.nvim_buf_set_keymap(floating_bufnr, "n", "q", "<cmd>bdelete<cr>", {silent = true, noremap = true, nowait = true})
- close_preview_autocmd(opts.close_events, floating_winnr, {floating_bufnr, bufnr})
+ api.nvim_buf_set_keymap(
+ floating_bufnr,
+ 'n',
+ 'q',
+ '<cmd>bdelete<cr>',
+ { silent = true, noremap = true, nowait = true }
+ )
+ close_preview_autocmd(opts.close_events, floating_winnr, { floating_bufnr, bufnr })
-- save focus_id
if opts.focus_id then
api.nvim_win_set_var(floating_winnr, opts.focus_id, bufnr)
end
- api.nvim_buf_set_var(bufnr, "lsp_floating_preview", floating_winnr)
+ api.nvim_buf_set_var(bufnr, 'lsp_floating_preview', floating_winnr)
return floating_bufnr, floating_winnr
end
do --[[ References ]]
- local reference_ns = api.nvim_create_namespace("vim_lsp_references")
+ local reference_ns = api.nvim_create_namespace('vim_lsp_references')
--- Removes document highlights from a buffer.
---
---@param bufnr number Buffer id
function M.buf_clear_references(bufnr)
- validate { bufnr = {bufnr, 'n', true} }
+ validate({ bufnr = { bufnr, 'n', true } })
api.nvim_buf_clear_namespace(bufnr or 0, reference_ns, 0, -1)
end
@@ -1509,35 +1610,50 @@ do --[[ References ]]
---
---@param bufnr number Buffer id
---@param references table List of `DocumentHighlight` objects to highlight
- ---@param offset_encoding string One of "utf-8", "utf-16", "utf-32", or nil. Defaults to `offset_encoding` of first client of `bufnr`
+ ---@param offset_encoding string One of "utf-8", "utf-16", "utf-32".
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight
function M.buf_highlight_references(bufnr, references, offset_encoding)
- validate { bufnr = {bufnr, 'n', true} }
- offset_encoding = offset_encoding or M._get_offset_encoding(bufnr)
+ validate({
+ bufnr = { bufnr, 'n', true },
+ offset_encoding = { offset_encoding, 'string', false },
+ })
for _, reference in ipairs(references) do
- local start_line, start_char = reference["range"]["start"]["line"], reference["range"]["start"]["character"]
- local end_line, end_char = reference["range"]["end"]["line"], reference["range"]["end"]["character"]
-
- local start_idx = get_line_byte_from_position(bufnr, { line = start_line, character = start_char }, offset_encoding)
- local end_idx = get_line_byte_from_position(bufnr, { line = start_line, character = end_char }, offset_encoding)
+ local start_line, start_char =
+ reference['range']['start']['line'], reference['range']['start']['character']
+ local end_line, end_char =
+ reference['range']['end']['line'], reference['range']['end']['character']
+
+ local start_idx = get_line_byte_from_position(
+ bufnr,
+ { line = start_line, character = start_char },
+ offset_encoding
+ )
+ local end_idx = get_line_byte_from_position(
+ bufnr,
+ { line = start_line, character = end_char },
+ offset_encoding
+ )
local document_highlight_kind = {
- [protocol.DocumentHighlightKind.Text] = "LspReferenceText";
- [protocol.DocumentHighlightKind.Read] = "LspReferenceRead";
- [protocol.DocumentHighlightKind.Write] = "LspReferenceWrite";
+ [protocol.DocumentHighlightKind.Text] = 'LspReferenceText',
+ [protocol.DocumentHighlightKind.Read] = 'LspReferenceRead',
+ [protocol.DocumentHighlightKind.Write] = 'LspReferenceWrite',
}
- local kind = reference["kind"] or protocol.DocumentHighlightKind.Text
- highlight.range(bufnr,
- reference_ns,
- document_highlight_kind[kind],
- { start_line, start_idx },
- { end_line, end_idx })
+ local kind = reference['kind'] or protocol.DocumentHighlightKind.Text
+ highlight.range(
+ bufnr,
+ reference_ns,
+ document_highlight_kind[kind],
+ { start_line, start_idx },
+ { end_line, end_idx },
+ { priority = vim.highlight.priorities.user }
+ )
end
end
end
local position_sort = sort_by_key(function(v)
- return {v.start.line, v.start.character}
+ return { v.start.line, v.start.character }
end)
--- Returns the items with the byte position calculated correctly and in sorted
@@ -1546,25 +1662,32 @@ end)
--- The result can be passed to the {list} argument of |setqflist()| or
--- |setloclist()|.
---
----@param locations (table) list of `Location`s or `LocationLink`s
+---@param locations table list of `Location`s or `LocationLink`s
+---@param offset_encoding string offset_encoding for locations utf-8|utf-16|utf-32
---@returns (table) list of items
-function M.locations_to_items(locations)
+function M.locations_to_items(locations, offset_encoding)
+ if offset_encoding == nil then
+ vim.notify_once(
+ 'locations_to_items must be called with valid offset encoding',
+ vim.log.levels.WARN
+ )
+ end
+
local items = {}
local grouped = setmetatable({}, {
__index = function(t, k)
local v = {}
rawset(t, k, v)
return v
- end;
+ end,
})
for _, d in ipairs(locations) do
-- 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})
+ table.insert(grouped[uri], { start = range.start })
end
-
local keys = vim.tbl_keys(grouped)
table.sort(keys)
-- TODO(ashkan) I wish we could do this lazily.
@@ -1587,53 +1710,24 @@ function M.locations_to_items(locations)
for _, temp in ipairs(rows) do
local pos = temp.start
local row = pos.line
- local line = lines[row] or ""
- local col = pos.character
+ local line = lines[row] or ''
+ local col = M._str_byteindex_enc(line, pos.character, offset_encoding)
table.insert(items, {
filename = filename,
lnum = row + 1,
- col = col + 1;
- text = line;
+ col = col + 1,
+ text = line,
})
end
end
return items
end
---- Fills target window's location list with given list of items.
---- Can be obtained with e.g. |vim.lsp.util.locations_to_items()|.
---- Defaults to current window.
----
----@deprecated Use |setloclist()|
----
----@param items (table) list of items
-function M.set_loclist(items, win_id)
- vim.api.nvim_echo({{'vim.lsp.util.set_loclist is deprecated. See :h deprecated', 'WarningMsg'}}, true, {})
- vim.fn.setloclist(win_id or 0, {}, ' ', {
- title = 'Language Server';
- items = items;
- })
-end
-
---- Fills quickfix list with given list of items.
---- Can be obtained with e.g. |vim.lsp.util.locations_to_items()|.
----
----@deprecated Use |setqflist()|
----
----@param items (table) list of items
-function M.set_qflist(items)
- vim.api.nvim_echo({{'vim.lsp.util.set_qflist is deprecated. See :h deprecated', 'WarningMsg'}}, true, {})
- vim.fn.setqflist({}, ' ', {
- title = 'Language Server';
- items = items;
- })
-end
-
-- According to LSP spec, if the client set "symbolKind.valueSet",
-- the client must handle it properly even if it receives a value outside the specification.
-- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
function M._get_symbol_kind_name(symbol_kind)
- return protocol.SymbolKind[symbol_kind] or "Unknown"
+ return protocol.SymbolKind[symbol_kind] or 'Unknown'
end
--- Converts symbols to quickfix list items.
@@ -1651,17 +1745,17 @@ function M.symbols_to_items(symbols, bufnr)
lnum = range.start.line + 1,
col = range.start.character + 1,
kind = kind,
- text = '['..kind..'] '..symbol.name,
+ text = '[' .. kind .. '] ' .. symbol.name,
})
elseif symbol.selectionRange then -- DocumentSymbole type
local kind = M._get_symbol_kind_name(symbol.kind)
table.insert(_items, {
-- bufnr = _bufnr,
- filename = vim.api.nvim_buf_get_name(_bufnr),
+ filename = api.nvim_buf_get_name(_bufnr),
lnum = symbol.selectionRange.start.line + 1,
col = symbol.selectionRange.start.character + 1,
kind = kind,
- text = '['..kind..'] '..symbol.name
+ text = '[' .. kind .. '] ' .. symbol.name,
})
if symbol.children then
for _, v in ipairs(_symbols_to_items(symbol.children, _items, _bufnr)) do
@@ -1695,7 +1789,7 @@ function M.trim_empty_lines(lines)
break
end
end
- return vim.list_extend({}, lines, start, finish)
+ return list_extend({}, lines, start, finish)
end
--- Accepts markdown lines and tries to reduce them to a filetype if they
@@ -1706,12 +1800,12 @@ end
---@param lines (table) list of lines
---@returns (string) filetype or 'markdown' if it was unchanged.
function M.try_trim_markdown_code_blocks(lines)
- local language_id = lines[1]:match("^```(.*)")
+ local language_id = lines[1]:match('^```(.*)')
if language_id then
local has_inner_code_fence = false
for i = 2, (#lines - 1) do
local line = lines[i]
- if line:sub(1,3) == '```' then
+ if line:sub(1, 3) == '```' then
has_inner_code_fence = true
break
end
@@ -1731,18 +1825,18 @@ end
---@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 = vim.api.nvim_win_get_buf(window)
+ local buf = api.nvim_win_get_buf(window)
local row, col = unpack(api.nvim_win_get_cursor(window))
offset_encoding = offset_encoding or M._get_offset_encoding(buf)
row = row - 1
- local line = api.nvim_buf_get_lines(buf, row, row+1, true)[1]
+ local line = api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
if not line then
- return { line = 0; character = 0; }
+ return { line = 0, character = 0 }
end
col = _str_utfindex_enc(line, col, offset_encoding)
- return { line = row; character = col; }
+ return { line = row, character = col }
end
--- Creates a `TextDocumentPositionParams` object for the current buffer and cursor position.
@@ -1753,11 +1847,11 @@ end
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
function M.make_position_params(window, offset_encoding)
window = window or 0
- local buf = vim.api.nvim_win_get_buf(window)
+ local buf = api.nvim_win_get_buf(window)
offset_encoding = offset_encoding or M._get_offset_encoding(buf)
return {
- textDocument = M.make_text_document_params(buf);
- position = make_position_param(window, offset_encoding)
+ textDocument = M.make_text_document_params(buf),
+ position = make_position_param(window, offset_encoding),
}
end
@@ -1765,18 +1859,30 @@ end
---@param bufnr (number) buffer handle or 0 for current, defaults to current
---@returns (string) encoding first client if there is one, nil otherwise
function M._get_offset_encoding(bufnr)
- validate {
- bufnr = {bufnr, 'n', true};
- }
+ validate({
+ bufnr = { bufnr, 'n', true },
+ })
local offset_encoding
for _, client in pairs(vim.lsp.buf_get_clients(bufnr)) do
- local this_offset_encoding = client.offset_encoding or "utf-16"
+ if client.offset_encoding == nil then
+ vim.notify_once(
+ string.format(
+ 'Client (id: %s) offset_encoding is nil. Do not unset offset_encoding.',
+ client.id
+ ),
+ vim.log.levels.ERROR
+ )
+ end
+ local this_offset_encoding = client.offset_encoding
if not offset_encoding then
offset_encoding = this_offset_encoding
elseif offset_encoding ~= this_offset_encoding then
- vim.notify("warning: multiple different client offset_encodings detected for buffer, this is not supported yet", vim.log.levels.WARN)
+ vim.notify(
+ 'warning: multiple different client offset_encodings detected for buffer, this is not supported yet',
+ vim.log.levels.WARN
+ )
end
end
@@ -1793,12 +1899,12 @@ end
---@returns { textDocument = { uri = `current_file_uri` }, range = { start =
---`current_position`, end = `current_position` } }
function M.make_range_params(window, offset_encoding)
- local buf = vim.api.nvim_win_get_buf(window or 0)
+ local buf = api.nvim_win_get_buf(window or 0)
offset_encoding = offset_encoding or M._get_offset_encoding(buf)
local position = make_position_param(window, offset_encoding)
return {
textDocument = M.make_text_document_params(buf),
- range = { start = position; ["end"] = position; }
+ range = { start = position, ['end'] = position },
}
end
@@ -1814,12 +1920,12 @@ end
---@returns { textDocument = { uri = `current_file_uri` }, range = { start =
---`start_position`, end = `end_position` } }
function M.make_given_range_params(start_pos, end_pos, bufnr, offset_encoding)
- validate {
- start_pos = {start_pos, 't', true};
- end_pos = {end_pos, 't', true};
- offset_encoding = {offset_encoding, 's', true};
- }
- bufnr = bufnr or vim.api.nvim_get_current_buf()
+ validate({
+ start_pos = { start_pos, 't', true },
+ end_pos = { end_pos, 't', true },
+ offset_encoding = { offset_encoding, 's', true },
+ })
+ bufnr = bufnr or api.nvim_get_current_buf()
offset_encoding = offset_encoding or M._get_offset_encoding(bufnr)
local A = list_extend({}, start_pos or api.nvim_buf_get_mark(bufnr, '<'))
local B = list_extend({}, end_pos or api.nvim_buf_get_mark(bufnr, '>'))
@@ -1828,10 +1934,10 @@ function M.make_given_range_params(start_pos, end_pos, bufnr, offset_encoding)
B[1] = B[1] - 1
-- account for offset_encoding.
if A[2] > 0 then
- A = {A[1], M.character_offset(bufnr, A[1], A[2], offset_encoding)}
+ A = { A[1], M.character_offset(bufnr, A[1], A[2], offset_encoding) }
end
if B[2] > 0 then
- B = {B[1], M.character_offset(bufnr, B[1], B[2], offset_encoding)}
+ B = { B[1], M.character_offset(bufnr, B[1], B[2], offset_encoding) }
end
-- we need to offset the end character position otherwise we loose the last
-- character of the selection, as LSP end position is exclusive
@@ -1842,9 +1948,9 @@ function M.make_given_range_params(start_pos, end_pos, bufnr, offset_encoding)
return {
textDocument = M.make_text_document_params(bufnr),
range = {
- start = {line = A[1], character = A[2]},
- ['end'] = {line = B[1], character = B[2]}
- }
+ start = { line = A[1], character = A[2] },
+ ['end'] = { line = B[1], character = B[2] },
+ },
}
end
@@ -1861,34 +1967,34 @@ end
---@param added
---@param removed
function M.make_workspace_params(added, removed)
- return { event = { added = added; removed = removed; } }
+ return { event = { added = added, removed = removed } }
end
---- Returns visual width of tabstop.
+--- Returns indentation size.
---
----@see |softtabstop|
----@param bufnr (optional, number): Buffer handle, defaults to current
----@returns (number) tabstop visual width
+---@see |shiftwidth|
+---@param bufnr (number|nil): Buffer handle, defaults to current
+---@returns (number) indentation size
function M.get_effective_tabstop(bufnr)
- validate { bufnr = {bufnr, 'n', true} }
+ validate({ bufnr = { bufnr, 'n', true } })
local bo = bufnr and vim.bo[bufnr] or vim.bo
- local sts = bo.softtabstop
- return (sts > 0 and sts) or (sts < 0 and bo.shiftwidth) or bo.tabstop
+ local sw = bo.shiftwidth
+ return (sw == 0 and bo.tabstop) or sw
end
--- Creates a `DocumentFormattingParams` object for the current buffer and cursor position.
---
----@param options Table with valid `FormattingOptions` entries
+---@param options table|nil with valid `FormattingOptions` entries
---@returns `DocumentFormattingParams` object
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
function M.make_formatting_params(options)
- validate { options = {options, 't', true} }
+ validate({ options = { options, 't', true } })
options = vim.tbl_extend('keep', options or {}, {
- tabSize = M.get_effective_tabstop();
- insertSpaces = vim.bo.expandtab;
+ tabSize = M.get_effective_tabstop(),
+ insertSpaces = vim.bo.expandtab,
})
return {
- textDocument = { uri = vim.uri_from_bufnr(0) };
- options = options;
+ textDocument = { uri = vim.uri_from_bufnr(0) },
+ options = options,
}
end
@@ -1901,7 +2007,12 @@ end
---@returns (number, number) `offset_encoding` index of the character in line {row} column {col} in buffer {buf}
function M.character_offset(buf, row, col, offset_encoding)
local line = get_line(buf, row)
- offset_encoding = offset_encoding or M._get_offset_encoding(buf)
+ if offset_encoding == nil then
+ vim.notify_once(
+ 'character_offset must be called with valid offset encoding',
+ vim.log.levels.WARN
+ )
+ end
-- If the col is past the EOL, use the line length.
if col > #line then
return _str_utfindex_enc(line, nil, offset_encoding)
@@ -1917,8 +2028,8 @@ end
function M.lookup_section(settings, section)
for part in vim.gsplit(section, '.', true) do
settings = settings[part]
- if not settings then
- return
+ if settings == nil then
+ return vim.NIL
end
end
return settings
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index e170befa4c..d6c3e25b3b 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -1,8 +1,10 @@
-- Functions shared by Nvim and its test-suite.
--
--- The singular purpose of this module is to share code with the Nvim
--- test-suite. If, in the future, Nvim itself is used to run the test-suite
--- instead of "vanilla Lua", these functions could move to src/nvim/lua/vim.lua
+-- These are "pure" lua functions not depending of the state of the editor.
+-- Thus they should always be available whenever nvim-related lua code is run,
+-- regardless if it is code in the editor itself, or in worker threads/processes,
+-- or the test suite. (Eventually the test suite will be run in a worker process,
+-- so this wouldn't be a separate case to consider)
local vim = vim or {}
@@ -13,8 +15,8 @@ local vim = vim or {}
--- copied and will throw an error.
---
---@param orig table Table to copy
----@returns New table of copied keys and (nested) values.
-function vim.deepcopy(orig) end -- luacheck: no unused
+---@return table Table of copied keys and (nested) values.
+function vim.deepcopy(orig) end -- luacheck: no unused
vim.deepcopy = (function()
local function _id(v)
return v
@@ -22,7 +24,9 @@ vim.deepcopy = (function()
local deepcopy_funcs = {
table = function(orig, cache)
- if cache[orig] then return cache[orig] end
+ if cache[orig] then
+ return cache[orig]
+ end
local copy = {}
cache[orig] = copy
@@ -44,7 +48,7 @@ vim.deepcopy = (function()
if f then
return f(orig, cache or {})
else
- error("Cannot deepcopy object of type "..type(orig))
+ error('Cannot deepcopy object of type ' .. type(orig))
end
end
end)()
@@ -55,19 +59,19 @@ end)()
---@see https://www.lua.org/pil/20.2.html
---@see http://lua-users.org/wiki/StringLibraryTutorial
---
----@param s String to split
----@param sep Separator string or pattern
----@param plain If `true` use `sep` literally (passed to String.find)
----@returns Iterator over the split components
+---@param s string String to split
+---@param sep string Separator or pattern
+---@param plain boolean If `true` use `sep` literally (passed to string.find)
+---@return function Iterator over the split components
function vim.gsplit(s, sep, plain)
- vim.validate{s={s,'s'},sep={sep,'s'},plain={plain,'b',true}}
+ vim.validate({ s = { s, 's' }, sep = { sep, 's' }, plain = { plain, 'b', true } })
local start = 1
local done = false
local function _pass(i, j, ...)
if i then
- assert(j+1 > start, "Infinite loop detected")
+ assert(j + 1 > start, 'Infinite loop detected')
local seg = s:sub(start, i - 1)
start = j + 1
return seg, ...
@@ -85,7 +89,7 @@ function vim.gsplit(s, sep, plain)
if start == #s then
done = true
end
- return _pass(start+1, start)
+ return _pass(start + 1, start)
end
return _pass(s:find(sep, start, plain))
end
@@ -103,13 +107,13 @@ end
---
---@see |vim.gsplit()|
---
----@param s String to split
----@param sep Separator string or pattern
----@param kwargs Keyword arguments:
+---@param s string String to split
+---@param sep string Separator or pattern
+---@param kwargs table Keyword arguments:
--- - plain: (boolean) If `true` use `sep` literally (passed to string.find)
--- - trimempty: (boolean) If `true` remove empty items from the front
--- and back of the list
----@returns List-like table of the split components.
+---@return table List of split components
function vim.split(s, sep, kwargs)
local plain
local trimempty = false
@@ -117,7 +121,7 @@ function vim.split(s, sep, kwargs)
-- Support old signature for backward compatibility
plain = kwargs
else
- vim.validate { kwargs = {kwargs, 't', true} }
+ vim.validate({ kwargs = { kwargs, 't', true } })
kwargs = kwargs or {}
plain = kwargs.plain
trimempty = kwargs.trimempty
@@ -126,7 +130,7 @@ function vim.split(s, sep, kwargs)
local t = {}
local skip = trimempty
for c in vim.gsplit(s, sep, plain) do
- if c ~= "" then
+ if c ~= '' then
skip = false
end
@@ -137,7 +141,7 @@ function vim.split(s, sep, kwargs)
if trimempty then
for i = #t, 1, -1 do
- if t[i] ~= "" then
+ if t[i] ~= '' then
break
end
table.remove(t, i)
@@ -152,10 +156,10 @@ end
---
---@see From https://github.com/premake/premake-core/blob/master/src/base/table.lua
---
----@param t Table
----@returns list of keys
+---@param t table Table
+---@return table List of keys
function vim.tbl_keys(t)
- assert(type(t) == 'table', string.format("Expected table, got %s", type(t)))
+ assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
local keys = {}
for k, _ in pairs(t) do
@@ -167,10 +171,10 @@ end
--- Return a list of all values used in a table.
--- However, the order of the return table of values is not guaranteed.
---
----@param t Table
----@returns list of values
+---@param t table Table
+---@return table List of values
function vim.tbl_values(t)
- assert(type(t) == 'table', string.format("Expected table, got %s", type(t)))
+ assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
local values = {}
for _, v in pairs(t) do
@@ -181,10 +185,11 @@ end
--- Apply a function to all values of a table.
---
----@param func function or callable table
----@param t table
+---@param func function|table Function or callable table
+---@param t table Table
+---@return table Table of transformed values
function vim.tbl_map(func, t)
- vim.validate{func={func,'c'},t={t,'t'}}
+ vim.validate({ func = { func, 'c' }, t = { t, 't' } })
local rettab = {}
for k, v in pairs(t) do
@@ -195,10 +200,11 @@ end
--- Filter a table using a predicate function
---
----@param func function or callable table
----@param t table
+---@param func function|table Function or callable table
+---@param t table Table
+---@return table Table of filtered values
function vim.tbl_filter(func, t)
- vim.validate{func={func,'c'},t={t,'t'}}
+ vim.validate({ func = { func, 'c' }, t = { t, 't' } })
local rettab = {}
for _, entry in pairs(t) do
@@ -211,13 +217,13 @@ end
--- Checks if a list-like (vector) table contains `value`.
---
----@param t Table to check
----@param value Value to compare
----@returns true if `t` contains `value`
+---@param t table Table to check
+---@param value any Value to compare
+---@return boolean `true` if `t` contains `value`
function vim.tbl_contains(t, value)
- vim.validate{t={t,'t'}}
+ vim.validate({ t = { t, 't' } })
- for _,v in ipairs(t) do
+ for _, v in ipairs(t) do
if v == value then
return true
end
@@ -229,25 +235,30 @@ end
---
---@see https://github.com/premake/premake-core/blob/master/src/base/table.lua
---
----@param t Table to check
+---@param t table Table to check
+---@return boolean `true` if `t` is empty
function vim.tbl_isempty(t)
- assert(type(t) == 'table', string.format("Expected table, got %s", type(t)))
+ assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
return next(t) == nil
end
---- we only merge empty tables or tables that are not a list
+--- We only merge empty tables or tables that are not a list
---@private
local function can_merge(v)
- return type(v) == "table" and (vim.tbl_isempty(v) or not vim.tbl_islist(v))
+ return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.tbl_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))
+ 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)')
+ error(
+ 'wrong number of arguments (given '
+ .. tostring(1 + select('#', ...))
+ .. ', expected at least 3)'
+ )
end
local ret = {}
@@ -257,15 +268,15 @@ local function tbl_extend(behavior, deep_extend, ...)
for i = 1, select('#', ...) do
local tbl = select(i, ...)
- vim.validate{["after the second argument"] = {tbl,'t'}}
+ vim.validate({ ['after the second argument'] = { tbl, 't' } })
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)
elseif behavior ~= 'force' and ret[k] ~= nil then
if behavior == 'error' then
- error('key found in more than one map: '..k)
- end -- Else behavior is "keep".
+ error('key found in more than one map: ' .. k)
+ end -- Else behavior is "keep".
else
ret[k] = v
end
@@ -279,11 +290,12 @@ end
---
---@see |extend()|
---
----@param behavior Decides what to do if a key is found in more than one map:
+---@param behavior string Decides what to do if a key is found in more than one map:
--- - "error": raise an error
--- - "keep": use value from the leftmost map
--- - "force": use value from the rightmost map
----@param ... Two or more map-like tables.
+---@param ... table Two or more map-like tables
+---@return table Merged table
function vim.tbl_extend(behavior, ...)
return tbl_extend(behavior, false, ...)
end
@@ -292,25 +304,30 @@ end
---
---@see |tbl_extend()|
---
----@param behavior Decides what to do if a key is found in more than one map:
+---@param behavior string Decides what to do if a key is found in more than one map:
--- - "error": raise an error
--- - "keep": use value from the leftmost map
--- - "force": use value from the rightmost map
----@param ... Two or more map-like tables.
+---@param ... table Two or more map-like tables
+---@return table Merged table
function vim.tbl_deep_extend(behavior, ...)
return tbl_extend(behavior, true, ...)
end
--- Deep compare values for equality
---
---- Tables are compared recursively unless they both provide the `eq` methamethod.
+--- Tables are compared recursively unless they both provide the `eq` metamethod.
--- All other types are compared using the equality `==` operator.
----@param a first value
----@param b second value
----@returns `true` if values are equals, else `false`.
+---@param a any First value
+---@param b any Second value
+---@return boolean `true` if values are equals, else `false`
function vim.deep_equal(a, b)
- if a == b then return true end
- if type(a) ~= type(b) then return false end
+ if a == b then
+ return true
+ end
+ if type(a) ~= type(b) then
+ return false
+ end
if type(a) == 'table' then
for k, v in pairs(a) do
if not vim.deep_equal(v, b[k]) then
@@ -329,40 +346,77 @@ end
--- Add the reverse lookup values to an existing table.
--- For example:
---- `tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A = 1 }`
---
---Do note that it *modifies* the input.
----@param o table The table to add the reverse to.
+--- ``tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A = 1 }``
+---
+--- Note that this *modifies* the input.
+---@param o table Table to add the reverse to
+---@return table o
function vim.tbl_add_reverse_lookup(o)
local keys = vim.tbl_keys(o)
for _, k in ipairs(keys) do
local v = o[k]
if o[v] then
- error(string.format("The reverse lookup found an existing value for %q while processing key %q", tostring(v), tostring(k)))
+ error(
+ string.format(
+ 'The reverse lookup found an existing value for %q while processing key %q',
+ tostring(v),
+ tostring(k)
+ )
+ )
end
o[v] = k
end
return o
end
+--- Index into a table (first argument) via string keys passed as subsequent arguments.
+--- Return `nil` if the key does not exist.
+---
+--- Examples:
+--- <pre>
+--- vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true
+--- vim.tbl_get({ key = {}}, 'key', 'nested_key') == nil
+--- </pre>
+---
+---@param o table Table to index
+---@param ... string Optional strings (0 or more, variadic) via which to index the table
+---
+---@return any Nested value indexed by key (if it exists), else nil
+function vim.tbl_get(o, ...)
+ local keys = { ... }
+ if #keys == 0 then
+ return
+ end
+ for i, k in ipairs(keys) do
+ if type(o[k]) ~= 'table' and next(keys, i) then
+ return nil
+ end
+ o = o[k]
+ if o == nil then
+ return
+ end
+ end
+ return o
+end
+
--- Extends a list-like table with the values of another list-like table.
---
--- NOTE: This mutates dst!
---
---@see |vim.tbl_extend()|
---
----@param dst list which will be modified and appended to.
----@param src list from which values will be inserted.
----@param start Start index on src. defaults to 1
----@param finish Final index on src. defaults to #src
----@returns dst
+---@param dst table List which will be modified and appended to
+---@param src table List from which values will be inserted
+---@param start number Start index on src. Defaults to 1
+---@param finish number Final index on src. Defaults to `#src`
+---@return table dst
function vim.list_extend(dst, src, start, finish)
- vim.validate {
- dst = {dst, 't'};
- src = {src, 't'};
- start = {start, 'n', true};
- finish = {finish, 'n', true};
- }
+ vim.validate({
+ dst = { dst, 't' },
+ src = { src, 't' },
+ start = { start, 'n', true },
+ finish = { finish, 'n', true },
+ })
for i = start or 1, finish or #src do
table.insert(dst, src[i])
end
@@ -374,15 +428,15 @@ end
---
---@see From https://github.com/premake/premake-core/blob/master/src/base/table.lua
---
----@param t List-like table
----@returns Flattened copy of the given list-like table.
+---@param t table List-like table
+---@return table Flattened copy of the given list-like table
function vim.tbl_flatten(t)
local result = {}
local function _tbl_flatten(_t)
local n = #_t
for i = 1, n do
local v = _t[i]
- if type(v) == "table" then
+ if type(v) == 'table' then
_tbl_flatten(v)
elseif v then
table.insert(result, v)
@@ -399,8 +453,8 @@ end
--- |vim.empty_dict()| or returned as a dict-like |API| or Vimscript result,
--- for example from |rpcrequest()| or |vim.fn|.
---
----@param t Table
----@returns `true` if array-like table, else `false`.
+---@param t table Table
+---@return boolean `true` if array-like table, else `false`
function vim.tbl_islist(t)
if type(t) ~= 'table' then
return false
@@ -409,7 +463,7 @@ function vim.tbl_islist(t)
local count = 0
for k, _ in pairs(t) do
- if type(k) == "number" then
+ if type(k) == 'number' then
count = count + 1
else
return false
@@ -436,26 +490,28 @@ end
--- </pre>
---
---@see https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
----@param t Table
----@returns Number that is the number of the value in table
+---@param t table Table
+---@return number Number of non-nil values in table
function vim.tbl_count(t)
- vim.validate{t={t,'t'}}
+ vim.validate({ t = { t, 't' } })
local count = 0
- for _ in pairs(t) do count = count + 1 end
+ for _ in pairs(t) do
+ count = count + 1
+ end
return count
end
--- Creates a copy of a table containing only elements from start to end (inclusive)
---
----@param list table table
----@param start integer Start range of slice
----@param finish integer End range of slice
----@returns Copy of table sliced from start to finish (inclusive)
+---@param list table Table
+---@param start number Start range of slice
+---@param finish number End range of slice
+---@return table Copy of table sliced from start to finish (inclusive)
function vim.list_slice(list, start, finish)
local new_list = {}
for i = start or 1, finish or #list do
- new_list[#new_list+1] = list[i]
+ new_list[#new_list + 1] = list[i]
end
return new_list
end
@@ -463,40 +519,40 @@ end
--- Trim whitespace (Lua pattern "%s") from both sides of a string.
---
---@see https://www.lua.org/pil/20.2.html
----@param s String to trim
----@returns String with whitespace removed from its beginning and 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, 's' } })
return s:match('^%s*(.*%S)') or ''
end
--- Escapes magic chars in a Lua pattern.
---
---@see https://github.com/rxi/lume
----@param s String to escape
----@returns %-escaped pattern string
+---@param s string String to escape
+---@return string %-escaped pattern string
function vim.pesc(s)
- vim.validate{s={s,'s'}}
+ vim.validate({ s = { s, 's' } })
return s:gsub('[%(%)%.%%%+%-%*%?%[%]%^%$]', '%%%1')
end
--- Tests if `s` starts with `prefix`.
---
----@param s (string) a string
----@param prefix (string) a prefix
----@return (boolean) true if `prefix` is a prefix of s
+---@param s string String
+---@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, 's' }, prefix = { prefix, 's' } })
return s:sub(1, #prefix) == prefix
end
--- Tests if `s` ends with `suffix`.
---
----@param s (string) a string
----@param suffix (string) a suffix
----@return (boolean) true if `suffix` is a suffix of s
+---@param s string String
+---@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, 's' }, suffix = { suffix, 's' } })
return #suffix == 0 or s:sub(-#suffix) == suffix
end
@@ -536,7 +592,7 @@ end
---
--- </pre>
---
----@param opt table of parameter names to validations. Each key is a parameter
+---@param opt table Names of parameters to validate. Each key is a parameter
--- name; each value is a tuple in one of these forms:
--- 1. (arg_value, type_name, optional)
--- - arg_value: argument value
@@ -550,18 +606,24 @@ end
--- 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) end -- luacheck: no unused
+function vim.validate(opt) end -- luacheck: no unused
do
local type_names = {
- ['table'] = 'table', t = 'table',
- ['string'] = 'string', s = 'string',
- ['number'] = 'number', n = 'number',
- ['boolean'] = 'boolean', b = 'boolean',
- ['function'] = 'function', f = 'function',
- ['callable'] = 'callable', c = 'callable',
- ['nil'] = 'nil',
- ['thread'] = 'thread',
+ ['table'] = 'table',
+ t = 'table',
+ ['string'] = 'string',
+ s = 'string',
+ ['number'] = 'number',
+ n = 'number',
+ ['boolean'] = 'boolean',
+ b = 'boolean',
+ ['function'] = 'function',
+ f = 'function',
+ ['callable'] = 'callable',
+ c = 'callable',
+ ['nil'] = 'nil',
+ ['thread'] = 'thread',
['userdata'] = 'userdata',
}
@@ -580,21 +642,22 @@ do
return false, string.format('opt[%s]: expected table, got %s', param_name, type(spec))
end
- local val = spec[1] -- Argument value.
- local types = spec[2] -- Type name, or callable.
+ local val = spec[1] -- Argument value
+ local types = spec[2] -- Type name, or callable
local optional = (true == spec[3])
if type(types) == 'string' then
- types = {types}
+ types = { types }
end
if vim.is_callable(types) then
- -- Check user-provided validation function.
+ -- Check user-provided validation function
local valid, optional_message = types(val)
if not valid then
- local error_message = string.format("%s: expected %s, got %s", param_name, (spec[3] or '?'), tostring(val))
+ local error_message =
+ string.format('%s: expected %s, got %s', param_name, (spec[3] or '?'), tostring(val))
if optional_message ~= nil then
- error_message = error_message .. string.format(". Info: %s", optional_message)
+ error_message = error_message .. string.format('. Info: %s', optional_message)
end
return false, error_message
@@ -614,10 +677,16 @@ do
end
end
if not success then
- return false, string.format("%s: expected %s, got %s", param_name, table.concat(types, '|'), type(val))
+ return false,
+ string.format(
+ '%s: expected %s, got %s',
+ param_name,
+ table.concat(types, '|'),
+ type(val)
+ )
end
else
- return false, string.format("invalid type name: %s", tostring(types))
+ return false, string.format('invalid type name: %s', tostring(types))
end
end
@@ -633,12 +702,16 @@ do
end
--- Returns true if object `f` can be called as a function.
---
----@param f Any object
----@return true if `f` is callable, else false
+---@param f any Any object
+---@return boolean `true` if `f` is callable, else `false`
function vim.is_callable(f)
- if type(f) == 'function' then return true end
+ if type(f) == 'function' then
+ return true
+ end
local m = getmetatable(f)
- if m == nil then return false end
+ if m == nil then
+ return false
+ end
return type(m.__call) == 'function'
end
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 07f6418c0c..70f2c425ed 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -1,31 +1,32 @@
local a = vim.api
-local query = require'vim.treesitter.query'
-local language = require'vim.treesitter.language'
-local LanguageTree = require'vim.treesitter.languagetree'
+local query = require('vim.treesitter.query')
+local language = require('vim.treesitter.language')
+local LanguageTree = require('vim.treesitter.languagetree')
-- TODO(bfredl): currently we retain parsers for the lifetime of the buffer.
-- Consider use weak references to release parser if all plugins are done with
-- it.
local parsers = {}
-local M = vim.tbl_extend("error", query, language)
+local M = vim.tbl_extend('error', query, language)
M.language_version = vim._ts_get_language_version()
+M.minimum_language_version = vim._ts_get_minimum_language_version()
setmetatable(M, {
- __index = function (t, k)
- if k == "highlighter" then
- t[k] = require'vim.treesitter.highlighter'
- return t[k]
- elseif k == "language" then
- t[k] = require"vim.treesitter.language"
- return t[k]
- elseif k == "query" then
- t[k] = require"vim.treesitter.query"
- return t[k]
- end
- end
- })
+ __index = function(t, k)
+ if k == 'highlighter' then
+ t[k] = require('vim.treesitter.highlighter')
+ return t[k]
+ elseif k == 'language' then
+ t[k] = require('vim.treesitter.language')
+ return t[k]
+ elseif k == 'query' then
+ t[k] = require('vim.treesitter.query')
+ return t[k]
+ end
+ end,
+})
--- Creates a new parser.
---
@@ -62,7 +63,11 @@ function M._create_parser(bufnr, lang, opts)
self:_on_reload(...)
end
- a.nvim_buf_attach(self:source(), false, {on_bytes=bytes_cb, on_detach=detach_cb, on_reload=reload_cb, preview=true})
+ a.nvim_buf_attach(
+ self:source(),
+ false,
+ { on_bytes = bytes_cb, on_detach = detach_cb, on_reload = reload_cb, preview = true }
+ )
self:parse()
@@ -86,10 +91,10 @@ function M.get_parser(bufnr, lang, opts)
bufnr = a.nvim_get_current_buf()
end
if lang == nil then
- lang = a.nvim_buf_get_option(bufnr, "filetype")
+ lang = a.nvim_buf_get_option(bufnr, 'filetype')
end
- if parsers[bufnr] == nil then
+ if parsers[bufnr] == nil or parsers[bufnr]:lang() ~= lang then
parsers[bufnr] = M._create_parser(bufnr, lang, opts)
end
@@ -104,10 +109,10 @@ end
---@param lang The language of this string
---@param opts Options to pass to the created language tree
function M.get_string_parser(str, lang, opts)
- vim.validate {
+ vim.validate({
str = { str, 'string' },
- lang = { lang, 'string' }
- }
+ lang = { lang, 'string' },
+ })
language.require_language(lang)
return LanguageTree.new(str, lang, opts)
diff --git a/runtime/lua/vim/treesitter/health.lua b/runtime/lua/vim/treesitter/health.lua
index 53ccc6e88d..3bd59ca282 100644
--- a/runtime/lua/vim/treesitter/health.lua
+++ b/runtime/lua/vim/treesitter/health.lua
@@ -15,24 +15,24 @@ function M.check()
local report_error = vim.fn['health#report_error']
local parsers = M.list_parsers()
- report_info(string.format("Runtime ABI version : %d", ts.language_version))
+ report_info(string.format('Runtime ABI version : %d', ts.language_version))
for _, parser in pairs(parsers) do
- local parsername = vim.fn.fnamemodify(parser, ":t:r")
+ local parsername = vim.fn.fnamemodify(parser, ':t:r')
local is_loadable, ret = pcall(ts.language.require_language, parsername)
if not is_loadable then
- report_error(string.format("Impossible to load parser for %s: %s", parsername, ret))
+ report_error(string.format('Impossible to load parser for %s: %s', parsername, ret))
elseif ret then
local lang = ts.language.inspect_language(parsername)
- report_ok(string.format("Loaded parser for %s: ABI version %d",
- parsername, lang._abi_version))
+ report_ok(
+ string.format('Loaded parser for %s: ABI version %d', parsername, lang._abi_version)
+ )
else
- report_error(string.format("Unable to load parser for %s", parsername))
+ report_error(string.format('Unable to load parser for %s', parsername))
end
end
end
return M
-
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 22b528838c..e27a5fa9c3 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -1,5 +1,5 @@
local a = vim.api
-local query = require"vim.treesitter.query"
+local query = require('vim.treesitter.query')
-- support reload for quick experimentation
local TSHighlighter = rawget(vim.treesitter, 'TSHighlighter') or {}
@@ -10,64 +10,88 @@ TSHighlighter.active = TSHighlighter.active or {}
local TSHighlighterQuery = {}
TSHighlighterQuery.__index = TSHighlighterQuery
-local ns = a.nvim_create_namespace("treesitter/highlighter")
+local ns = a.nvim_create_namespace('treesitter/highlighter')
local _default_highlights = {}
local _link_default_highlight_once = function(from, to)
if not _default_highlights[from] then
_default_highlights[from] = true
- vim.cmd(string.format("highlight default link %s %s", from, to))
+ a.nvim_set_hl(0, from, { link = to, default = true })
end
return from
end
-TSHighlighter.hl_map = {
- ["error"] = "Error",
-
--- Miscs
- ["comment"] = "Comment",
- ["punctuation.delimiter"] = "Delimiter",
- ["punctuation.bracket"] = "Delimiter",
- ["punctuation.special"] = "Delimiter",
-
--- Constants
- ["constant"] = "Constant",
- ["constant.builtin"] = "Special",
- ["constant.macro"] = "Define",
- ["string"] = "String",
- ["string.regex"] = "String",
- ["string.escape"] = "SpecialChar",
- ["character"] = "Character",
- ["number"] = "Number",
- ["boolean"] = "Boolean",
- ["float"] = "Float",
-
--- Functions
- ["function"] = "Function",
- ["function.special"] = "Function",
- ["function.builtin"] = "Special",
- ["function.macro"] = "Macro",
- ["parameter"] = "Identifier",
- ["method"] = "Function",
- ["field"] = "Identifier",
- ["property"] = "Identifier",
- ["constructor"] = "Special",
-
--- Keywords
- ["conditional"] = "Conditional",
- ["repeat"] = "Repeat",
- ["label"] = "Label",
- ["operator"] = "Operator",
- ["keyword"] = "Keyword",
- ["exception"] = "Exception",
-
- ["type"] = "Type",
- ["type.builtin"] = "Type",
- ["structure"] = "Structure",
- ["include"] = "Include",
+-- If @definition.special does not exist use @definition instead
+local subcapture_fallback = {
+ __index = function(self, capture)
+ local rtn
+ local shortened = capture
+ while not rtn and shortened do
+ shortened = shortened:match('(.*)%.')
+ rtn = shortened and rawget(self, shortened)
+ end
+ rawset(self, capture, rtn or '__notfound')
+ return rtn
+ end,
}
+TSHighlighter.hl_map = setmetatable({
+ ['error'] = 'Error',
+ ['text.underline'] = 'Underlined',
+ ['todo'] = 'Todo',
+ ['debug'] = 'Debug',
+
+ -- Miscs
+ ['comment'] = 'Comment',
+ ['punctuation.delimiter'] = 'Delimiter',
+ ['punctuation.bracket'] = 'Delimiter',
+ ['punctuation.special'] = 'Delimiter',
+
+ -- Constants
+ ['constant'] = 'Constant',
+ ['constant.builtin'] = 'Special',
+ ['constant.macro'] = 'Define',
+ ['define'] = 'Define',
+ ['macro'] = 'Macro',
+ ['string'] = 'String',
+ ['string.regex'] = 'String',
+ ['string.escape'] = 'SpecialChar',
+ ['character'] = 'Character',
+ ['character.special'] = 'SpecialChar',
+ ['number'] = 'Number',
+ ['boolean'] = 'Boolean',
+ ['float'] = 'Float',
+
+ -- Functions
+ ['function'] = 'Function',
+ ['function.special'] = 'Function',
+ ['function.builtin'] = 'Special',
+ ['function.macro'] = 'Macro',
+ ['parameter'] = 'Identifier',
+ ['method'] = 'Function',
+ ['field'] = 'Identifier',
+ ['property'] = 'Identifier',
+ ['constructor'] = 'Special',
+
+ -- Keywords
+ ['conditional'] = 'Conditional',
+ ['repeat'] = 'Repeat',
+ ['label'] = 'Label',
+ ['operator'] = 'Operator',
+ ['keyword'] = 'Keyword',
+ ['exception'] = 'Exception',
+
+ ['type'] = 'Type',
+ ['type.builtin'] = 'Type',
+ ['type.qualifier'] = 'Type',
+ ['type.definition'] = 'Typedef',
+ ['storageclass'] = 'StorageClass',
+ ['structure'] = 'Structure',
+ ['include'] = 'Include',
+ ['preproc'] = 'PreProc',
+}, subcapture_fallback)
+
---@private
local function is_highlight_name(capture_name)
local firstc = string.sub(capture_name, 1, 1)
@@ -89,13 +113,13 @@ function TSHighlighterQuery.new(lang, query_string)
rawset(table, capture, id)
return id
- end
+ end,
})
if query_string then
self._query = query.parse_query(lang, query_string)
else
- self._query = query.get_query(lang, "highlights")
+ self._query = query.get_query(lang, 'highlights')
end
return self
@@ -128,17 +152,23 @@ end
function TSHighlighter.new(tree, opts)
local self = setmetatable({}, TSHighlighter)
- if type(tree:source()) ~= "number" then
- error("TSHighlighter can not be used with a string parser source.")
+ if type(tree:source()) ~= 'number' then
+ error('TSHighlighter can not be used with a string parser source.')
end
opts = opts or {}
self.tree = tree
- tree:register_cbs {
- on_changedtree = function(...) self:on_changedtree(...) end;
- on_bytes = function(...) self:on_bytes(...) end;
- on_detach = function(...) self:on_detach(...) end;
- }
+ tree:register_cbs({
+ on_changedtree = function(...)
+ self:on_changedtree(...)
+ end,
+ on_bytes = function(...)
+ self:on_bytes(...)
+ end,
+ on_detach = function(...)
+ self:on_detach(...)
+ end,
+ })
self.bufnr = tree:source()
self.edit_count = 0
@@ -157,7 +187,7 @@ function TSHighlighter.new(tree, opts)
end
end
- a.nvim_buf_set_option(self.bufnr, "syntax", "")
+ a.nvim_buf_set_option(self.bufnr, 'syntax', '')
TSHighlighter.active[self.bufnr] = self
@@ -166,7 +196,7 @@ function TSHighlighter.new(tree, opts)
-- syntax FileType autocmds. Later on we should integrate with the
-- `:syntax` and `set syntax=...` machinery properly.
if vim.g.syntax_on ~= 1 then
- vim.api.nvim_command("runtime! syntax/synload.vim")
+ vim.api.nvim_command('runtime! syntax/synload.vim')
end
self.tree:parse()
@@ -186,7 +216,7 @@ function TSHighlighter:get_highlight_state(tstree)
if not self._highlight_states[tstree] then
self._highlight_states[tstree] = {
next_row = 0,
- iter = nil
+ iter = nil,
}
end
@@ -211,7 +241,7 @@ end
---@private
function TSHighlighter:on_changedtree(changes)
for _, ch in ipairs(changes or {}) do
- a.nvim__buf_redraw_range(self.bufnr, ch[1], ch[3]+1)
+ a.nvim__buf_redraw_range(self.bufnr, ch[1], ch[3] + 1)
end
end
@@ -229,39 +259,50 @@ end
---@private
local function on_line_impl(self, buf, line)
self.tree:for_each_tree(function(tstree, tree)
- if not tstree then return end
+ if not tstree then
+ return
+ end
local root_node = tstree:root()
local root_start_row, _, root_end_row, _ = root_node:range()
-- Only worry about trees within the line range
- if root_start_row > line or root_end_row < line then return end
+ if root_start_row > line or root_end_row < line then
+ return
+ end
local state = self:get_highlight_state(tstree)
local highlighter_query = self:get_query(tree:lang())
-- Some injected languages may not have highlight queries.
- if not highlighter_query:query() then return end
+ if not highlighter_query:query() then
+ return
+ end
- if state.iter == nil then
- state.iter = highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1)
+ if state.iter == nil or state.next_row < line then
+ state.iter =
+ highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1)
end
while line >= state.next_row do
local capture, node, metadata = state.iter()
- if capture == nil then break end
+ if capture == nil then
+ break
+ end
local start_row, start_col, end_row, end_col = node:range()
local hl = highlighter_query.hl_cache[capture]
if hl and end_row >= line then
- a.nvim_buf_set_extmark(buf, ns, start_row, start_col,
- { end_line = end_row, end_col = end_col,
- hl_group = hl,
- ephemeral = true,
- priority = tonumber(metadata.priority) or 100 -- Low but leaves room below
- })
+ a.nvim_buf_set_extmark(buf, ns, start_row, start_col, {
+ end_line = end_row,
+ end_col = end_col,
+ hl_group = hl,
+ ephemeral = true,
+ priority = tonumber(metadata.priority) or 100, -- Low but leaves room below
+ conceal = metadata.conceal,
+ })
end
if start_row > line then
state.next_row = start_row
@@ -273,7 +314,9 @@ end
---@private
function TSHighlighter._on_line(_, _win, buf, line, _)
local self = TSHighlighter.active[buf]
- if not self then return end
+ if not self then
+ return
+ end
on_line_impl(self, buf, line)
end
@@ -299,9 +342,9 @@ function TSHighlighter._on_win(_, _win, buf, _topline)
end
a.nvim_set_decoration_provider(ns, {
- on_buf = TSHighlighter._on_buf;
- on_win = TSHighlighter._on_win;
- on_line = TSHighlighter._on_line;
+ on_buf = TSHighlighter._on_buf,
+ on_win = TSHighlighter._on_win,
+ on_line = TSHighlighter._on_line,
})
return TSHighlighter
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index 6f347ff25f..dfb6f5be84 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -14,7 +14,7 @@ function M.require_language(lang, path, silent)
return true
end
if path == nil then
- local fname = 'parser/' .. lang .. '.*'
+ local fname = 'parser/' .. vim.fn.fnameescape(lang) .. '.*'
local paths = a.nvim_get_runtime_file(fname, false)
if #paths == 0 then
if silent then
@@ -22,13 +22,15 @@ function M.require_language(lang, path, silent)
end
-- TODO(bfredl): help tag?
- error("no parser for '"..lang.."' language, see :help treesitter-parsers")
+ error("no parser for '" .. lang .. "' language, see :help treesitter-parsers")
end
path = paths[1]
end
if silent then
- return pcall(function() vim._ts_add_language(path, lang) end)
+ return pcall(function()
+ vim._ts_add_language(path, lang)
+ end)
else
vim._ts_add_language(path, lang)
end
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 85fd5cd8e0..4d3b0631a2 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -1,6 +1,6 @@
local a = vim.api
-local query = require'vim.treesitter.query'
-local language = require'vim.treesitter.language'
+local query = require('vim.treesitter.query')
+local language = require('vim.treesitter.language')
local LanguageTree = {}
LanguageTree.__index = LanguageTree
@@ -32,9 +32,8 @@ function LanguageTree.new(source, lang, opts)
_regions = {},
_trees = {},
_opts = opts,
- _injection_query = injections[lang]
- and query.parse_query(lang, injections[lang])
- or query.get_query(lang, "injections"),
+ _injection_query = injections[lang] and query.parse_query(lang, injections[lang])
+ or query.get_query(lang, 'injections'),
_valid = false,
_parser = vim._create_ts_parser(lang),
_callbacks = {
@@ -42,11 +41,10 @@ function LanguageTree.new(source, lang, opts)
bytes = {},
detach = {},
child_added = {},
- child_removed = {}
+ child_removed = {},
},
}, LanguageTree)
-
return self
end
@@ -76,8 +74,8 @@ function LanguageTree:lang()
end
--- Determines whether this tree is valid.
---- If the tree is invalid, `parse()` must be called
---- to get the updated tree.
+--- If the tree is invalid, call `parse()`.
+--- This will return the updated tree.
function LanguageTree:is_valid()
return self._valid
end
@@ -234,7 +232,9 @@ end
--- Destroys this language tree and all its children.
---
--- Any cleanup logic should be performed here.
---- Note, this DOES NOT remove this tree from a parent.
+---
+--- Note:
+--- This DOES NOT remove this tree from a parent. Instead,
--- `remove_child` must be called on the parent to remove it.
function LanguageTree:destroy()
-- Cleanup here
@@ -259,22 +259,27 @@ end
---
--- Note, this call invalidates the tree and requires it to be parsed again.
---
----@param regions A list of regions this tree should manage and parse.
+---@param regions (table) list of regions this tree should manage and parse.
function LanguageTree:set_included_regions(regions)
- -- TODO(vigoux): I don't think string parsers are useful for now
- if type(self._source) == "number" then
- -- Transform the tables from 4 element long to 6 element long (with byte offset)
- for _, region in ipairs(regions) do
- for i, range in ipairs(region) do
- if type(range) == "table" and #range == 4 then
- local start_row, start_col, end_row, end_col = unpack(range)
+ -- Transform the tables from 4 element long to 6 element long (with byte offset)
+ for _, region in ipairs(regions) do
+ for i, range in ipairs(region) do
+ if type(range) == 'table' and #range == 4 then
+ local start_row, start_col, end_row, end_col = unpack(range)
+ local start_byte = 0
+ local end_byte = 0
+ -- TODO(vigoux): proper byte computation here, and account for EOL ?
+ if type(self._source) == 'number' then
-- Easy case, this is a buffer parser
- -- TODO(vigoux): proper byte computation here, and account for EOL ?
- local start_byte = a.nvim_buf_get_offset(self._source, start_row) + start_col
- local end_byte = a.nvim_buf_get_offset(self._source, end_row) + end_col
-
- region[i] = { start_row, start_col, start_byte, end_row, end_col, end_byte }
+ start_byte = a.nvim_buf_get_offset(self._source, start_row) + start_col
+ end_byte = a.nvim_buf_get_offset(self._source, end_row) + end_col
+ elseif type(self._source) == 'string' then
+ -- string parser, single `\n` delimited string
+ start_byte = vim.fn.byteidx(self._source, start_col)
+ end_byte = vim.fn.byteidx(self._source, end_col)
end
+
+ region[i] = { start_row, start_col, start_byte, end_row, end_col, end_byte }
end
end
end
@@ -293,6 +298,14 @@ function LanguageTree:included_regions()
return self._regions
end
+---@private
+local function get_node_range(node, id, metadata)
+ if metadata[id] and metadata[id].range then
+ return metadata[id].range
+ end
+ return { node:range() }
+end
+
--- Gets language injection points by language.
---
--- This is where most of the injection processing occurs.
@@ -301,7 +314,9 @@ end
--- instead of using the entire nodes range.
---@private
function LanguageTree:_get_injections()
- if not self._injection_query then return {} end
+ if not self._injection_query then
+ return {}
+ end
local injections = {}
@@ -309,7 +324,9 @@ function LanguageTree:_get_injections()
local root_node = tree:root()
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) do
+ for pattern, match, metadata in
+ self._injection_query:iter_matches(root_node, self._source, start_line, end_line + 1)
+ do
local lang = nil
local ranges = {}
local combined = metadata.combined
@@ -320,11 +337,11 @@ function LanguageTree:_get_injections()
local content = metadata.content
-- Allow for captured nodes to be used
- if type(content) == "number" then
- content = {match[content]}
+ if type(content) == 'number' then
+ content = { match[content]:range() }
end
- if content then
+ if type(content) == 'table' and #content >= 4 then
vim.list_extend(ranges, content)
end
end
@@ -340,21 +357,21 @@ function LanguageTree:_get_injections()
local name = self._injection_query.captures[id]
-- Lang should override any other language tag
- if name == "language" and not lang then
+ if name == 'language' and not lang then
lang = query.get_node_text(node, self._source)
- elseif name == "combined" then
+ elseif name == 'combined' then
combined = true
- elseif name == "content" and #ranges == 0 then
- table.insert(ranges, node)
- -- Ignore any tags that start with "_"
- -- Allows for other tags to be used in matches
- elseif string.sub(name, 1, 1) ~= "_" then
+ elseif name == 'content' and #ranges == 0 then
+ table.insert(ranges, get_node_range(node, id, metadata))
+ -- Ignore any tags that start with "_"
+ -- Allows for other tags to be used in matches
+ elseif string.sub(name, 1, 1) ~= '_' then
if not lang then
lang = name
end
if #ranges == 0 then
- table.insert(ranges, node)
+ table.insert(ranges, get_node_range(node, id, metadata))
end
end
end
@@ -391,7 +408,10 @@ function LanguageTree:_get_injections()
for _, entry in pairs(patterns) do
if entry.combined then
- table.insert(result[lang], vim.tbl_flatten(entry.regions))
+ local regions = vim.tbl_map(function(e)
+ return vim.tbl_flatten(e)
+ end, entry.regions)
+ table.insert(result[lang], regions)
else
for _, ranges in ipairs(entry.regions) do
table.insert(result[lang], ranges)
@@ -412,10 +432,19 @@ function LanguageTree:_do_callback(cb_name, ...)
end
---@private
-function LanguageTree:_on_bytes(bufnr, changed_tick,
- start_row, start_col, start_byte,
- old_row, old_col, old_byte,
- new_row, new_col, new_byte)
+function LanguageTree:_on_bytes(
+ bufnr,
+ changed_tick,
+ start_row,
+ start_col,
+ start_byte,
+ old_row,
+ old_col,
+ old_byte,
+ new_row,
+ new_col,
+ new_byte
+)
self:invalidate()
local old_end_col = old_col + ((old_row == 0) and start_col or 0)
@@ -424,16 +453,33 @@ function LanguageTree:_on_bytes(bufnr, changed_tick,
-- Edit all trees recursively, together BEFORE emitting a bytes callback.
-- In most cases this callback should only be called from the root tree.
self:for_each_tree(function(tree)
- tree:edit(start_byte,start_byte+old_byte,start_byte+new_byte,
- start_row, start_col,
- start_row+old_row, old_end_col,
- start_row+new_row, new_end_col)
+ tree:edit(
+ start_byte,
+ start_byte + old_byte,
+ start_byte + new_byte,
+ start_row,
+ start_col,
+ start_row + old_row,
+ old_end_col,
+ start_row + new_row,
+ new_end_col
+ )
end)
- self:_do_callback('bytes', bufnr, changed_tick,
- start_row, start_col, start_byte,
- old_row, old_col, old_byte,
- new_row, new_col, new_byte)
+ self:_do_callback(
+ 'bytes',
+ bufnr,
+ changed_tick,
+ start_row,
+ start_col,
+ start_byte,
+ old_row,
+ old_col,
+ old_byte,
+ new_row,
+ new_col,
+ new_byte
+ )
end
---@private
@@ -441,23 +487,24 @@ function LanguageTree:_on_reload()
self:invalidate(true)
end
-
---@private
function LanguageTree:_on_detach(...)
self:invalidate(true)
self:_do_callback('detach', ...)
end
---- Registers callbacks for the parser
----@param cbs An `nvim_buf_attach`-like table argument with the following keys :
---- `on_bytes` : see `nvim_buf_attach`, but this will be called _after_ the parsers callback.
---- `on_changedtree` : a callback that will be called every time the tree has syntactical changes.
---- it will only be passed one argument, that is a table of the ranges (as node ranges) that
---- changed.
---- `on_child_added` : emitted when a child is added to the tree.
---- `on_child_removed` : emitted when a child is removed from the tree.
+--- Registers callbacks for the parser.
+---@param cbs table An |nvim_buf_attach()|-like table argument with the following keys :
+--- - `on_bytes` : see |nvim_buf_attach()|, but this will be called _after_ the parsers callback.
+--- - `on_changedtree` : a callback that will be called every time the tree has syntactical changes.
+--- It will only be passed one argument, which is a table of the ranges (as node ranges) that
+--- changed.
+--- - `on_child_added` : emitted when a child is added to the tree.
+--- - `on_child_removed` : emitted when a child is removed from the tree.
function LanguageTree:register_cbs(cbs)
- if not cbs then return end
+ if not cbs then
+ return
+ end
if cbs.on_changedtree then
table.insert(self._callbacks.changedtree, cbs.on_changedtree)
@@ -486,16 +533,10 @@ local function tree_contains(tree, range)
local start_fits = start_row < range[1] or (start_row == range[1] and start_col <= range[2])
local end_fits = end_row > range[3] or (end_row == range[3] and end_col >= range[4])
- if start_fits and end_fits then
- return true
- end
-
- return false
+ return start_fits and end_fits
end
---- Determines whether @param range is contained in this language tree
----
---- This goes down the tree to recursively check children.
+--- Determines whether {range} is contained in this language tree
---
---@param range A range, that is a `{ start_line, start_col, end_line, end_col }` table.
function LanguageTree:contains(range)
@@ -508,7 +549,7 @@ function LanguageTree:contains(range)
return false
end
---- Gets the appropriate language that contains @param range
+--- Gets the appropriate language that contains {range}
---
---@param range A text range, see |LanguageTree:contains|
function LanguageTree:language_for_range(range)
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index ebed502c92..103e85abfd 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -1,5 +1,5 @@
local a = vim.api
-local language = require'vim.treesitter.language'
+local language = require('vim.treesitter.language')
-- query: pattern matching on trees
-- predicate matching is implemented in lua
@@ -43,7 +43,9 @@ function M.get_query_files(lang, query_name, is_included)
local query_path = string.format('queries/%s/%s.scm', lang, query_name)
local lang_files = dedupe_files(a.nvim_get_runtime_file(query_path, true))
- if #lang_files == 0 then return {} end
+ if #lang_files == 0 then
+ return {}
+ end
local base_langs = {}
@@ -52,7 +54,7 @@ function M.get_query_files(lang, query_name, is_included)
-- ;+ inherits: ({language},)*{language}
--
-- {language} ::= {lang} | ({lang})
- local MODELINE_FORMAT = "^;+%s*inherits%s*:?%s*([a-z_,()]+)%s*$"
+ local MODELINE_FORMAT = '^;+%s*inherits%s*:?%s*([a-z_,()]+)%s*$'
for _, file in ipairs(lang_files) do
local modeline = safe_read(file, '*l')
@@ -62,7 +64,7 @@ function M.get_query_files(lang, query_name, is_included)
if langlist then
for _, incllang in ipairs(vim.split(langlist, ',', true)) do
- local is_optional = incllang:match("%(.*%)")
+ local is_optional = incllang:match('%(.*%)')
if is_optional then
if not is_included then
@@ -90,7 +92,7 @@ end
local function read_query_files(filenames)
local contents = {}
- for _,filename in ipairs(filenames) do
+ for _, filename in ipairs(filenames) do
table.insert(contents, safe_read(filename, '*a'))
end
@@ -138,30 +140,43 @@ function M.get_query(lang, query_name)
end
end
+local query_cache = setmetatable({}, {
+ __index = function(tbl, key)
+ rawset(tbl, key, {})
+ return rawget(tbl, key)
+ end,
+})
+
--- Parse {query} as a string. (If the query is in a file, the caller
---- should read the contents into a string before calling).
+--- should read the contents into a string before calling).
---
--- Returns a `Query` (see |lua-treesitter-query|) object which can be used to
--- search nodes in the syntax tree for the patterns defined in {query}
--- using `iter_*` methods below.
---
---- Exposes `info` and `captures` with additional information about the {query}.
+--- Exposes `info` and `captures` with additional context about {query}.
--- - `captures` contains the list of unique capture names defined in
--- {query}.
--- -` info.captures` also points to `captures`.
--- - `info.patterns` contains information about predicates.
---
----@param lang The language
----@param query A string containing the query (s-expr syntax)
+---@param lang string The language
+---@param query string A string containing the query (s-expr syntax)
---
---@returns The query
function M.parse_query(lang, query)
language.require_language(lang)
- local self = setmetatable({}, Query)
- self.query = vim._ts_parse_query(lang, query)
- self.info = self.query:inspect()
- self.captures = self.info.captures
- return self
+ local cached = query_cache[lang][query]
+ if cached then
+ return cached
+ else
+ local self = setmetatable({}, Query)
+ self.query = vim._ts_parse_query(lang, query)
+ self.info = self.query:inspect()
+ self.captures = self.info.captures
+ query_cache[lang][query] = self
+ return self
+ end
end
--- Gets the text corresponding to a given node
@@ -172,7 +187,7 @@ function M.get_node_text(node, source)
local start_row, start_col, start_byte = node:start()
local end_row, end_col, end_byte = node:end_()
- if type(source) == "number" then
+ if type(source) == 'number' then
local lines
local eof_row = a.nvim_buf_line_count(source)
if start_row >= eof_row then
@@ -186,56 +201,64 @@ function M.get_node_text(node, source)
lines = a.nvim_buf_get_lines(source, start_row, end_row + 1, true)
end
- if #lines == 1 then
- lines[1] = string.sub(lines[1], start_col+1, end_col)
- else
- lines[1] = string.sub(lines[1], start_col+1)
- lines[#lines] = string.sub(lines[#lines], 1, end_col)
+ if #lines > 0 then
+ if #lines == 1 then
+ lines[1] = string.sub(lines[1], start_col + 1, end_col)
+ else
+ lines[1] = string.sub(lines[1], start_col + 1)
+ lines[#lines] = string.sub(lines[#lines], 1, end_col)
+ end
end
- return table.concat(lines, "\n")
- elseif type(source) == "string" then
- return source:sub(start_byte+1, end_byte)
+ return table.concat(lines, '\n')
+ elseif type(source) == 'string' then
+ return source:sub(start_byte + 1, end_byte)
end
end
-- Predicate handler receive the following arguments
-- (match, pattern, bufnr, predicate)
local predicate_handlers = {
- ["eq?"] = function(match, _, source, predicate)
- local node = match[predicate[2]]
- local node_text = M.get_node_text(node, source)
-
- local str
- if type(predicate[3]) == "string" then
- -- (#eq? @aa "foo")
- str = predicate[3]
- else
- -- (#eq? @aa @bb)
- str = M.get_node_text(match[predicate[3]], source)
- end
+ ['eq?'] = function(match, _, source, predicate)
+ local node = match[predicate[2]]
+ if not node then
+ return true
+ end
+ local node_text = M.get_node_text(node, source)
- if node_text ~= str or str == nil then
- return false
- end
+ local str
+ if type(predicate[3]) == 'string' then
+ -- (#eq? @aa "foo")
+ str = predicate[3]
+ else
+ -- (#eq? @aa @bb)
+ str = M.get_node_text(match[predicate[3]], source)
+ end
- return true
+ if node_text ~= str or str == nil then
+ return false
+ end
+
+ return true
end,
- ["lua-match?"] = function(match, _, source, predicate)
- local node = match[predicate[2]]
- local regex = predicate[3]
- return string.find(M.get_node_text(node, source), regex)
+ ['lua-match?'] = function(match, _, source, predicate)
+ local node = match[predicate[2]]
+ if not node then
+ return true
+ end
+ local regex = predicate[3]
+ return string.find(M.get_node_text(node, source), regex)
end,
- ["match?"] = (function()
- local magic_prefixes = {['\\v']=true, ['\\m']=true, ['\\M']=true, ['\\V']=true}
+ ['match?'] = (function()
+ local magic_prefixes = { ['\\v'] = true, ['\\m'] = true, ['\\M'] = true, ['\\V'] = true }
---@private
local function check_magic(str)
- if string.len(str) < 2 or magic_prefixes[string.sub(str,1,2)] then
+ if string.len(str) < 2 or magic_prefixes[string.sub(str, 1, 2)] then
return str
end
- return '\\v'..str
+ return '\\v' .. str
end
local compiled_vim_regexes = setmetatable({}, {
@@ -243,21 +266,27 @@ local predicate_handlers = {
local res = vim.regex(check_magic(pattern))
rawset(t, pattern, res)
return res
- end
+ end,
})
return function(match, _, source, pred)
local node = match[pred[2]]
+ if not node then
+ return true
+ end
local regex = compiled_vim_regexes[pred[3]]
return regex:match_str(M.get_node_text(node, source))
end
end)(),
- ["contains?"] = function(match, _, source, predicate)
+ ['contains?'] = function(match, _, source, predicate)
local node = match[predicate[2]]
+ if not node then
+ return true
+ end
local node_text = M.get_node_text(node, source)
- for i=3,#predicate do
+ for i = 3, #predicate do
if string.find(node_text, predicate[i], 1, true) then
return true
end
@@ -266,19 +295,22 @@ local predicate_handlers = {
return false
end,
- ["any-of?"] = function(match, _, source, predicate)
+ ['any-of?'] = function(match, _, source, predicate)
local node = match[predicate[2]]
+ if not node then
+ return true
+ end
local node_text = M.get_node_text(node, source)
-- Since 'predicate' will not be used by callers of this function, use it
-- to store a string set built from the list of words to check against.
- local string_set = predicate["string_set"]
+ local string_set = predicate['string_set']
if not string_set then
string_set = {}
- for i=3,#predicate do
+ for i = 3, #predicate do
string_set[predicate[i]] = true
end
- predicate["string_set"] = string_set
+ predicate['string_set'] = string_set
end
return string_set[node_text]
@@ -286,32 +318,33 @@ local predicate_handlers = {
}
-- As we provide lua-match? also expose vim-match?
-predicate_handlers["vim-match?"] = predicate_handlers["match?"]
-
+predicate_handlers['vim-match?'] = predicate_handlers['match?']
-- Directives store metadata or perform side effects against a match.
-- Directives should always end with a `!`.
-- Directive handler receive the following arguments
-- (match, pattern, bufnr, predicate, metadata)
local directive_handlers = {
- ["set!"] = function(_, _, _, pred, metadata)
+ ['set!'] = function(_, _, _, pred, metadata)
if #pred == 4 then
-- (#set! @capture "key" "value")
- local capture = pred[2]
- if not metadata[capture] then
- metadata[capture] = {}
+ local _, capture_id, key, value = unpack(pred)
+ if not metadata[capture_id] then
+ metadata[capture_id] = {}
end
- metadata[capture][pred[3]] = pred[4]
+ metadata[capture_id][key] = value
else
+ local _, key, value = unpack(pred)
-- (#set! "key" "value")
- metadata[pred[2]] = pred[3]
+ metadata[key] = value
end
end,
-- Shifts the range of a node.
-- Example: (#offset! @_node 0 1 0 -1)
- ["offset!"] = function(match, _, _, pred, metadata)
- local offset_node = match[pred[2]]
- local range = {offset_node:range()}
+ ['offset!'] = function(match, _, _, pred, metadata)
+ local capture_id = pred[2]
+ local offset_node = match[capture_id]
+ local range = { offset_node:range() }
local start_row_offset = pred[3] or 0
local start_col_offset = pred[4] or 0
local end_row_offset = pred[5] or 0
@@ -324,9 +357,12 @@ local directive_handlers = {
-- If this produces an invalid range, we just skip it.
if range[1] < range[3] or (range[1] == range[3] and range[2] <= range[4]) then
- metadata.content = {range}
+ if not metadata[capture_id] then
+ metadata[capture_id] = {}
+ end
+ metadata[capture_id].range = range
end
- end
+ end,
}
--- Adds a new predicate to be used in queries
@@ -336,7 +372,7 @@ local directive_handlers = {
--- signature will be (match, pattern, bufnr, predicate)
function M.add_predicate(name, handler, force)
if predicate_handlers[name] and not force then
- error(string.format("Overriding %s", name))
+ error(string.format('Overriding %s', name))
end
predicate_handlers[name] = handler
@@ -344,17 +380,23 @@ end
--- Adds a new directive to be used in queries
---
+--- Handlers can set match level data by setting directly on the
+--- metadata object `metadata.key = value`, additionally, handlers
+--- can set node level data by using the capture id on the
+--- metadata table `metadata[capture_id].key = value`
+---
---@param name the name of the directive, without leading #
---@param handler the handler function to be used
---- signature will be (match, pattern, bufnr, predicate)
+--- signature will be (match, pattern, bufnr, predicate, metadata)
function M.add_directive(name, handler, force)
if directive_handlers[name] and not force then
- error(string.format("Overriding %s", name))
+ error(string.format('Overriding %s', name))
end
directive_handlers[name] = handler
end
+--- Lists the currently available directives to use in queries.
---@return The list of supported directives.
function M.list_directives()
return vim.tbl_keys(directive_handlers)
@@ -372,7 +414,7 @@ end
---@private
local function is_directive(name)
- return string.sub(name, -1) == "!"
+ return string.sub(name, -1) == '!'
end
---@private
@@ -389,7 +431,7 @@ function Query:match_preds(match, pattern, source)
-- Skip over directives... they will get processed after all the predicates.
if not is_directive(pred[1]) then
- if string.sub(pred[1], 1, 4) == "not-" then
+ if string.sub(pred[1], 1, 4) == 'not-' then
pred_name = string.sub(pred[1], 5)
is_not = true
else
@@ -400,7 +442,7 @@ function Query:match_preds(match, pattern, source)
local handler = predicate_handlers[pred_name]
if not handler then
- error(string.format("No handler for %s", pred[1]))
+ error(string.format('No handler for %s', pred[1]))
return false
end
@@ -423,7 +465,7 @@ function Query:apply_directives(match, pattern, source, metadata)
local handler = directive_handlers[pred[1]]
if not handler then
- error(string.format("No handler for %s", pred[1]))
+ error(string.format('No handler for %s', pred[1]))
return
end
@@ -432,7 +474,6 @@ function Query:apply_directives(match, pattern, source, metadata)
end
end
-
--- Returns the start and stop value if set else the node's range.
-- When the node's range is used, the stop is incremented by 1
-- to make the search inclusive.
@@ -477,7 +518,7 @@ end
---@returns The matching capture id
---@returns The captured node
function Query:iter_captures(node, source, start, stop)
- if type(source) == "number" and source == 0 then
+ if type(source) == 'number' and source == 0 then
source = vim.api.nvim_get_current_buf()
end
@@ -534,7 +575,7 @@ end
---@returns The matching pattern id
---@returns The matching match
function Query:iter_matches(node, source, start, stop)
- if type(source) == "number" and source == 0 then
+ if type(source) == 'number' and source == 0 then
source = vim.api.nvim_get_current_buf()
end
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index 9568b60fd0..6f1ce3089d 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -16,15 +16,33 @@ local M = {}
--- `items`, or the context in which select() was called.
---@param on_choice function ((item|nil, idx|nil) -> ())
--- Called once the user made a choice.
---- `idx` is the 1-based index of `item` within `item`.
+--- `idx` is the 1-based index of `item` within `items`.
--- `nil` if the user aborted the dialog.
+---
+---
+--- Example:
+--- <pre>
+--- vim.ui.select({ 'tabs', 'spaces' }, {
+--- prompt = 'Select tabs or spaces:',
+--- format_item = function(item)
+--- return "I'd like to choose " .. item
+--- end,
+--- }, function(choice)
+--- if choice == 'spaces' then
+--- vim.o.expandtab = true
+--- else
+--- vim.o.expandtab = false
+--- end
+--- end)
+--- </pre>
+
function M.select(items, opts, on_choice)
- vim.validate {
+ vim.validate({
items = { items, 'table', false },
on_choice = { on_choice, 'function', false },
- }
+ })
opts = opts or {}
- local choices = {opts.prompt or 'Select one of:'}
+ local choices = { opts.prompt or 'Select one of:' }
local format_item = opts.format_item or tostring
for i, item in pairs(items) do
table.insert(choices, string.format('%d: %s', i, format_item(item)))
@@ -41,7 +59,7 @@ end
---
---@param opts table Additional options. See |input()|
--- - prompt (string|nil)
---- Text of the prompt. Defaults to `Input: `.
+--- Text of the prompt
--- - default (string|nil)
--- Default reply to the input
--- - completion (string|nil)
@@ -57,12 +75,19 @@ end
--- Called once the user confirms or abort the input.
--- `input` is what the user typed.
--- `nil` if the user aborted the dialog.
+---
+--- Example:
+--- <pre>
+--- vim.ui.input({ prompt = 'Enter value for shiftwidth: ' }, function(input)
+--- vim.o.shiftwidth = tonumber(input)
+--- end)
+--- </pre>
function M.input(opts, on_confirm)
- vim.validate {
+ vim.validate({
on_confirm = { on_confirm, 'function', false },
- }
+ })
- opts = opts or {}
+ opts = (opts and not vim.tbl_isempty(opts)) and opts or vim.empty_dict()
local input = vim.fn.input(opts)
if #input > 0 then
on_confirm(input)
diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua
index 11b661cd1a..d6b0b7410e 100644
--- a/runtime/lua/vim/uri.lua
+++ b/runtime/lua/vim/uri.lua
@@ -3,7 +3,6 @@
-- https://tools.ietf.org/html/rfc2732
-- https://tools.ietf.org/html/rfc2396
-
local uri_decode
do
local schar = string.char
@@ -14,7 +13,7 @@ do
return schar(tonumber(hex, 16))
end
uri_decode = function(str)
- return str:gsub("%%([a-fA-F0-9][a-fA-F0-9])", hex_to_char)
+ return str:gsub('%%([a-fA-F0-9][a-fA-F0-9])', hex_to_char)
end
end
@@ -23,33 +22,36 @@ do
local PATTERNS = {
--- RFC 2396
-- https://tools.ietf.org/html/rfc2396#section-2.2
- rfc2396 = "^A-Za-z0-9%-_.!~*'()";
+ rfc2396 = "^A-Za-z0-9%-_.!~*'()",
--- RFC 2732
-- https://tools.ietf.org/html/rfc2732
- rfc2732 = "^A-Za-z0-9%-_.!~*'()[]";
+ rfc2732 = "^A-Za-z0-9%-_.!~*'()[]",
--- RFC 3986
-- https://tools.ietf.org/html/rfc3986#section-2.2
- rfc3986 = "^A-Za-z0-9%-._~!$&'()*+,;=:@/";
+ rfc3986 = "^A-Za-z0-9%-._~!$&'()*+,;=:@/",
}
local sbyte, tohex = string.byte
if jit then
- tohex = require'bit'.tohex
+ tohex = require('bit').tohex
else
- tohex = function(b) return string.format("%02x", b) end
+ tohex = function(b)
+ return string.format('%02x', b)
+ end
end
---@private
local function percent_encode_char(char)
- return "%"..tohex(sbyte(char), 2)
+ return '%' .. tohex(sbyte(char), 2)
end
uri_encode = function(text, rfc)
- if not text then return end
+ if not text then
+ return
+ end
local pattern = PATTERNS[rfc] or PATTERNS.rfc3986
- return text:gsub("(["..pattern.."])", percent_encode_char)
+ return text:gsub('([' .. pattern .. '])', percent_encode_char)
end
end
-
---@private
local function is_windows_file_uri(uri)
return uri:match('^file:/+[a-zA-Z]:') ~= nil
@@ -59,16 +61,16 @@ end
---@param path string Path to file
---@return string URI
local function uri_from_fname(path)
- local volume_path, fname = path:match("^([a-zA-Z]:)(.*)")
+ local volume_path, fname = path:match('^([a-zA-Z]:)(.*)')
local is_windows = volume_path ~= nil
if is_windows then
- path = volume_path..uri_encode(fname:gsub("\\", "/"))
+ path = volume_path .. uri_encode(fname:gsub('\\', '/'))
else
path = uri_encode(path)
end
- local uri_parts = {"file://"}
+ local uri_parts = { 'file://' }
if is_windows then
- table.insert(uri_parts, "/")
+ table.insert(uri_parts, '/')
end
table.insert(uri_parts, path)
return table.concat(uri_parts)
@@ -82,11 +84,11 @@ local WINDOWS_URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):[a-zA-Z]:.*'
---@return string URI
local function uri_from_bufnr(bufnr)
local fname = vim.api.nvim_buf_get_name(bufnr)
- local volume_path = fname:match("^([a-zA-Z]:).*")
+ local volume_path = fname:match('^([a-zA-Z]:).*')
local is_windows = volume_path ~= nil
local scheme
if is_windows then
- fname = fname:gsub("\\", "/")
+ fname = fname:gsub('\\', '/')
scheme = fname:match(WINDOWS_URI_SCHEME_PATTERN)
else
scheme = fname:match(URI_SCHEME_PATTERN)
diff --git a/runtime/menu.vim b/runtime/menu.vim
index 701dd33cdd..e20720dbd2 100644
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -164,6 +164,9 @@ if exists(':tlmenu')
endif
nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP
cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+
+if exists(':tlmenu')
+ tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+
+endif
exe 'vnoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['v']
exe 'inoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['i']
nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p
@@ -569,9 +572,9 @@ func! s:XxdConv()
%!mc vim:xxd
else
call s:XxdFind()
- exe '%!' . g:xxdprogram
+ exe ':%!' . g:xxdprogram
endif
- if getline(1) =~ "^0000000:" " only if it worked
+ if getline(1) =~ "^00000000:" " only if it worked
set ft=xxd
endif
let &mod = mod
@@ -583,7 +586,7 @@ func! s:XxdBack()
%!mc vim:xxd -r
else
call s:XxdFind()
- exe '%!' . g:xxdprogram . ' -r'
+ exe ':%!' . g:xxdprogram . ' -r'
endif
set ft=
doautocmd filetypedetect BufReadPost
diff --git a/runtime/nvim.appdata.xml b/runtime/nvim.appdata.xml
index 4ad656f1a3..1464c27694 100644
--- a/runtime/nvim.appdata.xml
+++ b/runtime/nvim.appdata.xml
@@ -26,6 +26,7 @@
</screenshots>
<releases>
+ <release date="2022-04-15" version="0.7.0"/>
<release date="2021-12-31" version="0.6.1"/>
<release date="2021-11-30" version="0.6.0"/>
<release date="2021-09-26" version="0.5.1"/>
diff --git a/runtime/nvim.desktop b/runtime/nvim.desktop
index 052904dd76..224353c6ad 100644
--- a/runtime/nvim.desktop
+++ b/runtime/nvim.desktop
@@ -1,6 +1,7 @@
[Desktop Entry]
Name=Neovim
GenericName=Text Editor
+GenericName[ckb]=دەستکاریکەری دەق
GenericName[de]=Texteditor
GenericName[fr]=Éditeur de texte
GenericName[ru]=Текстовый редактор
@@ -16,6 +17,7 @@ Comment[bg]=Редактиране на текстови файлове
Comment[bn]=টেক্স্ট ফাইল এডিট করুন
Comment[bs]=Izmijeni tekstualne datoteke
Comment[ca]=Edita fitxers de text
+Comment[ckb]=دەستکاریی فایلی دەق بکە
Comment[cs]=Úprava textových souborů
Comment[cy]=Golygu ffeiliau testun
Comment[da]=Redigér tekstfiler
@@ -79,6 +81,7 @@ Exec=nvim %F
Terminal=true
Type=Application
Keywords=Text;editor;
+Keywords[ckb]=دەق;دەستکاریکەر;
Keywords[fr]=Texte;éditeur;
Keywords[ru]=текст;текстовый редактор;
Keywords[sr]=Текст;едитор;
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index c873252909..228336e5a4 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Dec 12
+" Last Change: 2022 Apr 07
" If there already is an option window, jump to that one.
let buf = bufnr('option-window')
@@ -229,8 +229,6 @@ call append("$", "compatible\tbehave very Vi compatible (not advisable)")
call <SID>BinOptionG("cp", &cp)
call append("$", "cpoptions\tlist of flags to specify Vi compatibility")
call <SID>OptionG("cpo", &cpo)
-call append("$", "insertmode\tuse Insert mode as the default mode")
-call <SID>BinOptionG("im", &im)
call append("$", "paste\tpaste mode, insert typed text literally")
call <SID>BinOptionG("paste", &paste)
call append("$", "pastetoggle\tkey sequence to toggle paste mode")
@@ -471,7 +469,7 @@ endif
call <SID>Header("multiple windows")
-call append("$", "laststatus\t0, 1 or 2; when to use a status line for the last window")
+call append("$", "laststatus\t0, 1, 2 or 3; when to use a status line for the last window")
call append("$", " \tset ls=" . &ls)
if has("statusline")
call append("$", "statusline\talternate format to be used for a status line")
@@ -870,6 +868,9 @@ if has("cindent")
call append("$", "cinwords\tlist of words that cause more C-indent")
call append("$", "\t(local to buffer)")
call <SID>OptionL("cinw")
+ call append("$", "cinscopedecls\tlist of scope declaration names used by cino-g")
+ call append("$", "\t(local to buffer)")
+ call <SID>OptionL("cinsd")
call append("$", "indentexpr\texpression used to obtain the indent of a line")
call append("$", "\t(local to buffer)")
call <SID>OptionL("inde")
@@ -953,7 +954,6 @@ call <SID>Header("mapping")
call append("$", "maxmapdepth\tmaximum depth of mapping")
call append("$", " \tset mmd=" . &mmd)
call append("$", "remap\trecognize mappings in mapped keys")
-call <SID>BinOptionG("remap", &remap)
call append("$", "timeout\tallow timing out halfway into a mapping")
call <SID>BinOptionG("to", &to)
call append("$", "ttimeout\tallow timing out halfway into a key code")
diff --git a/runtime/pack/dist/opt/matchit/autoload/matchit.vim b/runtime/pack/dist/opt/matchit/autoload/matchit.vim
index e8689980ae..eafb7c0551 100644
--- a/runtime/pack/dist/opt/matchit/autoload/matchit.vim
+++ b/runtime/pack/dist/opt/matchit/autoload/matchit.vim
@@ -763,9 +763,9 @@ fun! s:ParseSkip(str)
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" ..
\ strpart(skip,2) .. "'"
elseif skip[0] == "r"
- let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'"
+ let skip = "strpart(getline('.'),0,col('.'))=~'" .. strpart(skip,2) .. "'"
elseif skip[0] == "R"
- let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'"
+ let skip = "strpart(getline('.'),0,col('.'))!~'" .. strpart(skip,2) .. "'"
endif
endif
return skip
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index c881133b72..802ebd42b5 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -2,12 +2,13 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
-" Last Change: 2021 Dec 16
+" Last Change: 2022 Jun 24
"
-" WORK IN PROGRESS - Only the basics work
-" Note: On MS-Windows you need a recent version of gdb. The one included with
-" MingW is too old (7.6.1).
-" I used version 7.12 from http://www.equation.com/servlet/equation.cmd?fa=gdb
+" WORK IN PROGRESS - The basics works stable, more to come
+" Note: In general you need at least GDB 7.12 because this provides the
+" frame= response in MI thread-selected events we need to sync stack to file.
+" The one included with "old" MingW is too old (7.6.1), you may upgrade it or
+" use a newer version from http://www.equation.com/servlet/equation.cmd?fa=gdb
"
" There are two ways to run gdb:
" - In a terminal window; used if possible, does not work on MS-Windows
@@ -36,7 +37,7 @@
"
" For neovim compatibility, the vim specific calls were replaced with neovim
" specific calls:
-" term_start -> term_open
+" term_start -> termopen
" term_sendkeys -> chansend
" term_getline -> getbufline
" job_info && term_getjob -> using linux command ps to get the tty
@@ -70,11 +71,6 @@ set cpo&vim
command -nargs=* -complete=file -bang Termdebug call s:StartDebug(<bang>0, <f-args>)
command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(<bang>0, <f-args>)
-" Name of the gdb command, defaults to "gdb".
-if !exists('g:termdebugger')
- let g:termdebugger = 'gdb'
-endif
-
let s:pc_id = 12
let s:asm_id = 13
let s:break_id = 14 " breakpoint number is added to this
@@ -104,8 +100,17 @@ call s:Highlight(1, '', &background)
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray
+" Get the command to execute the debugger as a list, defaults to ["gdb"].
func s:GetCommand()
- return type(g:termdebugger) == v:t_list ? copy(g:termdebugger) : [g:termdebugger]
+ if exists('g:termdebug_config')
+ let cmd = get(g:termdebug_config, 'command', 'gdb')
+ elseif exists('g:termdebugger')
+ let cmd = g:termdebugger
+ else
+ let cmd = 'gdb'
+ endif
+
+ return type(cmd) == v:t_list ? copy(cmd) : [cmd]
endfunc
func s:StartDebug(bang, ...)
@@ -176,12 +181,10 @@ func s:StartDebug_internal(dict)
call s:StartDebug_term(a:dict)
endif
- if exists('g:termdebug_disasm_window')
- if g:termdebug_disasm_window
- let curwinid = win_getid(winnr())
- call s:GotoAsmwinOrCreateIt()
- call win_gotoid(curwinid)
- endif
+ if s:GetDisasmWindow()
+ let curwinid = win_getid(winnr())
+ call s:GotoAsmwinOrCreateIt()
+ call win_gotoid(curwinid)
endif
if exists('#User#TermdebugStartPost')
@@ -196,7 +199,7 @@ func s:CloseBuffers()
endfunc
func s:CheckGdbRunning()
- if nvim_get_chan_info(s:gdb_job_id) == {}
+ if !s:running
echoerr string(s:GetCommand()[0]) . ' exited unexpectedly'
call s:CloseBuffers()
return ''
@@ -204,8 +207,8 @@ func s:CheckGdbRunning()
return 'ok'
endfunc
+" Open a terminal window without a job, to run the debugged program in.
func s:StartDebug_term(dict)
- " Open a terminal window without a job, to run the debugged program in.
execute s:vertical ? 'vnew' : 'new'
let s:pty_job_id = termopen('tail -f /dev/null;#gdb program')
if s:pty_job_id == 0
@@ -251,18 +254,28 @@ func s:StartDebug_term(dict)
let proc_args = get(a:dict, 'proc_args', [])
let gdb_cmd = s:GetCommand()
- " Add -quiet to avoid the intro message causing a hit-enter prompt.
- let gdb_cmd += ['-quiet']
- " Disable pagination, it causes everything to stop at the gdb
- let gdb_cmd += ['-iex', 'set pagination off']
- " Interpret commands while the target is running. This should usually only
- " be exec-interrupt, since many commands don't work properly while the
- " target is running (so execute during startup).
- let gdb_cmd += ['-iex', 'set mi-async on']
- " Open a terminal window to run the debugger.
- let gdb_cmd += ['-tty', pty]
- " Command executed _after_ startup is done, provides us with the necessary feedback
- let gdb_cmd += ['-ex', 'echo startupdone\n']
+
+ if exists('g:termdebug_config') && has_key(g:termdebug_config, 'command_add_args')
+ let gdb_cmd = g:termdebug_config.command_add_args(gdb_cmd, pty)
+ else
+ " Add -quiet to avoid the intro message causing a hit-enter prompt.
+ let gdb_cmd += ['-quiet']
+ " Disable pagination, it causes everything to stop at the gdb
+ let gdb_cmd += ['-iex', 'set pagination off']
+ " Interpret commands while the target is running. This should usually only
+ " be exec-interrupt, since many commands don't work properly while the
+ " target is running (so execute during startup).
+ let gdb_cmd += ['-iex', 'set mi-async on']
+ " Open a terminal window to run the debugger.
+ let gdb_cmd += ['-tty', pty]
+ " Command executed _after_ startup is done, provides us with the necessary
+ " feedback
+ let gdb_cmd += ['-ex', 'echo startupdone\n']
+ endif
+
+ if exists('g:termdebug_config') && has_key(g:termdebug_config, 'command_filter')
+ let gdb_cmd = g:termdebug_config.command_filter(gdb_cmd)
+ endif
" Adding arguments requested by the user
let gdb_cmd += gdb_args
@@ -279,6 +292,8 @@ func s:StartDebug_term(dict)
call s:CloseBuffers()
return
endif
+ let s: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:gdbwin = win_getid(winnr())
@@ -354,14 +369,16 @@ func s:StartDebug_term(dict)
sleep 10m
endwhile
+ let s:starting = v:false
+
" Set the filetype, this can be used to add mappings.
set filetype=termdebug
call s:StartDebugCommon(a:dict)
endfunc
+" Open a window with a prompt buffer to run gdb in.
func s:StartDebug_prompt(dict)
- " Open a window with a prompt buffer to run gdb in.
if s:vertical
vertical new
else
@@ -461,7 +478,7 @@ endfunc
func s:StartDebugCommon(dict)
" Sign used to highlight the line where the program has stopped.
" There can be only one.
- sign define debugPC linehl=debugPC
+ call sign_define('debugPC', #{linehl: 'debugPC'})
" Install debugger commands in the text window.
call win_gotoid(s:sourcewin)
@@ -522,6 +539,7 @@ func TermDebugSendCommand(cmd)
endif
sleep 10m
endif
+ " TODO: should we prepend CTRL-U to clear the command?
call chansend(s:gdb_job_id, a:cmd . "\r")
if do_continue
Continue
@@ -662,6 +680,11 @@ func s:GetAsmAddr(msg)
endfunc
function s:EndTermDebug(job_id, exit_code, event)
+ let s:running = v:false
+ if s:starting
+ return
+ endif
+
if exists('#User#TermdebugStopPre')
doauto <nomodeline> User TermdebugStopPre
endif
@@ -690,7 +713,9 @@ func s:EndDebugCommon()
endif
endif
endfor
- exe was_buf .. "buf"
+ if bufexists(was_buf)
+ exe was_buf .. "buf"
+ endif
call s:DeleteCommands()
@@ -749,8 +774,8 @@ func s:HandleDisasmMsg(msg)
let lnum = search('^' . s:asm_addr)
if lnum != 0
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ call sign_unplace('TermDebug', #{id: s:asm_id})
+ call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@@ -836,6 +861,7 @@ func s:InstallCommands()
command Clear call s:ClearBreakpoint()
command Step call s:SendResumingCommand('-exec-step')
command Over call s:SendResumingCommand('-exec-next')
+ command -nargs=? Until call s:Until(<q-args>)
command Finish call s:SendResumingCommand('-exec-finish')
command -nargs=* Run call s:Run(<q-args>)
command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . <q-args>)
@@ -858,7 +884,13 @@ func s:InstallCommands()
command Asm call s:GotoAsmwinOrCreateIt()
command Winbar call s:InstallWinbar()
- if !exists('g:termdebug_map_K') || g:termdebug_map_K
+ let map = 1
+ if exists('g:termdebug_config')
+ let map = get(g:termdebug_config, 'map_K', 1)
+ elseif exists('g:termdebug_map_K')
+ let map = g:termdebug_map_K
+ endif
+ if map
" let s:k_map_saved = maparg('K', 'n', 0, 1)
let s:k_map_saved = {}
for map in nvim_get_keymap('n')
@@ -870,6 +902,26 @@ func s:InstallCommands()
nnoremap K :Evaluate<CR>
endif
+ if has('menu') && &mouse != ''
+ call s:InstallWinbar()
+
+ let popup = 1
+ if exists('g:termdebug_config')
+ let popup = get(g:termdebug_config, 'popup', 1)
+ elseif exists('g:termdebug_popup')
+ let popup = g:termdebug_popup
+ endif
+ if popup
+ let s:saved_mousemodel = &mousemodel
+ let &mousemodel = 'popup_setpos'
+ an 1.200 PopUp.-SEP3- <Nop>
+ an 1.210 PopUp.Set\ breakpoint :Break<CR>
+ an 1.220 PopUp.Clear\ breakpoint :Clear<CR>
+ an 1.230 PopUp.Run\ until :Until<CR>
+ an 1.240 PopUp.Evaluate :Evaluate<CR>
+ endif
+ endif
+
let &cpo = save_cpo
endfunc
@@ -894,6 +946,7 @@ func s:DeleteCommands()
delcommand Clear
delcommand Step
delcommand Over
+ delcommand Until
delcommand Finish
delcommand Run
delcommand Arguments
@@ -910,7 +963,7 @@ func s:DeleteCommands()
if empty(s:k_map_saved)
nunmap K
else
- " call mapset('n', 0, s:k_map_saved)
+ " call mapset(s:k_map_saved)
let mode = s:k_map_saved.mode !=# ' ' ? s:k_map_saved.mode : ''
call nvim_set_keymap(mode, 'K', s:k_map_saved.rhs, {
\ 'expr': s:k_map_saved.expr ? v:true : v:false,
@@ -923,22 +976,57 @@ func s:DeleteCommands()
unlet s:k_map_saved
endif
- exe 'sign unplace ' . s:pc_id
- for [id, entries] in items(s:breakpoints)
- for subid in keys(entries)
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
- endfor
- endfor
+ if has('menu')
+ " Remove the WinBar entries from all windows where it was added.
+ " let curwinid = win_getid(winnr())
+ " for winid in s:winbar_winids
+ " if win_gotoid(winid)
+ " aunmenu WinBar.Step
+ " aunmenu WinBar.Next
+ " aunmenu WinBar.Finish
+ " aunmenu WinBar.Cont
+ " aunmenu WinBar.Stop
+ " aunmenu WinBar.Eval
+ " endif
+ " endfor
+ " call win_gotoid(curwinid)
+ " let s:winbar_winids = []
+
+ if exists('s:saved_mousemodel')
+ let &mousemodel = s:saved_mousemodel
+ unlet s:saved_mousemodel
+ aunmenu PopUp.-SEP3-
+ aunmenu PopUp.Set\ breakpoint
+ aunmenu PopUp.Clear\ breakpoint
+ aunmenu PopUp.Run\ until
+ aunmenu PopUp.Evaluate
+ endif
+ endif
+
+ call sign_unplace('TermDebug')
unlet s:breakpoints
unlet s:breakpoint_locations
- sign undefine debugPC
- for val in s:BreakpointSigns
- exe "sign undefine debugBreakpoint" . val
- endfor
+ call sign_undefine('debugPC')
+ call sign_undefine(s:BreakpointSigns->map("'debugBreakpoint' .. v:val"))
let s:BreakpointSigns = []
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
+ " 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)
+ " else
+ " call ch_log('dropping command, program is running: exec-until')
+ endif
+endfunc
+
" :Break - Set a breakpoint at the cursor position.
func s:SetBreakpoint(at)
" Setting a breakpoint may not work while the program is running.
@@ -972,7 +1060,8 @@ func s:ClearBreakpoint()
" Assume this always works, the reply is simply "^done".
call s:SendCommand('-break-delete ' . id)
for subid in keys(s:breakpoints[id])
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
+ call sign_unplace('TermDebug',
+ \ #{id: s:Breakpoint2SignNumber(id, subid)})
endfor
unlet s:breakpoints[id]
unlet s:breakpoint_locations[bploc][idx]
@@ -1026,7 +1115,7 @@ func s:Evaluate(range, arg)
call s:SendEval(expr)
endfunc
-" get what is specified / under the cursor
+" get what is specified / under the cursor
func s:GetEvaluationExpression(range, arg)
if a:arg != ''
" user supplied evaluation
@@ -1257,6 +1346,26 @@ func s:GotoSourcewinOrCreateIt()
endif
endfunc
+func s:GetDisasmWindow()
+ if exists('g:termdebug_config')
+ return get(g:termdebug_config, 'disasm_window', 0)
+ endif
+ if exists('g:termdebug_disasm_window')
+ return g:termdebug_disasm_window
+ endif
+ return 0
+endfunc
+
+func s:GetDisasmWindowHeight()
+ if exists('g:termdebug_config')
+ return get(g:termdebug_config, 'disasm_window_height', 0)
+ endif
+ if exists('g:termdebug_disasm_window') && g:termdebug_disasm_window > 1
+ return g:termdebug_disasm_window
+ endif
+ return 0
+endfunc
+
func s:GotoAsmwinOrCreateIt()
if !win_gotoid(s:asmwin)
if win_gotoid(s:sourcewin)
@@ -1280,10 +1389,8 @@ func s:GotoAsmwinOrCreateIt()
exe 'file Termdebug-asm-listing'
endif
- if exists('g:termdebug_disasm_window')
- if g:termdebug_disasm_window > 1
- exe 'resize ' . g:termdebug_disasm_window
- endif
+ if s:GetDisasmWindowHeight() > 0
+ exe 'resize ' .. s:GetDisasmWindowHeight()
endif
endif
@@ -1294,8 +1401,8 @@ func s:GotoAsmwinOrCreateIt()
call s:SendCommand('disassemble $pc')
endif
else
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ call sign_unplace('TermDebug', #{id: s:asm_id})
+ call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
endif
endfunc
@@ -1330,8 +1437,8 @@ func s:HandleCursor(msg)
if lnum == 0
call s:SendCommand('disassemble $pc')
else
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ call sign_unplace('TermDebug', #{id: s:asm_id})
+ call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@@ -1344,6 +1451,16 @@ 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') .. '"'
+ augroup Termdebug
+ " Always open a file read-only instead of showing the ATTENTION
+ " prompt, since it is unlikely we want to edit the file.
+ " The file may be changed but not saved, warn for that.
+ au SwapExists * echohl WarningMsg
+ \ | echo 'Warning: file is being edited elsewhere'
+ \ | echohl None
+ \ | let v:swapchoice = 'o'
+ augroup END
if &modified
" TODO: find existing window
exe 'split ' . fnameescape(fname)
@@ -1352,11 +1469,15 @@ func s:HandleCursor(msg)
else
exe 'edit ' . fnameescape(fname)
endif
+ augroup Termdebug
+ au! SwapExists
+ augroup END
endif
exe lnum
normal! zv
- exe 'sign unplace ' . s:pc_id
- exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname
+ call sign_unplace('TermDebug', #{id: s:pc_id})
+ call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
+ \ #{lnum: lnum, priority: 110})
if !exists('b:save_signcolumn')
let b:save_signcolumn = &signcolumn
call add(s:signcolumn_buflist, bufnr())
@@ -1364,7 +1485,7 @@ func s:HandleCursor(msg)
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
- exe 'sign unplace ' . s:pc_id
+ call sign_unplace('TermDebug', #{id: s:pc_id})
endif
call win_gotoid(wid)
@@ -1381,7 +1502,9 @@ func s:CreateBreakpoint(id, subid, enabled)
else
let hiName = "debugBreakpoint"
endif
- exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=" . hiName
+ call sign_define('debugBreakpoint' .. nr,
+ \ #{text: substitute(nr, '\..*', '', ''),
+ \ texthl: hiName})
endif
endfunc
@@ -1459,7 +1582,9 @@ endfunc
func s:PlaceSign(id, subid, entry)
let nr = printf('%d.%d', a:id, a:subid)
- exe 'sign place ' . s:Breakpoint2SignNumber(a:id, a:subid) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . nr . ' priority=110 file=' . a:entry['fname']
+ call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
+ \ 'debugBreakpoint' .. nr, a:entry['fname'],
+ \ #{lnum: a:entry['lnum'], priority: 110})
let a:entry['placed'] = 1
endfunc
@@ -1473,7 +1598,8 @@ func s:HandleBreakpointDelete(msg)
if has_key(s:breakpoints, id)
for [subid, entry] in items(s:breakpoints[id])
if has_key(entry, 'placed')
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
+ call sign_unplace('TermDebug',
+ \ #{id: s:Breakpoint2SignNumber(id, subid)})
unlet entry['placed']
endif
endfor
diff --git a/runtime/plugin/rplugin.vim b/runtime/plugin/rplugin.vim
index 122d8d47f8..52f4bd05bc 100644
--- a/runtime/plugin/rplugin.vim
+++ b/runtime/plugin/rplugin.vim
@@ -62,4 +62,6 @@ endfunction
command! -bar UpdateRemotePlugins call remote#host#UpdateRemotePlugins()
-call s:LoadRemotePlugins()
+if index(v:argv, "--clean") < 0
+ call s:LoadRemotePlugins()
+endif
diff --git a/runtime/scripts.vim b/runtime/scripts.vim
index e41405a6c5..2d8bfdcb05 100644
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -11,6 +11,10 @@
" 'ignorecase' option making a difference. Where case is to be ignored use
" =~? instead. Do not use =~ anywhere.
+" Only run when using legacy filetype
+if !exists('g:do_legacy_filetype')
+ finish
+endif
" Only do the rest when the FileType autocommand has not been triggered yet.
if did_filetype()
@@ -202,6 +206,14 @@ if s:line1 =~# "^#!"
elseif s:name =~# 'gforth\>'
set ft=forth
+ " Icon
+ elseif s:name =~# 'icon\>'
+ set ft=icon
+
+ " Guile
+ elseif s:name =~# 'guile'
+ set ft=scheme
+
endif
unlet s:name
@@ -406,6 +418,12 @@ else
elseif s:line1 =~# '^#.*by RouterOS.*$'
set ft=routeros
+ " Sed scripts
+ " #ncomment is allowed but most likely a false positive so require a space
+ " before any trailing comment text
+ elseif s:line1 =~# '^#n\%($\|\s\)'
+ set ft=sed
+
" CVS diff
else
let s:lnum = 1
diff --git a/runtime/spell/cleanadd.vim b/runtime/spell/cleanadd.vim
new file mode 100644
index 0000000000..6dc0692186
--- /dev/null
+++ b/runtime/spell/cleanadd.vim
@@ -0,0 +1,32 @@
+" Vim script to clean the ll.xxxxx.add files of commented out entries
+" Author: Antonio Colombo, Bram Moolenaar
+" Last Update: 2008 Jun 3
+
+" Time in seconds after last time an ll.xxxxx.add file was updated
+" Default is one second.
+" If you invoke this script often set it to something bigger, e.g. 60 * 60
+" (one hour)
+if !exists("g:spell_clean_limit")
+ let g:spell_clean_limit = 1
+endif
+
+" Loop over all the runtime/spell/*.add files.
+" Delete all comment lines, except the ones starting with ##.
+for s:fname in split(globpath(&rtp, "spell/*.add"), "\n")
+ if filewritable(s:fname) && localtime() - getftime(s:fname) > g:spell_clean_limit
+ if exists('*fnameescape')
+ let s:f = fnameescape(s:fname)
+ else
+ let s:f = escape(s:fname, ' \|<')
+ endif
+ silent exe "tab split " . s:f
+ echo "Processing" s:f
+ silent! g/^#[^#]/d
+ silent update
+ close
+ unlet s:f
+ endif
+endfor
+unlet s:fname
+
+echo "Done"
diff --git a/runtime/syntax/apache.vim b/runtime/syntax/apache.vim
index dd18aa6570..e73045e4c8 100644
--- a/runtime/syntax/apache.vim
+++ b/runtime/syntax/apache.vim
@@ -3,7 +3,7 @@
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
" License: This file can be redistribued and/or modified under the same terms
" as Vim itself.
-" Last Change: 2020 Oct 07
+" Last Change: 2022 Apr 25
" Notes: Last synced with apache-2.2.3, version 1.x is no longer supported
" TODO: see particular FIXME's scattered through the file
" make it really linewise?
@@ -46,6 +46,7 @@ syn keyword apacheMethodOption GET POST PUT DELETE CONNECT OPTIONS TRACE PATCH P
syn keyword apacheMethodOption BASELINE-CONTROL CHECKIN CHECKOUT LABEL MERGE MKACTIVITY MKWORKSPACE REPORT UNCHECKOUT UPDATE VERSION-CONTROL contained
syn case ignore
syn match apacheSection "<\/\=\(Directory\|DirectoryMatch\|Files\|FilesMatch\|IfModule\|IfDefine\|Location\|LocationMatch\|VirtualHost\)[^>]*>" contains=apacheAnything
+syn match apacheSection "<\/\=\(RequireAll\|RequireAny\|RequireNone\)>" contains=apacheAnything
syn match apacheLimitSection "<\/\=\(Limit\|LimitExcept\)[^>]*>" contains=apacheLimitSectionKeyword,apacheMethodOption,apacheError
syn keyword apacheLimitSectionKeyword Limit LimitExcept contained
syn match apacheAuthType "AuthType\s.*$" contains=apacheAuthTypeValue
diff --git a/runtime/syntax/basic.vim b/runtime/syntax/basic.vim
index ad9450b3b8..b6bf23a3ed 100644
--- a/runtime/syntax/basic.vim
+++ b/runtime/syntax/basic.vim
@@ -1,14 +1,15 @@
" Vim syntax file
-" Language: BASIC
+" Language: BASIC (QuickBASIC 4.5)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Allan Kelly <allan@fruitloaf.co.uk>
" Contributors: Thilo Six
-" Last Change: 2015 Jan 10
+" Last Change: 2022 Jun 22
" First version based on Micro$soft QBASIC circa 1989, as documented in
" 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989.
-" This syntax file not a complete implementation yet. Send suggestions to the
-" maintainer.
+"
+" Second version attempts to match Microsoft QuickBASIC 4.5 while keeping FreeBASIC
+" (-lang qb) and QB64 (excluding extensions) in mind. -- DJK
" Prelude {{{1
if exists("b:current_syntax")
@@ -18,154 +19,357 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+syn iskeyword @,48-57,.,!,#,%,&,$
+syn case ignore
+
+" Whitespace Errors {{{1
+if exists("basic_space_errors")
+ if !exists("basic_no_trail_space_error")
+ syn match basicSpaceError display excludenl "\s\+$"
+ endif
+ if !exists("basic_no_tab_space_error")
+ syn match basicSpaceError display " \+\t"me=e-1
+ endif
+endif
+
+" Comment Errors {{{1
+if !exists("basic_no_comment_errors")
+ syn match basicCommentError "\<REM\>.*"
+endif
+
+" Not Top Cluster {{{1
+syn cluster basicNotTop contains=@basicLineIdentifier,basicDataString,basicDataSeparator,basicTodo
+
+" Statements {{{1
+
+syn cluster basicStatements contains=basicStatement,basicDataStatement,basicMetaRemStatement,basicPutStatement,basicRemStatement
+
+let s:statements =<< trim EOL " {{{2
+ beep
+ bload
+ bsave
+ call
+ calls
+ case
+ chain
+ chdir
+ circle
+ clear
+ close
+ cls
+ color
+ com
+ common
+ const
+ declare
+ def
+ def\s\+seg
+ defdbl
+ defint
+ deflng
+ defsng
+ defstr
+ dim
+ do
+ draw
+ elseif
+ end
+ end\s\+\%(def\|function\|if\|select\|sub\|type\)
+ environ
+ erase
+ error
+ exit\s\+\%(def\|do\|for\|function\|sub\)
+ field
+ files
+ for
+ function
+ get
+ gosub
+ goto
+ if
+ input
+ ioctl
+ key
+ kill
+ let
+ line
+ line\s\+input
+ locate
+ lock
+ loop
+ lprint
+ lset
+ mkdir
+ name
+ next
+ on
+ on\s\+error
+ on\s\+uevent
+ open
+ open\s\+com
+ option
+ out
+ paint
+ palette
+ palette\s\+using
+ pcopy
+ pen
+ pmap
+ poke
+ preset
+ print
+ pset
+ randomize
+ read
+ redim
+ reset
+ restore
+ resume
+ return
+ rmdir
+ rset
+ run
+ select\s\+case
+ shared
+ shell
+ sleep
+ sound
+ static
+ stop
+ strig
+ sub
+ swap
+ system
+ troff
+ tron
+ type
+ uevent
+ unlock
+ using
+ view
+ view\s\+print
+ wait
+ wend
+ while
+ width
+ window
+ write
+EOL
+" }}}
+
+for s in s:statements
+ exe 'syn match basicStatement "\<' .. s .. '\>" contained'
+endfor
+
+syn match basicStatement "\<\%(then\|else\)\>" nextgroup=@basicStatements skipwhite
+
+" DATA Statement
+syn match basicDataSeparator "," contained
+syn region basicDataStatement matchgroup=basicStatement start="\<data\>" matchgroup=basicStatementSeparator end=":\|$" contained contains=basicDataSeparator,basicDataString,basicNumber,basicFloat,basicString
+
+if !exists("basic_no_data_fold")
+ syn region basicMultilineData start="^\s*\<data\>.*\n\%(^\s*\<data\>\)\@=" end="^\s*\<data\>.*\n\%(^\s*\<data\>\)\@!" contains=basicDataStatement transparent fold keepend
+endif
+
+" PUT File I/O and Graphics statements - needs special handling for graphics
+" action verbs
+syn match basicPutAction "\<\%(pset\|preset\|and\|or\|xor\)\>" contained
+syn region basicPutStatement matchgroup=basicStatement start="\<put\>" matchgroup=basicStatementSeparator end=":\|$" contained contains=basicKeyword,basicPutAction,basicFilenumber
+
" Keywords {{{1
-syn keyword basicStatement BEEP beep Beep BLOAD bload Bload BSAVE bsave Bsave
-syn keyword basicStatement CALL call Call ABSOLUTE absolute Absolute
-syn keyword basicStatement CHAIN chain Chain CHDIR chdir Chdir
-syn keyword basicStatement CIRCLE circle Circle CLEAR clear Clear
-syn keyword basicStatement CLOSE close Close CLS cls Cls COLOR color Color
-syn keyword basicStatement COM com Com COMMON common Common
-syn keyword basicStatement CONST const Const DATA data Data
-syn keyword basicStatement DECLARE declare Declare DEF def Def
-syn keyword basicStatement DEFDBL defdbl Defdbl DEFINT defint Defint
-syn keyword basicStatement DEFLNG deflng Deflng DEFSNG defsng Defsng
-syn keyword basicStatement DEFSTR defstr Defstr DIM dim Dim
-syn keyword basicStatement DO do Do LOOP loop Loop
-syn keyword basicStatement DRAW draw Draw END end End
-syn keyword basicStatement ENVIRON environ Environ ERASE erase Erase
-syn keyword basicStatement ERROR error Error EXIT exit Exit
-syn keyword basicStatement FIELD field Field FILES files Files
-syn keyword basicStatement FOR for For NEXT next Next
-syn keyword basicStatement FUNCTION function Function GET get Get
-syn keyword basicStatement GOSUB gosub Gosub GOTO goto Goto
-syn keyword basicStatement IF if If THEN then Then ELSE else Else
-syn keyword basicStatement INPUT input Input INPUT# input# Input#
-syn keyword basicStatement IOCTL ioctl Ioctl KEY key Key
-syn keyword basicStatement KILL kill Kill LET let Let
-syn keyword basicStatement LINE line Line LOCATE locate Locate
-syn keyword basicStatement LOCK lock Lock UNLOCK unlock Unlock
-syn keyword basicStatement LPRINT lprint Lprint USING using Using
-syn keyword basicStatement LSET lset Lset MKDIR mkdir Mkdir
-syn keyword basicStatement NAME name Name ON on On
-syn keyword basicStatement ERROR error Error OPEN open Open
-syn keyword basicStatement OPTION option Option BASE base Base
-syn keyword basicStatement OUT out Out PAINT paint Paint
-syn keyword basicStatement PALETTE palette Palette PCOPY pcopy Pcopy
-syn keyword basicStatement PEN pen Pen PLAY play Play
-syn keyword basicStatement PMAP pmap Pmap POKE poke Poke
-syn keyword basicStatement PRESET preset Preset PRINT print Print
-syn keyword basicStatement PRINT# print# Print# USING using Using
-syn keyword basicStatement PSET pset Pset PUT put Put
-syn keyword basicStatement RANDOMIZE randomize Randomize READ read Read
-syn keyword basicStatement REDIM redim Redim RESET reset Reset
-syn keyword basicStatement RESTORE restore Restore RESUME resume Resume
-syn keyword basicStatement RETURN return Return RMDIR rmdir Rmdir
-syn keyword basicStatement RSET rset Rset RUN run Run
-syn keyword basicStatement SEEK seek Seek SELECT select Select
-syn keyword basicStatement CASE case Case SHARED shared Shared
-syn keyword basicStatement SHELL shell Shell SLEEP sleep Sleep
-syn keyword basicStatement SOUND sound Sound STATIC static Static
-syn keyword basicStatement STOP stop Stop STRIG strig Strig
-syn keyword basicStatement SUB sub Sub SWAP swap Swap
-syn keyword basicStatement SYSTEM system System TIMER timer Timer
-syn keyword basicStatement TROFF troff Troff TRON tron Tron
-syn keyword basicStatement TYPE type Type UNLOCK unlock Unlock
-syn keyword basicStatement VIEW view View WAIT wait Wait
-syn keyword basicStatement WHILE while While WEND wend Wend
-syn keyword basicStatement WIDTH width Width WINDOW window Window
-syn keyword basicStatement WRITE write Write DATE$ date$ Date$
-syn keyword basicStatement MID$ mid$ Mid$ TIME$ time$ Time$
-
-syn keyword basicFunction ABS abs Abs ASC asc Asc
-syn keyword basicFunction ATN atn Atn CDBL cdbl Cdbl
-syn keyword basicFunction CINT cint Cint CLNG clng Clng
-syn keyword basicFunction COS cos Cos CSNG csng Csng
-syn keyword basicFunction CSRLIN csrlin Csrlin CVD cvd Cvd
-syn keyword basicFunction CVDMBF cvdmbf Cvdmbf CVI cvi Cvi
-syn keyword basicFunction CVL cvl Cvl CVS cvs Cvs
-syn keyword basicFunction CVSMBF cvsmbf Cvsmbf EOF eof Eof
-syn keyword basicFunction ERDEV erdev Erdev ERL erl Erl
-syn keyword basicFunction ERR err Err EXP exp Exp
-syn keyword basicFunction FILEATTR fileattr Fileattr FIX fix Fix
-syn keyword basicFunction FRE fre Fre FREEFILE freefile Freefile
-syn keyword basicFunction INP inp Inp INSTR instr Instr
-syn keyword basicFunction INT int Int LBOUND lbound Lbound
-syn keyword basicFunction LEN len Len LOC loc Loc
-syn keyword basicFunction LOF lof Lof LOG log Log
-syn keyword basicFunction LPOS lpos Lpos PEEK peek Peek
-syn keyword basicFunction PEN pen Pen POINT point Point
-syn keyword basicFunction POS pos Pos RND rnd Rnd
-syn keyword basicFunction SADD sadd Sadd SCREEN screen Screen
-syn keyword basicFunction SEEK seek Seek SETMEM setmem Setmem
-syn keyword basicFunction SGN sgn Sgn SIN sin Sin
-syn keyword basicFunction SPC spc Spc SQR sqr Sqr
-syn keyword basicFunction STICK stick Stick STRIG strig Strig
-syn keyword basicFunction TAB tab Tab TAN tan Tan
-syn keyword basicFunction UBOUND ubound Ubound VAL val Val
-syn keyword basicFunction VALPTR valptr Valptr VALSEG valseg Valseg
-syn keyword basicFunction VARPTR varptr Varptr VARSEG varseg Varseg
-syn keyword basicFunction CHR$ Chr$ chr$ COMMAND$ command$ Command$
-syn keyword basicFunction DATE$ date$ Date$ ENVIRON$ environ$ Environ$
-syn keyword basicFunction ERDEV$ erdev$ Erdev$ HEX$ hex$ Hex$
-syn keyword basicFunction INKEY$ inkey$ Inkey$ INPUT$ input$ Input$
-syn keyword basicFunction IOCTL$ ioctl$ Ioctl$ LCASES$ lcases$ Lcases$
-syn keyword basicFunction LAFT$ laft$ Laft$ LTRIM$ ltrim$ Ltrim$
-syn keyword basicFunction MID$ mid$ Mid$ MKDMBF$ mkdmbf$ Mkdmbf$
-syn keyword basicFunction MKD$ mkd$ Mkd$ MKI$ mki$ Mki$
-syn keyword basicFunction MKL$ mkl$ Mkl$ MKSMBF$ mksmbf$ Mksmbf$
-syn keyword basicFunction MKS$ mks$ Mks$ OCT$ oct$ Oct$
-syn keyword basicFunction RIGHT$ right$ Right$ RTRIM$ rtrim$ Rtrim$
-syn keyword basicFunction SPACE$ space$ Space$ STR$ str$ Str$
-syn keyword basicFunction STRING$ string$ String$ TIME$ time$ Time$
-syn keyword basicFunction UCASE$ ucase$ Ucase$ VARPTR$ varptr$ Varptr$
+let s:keywords =<< trim EOL " {{{2
+ absolute
+ access
+ alias
+ append
+ as
+ base
+ binary
+ byval
+ cdecl
+ com
+ def
+ do
+ for
+ function
+ gosub
+ goto
+ input
+ int86old
+ int86xold
+ interrupt
+ interruptx
+ is
+ key
+ len
+ list
+ local
+ lock
+ lprint
+ next
+ off
+ on
+ output
+ pen
+ play
+ random
+ read
+ resume
+ screen
+ seg
+ shared
+ signal
+ static
+ step
+ stop
+ strig
+ sub
+ timer
+ to
+ until
+ using
+ while
+ write
+EOL
+" }}}
+
+for k in s:keywords
+ exe 'syn match basicKeyword "\<' .. k .. '\>"'
+endfor
+
+" Functions {{{1
+syn keyword basicFunction abs asc atn cdbl chr$ cint clng command$ cos csng
+syn keyword basicFunction csrlin cvd cvdmbf cvi cvl cvs cvsmbf environ$ eof
+syn keyword basicFunction erdev erdev$ erl err exp fileattr fix fre freefile
+syn keyword basicFunction hex$ inkey$ inp input$ instr int ioctl$ left$ lbound
+syn keyword basicFunction lcase$ len loc lof log lpos ltrim$ mkd$ mkdmbf$ mki$
+syn keyword basicFunction mkl$ mks$ mksmbf$ oct$ peek pen point pos right$ rnd
+syn keyword basicFunction rtrim$ sadd setmem sgn sin space$ spc sqr stick str$
+syn keyword basicFunction strig string$ tab tan ubound ucase$ val valptr
+syn keyword basicFunction valseg varptr varptr$ varseg
+
+" Functions and statements (same name) {{{1
+syn match basicStatement "\<\%(date\$\|mid\$\|play\|screen\|seek\|time\$\|timer\)\>" contained
+syn match basicFunction "\<\%(date\$\|mid\$\|play\|screen\|seek\|time\$\|timer\)\>"
+
+" Types {{{1
+syn keyword basicType integer long single double string any
+
+" Strings {{{1
+
+" Unquoted DATA strings - anything except [:,] and leading or trailing whitespace
+" Needs lower priority than numbers
+syn match basicDataString "[^[:space:],:]\+\%(\s\+[^[:space:],:]\+\)*" contained
+
+syn region basicString start=+"+ end=+"+ oneline
+
+" Booleans {{{1
+if exists("basic_booleans")
+ syn keyword basicBoolean true false
+endif
" Numbers {{{1
-" Integer number, or floating point number without a dot.
-syn match basicNumber "\<\d\+\>"
-" Floating point number, with dot
-syn match basicNumber "\<\d\+\.\d*\>"
-" Floating point number, starting with a dot
-syn match basicNumber "\.\d\+\>"
-" String and Character constants {{{1
-syn match basicSpecial "\\\d\d\d\|\\." contained
-syn region basicString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=basicSpecial
+" Integers
+syn match basicNumber "-\=&o\=\o\+[%&]\=\>"
+syn match basicNumber "-\=&h\x\+[%&]\=\>"
+syn match basicNumber "-\=\<\d\+[%&]\=\>"
+
+" Floats
+syn match basicFloat "-\=\<\d\+\.\=\d*\%(\%([ed][+-]\=\d*\)\|[!#]\)\=\>"
+syn match basicFloat "-\=\<\.\d\+\%(\%([ed][+-]\=\d*\)\|[!#]\)\=\>"
-" Line numbers {{{1
-syn region basicLineNumber start="^\d" end="\s"
+" Statement anchors {{{1
+syn match basicLineStart "^" nextgroup=@basicStatements,@basicLineIdentifier skipwhite
+syn match basicStatementSeparator ":" nextgroup=@basicStatements skipwhite
-" Data-type suffixes {{{1
-syn match basicTypeSpecifier "[a-zA-Z0-9][$%&!#]"ms=s+1
-" Used with OPEN statement
-syn match basicFilenumber "#\d\+"
+" Line numbers and labels {{{1
+
+" QuickBASIC limits these to 65,529 and 40 chars respectively
+syn match basicLineNumber "\d\+" nextgroup=@basicStatements skipwhite contained
+syn match basicLineLabel "\a[[:alnum:]]*\ze\s*:" nextgroup=@basicStatements skipwhite contained
+
+syn cluster basicLineIdentifier contains=basicLineNumber,basicLineLabel
+
+" Line Continuation {{{1
+syn match basicLineContinuation "\s*\zs_\ze\s*$"
+
+" Type suffixes {{{1
+if exists("basic_type_suffixes")
+ syn match basicTypeSuffix "\a[[:alnum:].]*\zs[$%&!#]"
+endif
-" Mathematical operators {{{1
-" syn match basicMathsOperator "[<>+\*^/\\=-]"
-syn match basicMathsOperator "-\|=\|[:<>+\*^/\\]\|AND\|OR"
+" File numbers {{{1
+syn match basicFilenumber "#\d\+"
+syn match basicFilenumber "#\a[[:alnum:].]*[%&!#]\="
+
+" Operators {{{1
+if exists("basic_operators")
+ syn match basicArithmeticOperator "[-+*/\\^]"
+ syn match basicRelationalOperator "<>\|<=\|>=\|[><=]"
+endif
+syn match basicLogicalOperator "\<\%(not\|and\|or\|xor\|eqv\|imp\)\>"
+syn match basicArithmeticOperator "\<mod\>"
+
+" Metacommands {{{1
+" Note: No trailing word boundaries. Text may be freely mixed however there
+" must be only leading whitespace prior to the first metacommand
+syn match basicMetacommand "$INCLUDE\s*:\s*'[^']\+'" contained containedin=@basicMetaComments
+syn match basicMetacommand "$\%(DYNAMIC\|STATIC\)" contained containedin=@basicMetaComments
" Comments {{{1
-syn keyword basicTodo TODO FIXME XXX NOTE contained
-syn region basicComment start="^\s*\zsREM\>" start="\%(:\s*\)\@<=REM\>" end="$" contains=basicTodo
-syn region basicComment start="'" end="$" contains=basicTodo
+syn keyword basicTodo TODO FIXME XXX NOTE contained
+
+syn region basicRemStatement matchgroup=basicStatement start="REM\>" end="$" contains=basicTodo,@Spell contained
+syn region basicComment start="'" end="$" contains=basicTodo,@Spell
+
+if !exists("basic_no_comment_fold")
+ syn region basicMultilineComment start="^\s*'.*\n\%(\s*'\)\@=" end="^\s*'.*\n\%(\s*'\)\@!" contains=@basicComments transparent fold keepend
+endif
+
+" Metacommands
+syn region basicMetaRemStatement matchgroup=basicStatement start="REM\>\s*\$\@=" end="$" contains=basicTodo contained
+syn region basicMetaComment start="'\s*\$\@=" end="$" contains=basicTodo
+
+syn cluster basicMetaComments contains=basicMetaComment,basicMetaRemStatement
+syn cluster basicComments contains=basicComment,basicMetaComment
"syn sync ccomment basicComment
" Default Highlighting {{{1
-hi def link basicLabel Label
-hi def link basicConditional Conditional
-hi def link basicRepeat Repeat
-hi def link basicLineNumber Comment
-hi def link basicNumber Number
-hi def link basicError Error
-hi def link basicStatement Statement
-hi def link basicString String
-hi def link basicComment Comment
-hi def link basicSpecial Special
-hi def link basicTodo Todo
-hi def link basicFunction Identifier
-hi def link basicTypeSpecifier Type
-hi def link basicFilenumber basicTypeSpecifier
-"hi basicMathsOperator term=bold cterm=bold gui=bold
+hi def link basicArithmeticOperator basicOperator
+hi def link basicBoolean Boolean
+hi def link basicComment Comment
+hi def link basicCommentError Error
+hi def link basicDataString basicString
+hi def link basicFilenumber basicTypeSuffix " TODO: better group
+hi def link basicFloat Float
+hi def link basicFunction Function
+hi def link basicKeyword Keyword
+hi def link basicLineIdentifier LineNr
+hi def link basicLineContinuation Special
+hi def link basicLineLabel basicLineIdentifier
+hi def link basicLineNumber basicLineIdentifier
+hi def link basicLogicalOperator basicOperator
+hi def link basicMetacommand SpecialComment
+hi def link basicMetaComment Comment
+hi def link basicMetaRemStatement Comment
+hi def link basicNumber Number
+hi def link basicOperator Operator
+hi def link basicPutAction Keyword
+hi def link basicRelationalOperator basicOperator
+hi def link basicRemStatement Comment
+hi def link basicSpaceError Error
+hi def link basicStatementSeparator Special
+hi def link basicStatement Statement
+hi def link basicString String
+hi def link basicTodo Todo
+hi def link basicType Type
+hi def link basicTypeSuffix Special
+if exists("basic_legacy_syntax_groups")
+ hi def link basicTypeSpecifier Type
+ hi def link basicTypeSuffix basicTypeSpecifier
+endif
" Postscript {{{1
let b:current_syntax = "basic"
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index e86e1b8669..890e9ae1a7 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Dec 07
+" Last Change: 2022 Apr 24
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -11,7 +11,7 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-let s:ft = matchstr(&ft, '^\([^.]\)\+')
+let s:ft = matchstr(&ft, '^\%([^.]\)\+')
" check if this was included from cpp.vim
let s:in_cpp_family = exists("b:filetype_in_cpp_family")
@@ -42,17 +42,17 @@ syn cluster cCommentGroup contains=cTodo,cBadContinuation
" String and Character constants
" Highlight special characters (those which have a backslash) differently
-syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
+syn match cSpecial display contained "\\\%(x\x\+\|\o\{1,3}\|.\|$\)"
if !exists("c_no_utf")
- syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
+ syn match cSpecial display contained "\\\%(u\x\{4}\|U\x\{8}\)"
endif
if !exists("c_no_cformat")
" Highlight % items in strings.
if !exists("c_no_c99") " ISO C99
- syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
+ syn match cFormat display "%\%(\d\+\$\)\=[-+' #0*]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjzt]\|ll\|hh\)\=\%([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
else
- syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
+ syn match cFormat display "%\%(\d\+\$\)\=[-+' #0*]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlL]\|ll\)\=\%([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
endif
syn match cFormat display "%%" contained
endif
@@ -60,8 +60,8 @@ endif
" cCppString: same as cString, but ends at end of line
if s:in_cpp_family && !exists("cpp_no_cpp11") && !exists("c_no_cformat")
" ISO C++11
- syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
- syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
+ syn region cString start=+\%(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
+ syn region cCppString start=+\%(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat")
" ISO C99
syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
@@ -73,7 +73,7 @@ else
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
endif
-syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
+syn region cCppSkip contained start="^\s*\%(%:\|#\)\s*\%(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\%(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
syn cluster cStringGroup contains=cCppString,cCppSkip
@@ -190,16 +190,16 @@ syn case ignore
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
" Same, but without octal error (for comments)
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
-syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
+syn match cNumber display contained "\d\+\%(u\=l\{0,2}\|ll\=u\)\>"
"hex number
-syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
+syn match cNumber display contained "0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>"
" Flag the first zero of an octal number as something special
-syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
+syn match cOctal display contained "0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
syn match cOctalZero display contained "\<0"
"floating point number, with dot, optional exponent
-syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
+syn match cFloat display contained "\d\+\.\d*\%(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
-syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
+syn match cFloat display contained "\.\d\+\%(e[-+]\=\d\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
if !exists("c_no_c99")
@@ -219,7 +219,7 @@ if exists("c_comment_strings")
" need to use a special type of cString: cCommentString, 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 cCommentSkip contained "^\s*\*\($\|\s\+\)"
+ syn match cCommentSkip contained "^\s*\*\%($\|\s\+\)"
syn region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
syn region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,cWrongComTail,@Spell
@@ -245,8 +245,14 @@ syn match cWrongComTail display "\*/"
syn keyword cOperator sizeof
if exists("c_gnu")
+ syn keyword cType __label__ __complex__
syn keyword cStatement __asm__
- syn keyword cOperator typeof __real__ __imag__
+ syn keyword cOperator __alignof__
+ syn keyword cOperator typeof __typeof__
+ syn keyword cOperator __real__ __imag__
+ syn keyword cStorageClass __attribute__ __const__ __extension__
+ syn keyword cStorageClass inline __inline__
+ syn keyword cStorageClass __restrict__ __volatile__ __noreturn__
endif
syn keyword cType int long short char void
syn keyword cType signed unsigned float double
@@ -270,16 +276,10 @@ if !exists("c_no_c99") " ISO C99
syn keyword cType intptr_t uintptr_t
syn keyword cType intmax_t uintmax_t
endif
-if exists("c_gnu")
- syn keyword cType __label__ __complex__ __volatile__
-endif
syn keyword cTypedef typedef
syn keyword cStructure struct union enum
syn keyword cStorageClass static register auto volatile extern const
-if exists("c_gnu")
- syn keyword cStorageClass inline __attribute__
-endif
if !exists("c_no_c99") && !s:in_cpp_family
syn keyword cStorageClass inline restrict
endif
@@ -292,6 +292,7 @@ if !exists("c_no_c11")
syn keyword cOperator _Static_assert static_assert
syn keyword cStorageClass _Thread_local thread_local
syn keyword cType char16_t char32_t
+ syn keyword cType max_align_t
" C11 atomics (take down the shield wall!)
syn keyword cType atomic_bool atomic_char atomic_schar atomic_uchar
syn keyword Ctype atomic_short atomic_ushort atomic_int atomic_uint
@@ -375,36 +376,36 @@ if !exists("c_no_c99") " ISO C99
endif
" Accept %: for # (C99)
-syn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
-syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>"
+syn region cPreCondit start="^\s*\zs\%(%:\|#\)\s*\%(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
+syn match cPreConditMatch display "^\s*\zs\%(%:\|#\)\s*\%(else\|endif\)\>"
if !exists("c_no_if0")
syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip
- syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
- syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
+ syn region cCppOutWrapper start="^\s*\zs\%(%:\|#\)\s*if\s\+0\+\s*\%($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
+ syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\%(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
if !exists("c_no_if0_fold")
- syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
+ syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
else
- syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
+ syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
endif
- syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
- syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold
- syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit
+ syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\%(%:\|#\)\s*\%(else\|elif\)" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
+ syn region cCppInWrapper start="^\s*\zs\%(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\%($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold
+ syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\%(%:\|#\)\s*endif\>" contains=TOP,cPreCondit
if !exists("c_no_if0_fold")
- syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
+ syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
else
- syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
+ syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
endif
- syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
- syn region cCppOutSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip
- syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc
+ syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\%(%:\|#\)\s*\%(else\|elif\)\%([^/]\|/[^/*]\)*" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
+ syn region cCppOutSkip contained start="^\s*\%(%:\|#\)\s*\%(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\%(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip
+ syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\%(%:\|#\)\s*\%(if\s\+\%(\d\+\s*\%($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\%(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc
endif
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>"
-syn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
+syn match cInclude display "^\s*\zs\%(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
"syn match cLineSkip "\\$"
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock
-syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
-syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
+syn region cDefine start="^\s*\zs\%(%:\|#\)\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
+syn region cPreProc start="^\s*\zs\%(%:\|#\)\s*\%(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
" Optional embedded Autodoc parsing
if exists("c_autodoc")
diff --git a/runtime/syntax/chordpro.vim b/runtime/syntax/chordpro.vim
index 5ccec26508..41a0a1e9d1 100644
--- a/runtime/syntax/chordpro.vim
+++ b/runtime/syntax/chordpro.vim
@@ -1,8 +1,7 @@
" Vim syntax file
-" Language: ChordPro (v. 3.6.2)
+" Language: ChordPro 6 (https://www.chordpro.org)
" Maintainer: Niels Bo Andersen <niels@niboan.dk>
-" Last Change: 2006 Apr 30
-" Remark: Requires VIM version 6.00 or greater
+" Last Change: 2022-04-15
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -12,54 +11,161 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-setlocal iskeyword+=-
-
syn case ignore
-syn keyword chordproDirective contained
- \ start_of_chorus soc end_of_chorus eoc new_song ns no_grid ng grid g
- \ new_page np new_physical_page npp start_of_tab sot end_of_tab eot
- \ column_break colb
-
-syn keyword chordproDirWithOpt contained
- \ comment c comment_italic ci comment_box cb title t subtitle st define
- \ textfont textsize chordfont chordsize columns col
-
-syn keyword chordproDefineKeyword contained base-fret frets
+" Include embedded abc syntax
+syn include @Abc syntax/abc.vim
+
+" Lilypond and Pango syntaxes could be embedded as well, but they are not
+" available in the distribution.
+
+" Directives without arguments
+syn keyword chordproDirective contained nextgroup=chordproConditional
+ \ new_song ns
+ \ start_of_chorus soc
+ \ chorus
+ \ start_of_verse sov
+ \ start_of_bridge sob
+ \ start_of_tab sot
+ \ start_of_grid sog
+ \ start_of_abc
+ \ start_of_ly
+ \ end_of_chorus eoc
+ \ end_of_verse eov
+ \ end_of_bridge eob
+ \ end_of_tab eot
+ \ end_of_grid eog
+ \ end_of_abc
+ \ end_of_ly
+ \ new_page np
+ \ new_physical_page npp
+ \ column_break cb
+ \ grid g
+ \ no_grid ng
+ \ transpose
+ \ chordfont cf chordsize cs chordcolour
+ \ footerfont footersize footercolour
+ \ gridfont gridsize gridcolour
+ \ tabfont tabsize tabcolour
+ \ tocfont tocsize toccolour
+ \ textfont tf textsize ts textcolour
+ \ titlefont titlesize titlecolour
+
+" Directives with arguments. Some directives are in both groups, as they can
+" be used both with and without arguments
+syn keyword chordproDirWithArg contained nextgroup=chordproConditional
+ \ title t
+ \ subtitle st
+ \ sorttitle
+ \ artist
+ \ composer
+ \ lyricist
+ \ arranger
+ \ copyright
+ \ album
+ \ year
+ \ key
+ \ time
+ \ tempo
+ \ duration
+ \ capo
+ \ comment c
+ \ highlight
+ \ comment_italic ci
+ \ comment_box cb
+ \ image
+ \ start_of_chorus soc
+ \ chorus
+ \ start_of_verse sov
+ \ start_of_bridge sob
+ \ start_of_tab sot
+ \ start_of_grid sog
+ \ start_of_abc
+ \ start_of_ly
+ \ define
+ \ chord
+ \ transpose
+ \ chordfont cf chordsize cs chordcolour
+ \ footerfont footersize footercolour
+ \ gridfont gridsize gridcolour
+ \ tabfont tabsize tabcolour
+ \ tocfont tocsize toccolour
+ \ textfont tf textsize ts textcolour
+ \ titlefont titlesize titlecolour
+ \ pagetype
+ \ titles
+ \ columns col
+
+syn keyword chordproMetaKeyword contained meta
+syn keyword chordproMetadata contained title sorttitle subtitle artist composer lyricist arranger copyright album year key time tempo duration capo
+syn keyword chordproStandardMetadata contained songindex page pages pagerange today tuning instrument user
+syn match chordproStandardMetadata /instrument\.type/ contained
+syn match chordproStandardMetadata /instrument\.description/ contained
+syn match chordproStandardMetadata /user\.name/ contained
+syn match chordproStandardMetadata /user\.fullname/ contained
+
+syn keyword chordproDefineKeyword contained frets fingers
+syn match chordproDefineKeyword /base-fret/ contained
+
+syn match chordproArgumentsNumber /\d\+/ contained
+
+syn match chordproCustom /x_\w\+/ contained
+
+syn match chordproDirMatch /{\w\+\(-\w\+\)\?}/ contains=chordproDirective contained transparent
+syn match chordproDirArgMatch /{\w\+\(-\w\+\)\?[: ]/ contains=chordproDirWithArg contained transparent
+syn match chordproMetaMatch /{meta\(-\w\+\)\?[: ]\+\w\+/ contains=chordproMetaKeyword,chordproMetadata contained transparent
+syn match chordproCustomMatch /{x_\w\+\(-\w\+\)\?[: ]/ contains=chordproCustom contained transparent
+
+syn match chordproConditional /-\w\+/ contained
+
+syn match chordproMetaDataOperator /[=|]/ contained
+syn match chordproMetaDataValue /%{\w*/ contains=chordproMetaData,chordproStandardMetadata contained transparent
+" Handles nested metadata tags, but the end of the containing chordproTag is
+" not highlighted correctly, if there are more than two levels of nesting
+syn region chordproMetaDataTag start=/%{\w*/ skip=/%{[^}]*}/ end=/}/ contains=chordproMetaDataValue,chordproMetaDataOperator,chordproMetadataTag contained
+
+syn region chordproArguments start=/{\w\+\(-\w\+\)\?[: ]/hs=e+1 skip=/%{[^}]*}/ end=/}/he=s-1 contains=chordproDirArgMatch,chordproArgumentsNumber,chordproMetaDataTag contained
+syn region chordproArguments start=/{\(define\|chord\)\(-\w\+\)\?[: ]/hs=e+1 end=/}/he=s-1 contains=chordproDirArgMatch,chordproDefineKeyword,chordproArgumentsNumber contained
+syn region chordproArguments start=/{meta\(-\w\+\)\?[: ]/hs=e+1 skip=/%{[^}]*}/ end=/}/he=s-1 contains=chordproMetaMatch,chordproMetaDataTag contained
+syn region chordproArguments start=/{x_\w\+\(-\w\+\)\?[: ]/hs=e+1 end=/}/he=s-1 contains=chordproCustomMatch contained
+
+syn region chordproTag start=/{/ skip=/%{[^}]*}/ end=/}/ contains=chordproDirMatch,chordproArguments oneline
-syn match chordproDirMatch /{\w*}/ contains=chordproDirective contained transparent
-syn match chordproDirOptMatch /{\w*:/ contains=chordproDirWithOpt contained transparent
+syn region chordproChord matchgroup=chordproBracket start=/\[/ end=/]/ oneline
-" Workaround for a bug in VIM 6, which causes incorrect coloring of the first {
-if version < 700
- syn region chordproOptions start=/{\w*:/ end=/}/ contains=chordproDirOptMatch contained transparent
- syn region chordproOptions start=/{define:/ end=/}/ contains=chordproDirOptMatch, chordproDefineKeyword contained transparent
-else
- syn region chordproOptions start=/{\w*:/hs=e+1 end=/}/he=s-1 contains=chordproDirOptMatch contained
- syn region chordproOptions start=/{define:/hs=e+1 end=/}/he=s-1 contains=chordproDirOptMatch, chordproDefineKeyword contained
-endif
+syn region chordproAnnotation matchgroup=chordproBracket start=/\[\*/ end=/]/ oneline
-syn region chordproTag start=/{/ end=/}/ contains=chordproDirMatch,chordproOptions oneline
+syn region chordproTab start=/{start_of_tab\(-\w\+\)\?\([: ].\+\)\?}\|{sot\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_tab}\|{eot}/me=s-1 contains=chordproTag,chordproComment keepend
-syn region chordproChord matchgroup=chordproBracket start=/\[/ end=/]/ oneline
+syn region chordproChorus start=/{start_of_chorus\(-\w\+\)\?\([: ].\+\)\?}\|{soc\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_chorus}\|{eoc}/me=s-1 contains=chordproTag,chordproChord,chordproAnnotation,chordproComment keepend
-syn region chordproTab start=/{start_of_tab}\|{sot}/hs=e+1 end=/{end_of_tab}\|{eot}/he=s-1 contains=chordproTag,chordproComment keepend
+syn region chordproBridge start=/{start_of_bridge\(-\w\+\)\?\([: ].\+\)\?}\|{sob\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_bridge}\|{eob}/me=s-1 contains=chordproTag,chordproChord,chordproAnnotation,chordproComment keepend
-syn region chordproChorus start=/{start_of_chorus}\|{soc}/hs=e+1 end=/{end_of_chorus}\|{eoc}/he=s-1 contains=chordproTag,chordproChord,chordproComment keepend
+syn region chordproAbc start=/{start_of_abc\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_abc}/me=s-1 contains=chordproTag,@Abc keepend
syn match chordproComment /^#.*/
" Define the default highlighting.
hi def link chordproDirective Statement
-hi def link chordproDirWithOpt Statement
-hi def link chordproOptions Special
+hi def link chordproDirWithArg Statement
+hi def link chordproConditional Statement
+hi def link chordproCustom Statement
+hi def link chordproMetaKeyword Statement
+hi def link chordproMetaDataOperator Operator
+hi def link chordproMetaDataTag Function
+hi def link chordproArguments Special
+hi def link chordproArgumentsNumber Number
hi def link chordproChord Type
+hi def link chordproAnnotation Identifier
hi def link chordproTag Constant
hi def link chordproTab PreProc
hi def link chordproComment Comment
hi def link chordproBracket Constant
-hi def link chordproDefineKeyword Type
+hi def link chordproDefineKeyword Identifier
+hi def link chordproMetadata Identifier
+hi def link chordproStandardMetadata Identifier
hi def chordproChorus term=bold cterm=bold gui=bold
+hi def chordproBridge term=italic cterm=italic gui=italic
let b:current_syntax = "chordpro"
diff --git a/runtime/syntax/clojure.vim b/runtime/syntax/clojure.vim
index 9782dc41ad..0d63728250 100644
--- a/runtime/syntax/clojure.vim
+++ b/runtime/syntax/clojure.vim
@@ -7,7 +7,7 @@
" Contributors: Joel Holdbrooks <cjholdbrooks@gmail.com> (Regexp support, bug fixes)
" URL: https://github.com/clojure-vim/clojure.vim
" License: Vim (see :h license)
-" Last Change: 2021-10-26
+" Last Change: 2022-03-24
if exists("b:current_syntax")
finish
@@ -21,20 +21,20 @@ if has("folding") && exists("g:clojure_fold") && g:clojure_fold > 0
endif
" -*- KEYWORDS -*-
-" Generated from https://github.com/clojure-vim/clojure.vim/blob/62b215f079ce0f3834fd295c7a7f6bd8cc54bcc3/clj/src/vim_clojure_static/generate.clj
-" Clojure version 1.10.3
+" Generated from https://github.com/clojure-vim/clojure.vim/blob/fd280e33e84c88e97860930557dba3ff80b1a82d/clj/src/vim_clojure_static/generate.clj
+" Clojure version 1.11.0
let s:clojure_syntax_keywords = {
- \ 'clojureBoolean': ["false","true"]
- \ , 'clojureCond': ["case","clojure.core/case","clojure.core/cond","clojure.core/cond->","clojure.core/cond->>","clojure.core/condp","clojure.core/if-let","clojure.core/if-not","clojure.core/if-some","clojure.core/when","clojure.core/when-first","clojure.core/when-let","clojure.core/when-not","clojure.core/when-some","cond","cond->","cond->>","condp","if-let","if-not","if-some","when","when-first","when-let","when-not","when-some"]
- \ , 'clojureConstant': ["nil"]
- \ , 'clojureDefine': ["clojure.core/definline","clojure.core/definterface","clojure.core/defmacro","clojure.core/defmethod","clojure.core/defmulti","clojure.core/defn","clojure.core/defn-","clojure.core/defonce","clojure.core/defprotocol","clojure.core/defrecord","clojure.core/defstruct","clojure.core/deftype","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype"]
- \ , 'clojureException': ["catch","finally","throw","try"]
- \ , 'clojureFunc': ["*","*'","+","+'","-","-'","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","/","<","<=","=","==",">",">=","PrintWriter-on","StackTraceElement->vec","Throwable->map","accessor","aclone","add-classpath","add-tap","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","ancestors","any?","apply","array-map","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","cast","cat","char","char-array","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","clojure.core/*","clojure.core/*'","clojure.core/+","clojure.core/+'","clojure.core/-","clojure.core/-'","clojure.core/->ArrayChunk","clojure.core/->Eduction","clojure.core/->Vec","clojure.core/->VecNode","clojure.core/->VecSeq","clojure.core/-cache-protocol-fn","clojure.core/-reset-methods","clojure.core//","clojure.core/<","clojure.core/<=","clojure.core/=","clojure.core/==","clojure.core/>","clojure.core/>=","clojure.core/PrintWriter-on","clojure.core/StackTraceElement->vec","clojure.core/Throwable->map","clojure.core/accessor","clojure.core/aclone","clojure.core/add-classpath","clojure.core/add-tap","clojure.core/add-watch","clojure.core/agent","clojure.core/agent-error","clojure.core/agent-errors","clojure.core/aget","clojure.core/alength","clojure.core/alias","clojure.core/all-ns","clojure.core/alter","clojure.core/alter-meta!","clojure.core/alter-var-root","clojure.core/ancestors","clojure.core/any?","clojure.core/apply","clojure.core/array-map","clojure.core/aset","clojure.core/aset-boolean","clojure.core/aset-byte","clojure.core/aset-char","clojure.core/aset-double","clojure.core/aset-float","clojure.core/aset-int","clojure.core/aset-long","clojure.core/aset-short","clojure.core/assoc","clojure.core/assoc!","clojure.core/assoc-in","clojure.core/associative?","clojure.core/atom","clojure.core/await","clojure.core/await-for","clojure.core/await1","clojure.core/bases","clojure.core/bean","clojure.core/bigdec","clojure.core/bigint","clojure.core/biginteger","clojure.core/bit-and","clojure.core/bit-and-not","clojure.core/bit-clear","clojure.core/bit-flip","clojure.core/bit-not","clojure.core/bit-or","clojure.core/bit-set","clojure.core/bit-shift-left","clojure.core/bit-shift-right","clojure.core/bit-test","clojure.core/bit-xor","clojure.core/boolean","clojure.core/boolean-array","clojure.core/boolean?","clojure.core/booleans","clojure.core/bound-fn*","clojure.core/bound?","clojure.core/bounded-count","clojure.core/butlast","clojure.core/byte","clojure.core/byte-array","clojure.core/bytes","clojure.core/bytes?","clojure.core/cast","clojure.core/cat","clojure.core/char","clojure.core/char-array","clojure.core/char?","clojure.core/chars","clojure.core/chunk","clojure.core/chunk-append","clojure.core/chunk-buffer","clojure.core/chunk-cons","clojure.core/chunk-first","clojure.core/chunk-next","clojure.core/chunk-rest","clojure.core/chunked-seq?","clojure.core/class","clojure.core/class?","clojure.core/clear-agent-errors","clojure.core/clojure-version","clojure.core/coll?","clojure.core/commute","clojure.core/comp","clojure.core/comparator","clojure.core/compare","clojure.core/compare-and-set!","clojure.core/compile","clojure.core/complement","clojure.core/completing","clojure.core/concat","clojure.core/conj","clojure.core/conj!","clojure.core/cons","clojure.core/constantly","clojure.core/construct-proxy","clojure.core/contains?","clojure.core/count","clojure.core/counted?","clojure.core/create-ns","clojure.core/create-struct","clojure.core/cycle","clojure.core/dec","clojure.core/dec'","clojure.core/decimal?","clojure.core/dedupe","clojure.core/delay?","clojure.core/deliver","clojure.core/denominator","clojure.core/deref","clojure.core/derive","clojure.core/descendants","clojure.core/destructure","clojure.core/disj","clojure.core/disj!","clojure.core/dissoc","clojure.core/dissoc!","clojure.core/distinct","clojure.core/distinct?","clojure.core/doall","clojure.core/dorun","clojure.core/double","clojure.core/double-array","clojure.core/double?","clojure.core/doubles","clojure.core/drop","clojure.core/drop-last","clojure.core/drop-while","clojure.core/eduction","clojure.core/empty","clojure.core/empty?","clojure.core/ensure","clojure.core/ensure-reduced","clojure.core/enumeration-seq","clojure.core/error-handler","clojure.core/error-mode","clojure.core/eval","clojure.core/even?","clojure.core/every-pred","clojure.core/every?","clojure.core/ex-cause","clojure.core/ex-data","clojure.core/ex-info","clojure.core/ex-message","clojure.core/extend","clojure.core/extenders","clojure.core/extends?","clojure.core/false?","clojure.core/ffirst","clojure.core/file-seq","clojure.core/filter","clojure.core/filterv","clojure.core/find","clojure.core/find-keyword","clojure.core/find-ns","clojure.core/find-protocol-impl","clojure.core/find-protocol-method","clojure.core/find-var","clojure.core/first","clojure.core/flatten","clojure.core/float","clojure.core/float-array","clojure.core/float?","clojure.core/floats","clojure.core/flush","clojure.core/fn?","clojure.core/fnext","clojure.core/fnil","clojure.core/force","clojure.core/format","clojure.core/frequencies","clojure.core/future-call","clojure.core/future-cancel","clojure.core/future-cancelled?","clojure.core/future-done?","clojure.core/future?","clojure.core/gensym","clojure.core/get","clojure.core/get-in","clojure.core/get-method","clojure.core/get-proxy-class","clojure.core/get-thread-bindings","clojure.core/get-validator","clojure.core/group-by","clojure.core/halt-when","clojure.core/hash","clojure.core/hash-combine","clojure.core/hash-map","clojure.core/hash-ordered-coll","clojure.core/hash-set","clojure.core/hash-unordered-coll","clojure.core/ident?","clojure.core/identical?","clojure.core/identity","clojure.core/ifn?","clojure.core/in-ns","clojure.core/inc","clojure.core/inc'","clojure.core/indexed?","clojure.core/init-proxy","clojure.core/inst-ms","clojure.core/inst-ms*","clojure.core/inst?","clojure.core/instance?","clojure.core/int","clojure.core/int-array","clojure.core/int?","clojure.core/integer?","clojure.core/interleave","clojure.core/intern","clojure.core/interpose","clojure.core/into","clojure.core/into-array","clojure.core/ints","clojure.core/isa?","clojure.core/iterate","clojure.core/iterator-seq","clojure.core/juxt","clojure.core/keep","clojure.core/keep-indexed","clojure.core/key","clojure.core/keys","clojure.core/keyword","clojure.core/keyword?","clojure.core/last","clojure.core/line-seq","clojure.core/list","clojure.core/list*","clojure.core/list?","clojure.core/load","clojure.core/load-file","clojure.core/load-reader","clojure.core/load-string","clojure.core/loaded-libs","clojure.core/long","clojure.core/long-array","clojure.core/longs","clojure.core/macroexpand","clojure.core/macroexpand-1","clojure.core/make-array","clojure.core/make-hierarchy","clojure.core/map","clojure.core/map-entry?","clojure.core/map-indexed","clojure.core/map?","clojure.core/mapcat","clojure.core/mapv","clojure.core/max","clojure.core/max-key","clojure.core/memoize","clojure.core/merge","clojure.core/merge-with","clojure.core/meta","clojure.core/method-sig","clojure.core/methods","clojure.core/min","clojure.core/min-key","clojure.core/mix-collection-hash","clojure.core/mod","clojure.core/munge","clojure.core/name","clojure.core/namespace","clojure.core/namespace-munge","clojure.core/nat-int?","clojure.core/neg-int?","clojure.core/neg?","clojure.core/newline","clojure.core/next","clojure.core/nfirst","clojure.core/nil?","clojure.core/nnext","clojure.core/not","clojure.core/not-any?","clojure.core/not-empty","clojure.core/not-every?","clojure.core/not=","clojure.core/ns-aliases","clojure.core/ns-imports","clojure.core/ns-interns","clojure.core/ns-map","clojure.core/ns-name","clojure.core/ns-publics","clojure.core/ns-refers","clojure.core/ns-resolve","clojure.core/ns-unalias","clojure.core/ns-unmap","clojure.core/nth","clojure.core/nthnext","clojure.core/nthrest","clojure.core/num","clojure.core/number?","clojure.core/numerator","clojure.core/object-array","clojure.core/odd?","clojure.core/parents","clojure.core/partial","clojure.core/partition","clojure.core/partition-all","clojure.core/partition-by","clojure.core/pcalls","clojure.core/peek","clojure.core/persistent!","clojure.core/pmap","clojure.core/pop","clojure.core/pop!","clojure.core/pop-thread-bindings","clojure.core/pos-int?","clojure.core/pos?","clojure.core/pr","clojure.core/pr-str","clojure.core/prefer-method","clojure.core/prefers","clojure.core/print","clojure.core/print-ctor","clojure.core/print-dup","clojure.core/print-method","clojure.core/print-simple","clojure.core/print-str","clojure.core/printf","clojure.core/println","clojure.core/println-str","clojure.core/prn","clojure.core/prn-str","clojure.core/promise","clojure.core/proxy-call-with-super","clojure.core/proxy-mappings","clojure.core/proxy-name","clojure.core/push-thread-bindings","clojure.core/qualified-ident?","clojure.core/qualified-keyword?","clojure.core/qualified-symbol?","clojure.core/quot","clojure.core/rand","clojure.core/rand-int","clojure.core/rand-nth","clojure.core/random-sample","clojure.core/range","clojure.core/ratio?","clojure.core/rational?","clojure.core/rationalize","clojure.core/re-find","clojure.core/re-groups","clojure.core/re-matcher","clojure.core/re-matches","clojure.core/re-pattern","clojure.core/re-seq","clojure.core/read","clojure.core/read+string","clojure.core/read-line","clojure.core/read-string","clojure.core/reader-conditional","clojure.core/reader-conditional?","clojure.core/realized?","clojure.core/record?","clojure.core/reduce","clojure.core/reduce-kv","clojure.core/reduced","clojure.core/reduced?","clojure.core/reductions","clojure.core/ref","clojure.core/ref-history-count","clojure.core/ref-max-history","clojure.core/ref-min-history","clojure.core/ref-set","clojure.core/refer","clojure.core/release-pending-sends","clojure.core/rem","clojure.core/remove","clojure.core/remove-all-methods","clojure.core/remove-method","clojure.core/remove-ns","clojure.core/remove-tap","clojure.core/remove-watch","clojure.core/repeat","clojure.core/repeatedly","clojure.core/replace","clojure.core/replicate","clojure.core/require","clojure.core/requiring-resolve","clojure.core/reset!","clojure.core/reset-meta!","clojure.core/reset-vals!","clojure.core/resolve","clojure.core/rest","clojure.core/restart-agent","clojure.core/resultset-seq","clojure.core/reverse","clojure.core/reversible?","clojure.core/rseq","clojure.core/rsubseq","clojure.core/run!","clojure.core/satisfies?","clojure.core/second","clojure.core/select-keys","clojure.core/send","clojure.core/send-off","clojure.core/send-via","clojure.core/seq","clojure.core/seq?","clojure.core/seqable?","clojure.core/seque","clojure.core/sequence","clojure.core/sequential?","clojure.core/set","clojure.core/set-agent-send-executor!","clojure.core/set-agent-send-off-executor!","clojure.core/set-error-handler!","clojure.core/set-error-mode!","clojure.core/set-validator!","clojure.core/set?","clojure.core/short","clojure.core/short-array","clojure.core/shorts","clojure.core/shuffle","clojure.core/shutdown-agents","clojure.core/simple-ident?","clojure.core/simple-keyword?","clojure.core/simple-symbol?","clojure.core/slurp","clojure.core/some","clojure.core/some-fn","clojure.core/some?","clojure.core/sort","clojure.core/sort-by","clojure.core/sorted-map","clojure.core/sorted-map-by","clojure.core/sorted-set","clojure.core/sorted-set-by","clojure.core/sorted?","clojure.core/special-symbol?","clojure.core/spit","clojure.core/split-at","clojure.core/split-with","clojure.core/str","clojure.core/string?","clojure.core/struct","clojure.core/struct-map","clojure.core/subs","clojure.core/subseq","clojure.core/subvec","clojure.core/supers","clojure.core/swap!","clojure.core/swap-vals!","clojure.core/symbol","clojure.core/symbol?","clojure.core/tagged-literal","clojure.core/tagged-literal?","clojure.core/take","clojure.core/take-last","clojure.core/take-nth","clojure.core/take-while","clojure.core/tap>","clojure.core/test","clojure.core/the-ns","clojure.core/thread-bound?","clojure.core/to-array","clojure.core/to-array-2d","clojure.core/trampoline","clojure.core/transduce","clojure.core/transient","clojure.core/tree-seq","clojure.core/true?","clojure.core/type","clojure.core/unchecked-add","clojure.core/unchecked-add-int","clojure.core/unchecked-byte","clojure.core/unchecked-char","clojure.core/unchecked-dec","clojure.core/unchecked-dec-int","clojure.core/unchecked-divide-int","clojure.core/unchecked-double","clojure.core/unchecked-float","clojure.core/unchecked-inc","clojure.core/unchecked-inc-int","clojure.core/unchecked-int","clojure.core/unchecked-long","clojure.core/unchecked-multiply","clojure.core/unchecked-multiply-int","clojure.core/unchecked-negate","clojure.core/unchecked-negate-int","clojure.core/unchecked-remainder-int","clojure.core/unchecked-short","clojure.core/unchecked-subtract","clojure.core/unchecked-subtract-int","clojure.core/underive","clojure.core/unreduced","clojure.core/unsigned-bit-shift-right","clojure.core/update","clojure.core/update-in","clojure.core/update-proxy","clojure.core/uri?","clojure.core/use","clojure.core/uuid?","clojure.core/val","clojure.core/vals","clojure.core/var-get","clojure.core/var-set","clojure.core/var?","clojure.core/vary-meta","clojure.core/vec","clojure.core/vector","clojure.core/vector-of","clojure.core/vector?","clojure.core/volatile!","clojure.core/volatile?","clojure.core/vreset!","clojure.core/with-bindings*","clojure.core/with-meta","clojure.core/with-redefs-fn","clojure.core/xml-seq","clojure.core/zero?","clojure.core/zipmap","coll?","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","dedupe","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-cause","ex-data","ex-info","ex-message","extend","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn?","fnext","fnil","force","format","frequencies","future-call","future-cancel","future-cancelled?","future-done?","future?","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","ifn?","in-ns","inc","inc'","indexed?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","long","long-array","longs","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy-call-with-super","proxy-mappings","proxy-name","push-thread-bindings","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read+string","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-tap","remove-watch","repeat","repeatedly","replace","replicate","require","requiring-resolve","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seqable?","seque","sequence","sequential?","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","tap>","test","the-ns","thread-bound?","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","uri?","use","uuid?","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","with-bindings*","with-meta","with-redefs-fn","xml-seq","zero?","zipmap"]
- \ , 'clojureMacro': ["->","->>","..","amap","and","areduce","as->","assert","binding","bound-fn","clojure.core/->","clojure.core/->>","clojure.core/..","clojure.core/amap","clojure.core/and","clojure.core/areduce","clojure.core/as->","clojure.core/assert","clojure.core/binding","clojure.core/bound-fn","clojure.core/comment","clojure.core/declare","clojure.core/delay","clojure.core/dosync","clojure.core/doto","clojure.core/extend-protocol","clojure.core/extend-type","clojure.core/for","clojure.core/future","clojure.core/gen-class","clojure.core/gen-interface","clojure.core/import","clojure.core/io!","clojure.core/lazy-cat","clojure.core/lazy-seq","clojure.core/letfn","clojure.core/locking","clojure.core/memfn","clojure.core/ns","clojure.core/or","clojure.core/proxy","clojure.core/proxy-super","clojure.core/pvalues","clojure.core/refer-clojure","clojure.core/reify","clojure.core/some->","clojure.core/some->>","clojure.core/sync","clojure.core/time","clojure.core/vswap!","clojure.core/with-bindings","clojure.core/with-in-str","clojure.core/with-loading-context","clojure.core/with-local-vars","clojure.core/with-open","clojure.core/with-out-str","clojure.core/with-precision","clojure.core/with-redefs","comment","declare","delay","dosync","doto","extend-protocol","extend-type","for","future","gen-class","gen-interface","import","io!","lazy-cat","lazy-seq","letfn","locking","memfn","ns","or","proxy","proxy-super","pvalues","refer-clojure","reify","some->","some->>","sync","time","vswap!","with-bindings","with-in-str","with-loading-context","with-local-vars","with-open","with-out-str","with-precision","with-redefs"]
- \ , 'clojureRepeat': ["clojure.core/doseq","clojure.core/dotimes","clojure.core/while","doseq","dotimes","while"]
- \ , 'clojureSpecial': [".","clojure.core/fn","clojure.core/let","clojure.core/loop","def","do","fn","if","let","loop","monitor-enter","monitor-exit","new","quote","recur","set!","var"]
- \ , 'clojureVariable': ["*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","EMPTY-NODE","Inst","char-escape-string","char-name-string","clojure.core/*1","clojure.core/*2","clojure.core/*3","clojure.core/*agent*","clojure.core/*allow-unresolved-vars*","clojure.core/*assert*","clojure.core/*clojure-version*","clojure.core/*command-line-args*","clojure.core/*compile-files*","clojure.core/*compile-path*","clojure.core/*compiler-options*","clojure.core/*data-readers*","clojure.core/*default-data-reader-fn*","clojure.core/*e","clojure.core/*err*","clojure.core/*file*","clojure.core/*flush-on-newline*","clojure.core/*fn-loader*","clojure.core/*in*","clojure.core/*math-context*","clojure.core/*ns*","clojure.core/*out*","clojure.core/*print-dup*","clojure.core/*print-length*","clojure.core/*print-level*","clojure.core/*print-meta*","clojure.core/*print-namespace-maps*","clojure.core/*print-readably*","clojure.core/*read-eval*","clojure.core/*reader-resolver*","clojure.core/*source-path*","clojure.core/*suppress-read*","clojure.core/*unchecked-math*","clojure.core/*use-context-classloader*","clojure.core/*verbose-defrecords*","clojure.core/*warn-on-reflection*","clojure.core/EMPTY-NODE","clojure.core/Inst","clojure.core/char-escape-string","clojure.core/char-name-string","clojure.core/default-data-readers","clojure.core/primitives-classnames","clojure.core/unquote","clojure.core/unquote-splicing","default-data-readers","primitives-classnames","unquote","unquote-splicing"]
- \ }
+ \ 'clojureBoolean': ["false","true"],
+ \ 'clojureCond': ["case","case*","clojure.core/case","clojure.core/cond","clojure.core/cond->","clojure.core/cond->>","clojure.core/condp","clojure.core/if-let","clojure.core/if-not","clojure.core/if-some","clojure.core/when","clojure.core/when-first","clojure.core/when-let","clojure.core/when-not","clojure.core/when-some","cond","cond->","cond->>","condp","if","if-let","if-not","if-some","when","when-first","when-let","when-not","when-some"],
+ \ 'clojureConstant': ["nil"],
+ \ 'clojureDefine': ["clojure.core/definline","clojure.core/definterface","clojure.core/defmacro","clojure.core/defmethod","clojure.core/defmulti","clojure.core/defn","clojure.core/defn-","clojure.core/defonce","clojure.core/defprotocol","clojure.core/defrecord","clojure.core/defstruct","clojure.core/deftype","def","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","deftype*"],
+ \ 'clojureException': ["catch","finally","throw","try"],
+ \ 'clojureFunc': ["*","*'","+","+'","-","-'","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","/","<","<=","=","==",">",">=","NaN?","PrintWriter-on","StackTraceElement->vec","Throwable->map","abs","accessor","aclone","add-classpath","add-tap","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","ancestors","any?","apply","array-map","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","cast","cat","char","char-array","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","clojure.core/*","clojure.core/*'","clojure.core/+","clojure.core/+'","clojure.core/-","clojure.core/-'","clojure.core/->ArrayChunk","clojure.core/->Eduction","clojure.core/->Vec","clojure.core/->VecNode","clojure.core/->VecSeq","clojure.core/-cache-protocol-fn","clojure.core/-reset-methods","clojure.core//","clojure.core/<","clojure.core/<=","clojure.core/=","clojure.core/==","clojure.core/>","clojure.core/>=","clojure.core/NaN?","clojure.core/PrintWriter-on","clojure.core/StackTraceElement->vec","clojure.core/Throwable->map","clojure.core/abs","clojure.core/accessor","clojure.core/aclone","clojure.core/add-classpath","clojure.core/add-tap","clojure.core/add-watch","clojure.core/agent","clojure.core/agent-error","clojure.core/agent-errors","clojure.core/aget","clojure.core/alength","clojure.core/alias","clojure.core/all-ns","clojure.core/alter","clojure.core/alter-meta!","clojure.core/alter-var-root","clojure.core/ancestors","clojure.core/any?","clojure.core/apply","clojure.core/array-map","clojure.core/aset","clojure.core/aset-boolean","clojure.core/aset-byte","clojure.core/aset-char","clojure.core/aset-double","clojure.core/aset-float","clojure.core/aset-int","clojure.core/aset-long","clojure.core/aset-short","clojure.core/assoc","clojure.core/assoc!","clojure.core/assoc-in","clojure.core/associative?","clojure.core/atom","clojure.core/await","clojure.core/await-for","clojure.core/await1","clojure.core/bases","clojure.core/bean","clojure.core/bigdec","clojure.core/bigint","clojure.core/biginteger","clojure.core/bit-and","clojure.core/bit-and-not","clojure.core/bit-clear","clojure.core/bit-flip","clojure.core/bit-not","clojure.core/bit-or","clojure.core/bit-set","clojure.core/bit-shift-left","clojure.core/bit-shift-right","clojure.core/bit-test","clojure.core/bit-xor","clojure.core/boolean","clojure.core/boolean-array","clojure.core/boolean?","clojure.core/booleans","clojure.core/bound-fn*","clojure.core/bound?","clojure.core/bounded-count","clojure.core/butlast","clojure.core/byte","clojure.core/byte-array","clojure.core/bytes","clojure.core/bytes?","clojure.core/cast","clojure.core/cat","clojure.core/char","clojure.core/char-array","clojure.core/char?","clojure.core/chars","clojure.core/chunk","clojure.core/chunk-append","clojure.core/chunk-buffer","clojure.core/chunk-cons","clojure.core/chunk-first","clojure.core/chunk-next","clojure.core/chunk-rest","clojure.core/chunked-seq?","clojure.core/class","clojure.core/class?","clojure.core/clear-agent-errors","clojure.core/clojure-version","clojure.core/coll?","clojure.core/commute","clojure.core/comp","clojure.core/comparator","clojure.core/compare","clojure.core/compare-and-set!","clojure.core/compile","clojure.core/complement","clojure.core/completing","clojure.core/concat","clojure.core/conj","clojure.core/conj!","clojure.core/cons","clojure.core/constantly","clojure.core/construct-proxy","clojure.core/contains?","clojure.core/count","clojure.core/counted?","clojure.core/create-ns","clojure.core/create-struct","clojure.core/cycle","clojure.core/dec","clojure.core/dec'","clojure.core/decimal?","clojure.core/dedupe","clojure.core/delay?","clojure.core/deliver","clojure.core/denominator","clojure.core/deref","clojure.core/derive","clojure.core/descendants","clojure.core/destructure","clojure.core/disj","clojure.core/disj!","clojure.core/dissoc","clojure.core/dissoc!","clojure.core/distinct","clojure.core/distinct?","clojure.core/doall","clojure.core/dorun","clojure.core/double","clojure.core/double-array","clojure.core/double?","clojure.core/doubles","clojure.core/drop","clojure.core/drop-last","clojure.core/drop-while","clojure.core/eduction","clojure.core/empty","clojure.core/empty?","clojure.core/ensure","clojure.core/ensure-reduced","clojure.core/enumeration-seq","clojure.core/error-handler","clojure.core/error-mode","clojure.core/eval","clojure.core/even?","clojure.core/every-pred","clojure.core/every?","clojure.core/ex-cause","clojure.core/ex-data","clojure.core/ex-info","clojure.core/ex-message","clojure.core/extend","clojure.core/extenders","clojure.core/extends?","clojure.core/false?","clojure.core/ffirst","clojure.core/file-seq","clojure.core/filter","clojure.core/filterv","clojure.core/find","clojure.core/find-keyword","clojure.core/find-ns","clojure.core/find-protocol-impl","clojure.core/find-protocol-method","clojure.core/find-var","clojure.core/first","clojure.core/flatten","clojure.core/float","clojure.core/float-array","clojure.core/float?","clojure.core/floats","clojure.core/flush","clojure.core/fn?","clojure.core/fnext","clojure.core/fnil","clojure.core/force","clojure.core/format","clojure.core/frequencies","clojure.core/future-call","clojure.core/future-cancel","clojure.core/future-cancelled?","clojure.core/future-done?","clojure.core/future?","clojure.core/gensym","clojure.core/get","clojure.core/get-in","clojure.core/get-method","clojure.core/get-proxy-class","clojure.core/get-thread-bindings","clojure.core/get-validator","clojure.core/group-by","clojure.core/halt-when","clojure.core/hash","clojure.core/hash-combine","clojure.core/hash-map","clojure.core/hash-ordered-coll","clojure.core/hash-set","clojure.core/hash-unordered-coll","clojure.core/ident?","clojure.core/identical?","clojure.core/identity","clojure.core/ifn?","clojure.core/in-ns","clojure.core/inc","clojure.core/inc'","clojure.core/indexed?","clojure.core/infinite?","clojure.core/init-proxy","clojure.core/inst-ms","clojure.core/inst-ms*","clojure.core/inst?","clojure.core/instance?","clojure.core/int","clojure.core/int-array","clojure.core/int?","clojure.core/integer?","clojure.core/interleave","clojure.core/intern","clojure.core/interpose","clojure.core/into","clojure.core/into-array","clojure.core/ints","clojure.core/isa?","clojure.core/iterate","clojure.core/iteration","clojure.core/iterator-seq","clojure.core/juxt","clojure.core/keep","clojure.core/keep-indexed","clojure.core/key","clojure.core/keys","clojure.core/keyword","clojure.core/keyword?","clojure.core/last","clojure.core/line-seq","clojure.core/list","clojure.core/list*","clojure.core/list?","clojure.core/load","clojure.core/load-file","clojure.core/load-reader","clojure.core/load-string","clojure.core/loaded-libs","clojure.core/long","clojure.core/long-array","clojure.core/longs","clojure.core/macroexpand","clojure.core/macroexpand-1","clojure.core/make-array","clojure.core/make-hierarchy","clojure.core/map","clojure.core/map-entry?","clojure.core/map-indexed","clojure.core/map?","clojure.core/mapcat","clojure.core/mapv","clojure.core/max","clojure.core/max-key","clojure.core/memoize","clojure.core/merge","clojure.core/merge-with","clojure.core/meta","clojure.core/method-sig","clojure.core/methods","clojure.core/min","clojure.core/min-key","clojure.core/mix-collection-hash","clojure.core/mod","clojure.core/munge","clojure.core/name","clojure.core/namespace","clojure.core/namespace-munge","clojure.core/nat-int?","clojure.core/neg-int?","clojure.core/neg?","clojure.core/newline","clojure.core/next","clojure.core/nfirst","clojure.core/nil?","clojure.core/nnext","clojure.core/not","clojure.core/not-any?","clojure.core/not-empty","clojure.core/not-every?","clojure.core/not=","clojure.core/ns-aliases","clojure.core/ns-imports","clojure.core/ns-interns","clojure.core/ns-map","clojure.core/ns-name","clojure.core/ns-publics","clojure.core/ns-refers","clojure.core/ns-resolve","clojure.core/ns-unalias","clojure.core/ns-unmap","clojure.core/nth","clojure.core/nthnext","clojure.core/nthrest","clojure.core/num","clojure.core/number?","clojure.core/numerator","clojure.core/object-array","clojure.core/odd?","clojure.core/parents","clojure.core/parse-boolean","clojure.core/parse-double","clojure.core/parse-long","clojure.core/parse-uuid","clojure.core/partial","clojure.core/partition","clojure.core/partition-all","clojure.core/partition-by","clojure.core/pcalls","clojure.core/peek","clojure.core/persistent!","clojure.core/pmap","clojure.core/pop","clojure.core/pop!","clojure.core/pop-thread-bindings","clojure.core/pos-int?","clojure.core/pos?","clojure.core/pr","clojure.core/pr-str","clojure.core/prefer-method","clojure.core/prefers","clojure.core/print","clojure.core/print-ctor","clojure.core/print-dup","clojure.core/print-method","clojure.core/print-simple","clojure.core/print-str","clojure.core/printf","clojure.core/println","clojure.core/println-str","clojure.core/prn","clojure.core/prn-str","clojure.core/promise","clojure.core/proxy-call-with-super","clojure.core/proxy-mappings","clojure.core/proxy-name","clojure.core/push-thread-bindings","clojure.core/qualified-ident?","clojure.core/qualified-keyword?","clojure.core/qualified-symbol?","clojure.core/quot","clojure.core/rand","clojure.core/rand-int","clojure.core/rand-nth","clojure.core/random-sample","clojure.core/random-uuid","clojure.core/range","clojure.core/ratio?","clojure.core/rational?","clojure.core/rationalize","clojure.core/re-find","clojure.core/re-groups","clojure.core/re-matcher","clojure.core/re-matches","clojure.core/re-pattern","clojure.core/re-seq","clojure.core/read","clojure.core/read+string","clojure.core/read-line","clojure.core/read-string","clojure.core/reader-conditional","clojure.core/reader-conditional?","clojure.core/realized?","clojure.core/record?","clojure.core/reduce","clojure.core/reduce-kv","clojure.core/reduced","clojure.core/reduced?","clojure.core/reductions","clojure.core/ref","clojure.core/ref-history-count","clojure.core/ref-max-history","clojure.core/ref-min-history","clojure.core/ref-set","clojure.core/refer","clojure.core/release-pending-sends","clojure.core/rem","clojure.core/remove","clojure.core/remove-all-methods","clojure.core/remove-method","clojure.core/remove-ns","clojure.core/remove-tap","clojure.core/remove-watch","clojure.core/repeat","clojure.core/repeatedly","clojure.core/replace","clojure.core/replicate","clojure.core/require","clojure.core/requiring-resolve","clojure.core/reset!","clojure.core/reset-meta!","clojure.core/reset-vals!","clojure.core/resolve","clojure.core/rest","clojure.core/restart-agent","clojure.core/resultset-seq","clojure.core/reverse","clojure.core/reversible?","clojure.core/rseq","clojure.core/rsubseq","clojure.core/run!","clojure.core/satisfies?","clojure.core/second","clojure.core/select-keys","clojure.core/send","clojure.core/send-off","clojure.core/send-via","clojure.core/seq","clojure.core/seq-to-map-for-destructuring","clojure.core/seq?","clojure.core/seqable?","clojure.core/seque","clojure.core/sequence","clojure.core/sequential?","clojure.core/set","clojure.core/set-agent-send-executor!","clojure.core/set-agent-send-off-executor!","clojure.core/set-error-handler!","clojure.core/set-error-mode!","clojure.core/set-validator!","clojure.core/set?","clojure.core/short","clojure.core/short-array","clojure.core/shorts","clojure.core/shuffle","clojure.core/shutdown-agents","clojure.core/simple-ident?","clojure.core/simple-keyword?","clojure.core/simple-symbol?","clojure.core/slurp","clojure.core/some","clojure.core/some-fn","clojure.core/some?","clojure.core/sort","clojure.core/sort-by","clojure.core/sorted-map","clojure.core/sorted-map-by","clojure.core/sorted-set","clojure.core/sorted-set-by","clojure.core/sorted?","clojure.core/special-symbol?","clojure.core/spit","clojure.core/split-at","clojure.core/split-with","clojure.core/str","clojure.core/string?","clojure.core/struct","clojure.core/struct-map","clojure.core/subs","clojure.core/subseq","clojure.core/subvec","clojure.core/supers","clojure.core/swap!","clojure.core/swap-vals!","clojure.core/symbol","clojure.core/symbol?","clojure.core/tagged-literal","clojure.core/tagged-literal?","clojure.core/take","clojure.core/take-last","clojure.core/take-nth","clojure.core/take-while","clojure.core/tap>","clojure.core/test","clojure.core/the-ns","clojure.core/thread-bound?","clojure.core/to-array","clojure.core/to-array-2d","clojure.core/trampoline","clojure.core/transduce","clojure.core/transient","clojure.core/tree-seq","clojure.core/true?","clojure.core/type","clojure.core/unchecked-add","clojure.core/unchecked-add-int","clojure.core/unchecked-byte","clojure.core/unchecked-char","clojure.core/unchecked-dec","clojure.core/unchecked-dec-int","clojure.core/unchecked-divide-int","clojure.core/unchecked-double","clojure.core/unchecked-float","clojure.core/unchecked-inc","clojure.core/unchecked-inc-int","clojure.core/unchecked-int","clojure.core/unchecked-long","clojure.core/unchecked-multiply","clojure.core/unchecked-multiply-int","clojure.core/unchecked-negate","clojure.core/unchecked-negate-int","clojure.core/unchecked-remainder-int","clojure.core/unchecked-short","clojure.core/unchecked-subtract","clojure.core/unchecked-subtract-int","clojure.core/underive","clojure.core/unreduced","clojure.core/unsigned-bit-shift-right","clojure.core/update","clojure.core/update-in","clojure.core/update-keys","clojure.core/update-proxy","clojure.core/update-vals","clojure.core/uri?","clojure.core/use","clojure.core/uuid?","clojure.core/val","clojure.core/vals","clojure.core/var-get","clojure.core/var-set","clojure.core/var?","clojure.core/vary-meta","clojure.core/vec","clojure.core/vector","clojure.core/vector-of","clojure.core/vector?","clojure.core/volatile!","clojure.core/volatile?","clojure.core/vreset!","clojure.core/with-bindings*","clojure.core/with-meta","clojure.core/with-redefs-fn","clojure.core/xml-seq","clojure.core/zero?","clojure.core/zipmap","coll?","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","dedupe","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-cause","ex-data","ex-info","ex-message","extend","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn?","fnext","fnil","force","format","frequencies","future-call","future-cancel","future-cancelled?","future-done?","future?","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","ifn?","in-ns","inc","inc'","indexed?","infinite?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","isa?","iterate","iteration","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","long","long-array","longs","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","parents","parse-boolean","parse-double","parse-long","parse-uuid","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy-call-with-super","proxy-mappings","proxy-name","push-thread-bindings","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","rand","rand-int","rand-nth","random-sample","random-uuid","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read+string","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-tap","remove-watch","repeat","repeatedly","replace","replicate","require","requiring-resolve","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq-to-map-for-destructuring","seq?","seqable?","seque","sequence","sequential?","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","tap>","test","the-ns","thread-bound?","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unreduced","unsigned-bit-shift-right","update","update-in","update-keys","update-proxy","update-vals","uri?","use","uuid?","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","with-bindings*","with-meta","with-redefs-fn","xml-seq","zero?","zipmap"],
+ \ 'clojureMacro': ["->","->>","..","amap","and","areduce","as->","assert","binding","bound-fn","clojure.core/->","clojure.core/->>","clojure.core/..","clojure.core/amap","clojure.core/and","clojure.core/areduce","clojure.core/as->","clojure.core/assert","clojure.core/binding","clojure.core/bound-fn","clojure.core/comment","clojure.core/declare","clojure.core/delay","clojure.core/dosync","clojure.core/doto","clojure.core/extend-protocol","clojure.core/extend-type","clojure.core/for","clojure.core/future","clojure.core/gen-class","clojure.core/gen-interface","clojure.core/import","clojure.core/io!","clojure.core/lazy-cat","clojure.core/lazy-seq","clojure.core/locking","clojure.core/memfn","clojure.core/ns","clojure.core/or","clojure.core/proxy","clojure.core/proxy-super","clojure.core/pvalues","clojure.core/refer-clojure","clojure.core/reify","clojure.core/some->","clojure.core/some->>","clojure.core/sync","clojure.core/time","clojure.core/vswap!","clojure.core/with-bindings","clojure.core/with-in-str","clojure.core/with-loading-context","clojure.core/with-local-vars","clojure.core/with-open","clojure.core/with-out-str","clojure.core/with-precision","clojure.core/with-redefs","comment","declare","delay","dosync","doto","extend-protocol","extend-type","for","future","gen-class","gen-interface","import","io!","lazy-cat","lazy-seq","locking","memfn","ns","or","proxy","proxy-super","pvalues","refer-clojure","reify","some->","some->>","sync","time","vswap!","with-bindings","with-in-str","with-loading-context","with-local-vars","with-open","with-out-str","with-precision","with-redefs"],
+ \ 'clojureRepeat': ["clojure.core/doseq","clojure.core/dotimes","clojure.core/loop","clojure.core/while","doseq","dotimes","loop","loop*","recur","while"],
+ \ 'clojureSpecial': ["&",".","clojure.core/fn","clojure.core/import*","clojure.core/let","clojure.core/letfn","do","fn","fn*","let","let*","letfn","letfn*","monitor-enter","monitor-exit","new","quote","reify*","set!","var"],
+ \ 'clojureVariable': ["*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","EMPTY-NODE","Inst","char-escape-string","char-name-string","clojure.core/*1","clojure.core/*2","clojure.core/*3","clojure.core/*agent*","clojure.core/*allow-unresolved-vars*","clojure.core/*assert*","clojure.core/*clojure-version*","clojure.core/*command-line-args*","clojure.core/*compile-files*","clojure.core/*compile-path*","clojure.core/*compiler-options*","clojure.core/*data-readers*","clojure.core/*default-data-reader-fn*","clojure.core/*e","clojure.core/*err*","clojure.core/*file*","clojure.core/*flush-on-newline*","clojure.core/*fn-loader*","clojure.core/*in*","clojure.core/*math-context*","clojure.core/*ns*","clojure.core/*out*","clojure.core/*print-dup*","clojure.core/*print-length*","clojure.core/*print-level*","clojure.core/*print-meta*","clojure.core/*print-namespace-maps*","clojure.core/*print-readably*","clojure.core/*read-eval*","clojure.core/*reader-resolver*","clojure.core/*source-path*","clojure.core/*suppress-read*","clojure.core/*unchecked-math*","clojure.core/*use-context-classloader*","clojure.core/*verbose-defrecords*","clojure.core/*warn-on-reflection*","clojure.core/EMPTY-NODE","clojure.core/Inst","clojure.core/char-escape-string","clojure.core/char-name-string","clojure.core/default-data-readers","clojure.core/primitives-classnames","clojure.core/print-dup","clojure.core/print-method","clojure.core/unquote","clojure.core/unquote-splicing","default-data-readers","primitives-classnames","print-dup","print-method","unquote","unquote-splicing"]
+ \ }
function! s:syntax_keyword(dict)
for key in keys(a:dict)
@@ -81,8 +81,6 @@ syntax match clojureSymbol "\v%([a-zA-Z!$&*_+=|<.>?-]|[^\x00-\x7F])+%(:?%([a-zA-
" NB. Correct matching of radix literals was removed for better performance.
syntax match clojureNumber "\v<[-+]?%(%([2-9]|[12]\d|3[0-6])[rR][[:alnum:]]+|%(0\o*|0x\x+|[1-9]\d*)N?|%(0|[1-9]\d*|%(0|[1-9]\d*)\.\d*)%(M|[eE][-+]?\d+)?|%(0|[1-9]\d*)/%(0|[1-9]\d*))>"
-syntax match clojureVarArg "&"
-
syntax match clojureQuote "\v['`]"
syntax match clojureUnquote "\v\~\@?"
syntax match clojureMeta "\^"
@@ -97,8 +95,8 @@ syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me
syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained
" -*- CHARACTER PROPERTY CLASSES -*-
-" Generated from https://github.com/clojure-vim/clojure.vim/blob/62b215f079ce0f3834fd295c7a7f6bd8cc54bcc3/clj/src/vim_clojure_static/generate.clj
-" Java version 17
+" Generated from https://github.com/clojure-vim/clojure.vim/blob/fd280e33e84c88e97860930557dba3ff80b1a82d/clj/src/vim_clojure_static/generate.clj
+" Java version 17.0.2
syntax match clojureRegexpPosixCharClass "\v\\[pP]\{%(Cntrl|A%(l%(pha|num)|SCII)|Space|Graph|Upper|P%(rint|unct)|Blank|XDigit|Digit|Lower)\}" contained display
syntax match clojureRegexpJavaCharClass "\v\\[pP]\{java%(Whitespace|JavaIdentifier%(Part|Start)|SpaceChar|Mirrored|TitleCase|I%(SOControl|de%(ographic|ntifierIgnorable))|D%(efined|igit)|U%(pperCase|nicodeIdentifier%(Part|Start))|L%(etter%(OrDigit)?|owerCase)|Alphabetic)\}" contained display
syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(l%(owercase|etter)|hex%(digit|_digit)|w%(hite%(_space|space)|ord)|noncharacter%(_code_point|codepoint)|p%(rint|unctuation)|ideographic|graph|a%(l%(num|phabetic)|ssigned)|uppercase|join%(control|_control)|titlecase|blank|digit|control)\}" contained display
@@ -127,7 +125,7 @@ syntax match clojureRegexpMod "\v\(@<=\?%(\<?[=!]|\>)" contained display
syntax match clojureRegexpMod "\v\(@<=\?\<[[:alpha:]]+\>" contained display
syntax region clojureRegexpGroup start="(" skip=/\\\\\|\\)/ end=")" matchgroup=clojureRegexpGroup contained contains=clojureRegexpMod,clojureRegexpQuantifier,clojureRegexpBoundary,clojureRegexpEscape,@clojureRegexpCharClasses
-syntax region clojureRegexp start=/\#"/ skip=/\\\\\|\\"/ end=/"/ contains=@clojureRegexpCharClasses,clojureRegexpEscape,clojureRegexpQuote,clojureRegexpBoundary,clojureRegexpQuantifier,clojureRegexpOr,clojureRegexpBackRef,clojureRegexpGroup keepend
+syntax region clojureRegexp matchgroup=clojureRegexpDelimiter start=/\#"/ skip=/\\\\\|\\"/ end=/"/ contains=@clojureRegexpCharClasses,clojureRegexpEscape,clojureRegexpQuote,clojureRegexpBoundary,clojureRegexpQuantifier,clojureRegexpOr,clojureRegexpBackRef,clojureRegexpGroup keepend
syntax keyword clojureCommentTodo contained FIXME XXX TODO BUG NOTE HACK FIXME: XXX: TODO: BUG: NOTE: HACK:
@@ -149,8 +147,8 @@ if exists('g:clojure_discard_macro') && g:clojure_discard_macro
endif
" -*- TOP CLUSTER -*-
-" Generated from https://github.com/clojure-vim/clojure.vim/blob/62b215f079ce0f3834fd295c7a7f6bd8cc54bcc3/clj/src/vim_clojure_static/generate.clj
-syntax cluster clojureTop contains=@Spell,clojureAnonArg,clojureBoolean,clojureCharacter,clojureComment,clojureCond,clojureConstant,clojureDefine,clojureDeref,clojureDiscard,clojureDispatch,clojureError,clojureException,clojureFunc,clojureKeyword,clojureMacro,clojureMap,clojureMeta,clojureNumber,clojureQuote,clojureRegexp,clojureRepeat,clojureSexp,clojureSpecial,clojureString,clojureSymbol,clojureUnquote,clojureVarArg,clojureVariable,clojureVector
+" Generated from https://github.com/clojure-vim/clojure.vim/blob/fd280e33e84c88e97860930557dba3ff80b1a82d/clj/src/vim_clojure_static/generate.clj
+syntax cluster clojureTop contains=@Spell,clojureAnonArg,clojureBoolean,clojureCharacter,clojureComment,clojureCond,clojureConstant,clojureDefine,clojureDeref,clojureDiscard,clojureDispatch,clojureError,clojureException,clojureFunc,clojureKeyword,clojureMacro,clojureMap,clojureMeta,clojureNumber,clojureQuote,clojureRegexp,clojureRepeat,clojureSexp,clojureSpecial,clojureString,clojureSymbol,clojureUnquote,clojureVariable,clojureVector
syntax region clojureSexp matchgroup=clojureParen start="(" end=")" contains=@clojureTop fold
syntax region clojureVector matchgroup=clojureParen start="\[" end="]" contains=@clojureTop fold
@@ -171,6 +169,7 @@ highlight default link clojureStringDelimiter String
highlight default link clojureStringEscape Character
highlight default link clojureRegexp Constant
+highlight default link clojureRegexpDelimiter Constant
highlight default link clojureRegexpEscape Character
highlight default link clojureRegexpCharClass SpecialChar
highlight default link clojureRegexpPosixCharClass clojureRegexpCharClass
@@ -195,7 +194,6 @@ highlight default link clojureMacro Macro
highlight default link clojureRepeat Repeat
highlight default link clojureSpecial Special
-highlight default link clojureVarArg Special
highlight default link clojureQuote SpecialChar
highlight default link clojureUnquote SpecialChar
highlight default link clojureMeta SpecialChar
diff --git a/runtime/syntax/coco.vim b/runtime/syntax/coco.vim
index ae32348bcb..dc21314e35 100644
--- a/runtime/syntax/coco.vim
+++ b/runtime/syntax/coco.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Coco/R
" Maintainer: Ashish Shukla <wahjava@gmail.com>
-" Last Change: 2007 Aug 10
+" Last Change: 2022 Jun 14
" Remark: Coco/R syntax partially implemented.
" License: Vim license
@@ -30,3 +30,4 @@ hi def link cocoOperator Operator
hi def link cocoProductionCode Statement
hi def link cocoPragma Special
+let b:current_syntax = 'coco'
diff --git a/runtime/syntax/confini.vim b/runtime/syntax/confini.vim
new file mode 100644
index 0000000000..823d417a81
--- /dev/null
+++ b/runtime/syntax/confini.vim
@@ -0,0 +1,12 @@
+" Vim syntax file
+" Language: confini
+
+" Quit if a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+" Use the cfg syntax for now, it's similar.
+runtime! syntax/cfg.vim
+
+let b:current_syntax = 'confini'
diff --git a/runtime/syntax/cs.vim b/runtime/syntax/cs.vim
index b4cb6489e6..722ddbedf6 100644
--- a/runtime/syntax/cs.vim
+++ b/runtime/syntax/cs.vim
@@ -3,13 +3,16 @@
" Maintainer: Nick Jensen <nickspoon@gmail.com>
" Former Maintainers: Anduin Withers <awithers@anduin.com>
" Johannes Zellner <johannes@zellner.org>
-" Last Change: 2020-11-23
+" Last Change: 2022-03-01
" Filenames: *.cs
" License: Vim (see :h license)
" Repository: https://github.com/nickspoons/vim-cs
"
-" REFERENCES:
-" [1] ECMA TC39: C# Language Specification (WD13Oct01.doc)
+" References:
+" - ECMA-334 5th Edition: C# Language Specification
+" https://www.ecma-international.org/publications-and-standards/standards/ecma-334/
+" - C# Language Design: Draft 6th Edition and later proposals
+" https://github.com/dotnet/csharplang
if exists('b:current_syntax')
finish
@@ -19,37 +22,72 @@ let s:save_cpo = &cpoptions
set cpoptions&vim
syn keyword csType bool byte char decimal double float int long object sbyte short string T uint ulong ushort var void dynamic
-syn keyword csStorage delegate enum interface namespace struct
+syn keyword csType nint nuint " contextual
+
+syn keyword csStorage enum interface namespace struct
+syn match csStorage "\<delegate\>"
syn keyword csRepeat break continue do for foreach goto return while
syn keyword csConditional else if switch
syn keyword csLabel case default
-syn match csOperatorError display +::+
-syn match csGlobal display +global::+
-" user labels (see [1] 8.6 Statements)
+
+syn match csNamespaceAlias "@\=\h\w*\ze\_s*::" display
+syn match csGlobalNamespaceAlias "global\ze\_s*::" display
+syn cluster csNamespaceAlias contains=csGlobalNamespaceAlias,csNamespaceAlias,csNamespaceAliasQualifier
+
+" user labels
syn match csLabel display +^\s*\I\i*\s*:\%([^:]\)\@=+
-syn keyword csModifier abstract const extern internal override private protected public readonly sealed static virtual volatile
-syn keyword csConstant false null true
+
+" Function pointers
+syn match csType "\<delegate\s*\*" contains=csOpSymbols nextgroup=csManagedModifier skipwhite skipempty
+syn keyword csManagedModifier managed unmanaged contained
+
+" Modifiers
+syn match csUsingModifier "\<global\ze\_s\+using\>"
+syn keyword csAccessModifier internal private protected public
+" TODO: in new out
+syn keyword csModifier abstract const event override readonly sealed static virtual volatile
+syn match csModifier "\<\%(extern\|fixed\|unsafe\)\>"
+syn match csModifier "\<partial\ze\_s\+\%(class\|struct\|interface\|record\|void\)\>"
+
syn keyword csException try catch finally throw when
-syn keyword csLinq ascending by descending equals from group in into join let on orderby select where
-syn keyword csAsync async await
+syn keyword csLinq ascending by descending equals from group in into join let on orderby select
+syn match csLinq "\<where\>"
-syn keyword csUnspecifiedStatement as base checked event fixed in is lock nameof operator out params ref sizeof stackalloc this unchecked unsafe using
-syn keyword csUnsupportedStatement add remove value
-syn keyword csUnspecifiedKeyword explicit implicit
+" Type parameter constraint clause
+syn match csStorage "\<where\>\ze\_s\+@\=\h\w*\_s*:"
-" Contextual Keywords
-syn match csContextualStatement /\<yield[[:space:]\n]\+\%(return\|break\)/me=s+5
-syn match csContextualStatement /\<partial[[:space:]\n]\+\%(class\|struct\|interface\)/me=s+7
-syn match csContextualStatement /\<\%(get\|set\)\%(;\|[[:space:]\n]*{\)/me=s+3
-syn match csContextualStatement /\<\%(get\|set\)\s*=>/me=s+3
-syn match csContextualStatement /\<where\>[^:]\+:/me=s+5
+" Async
+syn keyword csAsyncModifier async
+syn keyword csAsyncOperator await
+
+syn match csStorage "\<extern\ze\s\+alias\>"
+syn match csStorage "\%(\<extern\s\+\)\@16<=alias\>"
+
+syn match csStatement "\<\%(checked\|unchecked\|unsafe\)\ze\_s*{"
+syn match csStatement "\<fixed\ze\_s*("
+syn keyword csStatement lock
+syn match csStatement "\<yield\ze\_s\+\%(return\|break\)\>"
+
+syn match csAccessor "\<\%(get\|set\|init\|add\|remove\)\ze\_s*\%([;{]\|=>\)"
+
+syn keyword csAccess base
+syn match csAccess "\<this\>"
+
+" Extension method parameter modifier
+syn match csModifier "\<this\ze\_s\+@\=\h"
+
+syn keyword csUnspecifiedStatement as in is nameof operator out params ref sizeof stackalloc using
+syn keyword csUnsupportedStatement value
+syn keyword csUnspecifiedKeyword explicit implicit
" Operators
-syn keyword csTypeOf typeof contained
-syn region csTypeOfStatement start="typeof(" end=")" contains=csType, csTypeOf
+syn keyword csTypeOf typeof nextgroup=csTypeOfOperand,csTypeOfError skipwhite skipempty
+syn region csTypeOfOperand matchgroup=csParens start="(" end=")" contained contains=csType
+syn match csTypeOfError "[^([:space:]]" contained
+syn match csKeywordOperator "\<\%(checked\|unchecked\)\ze\_s*("
" Punctuation
-syn match csBraces "[{}\[\]]" display
+syn match csBraces "[{}[\]]" display
syn match csParens "[()]" display
syn match csOpSymbols "+\{1,2}" display
syn match csOpSymbols "-\{1,2}" display
@@ -64,128 +102,173 @@ syn match csLogicSymbols "&&" display
syn match csLogicSymbols "||" display
syn match csLogicSymbols "?" display
syn match csLogicSymbols ":" display
+syn match csNamespaceAliasQualifier "::" display
" Generics
-syn region csGeneric matchgroup=csGenericBraces start="<" end=">" oneline contains=csType,csGeneric,csUserType,csUserIdentifier,csUserInterface,csUserMethod
+syn region csGeneric matchgroup=csGenericBraces start="<" end=">" oneline contains=csType,csGeneric,@csNamespaceAlias,csUserType,csUserIdentifier,csUserInterface,csUserMethod
" Comments
"
" PROVIDES: @csCommentHook
syn keyword csTodo contained TODO FIXME XXX NOTE HACK TBD
-syn region csComment start="/\*" end="\*/" contains=@csCommentHook,csTodo,@Spell
-syn match csComment "//.*$" contains=@csCommentHook,csTodo,@Spell
-
-" xml markup inside '///' comments
-syn cluster xmlRegionHook add=csXmlCommentLeader
-syn cluster xmlCdataHook add=csXmlCommentLeader
-syn cluster xmlStartTagHook add=csXmlCommentLeader
-syn keyword csXmlTag contained Libraries Packages Types Excluded ExcludedTypeName ExcludedLibraryName
-syn keyword csXmlTag contained ExcludedBucketName TypeExcluded Type TypeKind TypeSignature AssemblyInfo
-syn keyword csXmlTag contained AssemblyName AssemblyPublicKey AssemblyVersion AssemblyCulture Base
-syn keyword csXmlTag contained BaseTypeName Interfaces Interface InterfaceName Attributes Attribute
-syn keyword csXmlTag contained AttributeName Members Member MemberSignature MemberType MemberValue
-syn keyword csXmlTag contained ReturnValue ReturnType Parameters Parameter MemberOfPackage
-syn keyword csXmlTag contained ThreadingSafetyStatement Docs devdoc example overload remarks returns summary
-syn keyword csXmlTag contained threadsafe value internalonly nodoc exception param permission platnote
-syn keyword csXmlTag contained seealso b c i pre sub sup block code note paramref see subscript superscript
-syn keyword csXmlTag contained list listheader item term description altcompliant altmember
-
-syn cluster xmlTagHook add=csXmlTag
-
-syn match csXmlCommentLeader "///" contained
-syn match csXmlComment "///.*$" contains=csXmlCommentLeader,@csXml,@Spell keepend
+syn region csBlockComment start="/\*" end="\*/" contains=@csCommentHook,csTodo,@Spell
+syn match csLineComment "//.*$" contains=@csCommentHook,csTodo,@Spell
+syn cluster csComment contains=csLineComment,csBlockComment
+
+syn region csSummary start="^\s*/// <summary" end="^\%\(\s*///\)\@!" transparent fold keepend
+
+" xml markup inside '///' and /**...*/ comments
+syn cluster xmlRegionHook add=csXmlLineCommentLeader,csXmlBlockCommentMiddle
+syn cluster xmlCdataHook add=csXmlLineCommentLeader,csXmlBlockCommentMiddle
+syn cluster xmlStartTagHook add=csXmlLineCommentLeader,csXmlBlockCommentMiddle
+syn cluster xmlTagHook add=csXmlTag
+syn cluster xmlAttribHook add=csXmlAttrib
+
+" https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags
+syn keyword csXmlTag contained summary remarks
+syn keyword csXmlTag contained returns param paramref exception value
+syn keyword csXmlTag contained para list c code example
+syn keyword csXmlTag contained inheritdoc include
+syn keyword csXmlTag contained see seealso
+syn keyword csXmlTag contained typeparam typeparamref
+syn keyword csXmlTag contained b i u br a
+syn keyword csXmlAttrib contained cref href
+
+syn match csXmlLineCommentLeader "///" contained
+syn match csXmlLineComment "///.*$" contains=csXmlLineCommentLeader,@csXml,@Spell keepend
+syn match csXmlBlockCommentMiddle "^\s*\zs\*" contained
+syn region csXmlBlockComment start="/\*\*" end="\*/" contains=@csXml,@Spell,csXmlBlockCommentMiddle keepend
syn include @csXml syntax/xml.vim
hi def link xmlRegion Comment
" Since syntax/xml.vim contains `syn spell toplevel`, we need to set it back to `default` here.
syn spell default
-" [1] 9.5 Pre-processing directives
-syn region csPreCondit start="^\s*#\s*\%(define\|undef\|if\|elif\|else\|endif\|line\|error\|warning\|pragma\)\>" skip="\\$" end="$" contains=csComment keepend
-syn region csRegion matchgroup=csPreCondit start="^\s*#\s*region.*$" end="^\s*#\s*endregion" transparent fold contains=TOP
-syn region csSummary start="^\s*/// <summary" end="^\%\(\s*///\)\@!" transparent fold keepend
+" Pre-processing directives
+syn region csPreProcDeclaration start="^\s*\zs#\s*\%(define\|undef\)\>" end="$" contains=csLineComment keepend
+syn region csPreProcConditional start="^\s*\zs#\s*\%(if\|elif\)\>" end="$" contains=csLineComment keepend
+syn region csPreProcConditional start="^\s*\zs#\s*\%(else\|endif\)\>" end="$" contains=csLineComment keepend
+syn region csPreProcLine start="^\s*\zs#\s*line\>" end="$" contains=csLineComment keepend
+syn region csPreProcDiagnostic start="^\s*\zs#\s*\%(error\|warning\)\>" end="$"
+syn region csPreProcConditionalSection matchgroup=csPreProcRegion start="^\s*#\s*region\>.*" end="^\s*#\s*endregion\>.*" transparent fold contains=TOP
+syn region csPreProcPragma start="^\s*\zs#\s*pragma\>" end="$" contains=csLineComment keepend
+syn region csPreProcNullable start="^\s*\zs#\s*nullable\>" end="$" contains=csLineComment keepend
+
+if expand('%:e') == 'csx' || getline('1') =~ '^#!.*\<dotnet-script\>'
+ syn region csPreProcInclude start="^\s*\zs#\s*\%(load\|r\)\>" end="$" contains=csLineComment keepend
+ syn match csShebang "\%^#!.*" display
+endif
+syn cluster csPreProcessor contains=csPreProc.*
-syn region csClassType start="@\@1<!\<class\>"hs=s+6 end="[:\n{]"me=e-1 contains=csClass
+syn region csClassType start="\<class\>"hs=s+6 end=">" end="[:{]"me=e-1 contains=csClass
" csUserType may be defined by user scripts/plugins - it should be contained in csNewType
-syn region csNewType start="@\@1<!\<new\>"hs=s+4 end="[;\n{(<\[]"me=e-1 contains=csNew,csUserType
+syn region csNewType start="\<new\>"hs=s+4 end="[;\n{(<\[]"me=e-1 contains=csNew,@csNamespaceAlias,csUserType
syn region csIsType start=" is "hs=s+4 end="[A-Za-z0-9]\+" oneline contains=csIsAs
syn region csIsType start=" as "hs=s+4 end="[A-Za-z0-9]\+" oneline contains=csIsAs
syn keyword csNew new contained
syn keyword csClass class contained
syn keyword csIsAs is as
+syn keyword csBoolean false true
+syn keyword csNull null
+
" Strings and constants
syn match csSpecialError "\\." contained
syn match csSpecialCharError "[^']" contained
-" [1] 9.4.4.4 Character literals
-syn match csSpecialChar +\\["\\'0abfnrtvx]+ contained display
-syn match csUnicodeNumber +\\x\x\{2,4}+ contained contains=csUnicodeSpecifier display
+" Character literals
+syn match csSpecialChar +\\["\\'0abfnrtv]+ contained display
+syn match csUnicodeNumber +\\x\x\{1,4}+ contained contains=csUnicodeSpecifier display
syn match csUnicodeNumber +\\u\x\{4}+ contained contains=csUnicodeSpecifier display
-syn match csUnicodeNumber +\\U\x\{8}+ contained contains=csUnicodeSpecifier display
-syn match csUnicodeSpecifier +\\[uU]+ contained display
+syn match csUnicodeNumber +\\U00\x\{6}+ contained contains=csUnicodeSpecifier display
+syn match csUnicodeSpecifier +\\[uUx]+ contained display
syn region csString matchgroup=csQuote start=+"+ end=+"+ end=+$+ extend contains=csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
syn match csCharacter "'[^']*'" contains=csSpecialChar,csSpecialCharError,csUnicodeNumber display
syn match csCharacter "'\\''" contains=csSpecialChar display
syn match csCharacter "'[^\\]'" display
-syn match csNumber "\<0[0-7]*[lL]\=\>" display
-syn match csNumber "\<0[xX][[:xdigit:]_]\+[lL]\=\>" display
-syn match csNumber "\<0[bB][01_]\+[lL]\=\>" display
-syn match csNumber "\<[[:digit:]_]\+[lL]\=\>" display
-syn match csNumber "\<[[:digit:]_]\+\.[[:digit:]_]*\%\([eE][-+]\=[[:digit:]_]\+\)\=[fFdDmM]\=" display
-syn match csNumber "\.[[:digit:]_]\+\%\([eE][-+]\=[[:digit:]_]\+\)\=[fFdDmM]\=" display
-syn match csNumber "\<[[:digit:]_]\+[eE][-+]\=[[:digit:]_]\+[fFdDmM]\=\>" display
-syn match csNumber "\<[[:digit:]_]\+\%\([eE][-+]\=[[:digit:]_]\+\)\=[fFdDmM]\>" display
+
+" Numbers
+syn case ignore
+syn match csInteger "\<0b[01_]*[01]\%([lu]\|lu\|ul\)\=\>" display
+syn match csInteger "\<\d\+\%(_\+\d\+\)*\%([lu]\|lu\|ul\)\=\>" display
+syn match csInteger "\<0x[[:xdigit:]_]*\x\%([lu]\|lu\|ul\)\=\>" display
+syn match csReal "\<\d\+\%(_\+\d\+\)*\.\d\+\%(_\+\d\+\)*\%\(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=" display
+syn match csReal "\.\d\+\%(_\+\d\+\)*\%(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=\>" display
+syn match csReal "\<\d\+\%(_\+\d\+\)*e[-+]\=\d\+\%(_\+\d\+\)*[fdm]\=\>" display
+syn match csReal "\<\d\+\%(_\+\d\+\)*[fdm]\>" display
+syn case match
+syn cluster csNumber contains=csInteger,csReal
syn region csInterpolatedString matchgroup=csQuote start=+\$"+ end=+"+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
syn region csInterpolation matchgroup=csInterpolationDelimiter start=+{+ end=+}+ keepend contained contains=@csAll,csBraced,csBracketed,csInterpolationAlign,csInterpolationFormat
syn match csEscapedInterpolation "{{" transparent contains=NONE display
syn match csEscapedInterpolation "}}" transparent contains=NONE display
-syn region csInterpolationAlign matchgroup=csInterpolationAlignDel start=+,+ end=+}+ end=+:+me=e-1 contained contains=csNumber,csConstant,csCharacter,csParens,csOpSymbols,csString,csBracketed display
+syn region csInterpolationAlign matchgroup=csInterpolationAlignDel start=+,+ end=+}+ end=+:+me=e-1 contained contains=@csNumber,csBoolean,csConstant,csCharacter,csParens,csOpSymbols,csString,csBracketed display
syn match csInterpolationFormat +:[^}]\+}+ contained contains=csInterpolationFormatDel display
syn match csInterpolationAlignDel +,+ contained display
syn match csInterpolationFormatDel +:+ contained display
syn region csVerbatimString matchgroup=csQuote start=+@"+ end=+"+ skip=+""+ extend contains=csVerbatimQuote,@Spell
syn match csVerbatimQuote +""+ contained
-syn match csQuoteError +@$"+he=s+2,me=s+2
-syn region csInterVerbString matchgroup=csQuote start=+\$@"+ end=+"+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell
+syn region csInterVerbString matchgroup=csQuote start=+$@"+ start=+@$"+ end=+"+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell
+
+syn cluster csString contains=csString,csInterpolatedString,csVerbatimString,csInterVerbString
+
+syn cluster csLiteral contains=csBoolean,@csNumber,csCharacter,@csString,csNull
syn region csBracketed matchgroup=csParens start=+(+ end=+)+ extend contained transparent contains=@csAll,csBraced,csBracketed
syn region csBraced matchgroup=csParens start=+{+ end=+}+ extend contained transparent contains=@csAll,csBraced,csBracketed
-syn cluster csAll contains=csCharacter,csClassType,csComment,csContextualStatement,csEndColon,csIsType,csLabel,csLogicSymbols,csNewType,csConstant,csNumber,csOpSymbols,csOperatorError,csParens,csPreCondit,csRegion,csString,csSummary,csType,csUnicodeNumber,csUnicodeSpecifier,csInterpolatedString,csVerbatimString,csInterVerbString,csUserType,csUserIdentifier,csUserInterface,csUserMethod
+syn cluster csAll contains=@csLiteral,csClassType,@csComment,csEndColon,csIsType,csLabel,csLogicSymbols,csNewType,csOpSymbols,csParens,@csPreProcessor,csSummary,@csNamespaceAlias,csType,csUnicodeNumber,csUserType,csUserIdentifier,csUserInterface,csUserMethod
+
+" Keyword identifiers
+syn match csIdentifier "@\h\w*"
" The default highlighting.
+hi def link csUnspecifiedStatement Statement
+hi def link csUnsupportedStatement Statement
+hi def link csUnspecifiedKeyword Keyword
+
+hi def link csGlobalNamespaceAlias Include
+
hi def link csType Type
hi def link csClassType Type
hi def link csIsType Type
+
hi def link csStorage Structure
hi def link csClass Structure
+hi def link csNew Statement
+hi def link csIsAs Keyword
+hi def link csAccessor Keyword
+hi def link csAccess Keyword
+
+hi def link csLinq Statement
+
+hi def link csStatement Statement
hi def link csRepeat Repeat
hi def link csConditional Conditional
hi def link csLabel Label
-hi def link csModifier StorageClass
-hi def link csConstant Constant
hi def link csException Exception
-hi def link csTypeOf Keyword
-hi def link csTypeOfStatement Typedef
-hi def link csUnspecifiedStatement Statement
-hi def link csUnsupportedStatement Statement
-hi def link csUnspecifiedKeyword Keyword
-hi def link csNew Statement
-hi def link csLinq Statement
-hi def link csIsAs Keyword
-hi def link csAsync Keyword
-hi def link csContextualStatement Statement
-hi def link csOperatorError Error
+
+hi def link csModifier StorageClass
+hi def link csAccessModifier csModifier
+hi def link csAsyncModifier csModifier
+hi def link csManagedModifier csModifier
+hi def link csUsingModifier csModifier
hi def link csTodo Todo
hi def link csComment Comment
-
+hi def link csLineComment csComment
+hi def link csBlockComment csComment
+
+hi def link csKeywordOperator Keyword
+hi def link csAsyncOperator csKeywordOperator
+hi def link csTypeOf csKeywordOperator
+hi def link csTypeOfOperand Typedef
+hi def link csTypeOfError Error
hi def link csOpSymbols Operator
hi def link csLogicSymbols Operator
@@ -193,15 +276,29 @@ hi def link csSpecialError Error
hi def link csSpecialCharError Error
hi def link csString String
hi def link csQuote String
-hi def link csQuoteError Error
hi def link csInterpolatedString String
hi def link csVerbatimString String
hi def link csInterVerbString String
hi def link csVerbatimQuote SpecialChar
-hi def link csPreCondit PreCondit
+
+hi def link csPreProc PreProc
+hi def link csPreProcDeclaration Define
+hi def link csPreProcConditional PreCondit
+hi def link csPreProcLine csPreProc
+hi def link csPreProcDiagnostic csPreProc
+hi def link csPreProcRegion csPreProc
+hi def link csPreProcPragma csPreProc
+hi def link csPreProcNullable csPreProc
+hi def link csPreProcInclude csPreProc
+hi def link csShebang csPreProc
+
+hi def link csConstant Constant
+hi def link csNull Constant
+hi def link csBoolean Boolean
hi def link csCharacter Character
hi def link csSpecialChar SpecialChar
-hi def link csNumber Number
+hi def link csInteger Number
+hi def link csReal Float
hi def link csUnicodeNumber SpecialChar
hi def link csUnicodeSpecifier SpecialChar
hi def link csInterpolationDelimiter Delimiter
@@ -212,9 +309,12 @@ hi def link csInterpolationFormatDel csInterpolationDelimiter
hi def link csGenericBraces csBraces
" xml markup
-hi def link csXmlCommentLeader Comment
-hi def link csXmlComment Comment
+hi def link csXmlLineCommentLeader Comment
+hi def link csXmlLineComment Comment
+hi def link csXmlBlockComment Comment
+hi def link csXmlBlockCommentMiddle csXmlBlockComment
hi def link csXmlTag Statement
+hi def link csXmlAttrib Statement
let b:current_syntax = 'cs'
diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim
index 79352c0827..2efd919772 100644
--- a/runtime/syntax/debchangelog.vim
+++ b/runtime/syntax/debchangelog.vim
@@ -3,7 +3,7 @@
" Maintainer: Debian Vim Maintainers
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
" Wichert Akkerman <wakkerma@debian.org>
-" Last Change: 2021 Oct 19
+" Last Change: 2022 May 01
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim
" Standard syntax initialization
@@ -24,7 +24,7 @@ let s:supported = [
\ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
\ 'trixie', 'sid', 'rc-buggy',
\
- \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'jammy',
+ \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy', 'kinetic',
\ 'devel'
\ ]
let s:unsupported = [
@@ -35,7 +35,7 @@ let s:unsupported = [
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
\ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
\ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic',
- \ 'disco', 'eoan', 'groovy'
+ \ 'disco', 'eoan', 'hirsute', 'groovy'
\ ]
let &cpo=s:cpo
diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim
index 8b65ece4ca..4c7fb5dd63 100644
--- a/runtime/syntax/debcontrol.vim
+++ b/runtime/syntax/debcontrol.vim
@@ -3,7 +3,7 @@
" Maintainer: Debian Vim Maintainers
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
" Wichert Akkerman <wakkerma@debian.org>
-" Last Change: 2021 Nov 26
+" Last Change: 2022 May 11
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debcontrol.vim
" Standard syntax initialization
@@ -17,7 +17,7 @@ set cpo&vim
" Should match case except for the keys of each field
syn case match
-syn iskeyword @,48-57,-,/
+syn iskeyword @,48-57,-
" Everything that is not explicitly matched by the rules below
syn match debcontrolElse "^.*$"
diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim
index 4b4c497f18..e3ec6e6598 100644
--- a/runtime/syntax/debsources.vim
+++ b/runtime/syntax/debsources.vim
@@ -2,7 +2,7 @@
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
-" Last Change: 2021 Oct 19
+" Last Change: 2022 May 01
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim
" Standard syntax initialization
@@ -26,7 +26,7 @@ let s:supported = [
\ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
\ 'trixie', 'sid', 'rc-buggy',
\
- \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'jammy',
+ \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy', 'kinetic',
\ 'devel'
\ ]
let s:unsupported = [
@@ -37,7 +37,7 @@ let s:unsupported = [
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
\ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
\ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic',
- \ 'disco', 'eoan', 'groovy'
+ \ 'disco', 'eoan', 'hirsute', 'groovy'
\ ]
let &cpo=s:cpo
diff --git a/runtime/syntax/dep3patch.vim b/runtime/syntax/dep3patch.vim
index 8b2cee629c..cb0eda8931 100644
--- a/runtime/syntax/dep3patch.vim
+++ b/runtime/syntax/dep3patch.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Debian DEP3 Patch headers
" Maintainer: Gabriel Filion <gabster@lelutin.ca>
-" Last Change: 2021-01-09
+" Last Change: 2022 Apr 06
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/dep3patch.vim
"
" Specification of the DEP3 patch header format is available at:
@@ -28,7 +28,7 @@ syn region dep3patchMultiField matchgroup=dep3patchKey start="^Bug\%(-[[:graph:]
syn region dep3patchMultiField matchgroup=dep3patchKey start="^Forwarded\ze: *" end="$" contained contains=dep3patchHTTPUrl,dep3patchForwardedShort oneline keepend
syn region dep3patchMultiField matchgroup=dep3patchKey start="^\%(Author\|From\)\ze: *" end="$" contained contains=dep3patchEmail oneline keepend
syn region dep3patchMultiField matchgroup=dep3patchKey start="^\%(Reviewed-by\|Acked-by\)\ze: *" end="$" contained contains=dep3patchEmail oneline keepend
-syn region dep3patchMultiField matchgroup=dep3patchKey start="^Last-Updated\ze: *" end="$" contained contains=dep3patchISODate oneline keepend
+syn region dep3patchMultiField matchgroup=dep3patchKey start="^Last-Update\ze: *" end="$" contained contains=dep3patchISODate oneline keepend
syn region dep3patchMultiField matchgroup=dep3patchKey start="^Applied-Upstream\ze: *" end="$" contained contains=dep3patchHTTPUrl,dep3patchCommitID oneline keepend
syn match dep3patchHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
diff --git a/runtime/syntax/dirpager.vim b/runtime/syntax/dirpager.vim
index 40137e4936..e93420f3ab 100644
--- a/runtime/syntax/dirpager.vim
+++ b/runtime/syntax/dirpager.vim
@@ -6,7 +6,7 @@
" Description: display directory content inside Vim with syntax
" highlighting
" File: runtime/syntax/dirpager.vim
-" Last Change: 2012 May 19
+" Last Change: 2022 Jun 14
" Modeline: vim: ts=8:sw=2:sts=2:
"
" Credits: dirpager.vim is derived from Nikolai Weibulls dircolors.vim
diff --git a/runtime/syntax/doxygen.vim b/runtime/syntax/doxygen.vim
index 167b17cd0f..357c4302cf 100644
--- a/runtime/syntax/doxygen.vim
+++ b/runtime/syntax/doxygen.vim
@@ -120,7 +120,7 @@ try
" end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+
"syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contains=doxygenContinueCommentWhite,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend matchgroup=xxx
-syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ skipwhite keepend matchgroup=xxx
+syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ skipwhite keepend matchgroup=xxx contains=@Spell
" syn region doxygenBriefLine matchgroup=xxxy contained start=+\<\k.\++ skip=+^\s*\k+ end=+end+ skipwhite keepend
"doxygenFindBriefSpecial,
"" syn region doxygenSpecialMultilineDesc start=+.\++ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend
@@ -498,12 +498,16 @@ endif
syn match doxygenLeadingWhite +\(^\s*\*\)\@<=\s*+ contained
- " This is still a proposal, but won't do any harm.
- aug doxygengroup
- au!
- au Syntax UserColor_reset nested call s:Doxygen_Hilights_Base()
- au Syntax UserColor_{on,reset,enable} nested call s:Doxygen_Hilights()
- aug END
+ " This is still a proposal, but it is probably fine. However, it doesn't
+ " work when 'syntax' is set in a modeline, catch the security error.
+ try
+ aug doxygengroup
+ au!
+ au Syntax UserColor_reset nested call s:Doxygen_Hilights_Base()
+ au Syntax UserColor_{on,reset,enable} nested call s:Doxygen_Hilights()
+ aug END
+ catch /E12:/
+ endtry
SynLink doxygenBody Comment
diff --git a/runtime/syntax/dts.vim b/runtime/syntax/dts.vim
index d75b9c178a..be51ab5b10 100644
--- a/runtime/syntax/dts.vim
+++ b/runtime/syntax/dts.vim
@@ -1,11 +1,12 @@
" Vim syntax file
" Language: dts/dtsi (device tree files)
" Maintainer: Daniel Mack <vim@zonque.org>
-" Last Change: 2021 May 15
+" Last Change: 2022 Jun 14
if exists("b:current_syntax")
finish
endif
+let b:current_syntax = 'dts'
syntax region dtsComment start="/\*" end="\*/"
syntax match dtsReference "&[[:alpha:][:digit:]_]\+"
diff --git a/runtime/syntax/eruby.vim b/runtime/syntax/eruby.vim
index 6bb24fe562..3d1bf715db 100644
--- a/runtime/syntax/eruby.vim
+++ b/runtime/syntax/eruby.vim
@@ -3,9 +3,9 @@
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2018 Jul 04
+" Last Change: 2022 Mar 18
-if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>'
+if exists("b:current_syntax")
finish
endif
@@ -19,8 +19,6 @@ endif
if &filetype =~ '^eruby\.'
let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
-elseif &filetype =~ '^.*\.eruby\>'
- let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>')
elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
@@ -54,10 +52,10 @@ if !b:eruby_nest_level
let b:eruby_nest_level = 1
endif
-if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>'
+if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
exe "runtime! syntax/".b:eruby_subtype.".vim"
+ unlet! b:current_syntax
endif
-unlet! b:current_syntax
syn include @rubyTop syntax/ruby.vim
syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
@@ -72,7 +70,7 @@ exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:erub
hi def link erubyDelimiter PreProc
hi def link erubyComment Comment
-let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>')
+let b:current_syntax = 'eruby'
if main_syntax == 'eruby'
unlet main_syntax
diff --git a/runtime/syntax/fetchmail.vim b/runtime/syntax/fetchmail.vim
index 7a421050d0..50d6b82562 100644
--- a/runtime/syntax/fetchmail.vim
+++ b/runtime/syntax/fetchmail.vim
@@ -1,7 +1,10 @@
" Vim syntax file
-" Language: fetchmail(1) RC File
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-04-19
+" Language: fetchmail(1) RC File
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2022 Jul 02
+
+" Version 6.4.3
if exists("b:current_syntax")
finish
@@ -10,64 +13,69 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-syn keyword fetchmailTodo contained FIXME TODO XXX NOTE
+syn keyword fetchmailTodo contained FIXME TODO XXX NOTE
-syn region fetchmailComment start='#' end='$' contains=fetchmailTodo,@Spell
+syn region fetchmailComment start='#' end='$' contains=fetchmailTodo,@Spell
-syn match fetchmailNumber display '\<\d\+\>'
+syn match fetchmailNumber display '\<\d\+\>'
-syn region fetchmailString start=+"+ skip=+\\\\\|\\"+ end=+"+
- \ contains=fetchmailStringEsc
-syn region fetchmailString start=+'+ skip=+\\\\\|\\'+ end=+'+
- \ contains=fetchmailStringEsc
+syn region fetchmailString start=+"+ skip=+\\\\\|\\"+ end=+"+
+ \ contains=fetchmailStringEsc
+syn region fetchmailString start=+'+ skip=+\\\\\|\\'+ end=+'+
+ \ contains=fetchmailStringEsc
-syn match fetchmailStringEsc contained '\\\([ntb]\|0\d*\|x\x\+\)'
+syn match fetchmailStringEsc contained '\\\([ntb]\|0\d*\|x\x\+\)'
-syn region fetchmailKeyword transparent matchgroup=fetchmailKeyword
- \ start='\<poll\|skip\|defaults\>'
- \ end='\<poll\|skip\|defaults\>'
- \ contains=ALLBUT,fetchmailOptions,fetchmailSet
+syn region fetchmailKeyword transparent matchgroup=fetchmailKeyword
+ \ start='\<poll\|skip\|defaults\>'
+ \ end='\<poll\|skip\|defaults\>'
+ \ contains=ALLBUT,fetchmailOptions,fetchmailSet
syn keyword fetchmailServerOpts contained via proto[col] local[domains] port
- \ auth[enticate] timeout envelope qvirtual aka
- \ interface monitor plugin plugout dns
- \ checkalias uidl interval netsec principal
- \ esmtpname esmtppassword
- \ sslcertck sslcertpath sslfingerprint
+ \ service auth[enticate] timeout envelope
+ \ qvirtual aka interface monitor plugin plugout
+ \ dns checkalias uidl interval tracepolls
+ \ principal esmtpname esmtppassword
+" removed in 6.3.0
+syn keyword fetchmailServerOpts contained netsec
+syn match fetchmailServerOpts contained '\<bad-header\>'
syn match fetchmailServerOpts contained '\<no\_s\+\(envelope\|dns\|checkalias\|uidl\)'
-syn keyword fetchmailUserOpts contained user[name] is to pass[word] ssl
- \ sslcert sslkey sslproto folder smtphost
- \ fetchdomains smtpaddress smtpname antispam
- \ mda bsmtp preconnect postconnect keep flush
- \ fetchall rewrite stripcr forcecr pass8bits
- \ dropstatus dropdelivered mimedecode idle
- \ limit warnings batchlimit fetchlimit expunge
- \ tracepolls properties
-syn match fetchmailUserOpts contained '\<no\_s\+\(keep\|flush\|fetchall\|rewrite\|stripcr\|forcecr\|pass8bits\|dropstatus\|dropdelivered\|mimedecode\|noidle\)'
-
-syn keyword fetchmailSpecial contained here there
-
-syn keyword fetchmailNoise and with has wants options
-syn match fetchmailNoise display '[:;,]'
-
-syn keyword fetchmailSet nextgroup=fetchmailOptions skipwhite skipnl set
-
-syn keyword fetchmailOptions daemon postmaster bouncemail spambounce logfile
- \ idfile syslog nosyslog properties
-syn match fetchmailOptions '\<no\_s\+\(bouncemail\|spambounce\)'
-
-hi def link fetchmailComment Comment
-hi def link fetchmailTodo Todo
-hi def link fetchmailNumber Number
-hi def link fetchmailString String
-hi def link fetchmailStringEsc SpecialChar
-hi def link fetchmailKeyword Keyword
+syn keyword fetchmailUserOpts contained user[name] is to pass[word] ssl
+ \ sslcert sslcertck sslcertfile sslcertpath
+ \ sslfingerprint sslkey sslproto folder
+ \ smtphost fetchdomains smtpaddress smtpname
+ \ antispam mda bsmtp preconnect postconnect
+ \ keep flush limitflush fetchall rewrite
+ \ stripcr forcecr pass8bits dropstatus
+ \ dropdelivered mimedecode idle limit warnings
+ \ batchlimit fetchlimit fetchsizelimit
+ \ fastuidl expunge properties
+ \ sslcommonname
+syn match fetchmailUserOpts contained '\<no\_s\+\(sslcertck\|keep\|flush\|fetchall\|rewrite\|stripcr\|forcecr\|pass8bits\|dropstatus\|dropdelivered\|mimedecode\|idle\)'
+
+syn keyword fetchmailSpecial contained here there
+
+syn keyword fetchmailNoise and with has wants options
+syn match fetchmailNoise display '[:;,]'
+
+syn keyword fetchmailSet nextgroup=fetchmailOptions skipwhite skipnl set
+
+syn keyword fetchmailOptions daemon postmaster bouncemail spambounce
+ \ softbounce logfile pidfile idfile syslog properties
+syn match fetchmailOptions '\<no\_s\+\(bouncemail\|spambounce\|softbounce\|syslog\)'
+
+hi def link fetchmailComment Comment
+hi def link fetchmailTodo Todo
+hi def link fetchmailNumber Number
+hi def link fetchmailString String
+hi def link fetchmailStringEsc SpecialChar
+hi def link fetchmailKeyword Keyword
hi def link fetchmailServerOpts Identifier
-hi def link fetchmailUserOpts Identifier
-hi def link fetchmailSpecial Special
-hi def link fetchmailSet Keyword
-hi def link fetchmailOptions Identifier
+hi def link fetchmailUserOpts Identifier
+hi def link fetchmailSpecial Special
+hi def link fetchmailSet Keyword
+hi def link fetchmailOptions Identifier
let b:current_syntax = "fetchmail"
diff --git a/runtime/syntax/freebasic.vim b/runtime/syntax/freebasic.vim
index 68e838f393..7549d02555 100644
--- a/runtime/syntax/freebasic.vim
+++ b/runtime/syntax/freebasic.vim
@@ -1,14 +1,14 @@
" Vim syntax file
-" Language: FreeBasic
-" Maintainer: Mark Manning <markem@sim1.us>
-" Updated: 10/9/2019
-" Version: 7.0b
+" Language: FreeBASIC
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Mark Manning <markem@sim1.us>
+" Last Change: 2022 Jun 26
"
" Description:
"
" Based originally on the work done by Allan Kelly <Allan.Kelly@ed.ac.uk>
" Updated by Mark Manning <markem@sim1.us>
-" Applied FreeBasic support to the already excellent support
+" Applied FreeBASIC support to the already excellent support
" for standard basic syntax (like QB).
"
" First version based on Micro$soft QBASIC circa
@@ -17,215 +17,595 @@
" not a complete implementation yet. Send suggestions to
" the maintainer.
"
+" TODO: split this into separate dialect-based files, possibly with a common base
+"
" Quit when a (custom) syntax file was already loaded (Taken from c.vim)
"
if exists("b:current_syntax")
finish
endif
"
+" Dialect detection
+"
+let s:lang = freebasic#GetDialect()
+"
+" Whitespace Errors
+"
+if exists("freebasic_space_errors")
+ if !exists("freebasic_no_trail_space_error")
+ syn match freebasicSpaceError display excludenl "\s\+$"
+ endif
+ if !exists("freebasic_no_tab_space_error")
+ syn match freebasicSpaceError display " \+\t"me=e-1
+ endif
+endif
+"
" Be sure to turn on the "case ignore" since current versions
" of freebasic support both upper as well as lowercase
" letters. - MEM 10/1/2006
"
syn case ignore
"
-" This list of keywords is taken directly from the FreeBasic
-" user's guide as presented by the FreeBasic online site.
+" Do the Basic variables names first. This is because it
+" is the most inclusive of the tests. Later on we change
+" this so the identifiers are split up into the various
+" types of identifiers like functions, basic commands and
+" such. MEM 9/9/2006
+"
+if s:lang =~# '\<\%(qb\|fblite\)\>'
+ syn iskeyword @,48-57,_,192-255,.
+ syn match freebasicIdentifier "\<\h\%(\w\|\.\)*\>"
+ syn match freebasicGenericFunction "\<\h\%(\w\|\.\)*\>\ze\s*("
+else
+ syn iskeyword @,48-57,_,192-255
+ syn match freebasicIdentifier "\<\h\w*\>"
+ syn match freebasicGenericFunction "\<\h\w*\>\ze\s*("
+endif
+"
+" This list of keywords is taken directly from the FreeBASIC
+" user's guide as presented by the FreeBASIC online site.
"
-syn keyword freebasicArrays ERASE LBOUND REDIM PRESERVE UBOUND
+syn keyword freebasicArrays ERASE LBOUND PRESERVE REDIM UBOUND
-syn keyword freebasicBitManipulation BIT BITRESET BITSET HIBYTE HIWORD LOBYTE LOWORD SHL SHR
+" array.bi
+syn keyword freebasicArrays ARRAYLEN ARRAYSIZE
+if s:lang == "fb"
+ syn keyword freebasicArrays ArrayConstDescriptorPtr ArrayDescriptorPtr FBARRAY
+endif
-syn keyword freebasicCompilerSwitches DEFBYTE DEFDBL DEFINT DEFLNG DEFLNGINT DEFSHORT DEFSNG DEFSTR
-syn keyword freebasicCompilerSwitches DEFUBYTE DEFUINT DEFULNGINT DEFUSHORT
-syn match freebasicCompilerSwitches "\<option\s+\(BASE\|BYVAL\|DYNAMIC\|ESCAPE\|EXPLICIT\|NOKEYWORD\)\>"
-syn match freebasicCompilerSwitches "\<option\s+\(PRIVATE\|STATIC\)\>"
+if s:lang == "qb"
+ syn keyword freebasicAsm __ASM
+ syn match freebasicAsm "\<end\s\+__asm\>"
+else
+ syn keyword freebasicAsm ASM
+ syn match freebasicAsm "\<end\s\+asm\>"
+endif
-syn region freebasicConditional start="\son\s+" skip=".*" end="gosub"
-syn region freebasicConditional start="\son\s+" skip=".*" end="goto"
-syn match freebasicConditional "\<select\s+case\>"
-syn keyword freebasicConditional if iif then case else elseif with
+if s:lang == "qb"
+ syn keyword freebasicBitManipulation __BIT __BITRESET __BITSET __HIBYTE __HIWORD __LOBYTE __LOWORD
+else
+ syn keyword freebasicBitManipulation BIT BITRESET BITSET HIBYTE HIWORD LOBYTE LOWORD
+endif
-syn match freebasicConsole "\<open\s+\(CONS\|ERR\|PIPE\|SCRN\)\>"
-syn keyword freebasicConsole BEEP CLS CSRLIN LOCATE PRINT POS SPC TAB VIEW WIDTH
+if s:lang != "fb"
+ syn keyword freebasicCompilerSwitches DEFDBL DEFINT DEFLNG DEFSNG DEFSTR
+endif
+if s:lang == "qb"
+ syn keyword freebasicCompilerSwitches __DEFBYTE __DEFLONGINT __DEFSHORT __DEFUBYTE __DEFUINT __DEFULONGINT __DEFUSHORT
+elseif s:lang == "fblite" || s:lang == "deprecated"
+ syn keyword freebasicCompilerSwitches DEFBYTE DEFLONGINT DEFSHORT DEFUBYTE DEFUINT DEFUILONGINT DEFUSHORT
+endif
-syn keyword freebasicDataTypes BYTE AS DIM CONST DOUBLE ENUM INTEGER LONG LONGINT SHARED SHORT STRING
-syn keyword freebasicDataTypes SINGLE TYPE UBYTE UINTEGER ULONGINT UNION UNSIGNED USHORT WSTRING ZSTRING
+syn match freebasicCompilerSwitches "\<option\s\+\%(BASE\|BYVAL\|DYNAMIC\|ESCAPE\|EXPLICIT\|GOSUB\|NOGOSUB\)\>"
+syn match freebasicCompilerSwitches "\<option\s\+\%(NOKEYWORD\|PRIVATE\|STATIC\)\>"
-syn keyword freebasicDateTime DATE DATEADD DATEDIFF DATEPART DATESERIAL DATEVALUE DAY HOUR MINUTE
-syn keyword freebasicDateTime MONTH MONTHNAME NOW SECOND SETDATE SETTIME TIME TIMESERIAL TIMEVALUE
-syn keyword freebasicDateTime TIMER YEAR WEEKDAY WEEKDAYNAME
+syn keyword freebasicData DATA READ RESTORE
-syn keyword freebasicDebug ASSERT STOP
+syn keyword freebasicProgramFlow EXIT GOTO RETURN SLEEP
+syn match freebasicProgramFlow "\<end\>"
+if s:lang == "qb"
+ syn keyword freebasicProgramFlow __SLEEP
+endif
+if s:lang == "fblite" || s:lang == "qb"
+ syn keyword freebasicProgramFlow GOSUB
+endif
+if s:lang == "fb" || s:lang == "deprecated"
+ syn keyword freebasicProgramFlow SCOPE
+ syn match freebasicProgramFlow "\<end\s\+scope\>"
+endif
-syn keyword freebasicErrorHandling ERR ERL ERROR LOCAL RESUME
-syn match freebasicErrorHandling "\<resume\s+next\>"
-syn match freebasicErrorHandling "\<on\s+error\>"
+if s:lang == "fblite" || s:lang == "qb"
+ syn region freebasicConditional matchgroup=freebasicConditional start="\<on\>" end="\<gosub\>" transparent
+ syn region freebasicConditional matchgroup=freebasicConditional start="\<on\>" end="\<goto\>" transparent
+endif
+syn keyword freebasicConditional IF THEN ELSE ELSEIF
+if s:lang == "qb"
+ syn keyword freebasicConditional __IIF __WITH
+ syn match freebasicConditional "\<end\s\+__with\>"
+else
+ syn keyword freebasicConditional IIF WITH
+ syn match freebasicConditional "\<end\s\+with\>"
+endif
+syn match freebasicConditional "\<end\s\+if\>"
+syn match freebasicConditional "\<select\s\+case\>"
+syn match freebasicConditional "\<case\>"
+syn match freebasicConditional "\<case\s\+is\>"
+syn match freebasicConditional "\<end\s\+select\>"
-syn match freebasicFiles "\<get\s+#\>"
-syn match freebasicFiles "\<input\s+#\>"
-syn match freebasicFiles "\<line\s+input\s+#\>"
-syn match freebasicFiles "\<put\s+#\>"
-syn keyword freebasicFiles ACCESS APPEND BINARY BLOAD BSAVE CLOSE EOF FREEFILE INPUT LOC
-syn keyword freebasicFiles LOCK LOF OPEN OUTPUT RANDOM RESET SEEK UNLOCK WRITE
+syn keyword freebasicConsole BEEP CLS CSRLIN LOCATE PRINT POS SPC TAB USING VIEW WIDTH
+syn match freebasicConsole "?"
-syn keyword freebasicFunctions ALIAS ANY BYREF BYVAL CALL CDECL CONSTRUCTOR DESTRUCTOR
-syn keyword freebasicFunctions DECLARE FUNCTION LIB OVERLOAD PASCAL STATIC SUB STDCALL
-syn keyword freebasicFunctions VA_ARG VA_FIRST VA_NEXT
+syn keyword freebasicDataTypes SINGLE DOUBLE INTEGER LONG
+syn match freebasicDataTypes "\<string\>"
+syn keyword freebasicDataTypes AS DIM CONST ENUM SHARED TYPE
+syn match freebasicDataTypes "\<end\s\+enum\>"
+syn match freebasicDataTypes "\<end\s\+type\>"
+if s:lang == "qb"
+ syn keyword freebasicDataTypes __BOOLEAN __BYTE __LONGINT __SHORT __UBYTE __UINTEGER __ULONG __ULONGINT __UNSIGNED __USHORT __ZSTRING
+ syn match freebasicDataTypes "\<__WSTRING\>"
+ syn keyword freebasicDataTypes __EXPLICIT __EXTENDS __IMPLEMENTS __OBJECT __POINTER __PTR __SIZEOF __TYPEOF
+ syn keyword freebasicDataTypes __UNION
+ syn match freebasicDataTypes "\<end\s\+__union\>"
+else
+ syn keyword freebasicDataTypes BOOLEAN BYTE LONGINT SHORT UBYTE UINTEGER ULONG ULONGINT UNSIGNED USHORT ZSTRING
+ syn match freebasicDataTypes "\<WSTRING\>"
+ syn keyword freebasicDataTypes EXPLICIT EXTENDS IMPLEMENTS OBJECT POINTER PTR SIZEOF TYPEOF
+ syn keyword freebasicDataTypes UNION
+ syn match freebasicDataTypes "\<end\s\+union\>"
+endif
+if s:lang == "fb"
+ syn keyword freebasicDataTypes BASE CLASS THIS VAR
+endif
-syn match freebasicGraphics "\<palette\s+get\>"
-syn keyword freebasicGraphics ALPHA CIRCLE CLS COLOR CUSTOM DRAW FLIP GET
-syn keyword freebasicGraphics IMAGECREATE IMAGEDESTROY LINE PAINT PALETTE PCOPY PMAP POINT
-syn keyword freebasicGraphics PRESET PSET PUT RGB RGBA SCREEN SCREENCOPY SCREENINFO SCREENLIST
-syn keyword freebasicGraphics SCREENLOCK SCREENPTR SCREENRES SCREENSET SCREENSYNC SCREENUNLOCK
-syn keyword freebasicGraphics TRANS USING VIEW WINDOW
+if s:lang == "qb"
+ syn match freebasicDateTime "\<\%(date\|time\)\$"
+elseif s:lang == "fblite" || s:lang == "deprecated"
+ syn match freebasicDateTime "\<\%(date\|time\)\>\$\="
+else " fb
+ syn keyword freebasicDateTime DATE TIME
+endif
+syn keyword freebasicDateTime SETDATE SETTIME
-syn match freebasicHardware "\<open\s+com\>"
-syn keyword freebasicHardware INP OUT WAIT LPT LPOS LPRINT
+" datetime.bi
+syn keyword freebasicDateTime DATEADD DATEDIFF DATEPART DATESERIAL DATEVALUE DAY HOUR ISDATE MINUTE
+syn keyword freebasicDateTime MONTH MONTHNAME NOW SECOND TIMESERIAL TIMEVALUE
+syn keyword freebasicDateTime TIMER YEAR WEEKDAY WEEKDAYNAME
-syn keyword freebasicLogical AND EQV IMP OR NOT XOR
+syn keyword freebasicDebug STOP
+if s:lang == "qb"
+ syn keyword freebasicDebug __ASSERT __ASSERTWARN
+else
+ syn keyword freebasicDebug ASSERT ASSERTWARN
+endif
-syn keyword freebasicMath ABS ACOS ASIN ATAN2 ATN COS EXP FIX INT LOG MOD RANDOMIZE
-syn keyword freebasicMath RND SGN SIN SQR TAN
+syn keyword freebasicErrorHandling ERR ERL ERROR
+if s:lang == "qb"
+ syn keyword freebasicErrorHandling __ERFN __ERMN
+ syn match freebasicErrorHandling "\<on\s\+error\>"
+else
+ syn keyword freebasicErrorHandling ERFN ERMN
+ syn match freebasicErrorHandling "\<on\s\+\%(local\s\+\)\=error\>"
+endif
+if s:lang != "fb"
+ syn match freebasicErrorHandling "\<resume\%(\s\+next\)\=\>"
+endif
-syn keyword freebasicMemory ALLOCATE CALLOCATE CLEAR DEALLOCATE FIELD FRE PEEK POKE REALLOCATE
+syn match freebasicFiles "\<get\s\+#\>"
+syn match freebasicFiles "\<input\s\+#\>"
+syn match freebasicFiles "\<line\s\+input\s\+#\>"
+syn match freebasicFiles "\<put\s\+#\>"
+syn keyword freebasicFiles ACCESS APPEND BINARY CLOSE EOF FREEFILE INPUT LOC
+syn keyword freebasicFiles LOCK LOF OUTPUT RANDOM RESET SEEK UNLOCK WRITE
+syn match freebasicFiles "\<open\>"
+if s:lang == "qb"
+ syn keyword freebasicFiles __ENCODING
+else
+ syn keyword freebasicFiles ENCODING WINPUT
+ syn match freebasicFiles "\<open\s\+\%(cons\|err\|pipe\|scrn\)\>"
+endif
-syn keyword freebasicMisc ASM DATA LET TO READ RESTORE SIZEOF SWAP OFFSETOF
+" file.bi
+syn keyword freebasicFiles FILEATTR FILECOPY FILEDATETIME FILEEXISTS FILEFLUSH FILELEN FILESETEOF
-syn keyword freebasicModularizing CHAIN COMMON EXPORT EXTERN DYLIBFREE DYLIBLOAD DYLIBSYMBOL
-syn keyword freebasicModularizing PRIVATE PUBLIC
+syn keyword freebasicFunctions ALIAS BYREF BYVAL CDECL DECLARE LIB NAKED PASCAL STATIC STDCALL
+syn match freebasicFunctions "\<option\ze\s*("
-syn keyword freebasicMultithreading MUTEXCREATE MUTEXDESTROY MUTEXLOCK MUTEXUNLOCK THREADCREATE THREADWAIT
+if s:lang == "qb"
+ syn keyword freebasicFunctions __CVA_ARG __CVA_COPY __CVA_END __CVA_LIST __CVA_START
+ syn keyword freebasicFunctions __VA_ARG __VA_FIRST __VA_NEXT
+else
+ syn keyword freebasicFunctions CVA_ARG CVA_COPY CVA_END CVA_LIST CVA_START
+ syn keyword freebasicFunctions VA_ARG VA_FIRST VA_NEXT
+ syn keyword freebasicFunctions ANY OVERLOAD
+endif
-syn keyword freebasicShell CHDIR DIR COMMAND ENVIRON EXEC EXEPATH KILL NAME MKDIR RMDIR RUN
+syn keyword freebasicFunctions FUNCTION SUB
+syn match freebasicFunctions "\<end\s\+function\>"
+syn match freebasicFunctions "\<end\s\+sub\>"
-syn keyword freebasicEnviron SHELL SYSTEM WINDOWTITLE POINTERS
+if s:lang == "fb"
+ syn keyword freebasicFunctions ABSTRACT OVERRIDE VIRTUAL __THISCALL
+ syn keyword freebasicFunctions CONSTRUCTOR DESTRUCTOR OPERATOR PROPERTY
+ syn match freebasicFunctions "\<end\s\+constructor\>"
+ syn match freebasicFunctions "\<end\s\+destructor\>"
+ syn match freebasicFunctions "\<end\s\+operator\>"
+ syn match freebasicFunctions "\<end\s\+property\>"
+else
+ syn keyword freebasicFunctions CALL
+endif
-syn keyword freebasicLoops FOR LOOP WHILE WEND DO CONTINUE STEP UNTIL next
+syn match freebasicGraphics "\<palette\s\+get\>"
+syn keyword freebasicGraphics ADD ALPHA BLOAD BSAVE CIRCLE CLS COLOR DRAW GET
+syn keyword freebasicGraphics LINE PAINT PALETTE PCOPY PMAP POINT
+syn keyword freebasicGraphics PRESET PSET PUT SCREEN
+syn keyword freebasicGraphics TRANS WINDOW
+if s:lang == "qb"
+ syn keyword freebasicGraphics __FLIP __IMAGECONVERTROW __IMAGECREATE __IMAGEDESTROY __IMAGEINFO __POINTCOORD
+ syn keyword freebasicGraphics __RGB __RGBA __SCREENCOPY __SCREENCONTROL __SCREENEVENT __SCREENGLPROC __SCREENINFO
+ syn keyword freebasicGraphics __SCREENLIST __SCREENLOCK __SCREENPTR __SCREENRES __SCREENSET __SCREENSYNC
+ syn keyword freebasicGraphics __SCREENUNLOCK __WINDOWTITLE
+else
+ syn keyword freebasicGraphics CUSTOM
+ syn keyword freebasicGraphics FLIP IMAGECONVERTROW IMAGECREATE IMAGEDESTROY IMAGEINFO POINTCOORD
+ syn keyword freebasicGraphics RGB RGBA SCREENCOPY SCREENCONTROL SCREENEVENT SCREENGLPROC SCREENINFO
+ syn keyword freebasicGraphics SCREENLIST SCREENLOCK SCREENPTR SCREENRES SCREENSET SCREENSYNC
+ syn keyword freebasicGraphics SCREENUNLOCK WINDOWTITLE
+endif
-syn match freebasicInclude "\<#\s*\(inclib\|include\)\>"
-syn match freebasicInclude "\<\$\s*include\>"
+if s:lang != "qb"
+ syn match freebasicHardware "\<open\s\+\%(com\|lpt\)\>"
+endif
+syn keyword freebasicHardware INP OUT WAIT LPOS LPRINT
-syn keyword freebasicPointer PROCPTR PTR SADD STRPTR VARPTR
+syn keyword freebasicMath ABS ATN COS EXP FIX FRAC INT LOG MOD RANDOMIZE RND SGN SIN SQR TAN
-syn keyword freebasicPredefined __DATE__ __FB_DOS__ __FB_LINUX__ __FB_MAIN__ __FB_MIN_VERSION__
-syn keyword freebasicPredefined __FB_SIGNATURE__ __FB_VERSION__ __FB_WIN32__ __FB_VER_MAJOR__
-syn keyword freebasicPredefined __FB_VER_MINOR__ __FB_VER_PATCH__ __FILE__ __FUNCTION__
-syn keyword freebasicPredefined __LINE__ __TIME__
+if s:lang == "qb"
+ syn keyword freebasicMath __ACOS __ASIN __ATAN2
+else
+ syn keyword freebasicMath ACOS ASIN ATAN2
+endif
-syn match freebasicPreProcessor "\<^#\s*\(define\|undef\)\>"
-syn match freebasicPreProcessor "\<^#\s*\(ifdef\|ifndef\|else\|elseif\|endif\|if\)\>"
-syn match freebasicPreProcessor "\<#\s*error\>"
-syn match freebasicPreProcessor "\<#\s*\(print\|dynamic\|static\)\>"
-syn keyword freebasicPreProcessor DEFINED ONCE
+if s:lang == "qb"
+ syn keyword freebasicMemory __ALLOCATE __CALLOCATE __DEALLOCATE __REALLOCATE
+else
+ syn keyword freebasicMemory ALLOCATE CALLOCATE DEALLOCATE REALLOCATE
+ syn keyword freebasicMemory PEEK POKE CLEAR FB_MEMCOPY FB_MEMCOPYCLEAR FB_MEMMOVE SWAP SADD
+ syn keyword freebasicMemory FIELD FRE
+endif
-syn keyword freebasicProgramFlow END EXIT GOSUB GOTO
-syn keyword freebasicProgramFlow IS RETURN SCOPE SLEEP
+syn keyword freebasicMisc LET TO
+if s:lang == "qb"
+ syn keyword freebasicMisc __OFFSETOF
+else
+ syn keyword freebasicMisc OFFSETOF
+endif
+
+syn keyword freebasicModularizing CHAIN COMMON
+if s:lang == "fb"
+ syn keyword freebasicModularizing EXTERN
+ syn match freebasicModularizing "\<end\s\+extern\>"
+ syn keyword freebasicModularizing PROTECTED
+endif
+if s:lang == "qb"
+ syn keyword freebasicModularizing __EXPORT __IMPORT __DYLIBFREE __DYLIBLOAD __DYLIBSYMBOL
+else
+ syn keyword freebasicModularizing EXPORT IMPORT DYLIBFREE DYLIBLOAD DYLIBSYMBOL
+ syn keyword freebasicModularizing PRIVATE PUBLIC
+ syn keyword freebasicModularizing NAMESPACE
+ syn match freebasicModularizing "\<end\s\+namespace\>"
+endif
+
+if s:lang != "qb"
+ syn keyword freebasicMultithreading MUTEXCREATE MUTEXDESTROY MUTEXLOCK MUTEXUNLOCK THREADCREATE THREADWAIT
+ syn keyword freebasicMultithreading CONDBROADCAST CONDCREATE CONDDESTROY CONDSIGNAL CONDWAIT
+ syn keyword freebasicMultithreading THREADCALL THREADDETACH THREADSELF
+endif
-syn keyword freebasicString INSTR LCASE LEFT LEN LSET LTRIM MID RIGHT RSET RTRIM
-syn keyword freebasicString SPACE STRING TRIM UCASE ASC BIN CHR CVD CVI CVL CVLONGINT
-syn keyword freebasicString CVS CVSHORT FORMAT HEX MKD MKI MKL MKLONGINT MKS MKSHORT
-syn keyword freebasicString OCT STR VAL VALLNG VALINT VALUINT VALULNG
+syn keyword freebasicShell CHDIR KILL NAME MKDIR RMDIR RUN SETENVIRON
+if s:lang == "qb"
+ syn keyword freebasicShell __CURDIR __DIR __EXEC __EXEPATH
+ syn match freebasicString "\<\%(command\|environ\)\$"
+else
+ " fbio.bi
+ syn keyword freebasicShell ISREDIRECTED
+ syn keyword freebasicShell CURDIR DIR EXEC EXEPATH
+ syn match freebasicString "\<\%(command\|environ\)\>\$\="
+endif
-syn keyword freebasicTypeCasting CAST CBYTE CDBL CINT CLNG CLNGINT CPTR CSHORT CSIGN CSNG
-syn keyword freebasicTypeCasting CUBYTE CUINT CULNGINT CUNSG CURDIR CUSHORT
+syn keyword freebasicEnviron SHELL SYSTEM
-syn match freebasicUserInput "\<line\s+input\>"
-syn keyword freebasicUserInput GETJOYSTICK GETKEY GETMOUSE INKEY INPUT MULTIKEY SETMOUSE
+syn keyword freebasicLoops FOR LOOP WHILE WEND DO STEP UNTIL NEXT
+if s:lang == "qb"
+ syn keyword freebasicLoops __CONTINUE
+else
+ syn keyword freebasicLoops CONTINUE
+endif
"
-" Do the Basic variables names first. This is because it
-" is the most inclusive of the tests. Later on we change
-" this so the identifiers are split up into the various
-" types of identifiers like functions, basic commands and
-" such. MEM 9/9/2006
+" File numbers
"
-syn match freebasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"
-syn match freebasicGenericFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-1
+syn match freebasicFilenumber "#\d\+"
+syn match freebasicFilenumber "#\a[[:alpha:].]*[%&!#]\="
+
+syn match freebasicMetacommand "$\s*\%(dynamic\|static\)"
+syn match freebasicMetacommand "$\s*include\s*\%(once\)\=\s*:\s*'[^']\+'"
+syn match freebasicMetacommand '$\s*include\s*\%(once\)\=\s*:\s*"[^"]\+"'
+syn match freebasicMetacommand '$\s*lang\s*:\s*"[^"]\+"'
+"
+" Intrinsic defines
+"
+syn keyword freebasicPredefined __DATE__ __DATE_ISO__
+syn keyword freebasicPredefined __FB_64BIT__ __FB_ARGC__ __FB_ARG_COUNT__ __FB_ARG_EXTRACT__ __FB_ARG_LEFTOF__
+syn keyword freebasicPredefined __FB_ARG_RIGHTOF__ __FB_ARGV__ __FB_ARM__ __FB_ASM__ __FB_BACKEND__
+syn keyword freebasicPredefined __FB_BIGENDIAN__ __FB_BUILD_DATE__ __FB_BUILD_DATE_ISO__ __FB_BUILD_SHA1__
+syn keyword freebasicPredefined __FB_CYGWIN__ __FB_DARWIN__ __FB_DEBUG__ __FB_DOS__ __FB_ERR__ __FB_EVAL__
+syn keyword freebasicPredefined __FB_FPMODE__ __FB_FPU__ __FB_FREEBSD__ __FB_GCC__ __FB_GUI__ __FB_JOIN__
+syn keyword freebasicPredefined __FB_LANG__ __FB_LINUX__ __FB_MAIN__ __FB_MIN_VERSION__ __FB_MT__ __FB_NETBSD__
+syn keyword freebasicPredefined __FB_OPENBSD__ __FB_OPTIMIZE__ __FB_OPTION_BYVAL__ __FB_OPTION_DYNAMIC__
+syn keyword freebasicPredefined __FB_OPTION_ESCAPE__ __FB_OPTION_EXPLICIT__ __FB_OPTION_GOSUB__
+syn keyword freebasicPredefined __FB_OPTION_PRIVATE__ __FB_OUT_DLL__ __FB_OUT_EXE__ __FB_OUT_LIB__ __FB_OUT_OBJ__
+syn keyword freebasicPredefined __FB_PCOS__ __FB_PPC__ __FB_QUOTE__ __FB_SIGNATURE__ __FB_SSE__ __FB_UNIQUEID__
+syn keyword freebasicPredefined __FB_UNIQUEID_POP__ __FB_UNIQUEID_PUSH__ __FB_UNIX__ __FB_UNQUOTE__
+syn keyword freebasicPredefined __FB_VECTORIZE__ __FB_VER_MAJOR__ __FB_VER_MINOR__ __FB_VER_PATCH__ __FB_VERSION__
+syn keyword freebasicPredefined __FB_WIN32__ __FB_X86__ __FB_XBOX__
+syn keyword freebasicPredefined __FILE__ __FILE_NQ__ __FUNCTION__ __FUNCTION_NQ__
+syn keyword freebasicPredefined __LINE__ __PATH__ __TIME__
+"
+" Preprocessor directives
+"
+syn match freebasicInclude "#\s*\%(inclib\|include\%(\s\+once\)\=\|libpath\)\>"
+
+syn match freebasicPreProcessor "#\s*assert\>"
+syn match freebasicPreProcessor "#\s*cmdline\>"
+syn match freebasicPreProcessor "#\s*\%(define\|undef\)\>"
+syn match freebasicPreProcessor "#\s*\%(if\|ifdef\|ifndef\|else\|elseif\|endif\)\>"
+syn match freebasicPreProcessor "#\s*\%(macro\|endmacro\)\>"
+syn match freebasicPreProcessor "#\s*error\>"
+syn match freebasicPreProcessor "#\s*lang\>"
+syn match freebasicPreProcessor "#\s*line\>"
+syn match freebasicPreProcessor "#\s*pragma\%(\s\+reserve\)\=\>"
+syn match freebasicPreProcessor "#\s*\%(print\|dynamic\|static\)\>"
+syn keyword freebasicPreProcessor DEFINED
+
+syn keyword freebasicString LEN
+syn keyword freebasicString ASC
+" string.bi
+syn keyword freebasicString FORMAT
+syn keyword freebasicString VAL
+syn keyword freebasicString CVD CVI CVL CVS
+syn keyword freebasicString INSTR
+syn keyword freebasicString LSET RSET
+
+if s:lang == "qb"
+ syn match freebasicString "\<string\$\ze\s*("
+ syn match freebasicString "\<__wstring\ze\s*("
+ syn match freebasicString "\<space\$"
+ syn keyword freebasicString __WSPACE
+ syn match freebasicString "\<chr\$"
+ syn keyword freebasicString __WCHR
+ syn keyword freebasicString __WBIN __WHEX __WOCT __WSTR
+ syn match freebasicString "\<\%(bin\|hex\|oct\|str\)\$"
+ syn keyword freebasicString __VALLNG __VALINT __VALUINT __VALULNG
+ syn match freebasicString "\<\%(mkd\|mki\|mkl\|mks\)\$"
+ syn keyword freebasicString __MKLONGINT __MKSHORT
+ syn keyword freebasicString __CVLONGINT __CVSHORT
+ syn match freebasicString "\<\%(left\|mid\|right\|lcase\|ucase\|ltrim\|rtrim\)\$"
+ syn keyword freebasicString __TRIM
+ syn keyword freebasicString __INSTRREV
+else
+ syn match freebasicString "\<string\$\=\ze\s*("
+ syn match freebasicString "\<wstring\ze\s*("
+ syn match freebasicString "\<space\>\$\="
+ syn keyword freebasicString WSPACE
+ syn match freebasicString "\<chr\>\$\="
+ syn keyword freebasicString WCHR
+ syn keyword freebasicString WBIN WHEX WOCT WSTR
+ syn match freebasicString "\<\%(bin\|hex\|oct\|str\)\>\$\="
+ syn keyword freebasicString VALLNG VALINT VALUINT VALULNG
+ syn match freebasicString "\<\%(mkd\|mki\|mkl\|mks\)\>\$\="
+ syn match freebasicString "\<\%(mklongint\|mkshort\)\>\$\="
+ syn keyword freebasicString CVLONGINT CVSHORT
+ syn match freebasicString "\<\%(left\|mid\|right\|lcase\|ucase\|ltrim\|rtrim\)\>\$\="
+ syn match freebasicString "\<trim\>\$\="
+ syn keyword freebasicString INSTRREV
+endif
+
+syn keyword freebasicTypeCasting CDBL CINT CLNG CSNG
+if s:lang == "qb"
+ syn keyword freebasicTypeCasting __CAST __CBOOL __CBYTE __CLNGINT __CPTR __CSHORT __CSIGN __CYBTE __CUINT __CULNG
+ syn keyword freebasicTypeCasting __CULNGINT __CUNSG __CUSHORT
+else
+ syn keyword freebasicTypeCasting CAST CBOOL CBYTE CLNGINT CPTR CSHORT CSIGN CUBYTE CUINT CULNG CULNGINT CUNSG CUSHORT
+endif
+
+syn match freebasicUserInput "\<line\s\+input\>"
+syn keyword freebasicUserInput INKEY INPUT
+if s:lang == "qb"
+ syn keyword freebasicUserInput __GETJOYSTICK __GETKEY __GETMOUSE __MULTIKEY __SETMOUSE STICK STRIG
+else
+ syn keyword freebasicUserInput GETJOYSTICK GETKEY GETMOUSE MULTIKEY SETMOUSE
+endif
"
-" Function list
+" Operators
"
-syn keyword freebasicTodo contained TODO
+" TODO: make these context sensitive to remove the overlap of common operators
+" : alpha operators should probably always be highlighted
+" -- DJK 20/11/19
+if s:lang == "qb"
+ syn match freebasicArithmeticOperator "\<\%(MOD\|__SHL\|__SHR\)\>"
+else
+ syn match freebasicArithmeticOperator "\<\%(MOD\|SHL\|SHR\)\>"
+endif
+syn match freebasicBitwiseOperator "\<\%(AND\|EQV\|IMP\|NOT\|OR\|XOR\)\>" " freebaseLogical?
+if s:lang == "qb"
+ syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|__SHL\|__SHR\)=\@=" " exclude trailing '='
+else
+ syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|SHL\|SHR\)=\@="
+endif
+syn match freebasicShortcircuitOperator "\<\%(ANDALSO\|ORELSE\)\>"
+if s:lang == "fb"
+ syn match freebasicMemoryOperator '\<\%(new\|delete\)\>'
+endif
+syn keyword freebasicPointerOperator STRPTR VARPTR
+if s:lang == "qb"
+ syn keyword freebasicPointerOperator __PROCPTR
+else
+ syn keyword freebasicPointerOperator PROCPTR
+endif
+syn match freebasicTypeOperator '\<is\>'
+syn match freebasicTypeOperator '\.' nextgroup=freebasicIdentifier skipwhite
+if s:lang == "fb"
+ syn match freebasicTypeOperator '->' nextgroup=freebasicIdentifier skipwhite
+endif
+
+if exists("freebasic_operators")
+ syn match freebasicAssignmentOperator "=>\=\|[-+&/\\*^]="
+ if s:lang == "qb"
+ syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|__SHL\|__SHR\)=" " include trailing '='
+ else
+ syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|SHL\|SHR\)="
+ endif
+ syn match freebasicArithmeticOperator "[-+&/\\*^]"
+ " syn match freebasicIndexingOperator "[[\]()]" " FIXME
+ syn match freebasicRelationalOperator "=\|<>\|<=\|<\|>=\|>"
+ syn match freebasicPreprocessorOperator '\%(^\s*\)\@<!\%(##\|#\)\|[$!]"\@='
+ syn match freebasicPointerOperator '[@*]'
+ syn match freebasicTypeOperator '\.' nextgroup=freebasicIdentifier skipwhite
+ if s:lang == "fb"
+ syn match freebasicTypeOperator '->' nextgroup=freebasicIdentifier skipwhite
+ endif
+endif
+
+syn cluster freebasicOperator contains=freebasic.*Operator
"
" Catch errors caused by wrong parenthesis
"
-syn region freebasicParen transparent start='(' end=')' contains=ALLBUT,@freebasicParenGroup
-syn match freebasicParenError ")"
-syn match freebasicInParen contained "[{}]"
-syn cluster freebasicParenGroup contains=freebasicParenError,freebasicSpecial,freebasicTodo,freebasicUserCont,freebasicUserLabel,freebasicBitField
+" syn region freebasicParen transparent start='(' end=')' contains=ALLBUT,@freebasicParenGroup
+" syn match freebasicParenError ")"
+" syn match freebasicInParen contained "[{}]"
+" syn cluster freebasicParenGroup contains=freebasicParenError,freebasicSpecial,freebasicTodo,freebasicUserCont,freebasicUserLabel,freebasicBitField
"
-" Integer number, or floating point number without a dot and with "f".
+" Integer number
"
-syn region freebasicHex start="&h" end="\W"
-syn region freebasicHexError start="&h\x*[g-zG-Z]" end="\W"
-syn region freebasicOctal start="&o" end="\W"
-syn region freebasicOctalError start="&o[0-7]*[89a-zA-Z]" end="\W"
-syn region freebasicBinary start="&b" end="\W"
-syn region freebasicBinaryError start="&b[01]*[2-9a-zA-Z]" end="\W"
-syn match freebasicInteger "\<\d\+\(u\=l\=\|lu\|f\)\>"
+syn match freebasicHexError "&h\w*\>"
+syn match freebasicOctalError "&o\w*\>"
+syn match freebasicBinaryError "&b\w*\>"
+syn match freebasicHex "&h\x\+\%([%L&U]\|UL\|LL\|ULL\)\=\>"
+syn match freebasicOctal "&o\o\+\%([%L&U]\|UL\|LL\|ULL\)\=\>"
+syn match freebasicBinary "&b[10]\+\%([%L&U]\|UL\|LL\|ULL\)\=\>"
+syn match freebasicInteger "\<\d\+\%([%L&U]\|UL\|LL\|ULL\)\=\>"
"
-" Floating point number, with dot, optional exponent
+" Floating point
+" See: https://www.freebasic.net/forum/viewtopic.php?t=20323
"
-syn match freebasicFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
+" Floating point number, with dot, optional exponent, optional suffix
"
-" Floating point number, starting with a dot, optional exponent
+syn match freebasicFloat "\<\d\+\.\d*\%([de][-+]\=\d*\)\=[f!#]\="
"
-syn match freebasicFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
+" Floating point number, starting with a dot, optional exponent, optional suffix
"
-" Floating point number, without dot, with exponent
+syn match freebasicFloat "\.\d\+\%([de][-+]\=\d*\)\=[f!#]\="
"
-syn match freebasicFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"
+" Floating point number, without dot, with optional exponent, optional suffix
"
-" Octal number
+syn match freebasicFloat "\<\d\+\%([de][-+]\=\d*\)[f!#]\="
"
-syn case match
-syn match freebasicOctal2 "\<0\o*\>"
-syn match freebasicOctal2Error "\<0\o*[89a-zA-Z]"
+" Floating point number, without dot, without exponent, with suffix
"
-" String and Character contstants
+syn match freebasicFloat "\<\d\+[f!#]"
"
-syn region freebasicString start='"' end='"' contains=freebasicSpecial,freebasicTodo
-syn region freebasicString start="'" end="'" contains=freebasicSpecial,freebasicTodo
+" Create the clusters
"
-" Comments
+syn cluster freebasicNumber contains=freebasicHex,freebasicOctal,freebasicBinary,freebasicInteger,freebasicFloat
+syn cluster freebasicNumberError contains=freebasicHexError,freebasicOctalError,freebasicBinaryError
"
-syn match freebasicSpecial contained "\\\\."
-syn region freebasicComment start="^rem" end="$" contains=freebasicSpecial,freebasicTodo
-syn region freebasicComment start=":\s*rem" end="$" contains=freebasicSpecial,freebasicTodo
-syn region freebasicComment start="\s*'" end="$" contains=freebasicSpecial,freebasicTodo
-syn region freebasicComment start="^'" end="$" contains=freebasicSpecial,freebasicTodo
+" Booleans
"
-" Now do the comments and labels
+if s:lang != "qb"
+ syn keyword freebasicBoolean TRUE FALSE
+endif
"
-syn match freebasicLabel "^\d"
-syn match freebasicLabel "\<^\w+:\>"
-syn region freebasicLineNumber start="^\d" end="\s"
"
-" Create the clusters
+" String and escape sequences
"
-syn cluster freebasicNumber contains=freebasicHex,freebasicOctal,freebasicOctal2,freebasicBinary,freebasicInteger,freebasicFloat
-syn cluster freebasicError contains=freebasicHexError,freebasicOctalError,freebasicOctal2,freebasicBinary
+syn match freebasicSpecial contained "\\."
+syn match freebasicSpecial contained "\\\d\{1,3}"
+syn match freebasicSpecial contained "\\&h\x\{1,2}"
+syn match freebasicSpecial contained "\\&o\o\{1,3}"
+syn match freebasicSpecial contained "\\&b[01]\{1,8}"
+syn match freebasicSpecial contained "\\u\x\{1,4}"
+syn region freebasicString start='"' end='"' " TODO: Toggle contains on Option Escape in fblite and qb? -- DJK 20/11/19
+syn region freebasicString start='!\zs"' end='"' contains=freebasicSpecial
+syn region freebasicString start='$\zs"' end='"'
"
-" Used with OPEN statement
+" Line labels
"
-syn match freebasicFilenumber "#\d\+"
-syn match freebasicMathOperator "[\+\-\=\|\*\/\>\<\%\()[\]]" contains=freebasicParen
+if s:lang =~# '\<\%(qb\|fblite\)\>'
+ syn match freebasicLineLabel "^\s*\zs\h\%(\w\|\.\)*\ze\s*:"
+else
+ syn match freebasicLineLabel "^\s*\zs\h\w*\ze\s*:"
+endif
+syn match freebasicLineNumber "^\s*\zs\d\+"
+"
+" Line continuations
+"
+" syn match freebasicLineContinuation "\<_\>" nextgroup=freebasicComment,freebasicPostLineContinuation skipwhite
+syn keyword freebasicLineContinuation _ nextgroup=freebasicComment,freebasicPostLineContinuation skipwhite
+syn match freebasicPostLineContinuation ".*" contained
+"
+"
+" Type suffixes
+if exists("freebasic_type_suffixes") && s:lang =~# '\<\%(qb\|fblite\)\>'
+ syn match freebasicTypeSuffix "\h\%(\w\|.\)*\zs[$%&!#]"
+endif
+"
+" Comments
+"
+syn keyword freebasicTodo TODO FIXME XXX NOTE contained
+syn region freebasicComment start="\<rem\>" end="$" contains=freebasicTodo,@Spell,freebasicMetacommand
+syn region freebasicComment start="'" end="$" contains=freebasicTodo,@Spell,freebasicMetacommand
+syn region freebasicDoubleComment start="''" end="$" contains=freebasicTodo,@Spell
+
+if !exists("freebasic_no_comment_fold")
+ syn region freebasicMultilineComment start="/'" end="'/" contains=freebasicTodo,@Spell,freeBasicMultilineComment fold keepend extend
+ syn region freebasicMultilineComment2 start="^\s*'.*\n\%(\s*'\)\@=" end="^\s*'.*\n\%(\s*'\)\@!" contains=freebasicComment,freebasicDoubleComment keepend fold
+else
+ syn region freebasicMultilineComment start="/'" end="'/" contains=freebasicTodo,@Spell,freeBasicMultilineComment
+endif
+
+syn case match
+
+syn sync linebreaks=1
+
"
" The default methods for highlighting. Can be overridden later
"
hi def link freebasicArrays StorageClass
+hi def link freebasicAsm Special
hi def link freebasicBitManipulation Operator
-hi def link freebasicCompilerSwitches PreCondit
+hi def link freebasicBoolean Boolean
+if s:lang == "fb"
+ hi def link freebasicCompilerSwitches freebasicUnsupportedError
+else
+ hi def link freebasicCompilerSwitches PreCondit
+endif
hi def link freebasicConsole Special
+hi def link freebasicData Special
hi def link freebasicDataTypes Type
hi def link freebasicDateTime Type
hi def link freebasicDebug Special
hi def link freebasicErrorHandling Special
+hi def link freebasicFilenumber Special
hi def link freebasicFiles Special
hi def link freebasicFunctions Function
hi def link freebasicGraphics Function
hi def link freebasicHardware Special
-hi def link freebasicLogical Conditional
+hi def link freebasicLoops Repeat
hi def link freebasicMath Function
+if s:lang == "fb"
+ hi def link freebasicMetacommand freebasicUnsupportedError
+else
+ hi def link freebasicMetacommand SpecialComment
+endif
hi def link freebasicMemory Function
hi def link freebasicMisc Special
hi def link freebasicModularizing Special
@@ -240,18 +620,55 @@ hi def link freebasicString String
hi def link freebasicTypeCasting Type
hi def link freebasicUserInput Statement
hi def link freebasicComment Comment
+hi def link freebasicDoubleComment Comment
+hi def link freebasicMultilineComment Comment
hi def link freebasicConditional Conditional
hi def link freebasicError Error
hi def link freebasicIdentifier Identifier
hi def link freebasicInclude Include
hi def link freebasicGenericFunction Function
-hi def link freebasicLabel Label
-hi def link freebasicLineNumber Label
+hi def link freebasicLineContinuation Special
+hi def link freebasicLineLabel LineNr
+if s:lang == "fb"
+ hi def link freebasicLineNumber freebasicUnsupportedError
+else
+ hi def link freebasicLineNumber LineNr
+endif
hi def link freebasicMathOperator Operator
-hi def link freebasicNumber Number
+
+hi def link freebasicHex Number
+hi def link freebasicOctal Number
+hi def link freebasicBinary Number
+hi def link freebasicInteger Number
+hi def link freebasicFloat Float
+
+hi def link freebasicHexError Error
+hi def link freebasicOctalError Error
+hi def link freebasicBinaryError Error
+
+hi def link freebasicAssignmentOperator Operator
+hi def link freebasicArithmeticOperator Operator
+hi def link freebasicIndexingOperator Operator
+hi def link freebasicRelationalOperator Operator
+hi def link freebasicBitwiseOperator Operator
+hi def link freebasicShortcircuitOperator Operator
+hi def link freebasicPreprocessorOperator Operator
+hi def link freebasicPointerOperator Operator
+if exists("freebasic_operators")
+ hi def link freebasicTypeOperator Operator
+endif
+hi def link freebasicMemoryOperator Operator
+
+hi def link freebasicSpaceError Error
+
hi def link freebasicSpecial Special
hi def link freebasicTodo Todo
+hi def link freebasicUnsupported freebasicUnsupportedError
+hi def link freebasicUnsupportedError Error
+
+unlet s:lang
+
let b:current_syntax = "freebasic"
-" vim: ts=8
+" vim: ts=8 tw=132 fdm=marker
diff --git a/runtime/syntax/i3config.vim b/runtime/syntax/i3config.vim
index f9e15d57e5..0018081da7 100644
--- a/runtime/syntax/i3config.vim
+++ b/runtime/syntax/i3config.vim
@@ -3,7 +3,7 @@
" Original Author: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
" Maintainer: Quentin Hibon (github user hiqua)
" Version: 0.4
-" Last Change: 2022 Jan 04
+" Last Change: 2022 Jun 05
" References:
" http://i3wm.org/docs/userguide.html#configuring
@@ -17,9 +17,6 @@ endif
scriptencoding utf-8
-" Error
-syn match i3ConfigError /.*/
-
" Todo
syn keyword i3ConfigTodo TODO FIXME XXX contained
@@ -50,6 +47,10 @@ syn match i3ConfigVariable /\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?/ contains=i3Confi
syn keyword i3ConfigInitializeKeyword set contained
syn match i3ConfigInitialize /^\s*set\s\+.*$/ contains=i3ConfigVariable,i3ConfigInitializeKeyword,i3ConfigColor,i3ConfigString
+" Include
+syn keyword i3ConfigIncludeKeyword include contained
+syn match i3ConfigInclude /^\s*include\s\+.*$/ contains=i3ConfigIncludeKeyword,i3ConfigString,i3ConfigVariable
+
" Gaps
syn keyword i3ConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle up down contained
syn match i3ConfigGapStyle /^\s*\(gaps\)\s\+\(inner\|outer\|horizontal\|vertical\|left\|top\|right\|bottom\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\|toggle\)\)\?\(\s\+\(-\?\d\+\|\$.*\)\)$/ contains=i3ConfigGapStyleKeyword,i3ConfigNumber,i3ConfigVariable
@@ -175,14 +176,13 @@ syn keyword i3ConfigDrawingMarksKeyword show_marks contained
syn match i3ConfigDrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigDrawingMarksKeyword
" Group mode/bar
-syn keyword i3ConfigBlockKeyword mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
-syn region i3ConfigBlock start=+.*s\?{$+ end=+^}$+ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
+syn keyword i3ConfigBlockKeyword mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_min_width workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
+syn region i3ConfigBlock start=+^\s*[^#]*s\?{$+ end=+^\s*[^#]*}$+ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
" Line continuation
syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
" Define the highlighting.
-hi def link i3ConfigError Error
hi def link i3ConfigTodo Todo
hi def link i3ConfigComment Comment
hi def link i3ConfigFontContent Type
@@ -221,6 +221,7 @@ hi def link i3ConfigAssignSpecial Special
hi def link i3ConfigFontNamespace PreProc
hi def link i3ConfigBindArgument PreProc
hi def link i3ConfigNoStartupId PreProc
+hi def link i3ConfigIncludeKeyword Identifier
hi def link i3ConfigFontKeyword Identifier
hi def link i3ConfigBindKeyword Identifier
hi def link i3ConfigOrientation Identifier
diff --git a/runtime/syntax/icon.vim b/runtime/syntax/icon.vim
index 179d75cd28..276bb58497 100644
--- a/runtime/syntax/icon.vim
+++ b/runtime/syntax/icon.vim
@@ -1,199 +1,211 @@
" Vim syntax file
-" Language: Icon
-" Maintainer: Wendell Turner <wendell@adsi-m4.com>
-" URL: ftp://ftp.halcyon.com/pub/users/wturner/icon.vim
-" Last Change: 2003 May 11
+" Language: Icon
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Wendell Turner <wendell@adsi-m4.com> (invalid last known address)
+" Last Change: 2022 Jun 16
+" Contributor: eschen@alumni.princeton.edu 2002.09.18
-" quit when a syntax file was already loaded
+" Prelude {{{1
if exists("b:current_syntax")
finish
endif
-syn keyword iconFunction abs acos any args asin atan bal
-syn keyword iconFunction callout center char chdir close collect copy
-syn keyword iconFunction cos cset delay delete detab display dtor
-syn keyword iconFunction entab errorclear exit exp find flush function
-syn keyword iconFunction get getch getche getenv iand icom image
-syn keyword iconFunction insert integer ior ishift ixor kbhit key
-syn keyword iconFunction left list loadfunc log many map match
-syn keyword iconFunction member move name numeric open ord pop
-syn keyword iconFunction pos proc pull push put read reads
-syn keyword iconFunction real remove rename repl reverse right rtod
-syn keyword iconFunction runerr save seek seq set sin sort
-syn keyword iconFunction sortf sqrt stop string system tab table
-syn keyword iconFunction tan trim type upto variable where write writes
-
-" Keywords
-syn match iconKeyword "&allocated"
-syn match iconKeyword "&ascii"
-syn match iconKeyword "&clock"
-syn match iconKeyword "&collections"
-syn match iconKeyword "&cset"
-syn match iconKeyword "&current"
-syn match iconKeyword "&date"
-syn match iconKeyword "&dateline"
-syn match iconKeyword "&digits"
-syn match iconKeyword "&dump"
-syn match iconKeyword "&e"
-syn match iconKeyword "&error"
-syn match iconKeyword "&errornumber"
-syn match iconKeyword "&errortext"
-syn match iconKeyword "&errorvalue"
-syn match iconKeyword "&errout"
-syn match iconKeyword "&fail"
-syn match iconKeyword "&features"
-syn match iconKeyword "&file"
-syn match iconKeyword "&host"
-syn match iconKeyword "&input"
-syn match iconKeyword "&lcase"
-syn match iconKeyword "&letters"
-syn match iconKeyword "&level"
-syn match iconKeyword "&line"
-syn match iconKeyword "&main"
-syn match iconKeyword "&null"
-syn match iconKeyword "&output"
-syn match iconKeyword "&phi"
-syn match iconKeyword "&pi"
-syn match iconKeyword "&pos"
-syn match iconKeyword "&progname"
-syn match iconKeyword "&random"
-syn match iconKeyword "&regions"
-syn match iconKeyword "&source"
-syn match iconKeyword "&storage"
-syn match iconKeyword "&subject"
-syn match iconKeyword "&time"
-syn match iconKeyword "&trace"
-syn match iconKeyword "&ucase"
-syn match iconKeyword "&version"
-
-" Reserved words
-syn keyword iconReserved break by case create default do
-syn keyword iconReserved else end every fail if
-syn keyword iconReserved initial link next not of
-syn keyword iconReserved procedure repeat return suspend
-syn keyword iconReserved then to until while
-
-" Storage class reserved words
-syn keyword iconStorageClass global static local record
-
-syn keyword iconTodo contained TODO FIXME XXX BUG
-
-" String and Character constants
-" Highlight special characters (those which have a backslash) differently
-syn match iconSpecial contained "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^c[a-zA-Z0-9]\|\\$"
-syn region iconString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconSpecial
-syn region iconCset start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconSpecial
-syn match iconCharacter "'[^\\]'"
-
-" not sure about these
-"syn match iconSpecialCharacter "'\\[bdeflnrtv]'"
-"syn match iconSpecialCharacter "'\\\o\{3\}'"
-"syn match iconSpecialCharacter "'\\x\x\{2}'"
-"syn match iconSpecialCharacter "'\\^c\[a-zA-Z0-9]'"
-
-"when wanted, highlight trailing white space
+syn iskeyword @,48-57,_,192-255,&
+
+" Not Top {{{1
+syn cluster iconNotTop contains=iconDocField,iconIncluded,iconStringSpecial,iconTodo,@Spell
+
+" Whitespace errors {{{1
if exists("icon_space_errors")
- syn match iconSpaceError "\s*$"
- syn match iconSpaceError " \+\t"me=e-1
+ if !exists("icon_no_trail_space_error")
+ syn match iconSpaceError "\s\+$" display excludenl
+ endif
+ if !exists("icon_no_tab_space_error")
+ syn match iconSpaceError " \+\t"me=e-1 display
+ endif
endif
-"catch errors caused by wrong parenthesis
-syn cluster iconParenGroup contains=iconParenError,iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
+" Reserved words {{{1
+syn keyword iconReserved break by case create default do else every fail if
+syn keyword iconReserved initial next not of repeat return suspend then to
+syn keyword iconReserved until while
-syn region iconParen transparent start='(' end=')' contains=ALLBUT,@iconParenGroup
-syn match iconParenError ")"
-syn match iconInParen contained "[{}]"
+syn keyword iconStorageClass global static local record invocable
+syn keyword iconLink link
-syn case ignore
+" Procedure definitions {{{1
+if exists("icon_no_procedure_fold")
+ syn region iconProcedure matchgroup=iconReserved start="\<procedure\>" end="\<end\>" contains=ALLBUT,@iconNotTop
+else
+ syn region iconProcedure matchgroup=iconReserved start="\<procedure\>" end="\<end\>" contains=ALLBUT,@iconNotTop fold
+endif
-"integer number, or floating point number without a dot
-syn match iconNumber "\<\d\+\>"
+" Keywords {{{1
+syn keyword iconKeyword &allocated &ascii &clock &collections &cset &current
+syn keyword iconKeyword &date &dateline &digits &dump &e &error &errornumber
+syn keyword iconKeyword &errortext &errorvalue &errout &fail &features &file
+syn keyword iconKeyword &host &input &lcase &letters &level &line &main &null
+syn keyword iconKeyword &output &phi &pi &pos &progname &random &regions
+syn keyword iconKeyword &source &storage &subject &time &trace &ucase &version
+
+" Graphics keywords
+syn keyword iconKeyword &col &control &interval &ldrag &lpress &lrelease
+syn keyword iconKeyword &mdrag &meta &mpress &mrelease &rdrag &resize &row
+syn keyword iconKeyword &rpress &rrelease &shift &window &x &y
+
+" Functions {{{1
+syn keyword iconFunction abs acos any args asin atan bal callout center char
+syn keyword iconFunction chdir close collect copy cos cset delay delete detab
+syn keyword iconFunction display dtor entab errorclear exit exp find flush
+syn keyword iconFunction function get getch getche getenv iand icom image
+syn keyword iconFunction insert integer ior ishift ixor kbhit key left list
+syn keyword iconFunction loadfunc log many map match member move name numeric
+syn keyword iconFunction open ord pop pos proc pull push put read reads real
+syn keyword iconFunction remove rename repl reverse right rtod runerr save
+syn keyword iconFunction seek self seq serial set sin sort sortf sqrt stop
+syn keyword iconFunction string system tab table tan trim type upto variable
+syn keyword iconFunction where write writes
+
+" Graphics functions
+syn keyword iconFunction Active Alert Bg CenterString Clip Clone Color
+syn keyword iconFunction ColorDialog ColorValue CopyArea Couple DrawArc
+syn keyword iconFunction DrawCircle DrawCurve DrawImage DrawLine DrawPoint
+syn keyword iconFunction DrawPolygon DrawRectangle DrawSegment DrawString
+syn keyword iconFunction Enqueue EraseArea Event Fg FillArc FillCircle
+syn keyword iconFunction FillPolygon FillRectangle Font FreeColor GotoRC
+syn keyword iconFunction GotoXY LeftString Lower NewColor Notice OpenDialog
+syn keyword iconFunction PaletteChars PaletteColor PaletteGrays PaletteKey
+syn keyword iconFunction Pattern Pending Pixel Raise ReadImage RightString
+syn keyword iconFunction SaveDialog SelectDialog Shade TextDialog TextWidth
+syn keyword iconFunction ToggleDialog Uncouple WAttrib WClose WDefault WDelay
+syn keyword iconFunction WDone WFlush WOpen WQuit WRead WReads WriteImage
+syn keyword iconFunction WSync WWrite WWrites
+
+" String and character constants {{{1
+syn match iconStringSpecial "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^[a-zA-Z0-9]" contained
+syn match iconStringSpecial "\\$" contained
+syn match iconStringSpecial "_\ze\s*$" contained
+
+syn region iconString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconStringSpecial
+syn region iconCset start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconStringSpecial
+
+" Bracket errors {{{1
+
+if !exists("icon_no_bracket_errors")
+ " catch errors caused by wrong brackets (ACE 2002.09.18)
+ syn cluster iconBracketGroup contains=iconBracketError,iconIncluded
+ syn region iconBracket start='\[' end='\]' contains=ALLBUT,@iconBracketGroup,@iconNotTop transparent
+ syn match iconBracketError "]"
+
+ "catch errors caused by wrong braces (ACE 2002.09.18)
+ syn cluster iconBraceGroup contains=iconBraceError,iconIncluded
+ syn region iconBrace start='{' end='}' contains=ALLBUT,@iconBraceGroup,@iconNotTop transparent
+ syn match iconBraceError "}"
+
+ "catch errors caused by wrong parenthesis
+ syn cluster iconParenGroup contains=iconParenError,iconIncluded
+ syn region iconParen start='(' end=')' contains=ALLBUT,@iconParenGroup,@iconNotTop transparent
+ syn match iconParenError ")"
+end
+
+" Numbers {{{1
+syn case ignore
-"floating point number, with dot, optional exponent
-syn match iconFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=\>"
+" integer
+syn match iconInteger "\<\d\+\>"
+syn match iconInteger "\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
-"floating point number, starting with a dot, optional exponent
-syn match iconFloat "\.\d\+\(e[-+]\=\d\+\)\=\>"
+" real with trailing dot
+syn match iconReal "\<\d\+\."
-"floating point number, without dot, with exponent
-syn match iconFloat "\<\d\+e[-+]\=\d\+\>"
+" real, with dot, optional exponent
+syn match iconReal "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>"
-"radix number
-syn match iconRadix "\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
+" real, with leading dot, optional exponent
+syn match iconReal "\.\d\+\%(e[-+]\=\d\+\)\=\>"
+" real, without dot, with exponent
+syn match iconReal "\<\d\+e[-+]\=\d\+\>"
-" syn match iconIdentifier "\<[a-z_][a-z0-9_]*\>"
+syn cluster iconNumber contains=iconInteger,iconReal
syn case match
-" Comment
-syn match iconComment "#.*" contains=iconTodo,iconSpaceError
-
-syn region iconPreCondit start="^\s*$\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=iconComment,iconString,iconCharacter,iconNumber,iconCommentError,iconSpaceError
-
-syn region iconIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
-syn match iconIncluded contained "<[^>]*>"
-syn match iconInclude "^\s*$\s*include\>\s*["<]" contains=iconIncluded
-"syn match iconLineSkip "\\$"
-
-syn cluster iconPreProcGroup contains=iconPreCondit,iconIncluded,iconInclude,iconDefine,iconInParen,iconUserLabel
-
-syn region iconDefine start="^\s*$\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@iconPreProcGroup
+" Comments {{{1
+syn keyword iconTodo TODO FIXME XXX BUG contained
+syn match iconComment "#.*" contains=iconTodo,iconSpaceError,@Spell
+syn match iconDocField "^#\s\+\zs\%(File\|Subject\|Authors\=\|Date\|Version\|Links\|Requires\|See also\):" contained
-"wt:syn region iconPreProc "start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" "end="$" contains=ALLBUT,@iconPreProcGroup
-
-" Highlight User Labels
-
-" syn cluster iconMultiGroup contains=iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
+if exists("icon_no_comment_fold")
+ syn region iconDocumentation start="\%^#\{2,}\%(\n#\+\%(\s\+.*\)\=\)\+" end="^#\+\n\s*$" contains=iconDocField keepend
+else
+ syn region iconMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=iconComment keepend fold transparent
+ syn region iconDocumentation start="\%^#\{2,}\%(\n#\)\+" end="^#\+\n\%([^#]\|$\)" contains=iconDocField keepend fold
+endif
+" Preprocessor {{{1
+syn match iconPreInclude '^\s*\zs$\s*include\>\ze\s*"' nextgroup=iconIncluded skipwhite
+syn match iconIncluded '"[^"]\+"' contained
+
+syn region iconPreDefine start="^\s*\zs$\s*\%(define\|undef\)\>" end="$" oneline contains=ALLBUT,@iconPreGroup
+syn region iconPreProc start="^\s*\zs$\s*\%(error\|line\)\>" end="$" oneline contains=ALLBUT,@iconPreGroup
+syn region iconPreConditional start="^\s*\zs$\s*\%(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" end="$" oneline contains=iconComment,iconString,iconCset,iconNumber,iconSpaceError
+
+syn cluster iconPreGroup contains=iconPreCondit,iconPreInclude,iconIncluded,iconPreDefine
+
+syn match iconPreSymbol "_V\d\+"
+syn keyword iconPreSymbol _ACORN _AMIGA _ARM_FUNCTIONS _ASCII _CALLING
+syn keyword iconPreSymbol _CO_EXPRESSIONS _COMPILED _DIRECT_EXECUTION
+syn keyword iconPreSymbol _DOS_FUNCTIONS _EBCDIC _EVENT_MONITOR
+syn keyword iconPreSymbol _EXECUTABLE_IMAGES _EXTERNAL_FUNCTIONS
+syn keyword iconPreSymbol _EXTERNAL_VALUES _INTERPRETED _KEYBOARD_FUNCTIONS
+syn keyword iconPreSymbol _LARGE_INTEGERS _MACINTOSH _MEMORY_MONITOR _MSDOS
+syn keyword iconPreSymbol _MSDOS_386 _MULTIREGION _MULTITASKING _OS2 _PIPES
+syn keyword iconPreSymbol _PORT _PRESENTATION_MGR _RECORD_IO _STRING_INVOKE
+syn keyword iconPreSymbol _SYSTEM_FUNCTION _UNIX _VISUALIZATION _VMS
+syn keyword iconPreSymbol _WINDOW_FUNCTIONS _X_WINDOW_SYSTEM
+
+" Syncing {{{1
if !exists("icon_minlines")
- let icon_minlines = 15
+ let icon_minlines = 250
endif
exec "syn sync ccomment iconComment minlines=" . icon_minlines
-" Define the default highlighting.
-
-" Only when an item doesn't have highlighting
-
-" The default methods for highlighting. Can be overridden later
+" Default Highlighting {{{1
-" hi def link iconSpecialCharacter iconSpecial
+hi def link iconParenError iconError
+hi def link iconBracketError iconError
+hi def link iconBraceError iconError
+hi def link iconSpaceError iconError
+hi def link iconError Error
-hi def link iconOctalError iconError
-hi def link iconParenError iconError
-hi def link iconInParen iconError
-hi def link iconCommentError iconError
-hi def link iconSpaceError iconError
-hi def link iconCommentError iconError
-hi def link iconIncluded iconString
-hi def link iconCommentString iconString
-hi def link iconComment2String iconString
-hi def link iconCommentSkip iconComment
+hi def link iconInteger Number
+hi def link iconReal Float
+hi def link iconString String
+hi def link iconCset String
+hi def link iconStringSpecial SpecialChar
-hi def link iconUserLabel Label
-hi def link iconCharacter Character
-hi def link iconNumber Number
-hi def link iconRadix Number
-hi def link iconFloat Float
-hi def link iconInclude Include
hi def link iconPreProc PreProc
-hi def link iconDefine Macro
-hi def link iconError Error
-hi def link iconStatement Statement
-hi def link iconPreCondit PreCondit
-hi def link iconString String
-hi def link iconCset String
-hi def link iconComment Comment
-hi def link iconSpecial SpecialChar
-hi def link iconTodo Todo
-hi def link iconStorageClass StorageClass
-hi def link iconFunction Statement
-hi def link iconReserved Label
-hi def link iconKeyword Operator
+hi def link iconIncluded iconString
+hi def link iconPreInclude Include
+hi def link iconPreSymbol iconPreProc
+hi def link iconPreDefine Define
+hi def link iconPreConditional PreCondit
-"hi def link iconIdentifier Identifier
+hi def link iconStatement Statement
+hi def link iconStorageClass StorageClass
+hi def link iconFunction Function
+hi def link iconReserved Label
+hi def link iconLink Include
+hi def link iconKeyword Keyword
+hi def link iconComment Comment
+hi def link iconTodo Todo
+hi def link iconDocField SpecialComment
+hi def link iconDocumentation Comment
+" Postscript {{{1
let b:current_syntax = "icon"
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/syntax/initng.vim b/runtime/syntax/initng.vim
index 5d7685cde1..959c79a176 100644
--- a/runtime/syntax/initng.vim
+++ b/runtime/syntax/initng.vim
@@ -20,7 +20,6 @@ endif
syn case match
let is_bash = 1
-unlet! b:current_syntax
syn include @shTop syntax/sh.vim
syn region initngService matchgroup=initngServiceHeader start="^\s*\(service\|virtual\|daemon\|class\|cron\)\s\+\(\(\w\|[-/*]\)\+\(\s\+:\s\+\(\w\|[-/*]\)\+\)\?\)\s\+{" end="}" contains=@initngServiceCluster
diff --git a/runtime/syntax/ipfilter.vim b/runtime/syntax/ipfilter.vim
index a7b7df2bac..c00762623f 100644
--- a/runtime/syntax/ipfilter.vim
+++ b/runtime/syntax/ipfilter.vim
@@ -1,7 +1,7 @@
" ipfilter syntax file
" Language: ipfilter configuration file
" Maintainer: Hendrik Scholz <hendrik@scholz.net>
-" Last Change: 2005 Jan 27
+" Last Change: 2022 Jun 14
"
" http://www.wormulon.net/files/misc/ipfilter.vim
"
@@ -52,3 +52,4 @@ hi def link IPFNetmask String
hi def link IPFAny Statement
hi def link IPFProto Identifier
+let b:current_syntax = 'ipfilter'
diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim
index c9bb5dc2d4..00d6071944 100644
--- a/runtime/syntax/java.vim
+++ b/runtime/syntax/java.vim
@@ -2,7 +2,7 @@
" Language: Java
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
" URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim
-" Last Change: 2018 July 26
+" Last Change: 2022 Jun 08
" Please check :help java.vim for comments on some of the options available.
@@ -23,8 +23,6 @@ set cpo&vim
syn match javaError "[\\@`]"
syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/"
-syn match javaOK "\.\.\."
-
" use separate name so that it can be deleted in javacc.vim
syn match javaError2 "#\|=<"
hi def link javaError2 javaError
@@ -59,8 +57,12 @@ syn match javaUserLabelRef "\k\+" contained
syn match javaVarArg "\.\.\."
syn keyword javaScopeDecl public protected private abstract
+function s:isModuleInfoDeclarationCurrentBuffer() abort
+ return fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!'
+endfunction
+
" Java Modules(Since Java 9, for "module-info.java" file)
-if fnamemodify(bufname("%"), ":t") == "module-info.java"
+if s:isModuleInfoDeclarationCurrentBuffer()
syn keyword javaModuleStorageClass module transitive
syn keyword javaModuleStmt open requires exports opens uses provides
syn keyword javaModuleExternal to with
@@ -72,20 +74,42 @@ if exists("java_highlight_java_lang_ids")
endif
if exists("java_highlight_all") || exists("java_highlight_java") || exists("java_highlight_java_lang")
" java.lang.*
- syn match javaLangClass "\<System\>"
- syn keyword javaR_JavaLang NegativeArraySizeException ArrayStoreException IllegalStateException RuntimeException IndexOutOfBoundsException UnsupportedOperationException ArrayIndexOutOfBoundsException ArithmeticException ClassCastException EnumConstantNotPresentException StringIndexOutOfBoundsException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException NumberFormatException NullPointerException TypeNotPresentException SecurityException
+ "
+ " The keywords of javaR_JavaLang, javaC_JavaLang, javaE_JavaLang,
+ " and javaX_JavaLang are sub-grouped according to the Java version
+ " of their introduction, and sub-group keywords (that is, class
+ " names) are arranged in alphabetical order, so that future newer
+ " keywords can be pre-sorted and appended without disturbing
+ " the current keyword placement. The below _match_es follow suit.
+
+ syn keyword javaR_JavaLang ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException ClassCastException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException IndexOutOfBoundsException NegativeArraySizeException NullPointerException NumberFormatException RuntimeException SecurityException StringIndexOutOfBoundsException IllegalStateException UnsupportedOperationException EnumConstantNotPresentException TypeNotPresentException IllegalCallerException LayerInstantiationException
syn cluster javaTop add=javaR_JavaLang
syn cluster javaClasses add=javaR_JavaLang
hi def link javaR_JavaLang javaR_Java
- syn keyword javaC_JavaLang Process RuntimePermission StringKeySet CharacterData01 Class ThreadLocal ThreadLocalMap CharacterData0E Package Character StringCoding Long ProcessImpl ProcessEnvironment Short AssertionStatusDirectives 1PackageInfoProxy UnicodeBlock InheritableThreadLocal AbstractStringBuilder StringEnvironment ClassLoader ConditionalSpecialCasing CharacterDataPrivateUse StringBuffer StringDecoder Entry StringEntry WrappedHook StringBuilder StrictMath State ThreadGroup Runtime CharacterData02 MethodArray Object CharacterDataUndefined Integer Gate Boolean Enum Variable Subset StringEncoder Void Terminator CharsetSD IntegerCache CharacterCache Byte CharsetSE Thread SystemClassLoaderAction CharacterDataLatin1 StringValues StackTraceElement Shutdown ShortCache String ConverterSD ByteCache Lock EnclosingMethodInfo Math Float Value Double SecurityManager LongCache ProcessBuilder StringEntrySet Compiler Number UNIXProcess ConverterSE ExternalData CaseInsensitiveComparator CharacterData00 NativeLibrary
+ " Member enumerations:
+ syn match javaC_JavaLang "\%(\<Thread\.\)\@<=\<State\>"
+ syn match javaC_JavaLang "\%(\<Character\.\)\@<=\<UnicodeScript\>"
+ syn match javaC_JavaLang "\%(\<ProcessBuilder\.Redirect\.\)\@<=\<Type\>"
+ syn match javaC_JavaLang "\%(\<StackWalker\.\)\@<=\<Option\>"
+ syn match javaC_JavaLang "\%(\<System\.Logger\.\)\@<=\<Level\>"
+ " Member classes:
+ syn match javaC_JavaLang "\%(\<Character\.\)\@<=\<Subset\>"
+ syn match javaC_JavaLang "\%(\<Character\.\)\@<=\<UnicodeBlock\>"
+ syn match javaC_JavaLang "\%(\<ProcessBuilder\.\)\@<=\<Redirect\>"
+ syn match javaC_JavaLang "\%(\<ModuleLayer\.\)\@<=\<Controller\>"
+ syn match javaC_JavaLang "\%(\<Runtime\.\)\@<=\<Version\>"
+ syn match javaC_JavaLang "\%(\<System\.\)\@<=\<LoggerFinder\>"
+ syn match javaC_JavaLang "\%(\<Enum\.\)\@<=\<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 match javaC_JavaLang "\<System\>" " See javaDebug.
syn cluster javaTop add=javaC_JavaLang
syn cluster javaClasses add=javaC_JavaLang
hi def link javaC_JavaLang javaC_Java
- syn keyword javaE_JavaLang IncompatibleClassChangeError InternalError UnknownError ClassCircularityError AssertionError ThreadDeath IllegalAccessError NoClassDefFoundError ClassFormatError UnsupportedClassVersionError NoSuchFieldError VerifyError ExceptionInInitializerError InstantiationError LinkageError NoSuchMethodError Error UnsatisfiedLinkError StackOverflowError AbstractMethodError VirtualMachineError OutOfMemoryError
+ syn keyword javaE_JavaLang AbstractMethodError ClassCircularityError ClassFormatError Error IllegalAccessError IncompatibleClassChangeError InstantiationError InternalError LinkageError NoClassDefFoundError NoSuchFieldError NoSuchMethodError OutOfMemoryError StackOverflowError ThreadDeath UnknownError UnsatisfiedLinkError VerifyError VirtualMachineError ExceptionInInitializerError UnsupportedClassVersionError AssertionError BootstrapMethodError
syn cluster javaTop add=javaE_JavaLang
syn cluster javaClasses add=javaE_JavaLang
hi def link javaE_JavaLang javaE_Java
- syn keyword javaX_JavaLang CloneNotSupportedException Exception NoSuchMethodException IllegalAccessException NoSuchFieldException Throwable InterruptedException ClassNotFoundException InstantiationException
+ syn keyword javaX_JavaLang ClassNotFoundException CloneNotSupportedException Exception IllegalAccessException InstantiationException InterruptedException NoSuchMethodException Throwable NoSuchFieldException ReflectiveOperationException
syn cluster javaTop add=javaX_JavaLang
syn cluster javaClasses add=javaX_JavaLang
hi def link javaX_JavaLang javaX_Java
@@ -118,7 +142,7 @@ if exists("java_space_errors")
endif
endif
-syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString
+syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" end="->" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString
syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel
syn keyword javaLabel default
@@ -126,7 +150,7 @@ syn keyword javaLabel default
" annoying. Was: if !exists("java_allow_cpp_keywords")
" The following cluster contains all java groups except the contained ones
-syn cluster javaTop add=javaExternal,javaError,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaClassDecl,javaClassDecl,javaScopeDecl,javaError,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg
+syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg
" Comments
@@ -153,7 +177,7 @@ syn cluster javaTop add=javaComment,javaLineComment
if !exists("java_ignore_javadoc") && main_syntax != 'jsp'
syntax case ignore
" syntax coloring for javadoc comments (HTML)
- syntax include @javaHtml <sfile>:p:h/html.vim
+ syntax include @javaHtml syntax/html.vim
unlet b:current_syntax
" HTML enables spell checking for all text that is not in a syntax item. This
" is wrong for Java (all identifiers would be spell-checked), so it's undone
@@ -336,7 +360,7 @@ hi def link htmlComment Special
hi def link htmlCommentPart Special
hi def link javaSpaceError Error
-if fnamemodify(bufname("%"), ":t") == "module-info.java"
+if s:isModuleInfoDeclarationCurrentBuffer()
hi def link javaModuleStorageClass StorageClass
hi def link javaModuleStmt Statement
hi def link javaModuleExternal Include
@@ -348,6 +372,7 @@ if main_syntax == 'java'
unlet main_syntax
endif
+delfunction! s:isModuleInfoDeclarationCurrentBuffer
let b:spell_options="contained"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim
index 1ab1c2db11..e513137984 100644
--- a/runtime/syntax/javascript.vim
+++ b/runtime/syntax/javascript.vim
@@ -7,7 +7,7 @@
" (ss) repaired several quoting and grouping glitches
" (ss) fixed regex parsing issue with multiple qualifiers [gi]
" (ss) additional factoring of keywords, globals, and members
-" Last Change: 2021 Mar 30
+" Last Change: 2022 Jun 09
" 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke)
" 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder)
@@ -39,9 +39,16 @@ syn region javaScriptStringT start=+`+ skip=+\\\\\|\\`+ end=+`+ contai
syn region javaScriptEmbed start=+${+ end=+}+ contains=@javaScriptEmbededExpr
+" number handling by Christopher Leonard chris.j.leonard@gmx.com
syn match javaScriptSpecialCharacter "'\\.'"
-syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
-syn match javaScriptNumber "-\=\<\d\+\%(_\d\+\)*\>"
+syn match javaScriptNumber "\<0[bB][0-1]\+\(_[0-1]\+\)*\>"
+syn match javaScriptNumber "\<0[oO][0-7]\+\(_[0-7]\+\)*\>"
+syn match javaScriptNumber "\<0\([0-7]\+\(_[0-7]\+\)*\)\?\>"
+syn match javaScriptNumber "\<0[xX][0-9a-fA-F]\+\(_[0-9a-fA-F]\+\)*\>"
+syn match javaScriptNumber "\<\d\+\(_\d\+\)*[eE][+-]\?\d\+\>"
+syn match javaScriptNumber "\<[1-9]\d*\(_\d\+\)*\(\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\)\?\>"
+syn match javaScriptNumber "\<\(\d\+\(_\d\+\)*\)\?\.\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\>"
+syn match javaScriptNumber "\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\>"
syn region javaScriptRegexpString start=+[,(=+]\s*/[^/*]+ms=e-1,me=e-1 skip=+\\\\\|\\/+ end=+/[gimuys]\{0,2\}\s*$+ end=+/[gimuys]\{0,2\}\s*[+;.,)\]}]+me=e-1 end=+/[gimuys]\{0,2\}\s\+\/+me=e-1 contains=@htmlPreproc,javaScriptComment oneline
syn keyword javaScriptConditional if else switch
diff --git a/runtime/syntax/krl.vim b/runtime/syntax/krl.vim
new file mode 100644
index 0000000000..a50790841e
--- /dev/null
+++ b/runtime/syntax/krl.vim
@@ -0,0 +1,458 @@
+" Vim syntax file
+" Language: Kuka Robot Language
+" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
+" Version: 3.0.0
+" Last Change: 18. Apr 2022
+" Credits: Thanks for contributions to this to Michael Jagusch
+" Thanks for beta testing to Thomas Baginski
+"
+" Note to self:
+" for testing perfomance
+" open a 1000 lines file.
+" :syntime on
+" G
+" hold down CTRL-U until reaching top
+" :syntime report
+
+" Init {{{
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:keepcpo = &cpo
+set cpo&vim
+
+" if colorscheme is tortus(less)? krlGroupName defaults to 1
+if get(g:, 'colors_name', " ") =~ '\<tortus'
+ \&& !exists("g:krlGroupName")
+ let g:krlGroupName=1
+endif
+" krlGroupName defaults to 0 if it's not initialized yet or 0
+if !get(g:, "krlGroupName", 0)
+ let g:krlGroupName = 0
+endif
+
+" krl does ignore case
+syn case ignore
+" take #, $ and & into keyword (syntax only)
+syn iskeyword @,48-57,_,192-255,#,$,&
+" spell checking
+syn spell notoplevel
+" }}} init
+
+" Comment and Folding {{{
+
+" Special Comment
+
+" TODO Comment
+syn keyword krlTodo contained TODO FIXME XXX
+highlight default link krlTodo Todo
+
+" Debug Comment
+syn keyword krlDebug contained DEBUG
+highlight default link krlDebug Debug
+
+" Comment
+" none move fold comment until second ;
+syn match krlFoldComment /\c\v^\s*;\s*%(end)?fold>[^;]*/ containedin=krlFold contains=krlSingleQuoteString,krlInteger,krlFloat,krlMovement,krlDelimiter,krlBoolean
+highlight default link krlFoldComment Comment
+
+" move fold comment until second ;
+syn match krlMoveFoldComment /\c\v^\s*;\s*fold>[^;]*<s?%(ptp|lin|circ|spl)(_rel)?>[^;]*/ containedin=krlFold contains=krlInteger,krlFloat,krlMovement,krlDelimiter
+highlight default link krlMoveFoldComment Comment
+
+" things to highlight in a fold line
+syn keyword krlFoldHighlights CONT IN SYN OUT containedin=krlFoldComment
+syn match krlFoldHighlights /\c\v<(M|F|E|A|t|i|bin|binin|UP|SPSMAKRO)\d+>/ containedin=krlFoldComment
+if g:krlGroupName
+ highlight default link krlFoldHighlights Sysvars
+else
+ " default color for Fold Highlights
+endif
+syn keyword krlVkrcFoldConstants EIN AUS containedin=krlFoldComment
+highlight default link krlVkrcFoldConstants Boolean
+
+" Comment without Fold, also includes endfold lines and fold line part after second ;
+syn match krlComment /\c\v;\s*%(<%(end)?fold>)@!.*$/ containedin=krlFold contains=krlTodo,krlDebug,@Spell
+" Commented out Fold line: "; ;FOLD PTP..."
+syn match krlComment /\c\v^\s*;\s*;.*$/ contains=krlTodo,krlDebug
+highlight default link krlComment Comment
+
+if has("conceal") && get(g:, 'krlConcealFoldTail', 1)
+ syn match krlConcealFoldTail /\c\v(^\s*;\s*fold[^;]*)@250<=;%(--|\s*<fold>|\s*<endfold>)@!.*$/ transparent containedin=krlComment conceal cchar=*
+endif
+" }}} Comment and Folding
+
+" Header {{{
+syn match krlHeader /&\a\w*/
+highlight default link krlHeader PreProc
+" }}} Header
+
+" Operator {{{
+" Boolean operator
+syn keyword krlBoolOperator and or exor not b_and b_or b_exor b_not
+highlight default link krlBoolOperator Operator
+" Arithmetic operator
+syn match krlArithOperator /[+-]/ containedin=krlFloat
+syn match krlArithOperator /[*/]/
+highlight default link krlArithOperator Operator
+" Compare operator
+syn match krlCompOperator /[<>=]/
+highlight default link krlCompOperator Operator
+" Geometric operator
+" Do not move the : operator
+" Must be present befor krlParamdef
+syn match krlGeomOperator /[:]/
+" syn match krlGeomOperator /[:]/ containedin=krlLabel,krlParamdef
+highlight default link krlGeomOperator Operator
+" }}} Operator
+
+" Type, StorageClass and Typedef {{{
+" Simple data types
+syn keyword krlType bool char real int containedin=krlAnyType
+" External program and function
+syn keyword krlType ext extfct extfctp extp containedin=krlAnyType
+" Communication
+syn keyword krlType signal channel containedin=krlAnyType
+highlight default link krlType Type
+" StorageClass
+syn keyword krlStorageClass decl global const struc enum
+highlight default link krlStorageClass StorageClass
+" .dat file public
+syn keyword krlDatStorageClass public
+highlight default link krlDatStorageClass StorageClass
+" Parameter StorageClass
+" Do not move the :in/:out
+" Must be present after krlGeomOperator
+syn match krlParamdef /[:]\s*in\>/
+syn match krlParamdef /[:]\s*out\>/
+highlight default link krlParamdef StorageClass
+" Not a typedef but I like to have those highlighted
+" different then types, structures or strorage classes
+syn keyword krlTypedef DEF DEFFCT ENDFCT DEFDAT ENDDAT
+syn match krlTypedef /^\s*END\>/
+highlight default link krlTypedef Typedef
+" }}} Type, StorageClass and Typedef
+
+" Delimiter {{{
+syn match krlDelimiter /[\[\](),\\]/
+highlight default link krlDelimiter Delimiter
+" }}} Delimiter
+
+" Constant values {{{
+" Boolean
+syn keyword krlBoolean true false containedin=krlStructVal
+highlight default link krlBoolean Boolean
+" Binary integer
+syn match krlBinaryInt /'b[01]\+'/ containedin=krlStructVal
+highlight default link krlBinaryInt Number
+" Hexadecimal integer
+syn match krlHexInt /'h[0-9a-fA-F]\+'/ containedin=krlStructVal
+highlight default link krlHexInt Number
+" Integer
+syn match krlInteger /\W\@1<=[+-]\?\d\+/ containedin=krlStructVal,krlFloat contains=krlArithOperator
+highlight default link krlInteger Number
+" Float
+syn match krlFloat /\v\W@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ containedin=krlStructVal
+highlight default link krlFloat Float
+" String
+syn region krlString start=/"/ end=/"/ oneline containedin=krlStructVal contains=@Spell
+highlight default link krlString String
+syn match krlSpecialChar /[|]/ containedin=krlString
+highlight default link krlSpecialChar SpecialChar
+" String within a fold line
+syn region krlSingleQuoteString start=/'/ end=/'/ oneline contained contains=@Spell
+highlight default link krlSingleQuoteString String
+" Enum
+syn match krlEnumVal /#\s*\a\w*/ containedin=krlStructVal
+highlight default link krlEnumVal Constant
+" }}} Constant values
+
+" Predefined Structure and Enum {{{
+" Predefined structures and enums found in
+" /r1/mada/$*.dat, /r1/steu/$*.dat and
+" /r1/system/$config.dat as well as
+" basisTech, gripperTech and spotTech
+"
+" Predefined data types found in krc1
+syn keyword krlStructure servopara keymove powermodul trace techangle tech techfct techcps techfctctrl axis_inc axis_cal date display_var pro_ip con bus
+syn keyword krlEnum ident_state sig_state move_state async_state emt_mode boxmode msg_prm_typ msg_typ cmd_stat asys trace_state trace_mode direction techsys techgeoref techclass techmode hpu_key_val pro_state eax transsys mode_move cosys device rotsys emstop cause_t
+"
+" Predefined data types found in kss functions
+syn keyword krlEnum ediagstate rdc_fs_state ret_c_psync_e var_type cancel_psync_e sys_vars
+syn keyword krlStructure siginf rw_rdc_file rw_mam_file diagpar_t error_t stopmess case_sense_t msgbuf_t e3pos e3axis diagopt_t
+"
+" Predefined structures for movement
+syn keyword krlStructure frame e6pos pos e6axis axis
+syn keyword krlStructure fdat ldat pdat
+syn keyword krlStructure load inertia
+"
+" Predefined structures for shapes
+syn keyword krlStructure axbox cylinder box
+"
+" Predefined structures and enums found in /r1/mada/$machine.dat
+syn keyword krlStructure cp fra acc_car jerk_struc dhart spin trpspin ex_kin et_ax maxtool
+syn keyword krlEnum individual_mames supply_voltage kinclass main_axis wrist_axis sw_onoff
+"
+" Predefined structures and enums found in /r1/mada/$robcor.dat
+" syn keyword krlStructure
+syn keyword krlEnum adap_acc model_type control_parameter eko_mode
+"
+" Predefined structures and enums found in /steu/mada/$custom.dat
+syn keyword krlStructure pro_io_t ser ext_mod_t coop_krc ws_config bin_type coop_update_t ldc_reaction
+syn keyword krlEnum axis_of_coordinates spline_para_variant target_status cp_vel_type cp_statmon
+"
+" Predefined structures and enums found in /steu/mada/$machine.dat
+syn keyword krlStructure emstop_path boxstatesafein boxstatesafeout
+syn keyword krlEnum digincode
+"
+" Predefined structures and enums found in /steu/mada/$option.dat
+syn keyword krlStructure msg_t
+" syn keyword krlEnum
+"
+" Predefined structures and enums found in /r1/system/$config.dat
+" BasisTech
+syn keyword krlStructure dig_out_type ctrl_in_t ctrl_out_t fct_out_t fct_in_t odat basis_sugg_t out_sugg_t md_state machine_def_t machine_tool_t machine_frame_t trigger_para constvel_para condstop_para adat tm_sugg_t tqm_tqdat_t sps_prog_type
+syn keyword krlEnum bas_command out_modetype ipo_m_t apo_mode_t funct_type p00_command timer_actiontype
+"
+" GripperTech
+syn keyword krlStructure grp_typ grp_types grp_sugg_t
+syn keyword krlEnum on_off_typ apo_typ
+"
+" SpotTech
+syn keyword krlStructure spot_type spot_sugg_t
+syn keyword krlEnum s_command s_pair_slct command_retr
+"
+" VW
+syn keyword krlStructure vw_mpara_typ zangentyp zangenbedingung ibszangentyp last_ibs_typ verr_typ verrcheck_t t_fb_state kollisionsdaten state_t modus_t
+syn keyword krlEnum synctype dir_typ subtype ari_typ bool_typ vw_command ibgn_command vw_user_cmd move_types adv_t_type bas_type ibs_mode_typ vw_user_cmd pro_mode mode_op
+"
+" ProgCoop
+syn keyword krlStructure ydat
+" syn keyword krlEnum
+"
+" bas.src
+syn keyword krlStructure cont
+syn keyword krlEnum esys ipo_mode circ_mode circ_type ori_type var_state
+"
+" MsgLib.src
+syn keyword krlStructure KrlMsg_T KrlMsgParType_T KrlMsgPar_T KrlMsgOpt_T KrlMsgDlgSK_T
+syn keyword krlEnum EKrlMsgType
+"
+highlight default link krlStructure Structure
+highlight default link krlEnum Structure
+" }}} Predefined Structure and Enum
+
+" System variable {{{
+syn match krlSysvars /\<\$\a[a-zA-Z0-9_.]*/
+if g:krlGroupName
+ highlight default link krlSysvars Sysvars
+else
+ " default color for Sysvars
+endif
+" }}} System variable
+
+" Statements, keywords et al {{{
+" continue
+syn keyword krlContinue continue
+if g:krlGroupName
+ highlight default link krlContinue Continue
+else
+ highlight default link krlContinue Statement
+endif
+" interrupt
+syn match krlStatement /\v\c%(<global>\s+)?<INTERRUPT>%(\s+<decl>)?/ contains=krlStorageClass
+" keywords
+syn keyword krlStatement wait on off enable disable stop trigger with when distance onstart delay do prio import is minimum maximum confirm on_error_proceed
+syn match krlStatement /\v\c%(<wait\s+)@7<=<sec>/
+syn match krlStatement /\v\c%(<when\s+)@7<=<path>/
+highlight default link krlStatement Statement
+" Conditional
+syn keyword krlConditional if then else endif switch case default endswitch skip endskip
+highlight default link krlConditional Conditional
+" Repeat
+syn keyword krlRepeat for to step endfor while endwhile repeat until loop endloop exit
+highlight default link krlRepeat Repeat
+" Label
+syn keyword krlLabel goto
+syn match krlLabel /^\s*\w\+:\ze\s*\%(;.*\)\?$/
+highlight default link krlLabel Label
+" Keyword
+syn keyword krlKeyword anin anout digin
+highlight default link krlKeyword Keyword
+" Exception
+syn keyword krlException return resume halt
+highlight default link krlException Exception
+" }}} Statements, keywords et al
+
+" special keywords for movement commands {{{
+syn keyword krlMovement PTP PTP_REL LIN LIN_REL CIRC CIRC_REL SPL SPL_REL SPTP SPTP_REL SLIN SLIN_REL SCIRC SCIRC_REL
+syn keyword krlMovement ASYPTP ASYCONT ASYSTOP ASYCANCEL MOVE_EMI
+syn match krlMovement /\v\c^\s*<BRAKE(\s+F)?>/
+if g:krlGroupName
+ highlight default link krlMovement Movement
+else
+ highlight default link krlMovement Special
+endif
+" movement modifiers
+syn match krlMoveBlockInst /\c\v^\s*TIME_BLOCK\s+(START|PART|END)/
+syn match krlMoveBlockInst /\c\v^\s*CONST_VEL\s+(START|END)/
+syn keyword krlMoveBlockInst ptp_spline spline endspline
+highlight default link krlMoveBlockInst Statement
+syn keyword krlMoveMod ca c_ptp c_dis c_vel c_ori c_spl
+if g:krlGroupName
+ highlight default link krlMoveMod Movement
+else
+ highlight default link krlMoveMod Special
+endif
+" }}} special keywords for movement commands
+
+" Structure value {{{
+" avoid coloring structure component names
+syn match krlNames /\.[a-zA-Z_][.a-zA-Z0-9_$]*/
+syn match krlNames contained /[a-zA-Z_][.a-zA-Z0-9_$]*/
+" highlight default link krlNames None
+" Structure value
+syn region krlStructVal start=/{/ end=/}/ oneline containedin=krlStructVal contains=krlNames
+highlight default link krlStructVal Delimiter
+" }}} Structure value
+
+" BuildInFunction {{{
+syn keyword krlBuildInFunction contained Pulse
+syn keyword krlBuildInFunction contained m_comment
+syn keyword krlBuildInFunction contained is_key_pressed
+syn keyword krlBuildInFunction contained set_opt_filter
+syn keyword krlBuildInFunction contained timer_limit
+syn keyword krlBuildInFunction contained tool_adj
+syn keyword krlBuildInFunction contained FRand
+syn keyword krlBuildInFunction contained ExecFunc eb_test EB EK EO LK mbx_rec
+" safe robot
+syn keyword krlbuildinfunction contained get_AxesMask get_BrakeTest_Time
+" math
+syn keyword krlBuildInFunction contained Abs Sin Cos Acos Tan Atan Atan2 Sqrt
+syn keyword krlBuildInFunction contained Forward Inverse inv_pos
+" cFoo sFoo
+syn keyword krlBuildInFunction contained cClose cOpen cRead cWrite sRead sWrite
+" string
+syn keyword krlBuildInFunction contained StrToBool StrToInt StrToReal StrToString StrToFrame StrToPos StrToE3Pos StrToE6Pos StrToAxis StrToE3Axis StrToE6Axis
+syn keyword krlBuildInFunction contained StrAdd StrClear StrCopy StrComp StrFind StrLen StrDeclLen StrToBool StrToInt StrToReal StrToString
+" diag
+syn keyword krlBuildInFunction contained diag_start diag_stop get_DiagState
+" rdc mam pid
+syn keyword krlBuildInFunction contained CheckPidOnRdc check_mam_on_rdc get_rdc_fs_state
+syn keyword krlBuildInFunction contained set_mam_on_hd copy_mam_hd_to_rdc copy_mam_rdc_to_hd
+syn keyword krlBuildInFunction contained PidToHd PidToRdc
+syn keyword krlBuildInFunction contained cal_to_rdc rdc_file_to_hd
+syn keyword krlBuildInFunction contained delete_pid_on_rdc delete_rdc_content
+syn keyword krlBuildInFunction contained create_rdc_archive restore_rdc_archive
+" ioctl
+syn keyword krlBuildInFunction contained IOCtl cIOCtl
+syn keyword krlBuildInFunction contained WSpaceGive WSpaceTake
+" sync
+syn keyword krlBuildInFunction contained Sync SyncCmd CancelProgSync
+" remote
+syn keyword krlBuildInFunction contained RemoteCmd RemoteRead
+" msg/dlg
+syn keyword krlBuildInFunction contained IsMessageSet clear_KrlMsg get_MsgBuffer exists_KrlDlg exists_KrlMsg set_KrlDlg set_KrlDlgAnswer set_KrlMsg
+" robvers
+syn keyword krlBuildInFunction contained maximize_UsedxRobvers set_UsedxRobvers
+" md_foo
+syn keyword krlBuildInFunction contained md_Cmd md_GetState md_SetState md_Asgn
+" emi
+syn keyword krlBuildInFunction contained emi_ActPos emi_EndPos emi_StartPos emi_RecState emi_RecName
+" var
+syn keyword krlBuildInFunction contained cast_from cast_to
+syn keyword krlBuildInFunction contained GetVarsize GetCycDef get_sig_inf get_decl_place VarType VarState
+" sys
+syn keyword krlBuildInFunction contained GetSysState get_system_data set_system_data set_system_data_delayed
+" err
+syn keyword krlBuildInFunction contained err_clear err_raise
+" motion
+syn keyword krlBuildInFunction contained delete_backward_buffer rob_stop rob_stop_release set_brake_delay suppress_repositioning VectorMoveOn VectorMoveOff
+" torque
+syn keyword krlBuildInFunction contained set_torque_limits reset_torque_limits
+" krc1
+syn keyword krlBuildInFunction contained cLcopy cCurpos cNew cClear cRelease cKey
+if g:krlGroupName
+ highlight default link krlBuildInFunction BuildInFunction
+else
+ highlight default link krlBuildInFunction Function
+endif
+" }}} BuildInFunction
+
+" Function {{{
+syn match krlFunction /[a-zA-Z_]\w* *(/me=e-1 contains=krlBuildInFunction
+highlight default link krlFunction Function
+" }}} Function
+
+" Error {{{
+if get(g:, 'krlShowError', 1)
+ " some more or less common typos
+ "
+ " vars or funcs >24 chars are not possible in krl. a234567890123456789012345
+ syn match krlError0 /\w\{25,}/ containedin=krlFunction,krlNames,krlLabel,krlAnyType,krlEnumVal,krlSysvars
+ "
+ " should be interrupt (on|off) \w+
+ syn match krlError1 /\vinterrupt[ \t(]+[_$a-zA-Z0-9]+[_$a-zA-Z0-9.\[\]()+\-*/]*[ \t)]+o%(n|ff)>/
+ "
+ " for bla==5 to 7...
+ " ||
+ syn match krlError3 /\v%(^\s*for%(\(|\s)+[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/ ]*\s*)@<=[:=]\=/
+ "
+ " TODO optimize performance
+ " wait for a=b
+ " |
+ syn match krlError4 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;<>=])@<=\=[^=]/
+ "
+ " wait for a><b
+ " ||
+ syn match krlError5 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+)@<=\>\s*\</
+ "
+ " if (a==5) (b==6) ...
+ " |||
+ syn match krlError6 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@<=\)\s*\(/
+ "
+ " TODO optimize performance
+ " a == b + 1
+ " a := b + 1
+ " ||
+ syn match krlError7 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@1<!%(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\],+\-*/]*\s*)@<=[:=]\=/
+ syn match krlError7 /\v\c%(^\s*%(decl\s+)%(global\s+)?%(const\s+)?\w+\s+\w+\s*)@<=[:=]\=/
+ syn match krlError7 /\v\c%(^\s*%(decl\s+)?%(global\s+)?%(const\s+)?%(bool\s+|int\s+|real\s+|char\s+)\w+\s*)@<=[:=]\=/
+ "
+ " this one is tricky. Make sure this does not match trigger instructions; OK, next try, now search for false positives
+ " TODO optimize performance
+ " a = b and c or (int1=int2)
+ " |
+ syn match krlError8 /\v(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/]*\s*\=[^;]*[^;<>=])@<=\=\ze[^=]/
+ "
+ " <(distance|delay|prio)> :=
+ " <(distance|delay|prio)> ==
+ " ||
+ syn match krlError9 /\v(^[^;]*<(distance|delay|prio|minimum|maximum)\s*)@<=[:=]\=/
+ "
+ " 'for', 'while' or 'repeat' followed by 'do'
+ syn match krlError10 /\c\v^\s*(until|while|for)>[^;]*<do>/
+ "
+ highlight default link krlError0 Error
+ highlight default link krlError1 Error
+ highlight default link krlError2 Error
+ highlight default link krlError3 Error
+ highlight default link krlError4 Error
+ highlight default link krlError5 Error
+ highlight default link krlError6 Error
+ highlight default link krlError7 Error
+ highlight default link krlError8 Error
+ highlight default link krlError9 Error
+ highlight default link krlError10 Error
+endif
+" }}} Error
+
+" Finish {{{
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
+let b:current_syntax = "krl"
+" }}} Finish
+
+" vim:sw=2 sts=2 et fdm=marker
diff --git a/runtime/syntax/liquid.vim b/runtime/syntax/liquid.vim
index 295a91775e..966b60f6f8 100644
--- a/runtime/syntax/liquid.vim
+++ b/runtime/syntax/liquid.vim
@@ -2,7 +2,7 @@
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.liquid
-" Last Change: 2013 May 30
+" Last Change: 2022 Mar 15
if exists('b:current_syntax')
finish
@@ -68,10 +68,10 @@ if !exists('s:subtype')
unlet s:subtype
endif
-syn region liquidStatement matchgroup=liquidDelimiter start="{%" end="%}" contains=@liquidStatement containedin=ALLBUT,@liquidExempt keepend
-syn region liquidExpression matchgroup=liquidDelimiter start="{{" end="}}" contains=@liquidExpression containedin=ALLBUT,@liquidExempt keepend
-syn region liquidComment matchgroup=liquidDelimiter start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=liquidTodo,@Spell containedin=ALLBUT,@liquidExempt keepend
-syn region liquidRaw matchgroup=liquidDelimiter start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" contains=TOP,@liquidExempt containedin=ALLBUT,@liquidExempt keepend
+syn region liquidStatement matchgroup=liquidDelimiter start="{%-\=" end="-\=%}" contains=@liquidStatement containedin=ALLBUT,@liquidExempt keepend
+syn region liquidExpression matchgroup=liquidDelimiter start="{{-\=" end="-\=}}" contains=@liquidExpression containedin=ALLBUT,@liquidExempt keepend
+syn region liquidComment matchgroup=liquidDelimiter start="{%-\=\s*comment\s*-\=%}" end="{%-\=\s*endcomment\s*-\=%}" contains=liquidTodo,@Spell containedin=ALLBUT,@liquidExempt keepend
+syn region liquidRaw matchgroup=liquidDelimiter start="{%-\=\s*raw\s*-\=%}" end="{%-\=\s*endraw\s*-\=%}" contains=TOP,@liquidExempt containedin=ALLBUT,@liquidExempt keepend
syn cluster liquidExempt contains=liquidStatement,liquidExpression,liquidComment,liquidRaw,@liquidStatement,liquidYamlHead
syn cluster liquidStatement contains=liquidConditional,liquidRepeat,liquidKeyword,@liquidExpression
@@ -79,11 +79,11 @@ syn cluster liquidExpression contains=liquidOperator,liquidString,liquidNumber,l
syn keyword liquidKeyword highlight nextgroup=liquidTypeHighlight skipwhite contained
syn keyword liquidKeyword endhighlight contained
-syn region liquidHighlight start="{%\s*highlight\s\+\w\+\s*%}" end="{% endhighlight %}" keepend
+syn region liquidHighlight start="{%-\=\s*highlight\s\+\w\+\s*-\=%}" end="{%-\= endhighlight -\=%}" keepend
for s:type in g:liquid_highlight_types
exe 'syn match liquidTypeHighlight "\<'.matchstr(s:type,'[^=]*').'\>" contained'
- exe 'syn region liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' start="{%\s*highlight\s\+'.matchstr(s:type,'[^=]*').'\s*%}" end="{% endhighlight %}" keepend contains=@liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
+ exe 'syn region liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' start="{%-\=\s*highlight\s\+'.matchstr(s:type,'[^=]*').'\s*-\=%}" end="{%-\= endhighlight -\=%}" keepend contains=@liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
endfor
unlet! s:type
@@ -92,18 +92,18 @@ syn region liquidString matchgroup=liquidQuote start=+'+ end=+'+ contained
syn match liquidNumber "-\=\<\d\+\>" contained
syn match liquidFloat "-\=\<\d\+\>\.\.\@!\%(\d\+\>\)\=" contained
syn keyword liquidBoolean true false contained
-syn keyword liquidNull null nil contained
+syn keyword liquidNull null nil blank contained
syn match liquidEmpty "\<empty\>" contained
syn keyword liquidOperator and or not contained
syn match liquidPipe '|' contained skipwhite nextgroup=liquidFilter
-syn keyword liquidFilter date capitalize downcase upcase first last join sort size strip_html strip_newlines newline_to_br replace replace_first remove remove_first truncate truncatewords prepend append minus plus times divided_by contained
+syn keyword liquidFilter date capitalize downcase upcase escape escape_once first last join sort size where uniq strip_html strip_newlines newline_to_br replace replace_first remove remove_first slice split strip truncate truncatewords prepend append url_encode url_decode abs at_most at_least ceil divided_by floor minus plus round times modulo contained
syn keyword liquidConditional if elsif else endif unless endunless case when endcase ifchanged endifchanged contained
-syn keyword liquidRepeat for endfor tablerow endtablerow in contained
-syn match liquidRepeat "\%({%\s*\)\@<=empty\>" contained
-syn keyword liquidKeyword assign cycle include with contained
+syn keyword liquidRepeat for endfor tablerow endtablerow in break continue limit offset reversed contained
+syn match liquidRepeat "\%({%-\=\s*\)\@<=empty\>" contained
+syn keyword liquidKeyword assign capture endcapture increasement decreasement cycle include with render contained
syn keyword liquidForloop forloop nextgroup=liquidForloopDot contained
syn match liquidForloopDot "\." nextgroup=liquidForloopAttribute contained
diff --git a/runtime/syntax/lsp_markdown.vim b/runtime/syntax/lsp_markdown.vim
index 90d3185673..4be7595807 100644
--- a/runtime/syntax/lsp_markdown.vim
+++ b/runtime/syntax/lsp_markdown.vim
@@ -1,23 +1,34 @@
" Vim syntax file
-" Language: lsp_markdown
-" Maintainer: Michael Lingelbach <m.j.lbach@gmail.com
-" URL: http://neovim.io
-" Remark: Uses markdown syntax file
+" Language: Markdown-like LSP docstrings
+" Maintainer: https://github.com/neovim/neovim
+" URL: http://neovim.io
+" Remark: Uses markdown syntax file
-" always source the system included markdown instead of any other installed
-" markdown.vim syntax files
+" Source the default Nvim markdown syntax, not other random ones.
execute 'source' expand('<sfile>:p:h') .. '/markdown.vim'
syn cluster mkdNonListItem add=mkdEscape,mkdNbsp
+" Don't highlight invalid markdown syntax in LSP docstrings.
+syn clear markdownError
+
syn clear markdownEscape
syntax region markdownEscape matchgroup=markdownEscape start=/\\\ze[\\\x60*{}\[\]()#+\-,.!_>~|"$%&'\/:;<=?@^ ]/ end=/./ containedin=ALL keepend oneline concealends
-" conceal html entities
+" Conceal backticks (which delimit code fragments).
+" We ignore g:markdown_syntax_conceal here.
+syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart concealends
+syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart concealends
+syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend concealends
+
+" Highlight code fragments.
+hi def link markdownCode Special
+
+" Conceal HTML entities.
syntax match mkdNbsp /&nbsp;/ conceal cchar=
syntax match mkdLt /&lt;/ conceal cchar=<
syntax match mkdGt /&gt;/ conceal cchar=>
syntax match mkdAmp /&amp;/ conceal cchar=&
syntax match mkdQuot /&quot;/ conceal cchar="
-hi def link mkdEscape special
+hi def link mkdEscape Special
diff --git a/runtime/syntax/lua.vim b/runtime/syntax/lua.vim
index f313c14e7a..b398e2e5c6 100644
--- a/runtime/syntax/lua.vim
+++ b/runtime/syntax/lua.vim
@@ -2,7 +2,7 @@
" Language: Lua 4.0, Lua 5.0, Lua 5.1 and Lua 5.2
" Maintainer: Marcus Aurelius Farias <masserahguard-lua 'at' yahoo com>
" First Author: Carlos Augusto Teixeira Mendes <cmendes 'at' inf puc-rio br>
-" Last Change: 2012 Aug 12
+" Last Change: 2022 Mar 31
" Options: lua_version = 4 or 5
" lua_subversion = 0 (4.0, 5.0) or 1 (5.1) or 2 (5.2)
" default 5.2
@@ -319,6 +319,15 @@ elseif lua_version == 5
syn match luaFunc /\<debug\.upvalueid\>/
syn match luaFunc /\<debug\.upvaluejoin\>/
endif
+ if lua_subversion >= 3
+ "https://www.lua.org/manual/5.3/manual.html#6.5
+ syn match luaFunc /\<utf8\.char\>/
+ syn match luaFunc /\<utf8\.charpattern\>/
+ syn match luaFunc /\<utf8\.codes\>/
+ syn match luaFunc /\<utf8\.codepoint\>/
+ syn match luaFunc /\<utf8\.len\>/
+ syn match luaFunc /\<utf8\.offset\>/
+ endif
endif
" Define the default highlighting.
diff --git a/runtime/syntax/m4.vim b/runtime/syntax/m4.vim
index 6f229ea1ab..f90197aeb0 100644
--- a/runtime/syntax/m4.vim
+++ b/runtime/syntax/m4.vim
@@ -2,7 +2,8 @@
" Language: M4
" Maintainer: Claudio Fleiner (claudio@fleiner.com)
" URL: http://www.fleiner.com/vim/syntax/m4.vim
-" Last Change: 2005 Jan 15
+" (outdated)
+" Last Change: 2022 Jun 12
" This file will highlight user function calls if they use only
" capital letters and have at least one argument (i.e. the '('
@@ -21,6 +22,7 @@ endif
syn match m4Variable contained "\$\d\+"
syn match m4Special contained "$[@*#]"
syn match m4Comment "\<\(m4_\)\=dnl\>.*" contains=SpellErrors
+syn match m4Comment "#.*" contains=SpellErrors
syn match m4Constants "\<\(m4_\)\=__file__"
syn match m4Constants "\<\(m4_\)\=__line__"
syn keyword m4Constants divnum sysval m4_divnum m4_sysval
@@ -32,7 +34,7 @@ syn region m4Command matchgroup=m4builtin start="\<\(m4_\)\=\(len\|index\|regex
syn keyword m4Statement divert undivert
syn region m4Command matchgroup=m4Type start="\<\(m4_\)\=\(undefine\|popdef\)("he=e-1 end=")" contains=@m4Top
syn region m4Function matchgroup=m4Type start="\<[_A-Z][_A-Z0-9]*("he=e-1 end=")" contains=@m4Top
-syn region m4String start="`" end="'" contained contains=@m4Top,@m4StringContents,SpellErrors
+syn region m4String start="`" end="'" contains=SpellErrors
syn cluster m4Top contains=m4Comment,m4Constants,m4Special,m4Variable,m4String,m4Paren,m4Command,m4Statement,m4Function
" Define the default highlighting.
diff --git a/runtime/syntax/man.vim b/runtime/syntax/man.vim
index 55b0e16de9..89162f1e20 100644
--- a/runtime/syntax/man.vim
+++ b/runtime/syntax/man.vim
@@ -10,7 +10,7 @@ syntax match manReference display '[^()[:space:]]\+(\%([0-9][a-z]*\|[nlpox]
syntax match manSectionHeading display '^\S.*$'
syntax match manHeader display '^\%1l.*$'
syntax match manSubHeading display '^ \{3\}\S.*$'
-syntax match manOptionDesc display '^\s\+\%(+\|-\)\S\+'
+syntax match manOptionDesc display '^\s\+\(\%(+\|-\)\S\+,\s\+\)*\%(+\|-\)\S\+'
highlight default link manHeader Title
highlight default link manSectionHeading Statement
diff --git a/runtime/syntax/masm.vim b/runtime/syntax/masm.vim
index c3b2a9bd63..3be0fd45d1 100644
--- a/runtime/syntax/masm.vim
+++ b/runtime/syntax/masm.vim
@@ -2,7 +2,7 @@
" Language: Microsoft Macro Assembler (80x86)
" Orig Author: Rob Brady <robb@datatone.com>
" Maintainer: Wu Yongwei <wuyongwei@gmail.com>
-" Last Change: 2020-05-09 22:55:38 +0800
+" Last Change: 2022-04-24 20:07:04 +0800
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -68,6 +68,7 @@ syn keyword masmType STDCALL SYSCALL C BASIC FORTRAN PASCAL
syn keyword masmType PTR NEAR FAR NEAR16 FAR16 NEAR32 FAR32
syn keyword masmType REAL4 REAL8 REAL10 BYTE SBYTE TBYTE
syn keyword masmType WORD DWORD QWORD FWORD SWORD SDWORD
+syn keyword masmType SQWORD OWORD MMWORD XMMWORD YMMWORD
syn keyword masmOperator AND NOT OR SHL SHR XOR MOD DUP
syn keyword masmOperator EQ GE GT LE LT NE
syn keyword masmOperator LROFFSET SEG LENGTH LENGTHOF SIZE SIZEOF
diff --git a/runtime/syntax/mason.vim b/runtime/syntax/mason.vim
index f087def794..e1638ece75 100644
--- a/runtime/syntax/mason.vim
+++ b/runtime/syntax/mason.vim
@@ -1,11 +1,12 @@
" Vim syntax file
-" Language: Mason (Perl embedded in HTML)
-" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Homepage: http://github.com/vim-perl/vim-perl/tree/master
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2017-09-12
-" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
-" Andrew Smith <andrewdsmith@yahoo.com>
+" Language: Mason (Perl embedded in HTML)
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2021 Oct 10
+" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
+" Andrew Smith <andrewdsmith@yahoo.com>
"
" TODO:
" - Fix <%text> blocks to show HTML tags but ignore Mason tags.
@@ -74,6 +75,7 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,
" syntax files.
hi def link masonDoc Comment
hi def link masonPod Comment
+hi def link podOrdinary masonPod
hi def link masonPerlComment perlComment
let b:current_syntax = "mason"
diff --git a/runtime/syntax/mupad.vim b/runtime/syntax/mupad.vim
index 55ea9c4e43..df87ad14fe 100644
--- a/runtime/syntax/mupad.vim
+++ b/runtime/syntax/mupad.vim
@@ -279,5 +279,6 @@ hi def link mupadType Type
hi def link mupadDefine Define
hi def link mupadIdentifier Identifier
+let b:current_syntax = 'mupad'
" TODO More comprehensive listing.
diff --git a/runtime/syntax/neomuttrc.vim b/runtime/syntax/neomuttrc.vim
index bd73de49ea..421b11ffa3 100644
--- a/runtime/syntax/neomuttrc.vim
+++ b/runtime/syntax/neomuttrc.vim
@@ -2,10 +2,10 @@
" Language: NeoMutt setup files
" Maintainer: Richard Russon <rich@flatcap.org>
" Previous Maintainer: Guillaume Brogi <gui-gui@netcourrier.com>
-" Last Change: 2020-06-21
+" Last Change: 2022-04-08
" Original version based on syntax/muttrc.vim
-" This file covers NeoMutt 2020-06-19
+" This file covers NeoMutt 2022-04-08
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -115,6 +115,8 @@ syntax region muttrcIndexFormatStr contained skipwhite keepend start=+"+ sk
syntax region muttrcIndexFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcIndexFormatEscapes,muttrcIndexFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax region muttrcMixFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcMixFormatEscapes,muttrcMixFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax region muttrcMixFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcMixFormatEscapes,muttrcMixFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+syntax region muttrcPatternFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPatternFormatEscapes,muttrcPatternFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+syntax region muttrcPatternFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPatternFormatEscapes,muttrcPatternFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax region muttrcPGPCmdFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPGPCmdFormatEscapes,muttrcPGPCmdFormatConditionals,muttrcVariable,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax region muttrcPGPCmdFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPGPCmdFormatEscapes,muttrcPGPCmdFormatConditionals,muttrcVariable,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax region muttrcPGPFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPGPFormatEscapes,muttrcPGPFormatConditionals,muttrcFormatErrors,muttrcPGPTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
@@ -144,35 +146,37 @@ function! s:escapesConditionals(baseName, sequence, padding, conditional)
endif
endfunction
-" CHECKED 2020-06-21
-" Ref: alias_format_str() in alias/dlgalias.c
+" CHECKED 2022-04-08
+" Ref: alias_format_str() in alias/dlg_alias.c
call s:escapesConditionals('AliasFormat', '[acfnrt]', 1, 0)
-" Ref: attach_format_str() in recvattach.c
+" Ref: attach_format_str() in attach/dlg_attach.c
call s:escapesConditionals('AttachFormat', '[CcDdeFfIMmnQsTtuX]', 1, 1)
-" Ref: compose_format_str() in compose.c
+" Ref: compose_format_str() in compose/cbar.c
call s:escapesConditionals('ComposeFormat', '[ahlv]', 1, 1)
-" Ref: folder_format_str() in browser.c
+" Ref: folder_format_str() in browser/browser.c
call s:escapesConditionals('FolderFormat', '[CDdFfgilmNnstu]', 1, 0)
-" Ref: group_index_format_str() in browser.c
+" Ref: group_index_format_str() in nntp/browse.c
call s:escapesConditionals('GroupIndexFormat', '[CdfMNns]', 1, 1)
" Ref: index_format_str() in hdrline.c
call s:escapesConditionals('IndexFormat', '[AaBbCDdEefgHIiJKLlMmNnOPqRrSsTtuvWXxYyZ(<[{]\|@\i\+@\|G[a-zA-Z]\+\|Fp\=\|z[cst]\|cr\=', 1, 1)
" Ref: mix_format_str() in remailer.c
call s:escapesConditionals('MixFormat', '[acns]', 1, 0)
+" Ref: pattern_format_str() in pattern/dlg_pattern.c
+call s:escapesConditionals('PatternFormat', '[den]', 1, 0)
" Ref: pgp_command_format_str() in ncrypt/pgpinvoke.c
call s:escapesConditionals('PGPCmdFormat', '[afprs]', 0, 1)
-" Ref: crypt_format_str() in ncrypt/crypt_gpgme.c
-" Ref: pgp_entry_format_str() in ncrypt/pgpkey.c
+" Ref: crypt_format_str() in ncrypt/dlg_gpgme.c
+" Ref: pgp_entry_format_str() in ncrypt/dlg_pgp.c
" Note: crypt_format_str() supports 'p', but pgp_entry_fmt() does not
call s:escapesConditionals('PGPFormat', '[AaCcFfKkLlnptu[]', 0, 0)
-" Ref: query_format_str() in alias/dlgquery.c
+" Ref: query_format_str() in alias/dlg_query.c
call s:escapesConditionals('QueryFormat', '[acent]', 1, 1)
-" Ref: sidebar_format_str() in sidebar.c
+" Ref: sidebar_format_str() in sidebar/window.c
call s:escapesConditionals('SidebarFormat', '[!BDdFLNnorStZ]', 1, 1)
" Ref: smime_command_format_str() in ncrypt/smime.c
call s:escapesConditionals('SmimeFormat', '[aCcdfiks]', 0, 1)
" Ref: status_format_str() in status.c
-call s:escapesConditionals('StatusFormat', '[bDdFfhLlMmnoPpRrSstuVv]', 1, 1)
+call s:escapesConditionals('StatusFormat', '[bDdFfhLlMmnoPpRrSsTtuVv]', 1, 1)
syntax region muttrcPGPTimeEscapes contained start=+%\[+ end=+\]+ contains=muttrcStrftimeEscapes
syntax region muttrcTimeEscapes contained start=+%(+ end=+)+ contains=muttrcStrftimeEscapes
@@ -187,6 +191,7 @@ syntax match muttrcVarEqualsFolderFmt contained skipwhite "=" nextgroup=mutt
syntax match muttrcVarEqualsGrpIdxFmt contained skipwhite "=" nextgroup=muttrcGroupIndexFormatStr
syntax match muttrcVarEqualsIdxFmt contained skipwhite "=" nextgroup=muttrcIndexFormatStr
syntax match muttrcVarEqualsMixFmt contained skipwhite "=" nextgroup=muttrcMixFormatStr
+syntax match muttrcVarEqualsPatternFmt contained skipwhite "=" nextgroup=muttrcPatternFormatStr
syntax match muttrcVarEqualsPGPCmdFmt contained skipwhite "=" nextgroup=muttrcPGPCmdFormatStr
syntax match muttrcVarEqualsPGPFmt contained skipwhite "=" nextgroup=muttrcPGPFormatStr
syntax match muttrcVarEqualsQueryFmt contained skipwhite "=" nextgroup=muttrcQueryFormatStr
@@ -197,9 +202,9 @@ syntax match muttrcVarEqualsStrftimeFmt contained skipwhite "=" nextgroup=mutt
syntax match muttrcVPrefix contained /[?&]/ nextgroup=muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-" CHECKED 2020-06-21
-" List of the different screens in mutt (see Menus in keymap.c)
-syntax keyword muttrcMenu contained alias attach browser compose editor generic index key_select_pgp key_select_smime mix pager pgp postpone query smime
+" CHECKED 2022-04-08
+" List of the different screens in NeoMutt (see MenuNames in menu/type.c)
+syntax keyword muttrcMenu contained alias attach autocrypt browser compose editor generic index key_select_pgp key_select_smime mix pager pgp postpone query smime
syntax match muttrcMenuList "\S\+" contained contains=muttrcMenu
syntax match muttrcMenuCommas /,/ contained
@@ -234,12 +239,12 @@ syntax match muttrcEscapedVariable contained "\\\$[a-zA-Z_-]\+"
syntax match muttrcBadAction contained "[^<>]\+" contains=muttrcEmail
syntax match muttrcAction contained "<[^>]\{-}>" contains=muttrcBadAction,muttrcFunction,muttrcKeyName
-" CHECKED 2020-06-21
-" First, functions that take regular expressions:
+" CHECKED 2022-04-08
+" First, hooks that take regular expressions:
syntax match muttrcRXHookNot contained /!\s*/ skipwhite nextgroup=muttrcRXHookString,muttrcRXHookStringNL
syntax match muttrcRXHooks /\<\%(account\|append\|close\|crypt\|folder\|mbox\|open\|pgp\)-hook\>/ skipwhite nextgroup=muttrcRXHookNot,muttrcRXHookString,muttrcRXHookStringNL
-" Now, functions that take patterns
+" Now, hooks that take patterns
syntax match muttrcPatHookNot contained /!\s*/ skipwhite nextgroup=muttrcPattern
syntax match muttrcPatHooks /\<\%(charset\|iconv\|index-format\)-hook\>/ skipwhite nextgroup=muttrcPatHookNot,muttrcPattern
syntax match muttrcPatHooks /\<\%(message\|reply\|send\|send2\|save\|fcc\|fcc-save\)-hook\>/ skipwhite nextgroup=muttrcPatHookNot,muttrcOptPattern
@@ -295,10 +300,10 @@ syntax match muttrcAliasNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrc
syntax match muttrcUnAliasKey contained "\s*\w\+\s*" skipwhite nextgroup=muttrcUnAliasKey,muttrcUnAliasNL
syntax match muttrcUnAliasNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcUnAliasKey,muttrcUnAliasNL
-" CHECKED 2020-06-21
-" List of letters in Flags in pattern.c
+" CHECKED 2022-04-08
+" List of letters in Flags in pattern/flags.c
" Parameter: none
-syntax match muttrcSimplePat contained "!\?\^\?[~][ADEFGgklNOPpQRSTuUvV#$=]"
+syntax match muttrcSimplePat contained "!\?\^\?[~][ADEFGgklNOPpQRSTUuVv#$=]"
" Parameter: range
syntax match muttrcSimplePat contained "!\?\^\?[~][mnXz]\s*\%([<>-][0-9]\+[kM]\?\|[0-9]\+[kM]\?[-]\%([0-9]\+[kM]\?\)\?\)"
" Parameter: date
@@ -306,7 +311,7 @@ syntax match muttrcSimplePat contained "!\?\^\?[~][dr]\s*\%(\%(-\?[0-9]\{1,2}\%(
" Parameter: regex
syntax match muttrcSimplePat contained "!\?\^\?[~][BbCcefHhIiLMstwxYy]\s*" nextgroup=muttrcSimplePatRXContainer
" Parameter: pattern
-syntax match muttrcSimplePat contained "!\?\^\?[%][bBcCefhHiLstxy]\s*" nextgroup=muttrcSimplePatString
+syntax match muttrcSimplePat contained "!\?\^\?[%][BbCcefHhiLstxy]\s*" nextgroup=muttrcSimplePatString
" Parameter: pattern
syntax match muttrcSimplePat contained "!\?\^\?[=][bcCefhHiLstxy]\s*" nextgroup=muttrcSimplePatString
syntax region muttrcSimplePat contained keepend start=+!\?\^\?[~](+ end=+)+ contains=muttrcSimplePat
@@ -369,8 +374,8 @@ syntax keyword muttrcMonoAttrib contained bold none normal reverse standout unde
syntax keyword muttrcMono contained mono skipwhite nextgroup=muttrcColorField,muttrcColorCompose
syntax match muttrcMonoLine "^\s*mono\s\+\S\+" skipwhite nextgroup=muttrcMonoAttrib contains=muttrcMono
-" CHECKED 2020-06-21
-" List of fields in Fields in color.c
+" CHECKED 2022-04-08
+" List of fields in ColorFields in color/commmand.c
syntax keyword muttrcColorField skipwhite contained
\ attachment attach_headers body bold error hdrdefault header index index_author
\ index_collapsed index_date index_flags index_label index_number index_size index_subject
@@ -383,8 +388,8 @@ syntax match muttrcColorField contained "\<quoted\d\=\>"
syntax match muttrcColorCompose skipwhite contained /\s*compose\s*/ nextgroup=muttrcColorComposeField
-" CHECKED 2020-06-21
-" List of fields in ComposeFields in color.c
+" CHECKED 2022-04-08
+" List of fields in ComposeColorFields in color/command.c
syntax keyword muttrcColorComposeField skipwhite contained
\ header security_both security_encrypt security_none security_sign
\ nextgroup=muttrcColorFG,muttrcColorFGNL
@@ -411,20 +416,21 @@ function! s:boolQuadGen(type, vars, deprecated)
endfunction
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of DT_BOOL in MuttVars in mutt_config.c
call s:boolQuadGen('Bool', [
- \ 'abort_backspace', 'allow_8bit', 'allow_ansi', 'arrow_cursor', 'ascii_chars', 'askbcc',
- \ 'askcc', 'ask_follow_up', 'ask_x_comment_to', 'attach_save_without_prompting',
- \ 'attach_split', 'autocrypt', 'autocrypt_reply', 'autoedit', 'auto_subscribe', 'auto_tag',
+ \ 'abort_backspace', 'allow_8bit', 'allow_ansi', 'arrow_cursor', 'ascii_chars', 'ask_bcc',
+ \ 'ask_cc', 'ask_follow_up', 'ask_x_comment_to', 'attach_save_without_prompting',
+ \ 'attach_split', 'autocrypt', 'autocrypt_reply', 'auto_edit', 'auto_subscribe', 'auto_tag',
\ 'beep', 'beep_new', 'bounce_delivered', 'braille_friendly',
\ 'browser_abbreviate_mailboxes', 'change_folder_next', 'check_mbox_size', 'check_new',
- \ 'collapse_all', 'collapse_flagged', 'collapse_unread', 'confirmappend', 'confirmcreate',
- \ 'crypt_autoencrypt', 'crypt_autopgp', 'crypt_autosign', 'crypt_autosmime',
- \ 'crypt_confirmhook', 'crypt_opportunistic_encrypt',
+ \ 'collapse_all', 'collapse_flagged', 'collapse_unread', 'compose_show_user_headers',
+ \ 'confirm_append', 'confirm_create', 'copy_decode_weed', 'count_alternatives',
+ \ 'crypt_auto_encrypt', 'crypt_auto_pgp', 'crypt_auto_sign', 'crypt_auto_smime',
+ \ 'crypt_confirm_hook', 'crypt_opportunistic_encrypt',
\ 'crypt_opportunistic_encrypt_strong_keys', 'crypt_protected_headers_read',
- \ 'crypt_protected_headers_save', 'crypt_protected_headers_write', 'crypt_replyencrypt',
- \ 'crypt_replysign', 'crypt_replysignencrypted', 'crypt_timestamp', 'crypt_use_gpgme',
+ \ 'crypt_protected_headers_save', 'crypt_protected_headers_write', 'crypt_reply_encrypt',
+ \ 'crypt_reply_sign', 'crypt_reply_sign_encrypted', 'crypt_timestamp', 'crypt_use_gpgme',
\ 'crypt_use_pka', 'delete_untag', 'digest_collapse', 'duplicate_threads', 'edit_headers',
\ 'encode_from', 'fast_reply', 'fcc_before_send', 'fcc_clear', 'flag_safe', 'followup_to',
\ 'force_name', 'forward_decode', 'forward_decrypt', 'forward_quote', 'forward_references',
@@ -433,45 +439,52 @@ call s:boolQuadGen('Bool', [
\ 'history_remove_dups', 'honor_disposition', 'idn_decode', 'idn_encode',
\ 'ignore_list_reply_to', 'imap_check_subscribed', 'imap_condstore', 'imap_deflate',
\ 'imap_idle', 'imap_list_subscribed', 'imap_passive', 'imap_peek', 'imap_qresync',
- \ 'imap_rfc5161', 'imap_servernoise', 'implicit_autoview', 'include_encrypted',
- \ 'include_onlyfirst', 'keep_flagged', 'mailcap_sanitize', 'maildir_check_cur',
- \ 'maildir_header_cache_verify', 'maildir_trash', 'mail_check_recent', 'mail_check_stats',
- \ 'markers', 'mark_old', 'menu_move_off', 'menu_scroll', 'message_cache_clean', 'meta_key',
- \ 'metoo', 'mh_purge', 'mime_forward_decode', 'mime_subject', 'mime_type_query_first',
- \ 'narrow_tree', 'nm_record', 'nntp_listgroup', 'nntp_load_description', 'pager_stop',
- \ 'pgp_autoinline', 'pgp_auto_decode', 'pgp_check_exit', 'pgp_check_gpg_decrypt_status_fd',
- \ 'pgp_ignore_subkeys', 'pgp_long_ids', 'pgp_replyinline', 'pgp_retainable_sigs',
+ \ 'imap_rfc5161', 'imap_server_noise', 'implicit_autoview', 'include_encrypted',
+ \ 'include_only_first', 'keep_flagged', 'local_date_header', 'mailcap_sanitize',
+ \ 'maildir_check_cur', 'maildir_header_cache_verify', 'maildir_trash', 'mail_check_recent',
+ \ 'mail_check_stats', 'markers', 'mark_old', 'menu_move_off', 'menu_scroll',
+ \ 'message_cache_clean', 'meta_key', 'me_too', 'mh_purge', 'mime_forward_decode',
+ \ 'mime_type_query_first', 'narrow_tree', 'nm_query_window_enable', 'nm_record',
+ \ 'nntp_listgroup', 'nntp_load_description', 'pager_stop', 'pgp_auto_decode',
+ \ 'pgp_auto_inline', 'pgp_check_exit', 'pgp_check_gpg_decrypt_status_fd',
+ \ 'pgp_ignore_subkeys', 'pgp_long_ids', 'pgp_reply_inline', 'pgp_retainable_sigs',
\ 'pgp_self_encrypt', 'pgp_show_unusable', 'pgp_strict_enc', 'pgp_use_gpg_agent',
- \ 'pipe_decode', 'pipe_split', 'pop_auth_try_all', 'pop_last', 'postpone_encrypt',
- \ 'print_decode', 'print_split', 'prompt_after', 'read_only', 'reflow_space_quotes',
- \ 'reflow_text', 'reply_self', 'reply_with_xorig', 'resolve', 'resume_draft_files',
- \ 'resume_edited_draft_files', 'reverse_alias', 'reverse_name', 'reverse_realname',
- \ 'rfc2047_parameters', 'save_address', 'save_empty', 'save_name', 'save_unsubscribed',
- \ 'score', 'show_new_news', 'show_only_unread', 'sidebar_folder_indent',
- \ 'sidebar_new_mail_only', 'sidebar_next_new_wrap', 'sidebar_non_empty_mailbox_only',
- \ 'sidebar_on_right', 'sidebar_short_path', 'sidebar_visible', 'sig_dashes', 'sig_on_top',
- \ 'size_show_bytes', 'size_show_fractions', 'size_show_mb', 'size_units_on_left',
- \ 'smart_wrap', 'smime_ask_cert_label', 'smime_decrypt_use_default_key', 'smime_is_default',
- \ 'smime_self_encrypt', 'sort_re', 'ssl_force_tls', 'ssl_usesystemcerts', 'ssl_use_sslv2',
- \ 'ssl_use_sslv3', 'ssl_use_tlsv1', 'ssl_use_tlsv1_1', 'ssl_use_tlsv1_2', 'ssl_use_tlsv1_3',
+ \ 'pipe_decode', 'pipe_decode_weed', 'pipe_split', 'pop_auth_try_all', 'pop_last',
+ \ 'postpone_encrypt', 'print_decode', 'print_decode_weed', 'print_split', 'prompt_after',
+ \ 'read_only', 'reflow_space_quotes', 'reflow_text', 'reply_self', 'reply_with_xorig',
+ \ 'resolve', 'resume_draft_files', 'resume_edited_draft_files', 'reverse_alias',
+ \ 'reverse_name', 'reverse_real_name', 'rfc2047_parameters', 'save_address', 'save_empty',
+ \ 'save_name', 'save_unsubscribed', 'score', 'show_new_news', 'show_only_unread',
+ \ 'sidebar_folder_indent', 'sidebar_new_mail_only', 'sidebar_next_new_wrap',
+ \ 'sidebar_non_empty_mailbox_only', 'sidebar_on_right', 'sidebar_short_path',
+ \ 'sidebar_visible', 'sig_dashes', 'sig_on_top', 'size_show_bytes', 'size_show_fractions',
+ \ 'size_show_mb', 'size_units_on_left', 'smart_wrap', 'smime_ask_cert_label',
+ \ 'smime_decrypt_use_default_key', 'smime_is_default', 'smime_self_encrypt', 'sort_re',
+ \ 'ssl_force_tls', 'ssl_use_sslv2', 'ssl_use_sslv3', 'ssl_use_system_certs',
+ \ 'ssl_use_tlsv1', 'ssl_use_tlsv1_1', 'ssl_use_tlsv1_2', 'ssl_use_tlsv1_3',
\ 'ssl_verify_dates', 'ssl_verify_host', 'ssl_verify_partial_chains', 'status_on_top',
\ 'strict_threads', 'suspend', 'text_flowed', 'thorough_search', 'thread_received', 'tilde',
- \ 'ts_enabled', 'uncollapse_jump', 'uncollapse_new', 'user_agent', 'use_8bitmime',
- \ 'use_domain', 'use_envelope_from', 'use_from', 'use_ipv6', 'virtual_spoolfile',
- \ 'wait_key', 'weed', 'wrap_search', 'write_bcc', 'x_comment_to'
+ \ 'ts_enabled', 'tunnel_is_secure', 'uncollapse_jump', 'uncollapse_new', 'user_agent',
+ \ 'use_8bit_mime', 'use_domain', 'use_envelope_from', 'use_from', 'use_ipv6',
+ \ 'virtual_spool_file', 'wait_key', 'weed', 'wrap_search', 'write_bcc', 'x_comment_to'
\ ], 0)
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" Deprecated Bools
" List of DT_SYNONYM or DT_DEPRECATED Bools in MuttVars in mutt_config.c
call s:boolQuadGen('Bool', [
- \ 'edit_hdrs', 'envelope_from', 'forw_decode', 'forw_decrypt', 'forw_quote',
- \ 'header_cache_compress', 'ignore_linear_white_space', 'pgp_autoencrypt', 'pgp_autosign',
- \ 'pgp_auto_traditional', 'pgp_create_traditional', 'pgp_replyencrypt', 'pgp_replysign',
- \ 'pgp_replysignencrypted', 'xterm_set_titles'
+ \ 'askbcc', 'askcc', 'autoedit', 'confirmappend', 'confirmcreate', 'crypt_autoencrypt',
+ \ 'crypt_autopgp', 'crypt_autosign', 'crypt_autosmime', 'crypt_confirmhook',
+ \ 'crypt_replyencrypt', 'crypt_replysign', 'crypt_replysignencrypted', 'edit_hdrs',
+ \ 'envelope_from', 'forw_decode', 'forw_decrypt', 'forw_quote', 'header_cache_compress',
+ \ 'ignore_linear_white_space', 'imap_servernoise', 'include_onlyfirst', 'metoo',
+ \ 'mime_subject', 'pgp_autoencrypt', 'pgp_autoinline', 'pgp_autosign',
+ \ 'pgp_auto_traditional', 'pgp_create_traditional', 'pgp_replyencrypt', 'pgp_replyinline',
+ \ 'pgp_replysign', 'pgp_replysignencrypted', 'reverse_realname', 'ssl_usesystemcerts',
+ \ 'use_8bitmime', 'virtual_spoolfile', 'xterm_set_titles'
\ ], 1)
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of DT_QUAD in MuttVars in mutt_config.c
call s:boolQuadGen('Quad', [
\ 'abort_noattach', 'abort_nosubject', 'abort_unmodified', 'bounce', 'catchup_newsgroup',
@@ -481,31 +494,32 @@ call s:boolQuadGen('Quad', [
\ 'post_moderated', 'print', 'quit', 'recall', 'reply_to', 'ssl_starttls',
\ ], 0)
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" Deprecated Quads
" List of DT_SYNONYM or DT_DEPRECATED Quads in MuttVars in mutt_config.c
call s:boolQuadGen('Quad', [
\ 'mime_fwd', 'pgp_encrypt_self', 'pgp_verify_sig', 'smime_encrypt_self'
\ ], 1)
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of DT_NUMBER or DT_LONG in MuttVars in mutt_config.c
syntax keyword muttrcVarNum skipwhite contained
- \ connect_timeout debug_level header_cache_compress_level history
- \ imap_fetch_chunk_size imap_keepalive imap_pipeline_depth imap_poll_timeout mail_check
- \ mail_check_stats_interval menu_context net_inc nm_db_limit nm_open_timeout
- \ nm_query_window_current_position nm_query_window_duration nntp_context nntp_poll
- \ pager_context pager_index_lines pgp_timeout pop_checkinterval read_inc reflow_wrap
- \ save_history score_threshold_delete score_threshold_flag score_threshold_read
- \ search_context sendmail_wait sidebar_component_depth sidebar_width skip_quoted_offset
- \ sleep_time smime_timeout ssl_min_dh_prime_bits timeout time_inc toggle_quoted_show_levels
- \ wrap wrap_headers write_inc
+ \ connect_timeout debug_level header_cache_compress_level history imap_fetch_chunk_size
+ \ imap_keepalive imap_pipeline_depth imap_poll_timeout mail_check mail_check_stats_interval
+ \ menu_context net_inc nm_db_limit nm_open_timeout nm_query_window_current_position
+ \ nm_query_window_duration nntp_context nntp_poll pager_context pager_index_lines
+ \ pager_read_delay pager_skip_quoted_context pgp_timeout pop_check_interval read_inc
+ \ reflow_wrap save_history score_threshold_delete score_threshold_flag score_threshold_read
+ \ search_context sendmail_wait sidebar_component_depth sidebar_width sleep_time
+ \ smime_timeout ssl_min_dh_prime_bits timeout time_inc toggle_quoted_show_levels wrap
+ \ wrap_headers write_inc
\ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+" CHECKED 2022-04-08
+" Deprecated Numbers
syntax keyword muttrcVarDeprecatedNum contained skipwhite
- \ header_cache_pagesize wrapmargin
- \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+ \ header_cache_pagesize pop_checkinterval skip_quoted_offset
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of DT_STRING in MuttVars in mutt_config.c
" Special cases first, and all the rest at the end
" Formats themselves must be updated in their respective groups
@@ -517,19 +531,19 @@ syntax keyword muttrcVarStr contained skipwhite compose_format nextgroup=muttrcV
syntax keyword muttrcVarStr contained skipwhite folder_format vfolder_format nextgroup=muttrcVarEqualsFolderFmt
syntax keyword muttrcVarStr contained skipwhite attribution forward_format index_format message_format pager_format nextgroup=muttrcVarEqualsIdxFmt
syntax keyword muttrcVarStr contained skipwhite mix_entry_format nextgroup=muttrcVarEqualsMixFmt
+syntax keyword muttrcVarStr contained skipwhite pattern_format nextgroup=muttrcVarEqualsPatternFmt
syntax keyword muttrcVarStr contained skipwhite
- \ pgp_clearsign_command pgp_decode_command pgp_decrypt_command
- \ pgp_encrypt_only_command pgp_encrypt_sign_command pgp_export_command pgp_getkeys_command
- \ pgp_import_command pgp_list_pubring_command pgp_list_secring_command
- \ pgp_sign_command pgp_verify_command pgp_verify_key_command
+ \ pgp_clear_sign_command pgp_decode_command pgp_decrypt_command pgp_encrypt_only_command
+ \ pgp_encrypt_sign_command pgp_export_command pgp_get_keys_command pgp_import_command
+ \ pgp_list_pubring_command pgp_list_secring_command pgp_sign_command pgp_verify_command
+ \ pgp_verify_key_command
\ nextgroup=muttrcVarEqualsPGPCmdFmt
syntax keyword muttrcVarStr contained skipwhite pgp_entry_format nextgroup=muttrcVarEqualsPGPFmt
syntax keyword muttrcVarStr contained skipwhite query_format nextgroup=muttrcVarEqualsQueryFmt
syntax keyword muttrcVarStr contained skipwhite
\ smime_decrypt_command smime_encrypt_command smime_get_cert_command
- \ smime_get_cert_email_command smime_get_signer_cert_command
- \ smime_import_cert_command smime_pk7out_command smime_sign_command
- \ smime_verify_command smime_verify_opaque_command
+ \ smime_get_cert_email_command smime_get_signer_cert_command smime_import_cert_command
+ \ smime_pk7out_command smime_sign_command smime_verify_command smime_verify_opaque_command
\ nextgroup=muttrcVarEqualsSmimeFmt
syntax keyword muttrcVarStr contained skipwhite status_format ts_icon_format ts_status_format nextgroup=muttrcVarEqualsStatusFmt
syntax keyword muttrcVarStr contained skipwhite date_format nextgroup=muttrcVarEqualsStrftimeFmt
@@ -538,64 +552,66 @@ syntax keyword muttrcVarStr contained skipwhite sidebar_format nextgroup=muttrcV
syntax keyword muttrcVarStr contained skipwhite
\ abort_key arrow_string assumed_charset attach_charset attach_sep attribution_locale
\ autocrypt_acct_format charset config_charset content_type crypt_protected_headers_subject
- \ default_hook dsn_notify dsn_return empty_subject escape forward_attribution_intro
- \ forward_attribution_trailer header_cache_backend header_cache_compress_method hidden_tags
- \ hostname imap_authenticators imap_delim_chars imap_headers imap_login imap_pass imap_user
- \ indent_string mailcap_path mark_macro_prefix mh_seq_flagged mh_seq_replied mh_seq_unseen
- \ newsgroups_charset news_server nm_default_url nm_exclude_tags nm_flagged_tag nm_query_type
- \ nm_query_window_current_search nm_query_window_timebase nm_record_tags nm_replied_tag
- \ nm_unread_tag nntp_authenticators nntp_pass nntp_user pgp_default_key pgp_sign_as pipe_sep
- \ pop_authenticators pop_host pop_pass pop_user postpone_encrypt_as post_indent_string
- \ preconnect preferred_languages realname send_charset show_multipart_alternative
- \ sidebar_delim_chars sidebar_divider_char sidebar_indent_string simple_search
- \ smime_default_key smime_encrypt_with smime_sign_as smime_sign_digest_alg
- \ smtp_authenticators smtp_pass smtp_url smtp_user spam_separator ssl_ciphers
+ \ default_hook dsn_notify dsn_return empty_subject forward_attribution_intro
+ \ forward_attribution_trailer greeting header_cache_backend header_cache_compress_method
+ \ hidden_tags hostname imap_authenticators imap_delim_chars imap_headers imap_login
+ \ imap_pass imap_user indent_string mailcap_path mark_macro_prefix mh_seq_flagged
+ \ mh_seq_replied mh_seq_unseen newsgroups_charset news_server nm_default_url nm_exclude_tags
+ \ nm_flagged_tag nm_query_type nm_query_window_current_search nm_query_window_or_terms
+ \ nm_query_window_timebase nm_record_tags nm_replied_tag nm_unread_tag nntp_authenticators
+ \ nntp_pass nntp_user pgp_default_key pgp_sign_as pipe_sep pop_authenticators pop_host
+ \ pop_pass pop_user postpone_encrypt_as post_indent_string preconnect preferred_languages
+ \ real_name send_charset show_multipart_alternative sidebar_delim_chars sidebar_divider_char
+ \ sidebar_indent_string simple_search smime_default_key smime_encrypt_with smime_sign_as
+ \ smime_sign_digest_alg smtp_authenticators smtp_pass smtp_url smtp_user spam_separator
+ \ ssl_ciphers
\ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
" Deprecated strings
syntax keyword muttrcVarDeprecatedStr
- \ abort_noattach_regexp attach_keyword forw_format hdr_format indent_str msg_format
- \ nm_default_uri pgp_self_encrypt_as post_indent_str print_cmd quote_regexp reply_regexp
- \ smime_self_encrypt_as xterm_icon xterm_title
+ \ abort_noattach_regexp attach_keyword escape forw_format hdr_format indent_str msg_format
+ \ nm_default_uri pgp_clearsign_command pgp_getkeys_command pgp_self_encrypt_as
+ \ post_indent_str print_cmd quote_regexp realname reply_regexp smime_self_encrypt_as
+ \ spoolfile visual xterm_icon xterm_title
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of DT_ADDRESS
syntax keyword muttrcVarStr contained skipwhite envelope_from_address from nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
" List of DT_ENUM
-syntax keyword muttrcVarStr contained skipwhite mbox_type nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+syntax keyword muttrcVarStr contained skipwhite mbox_type use_threads nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
" List of DT_MBTABLE
syntax keyword muttrcVarStr contained skipwhite crypt_chars flag_chars from_chars status_chars to_chars nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-" CHECKED 2020-06-21
-" List of DT_PATH
+" CHECKED 2022-04-08
+" List of DT_PATH or DT_MAILBOX
syntax keyword muttrcVarStr contained skipwhite
\ alias_file attach_save_dir autocrypt_dir certificate_file debug_file
\ entropy_file folder header_cache history_file mbox message_cachedir newsrc
\ news_cache_dir postponed record signature smime_ca_location
- \ smime_certificates smime_keys spoolfile ssl_ca_certificates_file
- \ ssl_client_cert tmpdir trash
+ \ smime_certificates smime_keys spool_file ssl_ca_certificates_file ssl_client_cert
+ \ tmpdir trash
\ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
" List of DT_COMMAND (excluding pgp_*_command and smime_*_command)
syntax keyword muttrcVarStr contained skipwhite
\ display_filter editor inews ispell mixmaster new_mail_command pager
- \ print_command query_command sendmail shell visual external_search_command
+ \ print_command query_command sendmail shell external_search_command
\ imap_oauth_refresh_command pop_oauth_refresh_command
\ mime_type_query_command smtp_oauth_refresh_command tunnel
\ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of DT_REGEX
syntax keyword muttrcVarStr contained skipwhite
- \ abort_noattach_regex gecos_mask mask pgp_decryption_okay pgp_good_sign
- \ quote_regex reply_regex smileys
+ \ abort_noattach_regex gecos_mask mask pgp_decryption_okay pgp_good_sign quote_regex
+ \ reply_regex smileys
\ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
" List of DT_SORT
syntax keyword muttrcVarStr contained skipwhite
\ pgp_sort_keys sidebar_sort_method sort sort_alias sort_aux sort_browser
\ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-" CHECKED 2020-06-21
-" List of commands in Commands in mutt_config.c
+" CHECKED 2022-04-08
+" List of commands in mutt_commands in mutt_commands.c
" Remember to remove hooks, they have already been dealt with
syntax keyword muttrcCommand skipwhite alias nextgroup=muttrcAliasGroupDef,muttrcAliasKey,muttrcAliasNL
syntax keyword muttrcCommand skipwhite bind nextgroup=muttrcBindMenuList,muttrcBindMenuListNL
@@ -607,14 +623,12 @@ syntax keyword muttrcCommand skipwhite spam nextgroup=muttrcSpamPattern
syntax keyword muttrcCommand skipwhite unalias nextgroup=muttrcUnAliasKey,muttrcUnAliasNL
syntax keyword muttrcCommand skipwhite unhook nextgroup=muttrcHooks
syntax keyword muttrcCommand skipwhite
- \ alternative_order attachments auto_view finish hdr_order ifdef ifndef
- \ ignore lua lua-source mailboxes mailto_allow mime_lookup my_hdr push score
- \ setenv sidebar_whitelist source subjectrx subscribe-to tag-formats
- \ tag-transforms unalternative_order unattachments unauto_view uncolor
- \ unhdr_order unignore unmailboxes unmailto_allow unmime_lookup unmono
- \ unmy_hdr unscore unsetenv unsidebar_whitelist unsubjectrx unsubscribe-from
- \ unvirtual-mailboxes virtual-mailboxes named-mailboxes
- \ echo unbind unmacro
+ \ alternative_order attachments auto_view cd echo finish hdr_order ifdef ifndef ignore lua
+ \ lua-source mailboxes mailto_allow mime_lookup my_hdr named-mailboxes push score setenv
+ \ sidebar_whitelist source subjectrx subscribe-to tag-formats tag-transforms
+ \ unalternative_order unattachments unauto_view unbind uncolor unhdr_order unignore unmacro
+ \ unmailboxes unmailto_allow unmime_lookup unmono unmy_hdr unscore unsetenv
+ \ unsidebar_whitelist unsubjectrx unsubscribe-from unvirtual-mailboxes virtual-mailboxes
function! s:genFunctions(functions)
for f in a:functions
@@ -622,66 +636,68 @@ function! s:genFunctions(functions)
endfor
endfunction
-" CHECKED 2020-06-21
+" CHECKED 2022-04-08
" List of functions in functions.c
" Note: 'noop' is included but is elsewhere in the source
call s:genFunctions(['noop',
- \ 'accept', 'append', 'attach-file', 'attach-key', 'attach-message', 'attach-news-message',
- \ 'autocrypt-acct-menu', 'autocrypt-menu', 'backspace', 'backward-char', 'backward-word',
- \ 'bol', 'bottom-page', 'bottom', 'bounce-message', 'break-thread', 'buffy-cycle',
- \ 'buffy-list', 'capitalize-word', 'catchup', 'chain-next', 'chain-prev', 'change-dir',
- \ 'change-folder-readonly', 'change-folder', 'change-newsgroup-readonly',
- \ 'change-newsgroup', 'change-vfolder', 'check-new', 'check-stats',
+ \ 'accept', 'alias-dialog', 'append', 'attach-file', 'attach-key', 'attach-message',
+ \ 'attach-news-message', 'autocrypt-acct-menu', 'autocrypt-menu', 'backspace',
+ \ 'backward-char', 'backward-word', 'bol', 'bottom', 'bottom-page', 'bounce-message',
+ \ 'break-thread', 'buffy-cycle', 'buffy-list', 'capitalize-word', 'catchup', 'chain-next',
+ \ 'chain-prev', 'change-dir', 'change-folder', 'change-folder-readonly', 'change-newsgroup',
+ \ 'change-newsgroup-readonly', 'change-vfolder', 'check-new', 'check-stats',
\ 'check-traditional-pgp', 'clear-flag', 'collapse-all', 'collapse-parts',
- \ 'collapse-thread', 'complete-query', 'complete', 'compose-to-sender', 'copy-file',
+ \ 'collapse-thread', 'complete', 'complete-query', 'compose-to-sender', 'copy-file',
\ 'copy-message', 'create-account', 'create-alias', 'create-mailbox', 'current-bottom',
\ 'current-middle', 'current-top', 'decode-copy', 'decode-save', 'decrypt-copy',
- \ 'decrypt-save', 'delete-account', 'delete-char', 'delete-entry', 'delete-mailbox',
- \ 'delete-message', 'delete-pattern', 'delete-subthread', 'delete-thread', 'delete',
+ \ 'decrypt-save', 'delete', 'delete-account', 'delete-char', 'delete-entry',
+ \ 'delete-mailbox', 'delete-message', 'delete-pattern', 'delete-subthread', 'delete-thread',
\ 'descend-directory', 'detach-file', 'display-address', 'display-filename',
- \ 'display-message', 'display-toggle-weed', 'downcase-word', 'edit-bcc', 'edit-cc',
- \ 'edit-description', 'edit-encoding', 'edit-fcc', 'edit-file', 'edit-followup-to',
- \ 'edit-from', 'edit-headers', 'edit-label', 'edit-language', 'edit-message', 'edit-mime',
- \ 'edit-newsgroups', 'edit-or-view-raw-message', 'edit-raw-message', 'edit-reply-to',
- \ 'edit-subject', 'edit-to', 'edit-type', 'edit-x-comment-to', 'edit', 'end-cond',
- \ 'enter-command', 'enter-mask', 'entire-thread', 'eol', 'exit', 'extract-keys',
- \ 'fetch-mail', 'filter-entry', 'first-entry', 'flag-message', 'followup-message',
- \ 'forget-passphrase', 'forward-char', 'forward-message', 'forward-to-group',
- \ 'forward-word', 'get-attachment', 'get-children', 'get-message', 'get-parent',
- \ 'goto-folder', 'goto-parent', 'group-alternatives', 'group-chat-reply',
- \ 'group-multilingual', 'group-reply', 'half-down', 'half-up', 'help', 'history-down',
- \ 'history-search', 'history-up', 'imap-fetch-mail', 'imap-logout-all', 'insert', 'ispell',
- \ 'jump', 'kill-eol', 'kill-eow', 'kill-line', 'kill-word', 'last-entry',
- \ 'limit-current-thread', 'limit', 'link-threads', 'list-reply', 'mail-key',
- \ 'mailbox-cycle', 'mailbox-list', 'mail', 'mark-as-new', 'mark-message', 'middle-page',
- \ 'mix', 'modify-labels-then-hide', 'modify-labels', 'modify-tags-then-hide',
- \ 'modify-tags', 'move-down', 'move-up', 'new-mime', 'next-entry', 'next-line',
- \ 'next-new-then-unread', 'next-new', 'next-page', 'next-subthread', 'next-thread',
- \ 'next-undeleted', 'next-unread-mailbox', 'next-unread', 'parent-message', 'pgp-menu',
- \ 'pipe-entry', 'pipe-message', 'post-message', 'postpone-message', 'previous-entry',
- \ 'previous-line', 'previous-new-then-unread', 'previous-new', 'previous-page',
- \ 'previous-subthread', 'previous-thread', 'previous-undeleted', 'previous-unread',
- \ 'print-entry', 'print-message', 'purge-message', 'purge-thread', 'quasi-delete',
- \ 'query-append', 'query', 'quit', 'quote-char', 'read-subthread', 'read-thread',
- \ 'recall-message', 'reconstruct-thread', 'redraw-screen', 'refresh', 'reload-active',
- \ 'rename-attachment', 'rename-file', 'rename-mailbox', 'reply', 'resend-message',
- \ 'root-message', 'save-entry', 'save-message', 'search-next', 'search-opposite',
- \ 'search-reverse', 'search-toggle', 'search', 'select-entry', 'select-new',
+ \ 'display-message', 'display-toggle-weed', 'downcase-word', 'edit', 'edit-bcc', 'edit-cc',
+ \ 'edit-content-id', 'edit-description', 'edit-encoding', 'edit-fcc', 'edit-file',
+ \ 'edit-followup-to', 'edit-from', 'edit-headers', 'edit-label', 'edit-language',
+ \ 'edit-message', 'edit-mime', 'edit-newsgroups', 'edit-or-view-raw-message',
+ \ 'edit-raw-message', 'edit-reply-to', 'edit-subject', 'edit-to', 'edit-type',
+ \ 'edit-x-comment-to', 'end-cond', 'enter-command', 'enter-mask', 'entire-thread', 'eol',
+ \ 'error-history', 'exit', 'extract-keys', 'fetch-mail', 'filter-entry', 'first-entry',
+ \ 'flag-message', 'followup-message', 'forget-passphrase', 'forward-char',
+ \ 'forward-message', 'forward-to-group', 'forward-word', 'get-attachment', 'get-children',
+ \ 'get-message', 'get-parent', 'goto-folder', 'goto-parent', 'group-alternatives',
+ \ 'group-chat-reply', 'group-multilingual', 'group-related', 'group-reply', 'half-down',
+ \ 'half-up', 'help', 'history-down', 'history-search', 'history-up', 'imap-fetch-mail',
+ \ 'imap-logout-all', 'insert', 'ispell', 'jump', 'kill-eol', 'kill-eow', 'kill-line',
+ \ 'kill-word', 'last-entry', 'limit', 'limit-current-thread', 'link-threads', 'list-reply',
+ \ 'list-subscribe', 'list-unsubscribe', 'mail', 'mail-key', 'mailbox-cycle', 'mailbox-list',
+ \ 'mark-as-new', 'mark-message', 'middle-page', 'mix', 'modify-labels',
+ \ 'modify-labels-then-hide', 'modify-tags', 'modify-tags-then-hide', 'move-down', 'move-up',
+ \ 'new-mime', 'next-entry', 'next-line', 'next-new', 'next-new-then-unread', 'next-page',
+ \ 'next-subthread', 'next-thread', 'next-undeleted', 'next-unread', 'next-unread-mailbox',
+ \ 'parent-message', 'pgp-menu', 'pipe-entry', 'pipe-message', 'post-message',
+ \ 'postpone-message', 'previous-entry', 'previous-line', 'previous-new',
+ \ 'previous-new-then-unread', 'previous-page', 'previous-subthread', 'previous-thread',
+ \ 'previous-undeleted', 'previous-unread', 'print-entry', 'print-message', 'purge-message',
+ \ 'purge-thread', 'quasi-delete', 'query', 'query-append', 'quit', 'quote-char',
+ \ 'read-subthread', 'read-thread', 'recall-message', 'reconstruct-thread', 'redraw-screen',
+ \ 'refresh', 'reload-active', 'rename-attachment', 'rename-file', 'rename-mailbox', 'reply',
+ \ 'resend-message', 'root-message', 'save-entry', 'save-message', 'search', 'search-next',
+ \ 'search-opposite', 'search-reverse', 'search-toggle', 'select-entry', 'select-new',
\ 'send-message', 'set-flag', 'shell-escape', 'show-limit', 'show-log-messages',
- \ 'show-version', 'sidebar-next-new', 'sidebar-first', 'sidebar-last', 'sidebar-next',
- \ 'sidebar-open', 'sidebar-page-down', 'sidebar-page-up', 'sidebar-prev-new',
- \ 'sidebar-prev', 'sidebar-toggle-virtual', 'sidebar-toggle-visible', 'skip-quoted',
- \ 'smime-menu', 'sort-mailbox', 'sort-reverse', 'sort', 'subscribe-pattern',
- \ 'sync-mailbox', 'tag-entry', 'tag-message', 'tag-pattern', 'tag-prefix-cond',
- \ 'tag-prefix', 'tag-subthread', 'tag-thread', 'toggle-active', 'toggle-disposition',
- \ 'toggle-mailboxes', 'toggle-new', 'toggle-prefer-encrypt', 'toggle-quoted',
- \ 'toggle-read', 'toggle-recode', 'toggle-subscribed', 'toggle-unlink', 'toggle-write',
- \ 'top-page', 'top', 'transpose-chars', 'uncatchup', 'undelete-entry', 'undelete-message',
- \ 'undelete-pattern', 'undelete-subthread', 'undelete-thread', 'unsubscribe-pattern',
- \ 'untag-pattern', 'upcase-word', 'update-encoding', 'verify-key',
- \ 'vfolder-from-query-readonly', 'vfolder-from-query', 'vfolder-window-backward',
- \ 'vfolder-window-forward', 'view-attachments', 'view-attach', 'view-file', 'view-mailcap',
- \ 'view-name', 'view-raw-message', 'view-text', 'what-key', 'write-fcc'
+ \ 'show-version', 'sidebar-first', 'sidebar-last', 'sidebar-next', 'sidebar-next-new',
+ \ 'sidebar-open', 'sidebar-page-down', 'sidebar-page-up', 'sidebar-prev',
+ \ 'sidebar-prev-new', 'sidebar-toggle-virtual', 'sidebar-toggle-visible', 'skip-headers',
+ \ 'skip-quoted', 'smime-menu', 'sort', 'sort-alias', 'sort-alias-reverse', 'sort-mailbox',
+ \ 'sort-reverse', 'subscribe', 'subscribe-pattern', 'sync-mailbox', 'tag-entry',
+ \ 'tag-message', 'tag-pattern', 'tag-prefix', 'tag-prefix-cond', 'tag-subthread',
+ \ 'tag-thread', 'toggle-active', 'toggle-disposition', 'toggle-mailboxes', 'toggle-new',
+ \ 'toggle-prefer-encrypt', 'toggle-quoted', 'toggle-read', 'toggle-recode',
+ \ 'toggle-subscribed', 'toggle-unlink', 'toggle-write', 'top', 'top-page',
+ \ 'transpose-chars', 'uncatchup', 'undelete-entry', 'undelete-message', 'undelete-pattern',
+ \ 'undelete-subthread', 'undelete-thread', 'ungroup-attachment', 'unsubscribe',
+ \ 'unsubscribe-pattern', 'untag-pattern', 'upcase-word', 'update-encoding', 'verify-key',
+ \ 'vfolder-from-query', 'vfolder-from-query-readonly', 'vfolder-window-backward',
+ \ 'vfolder-window-forward', 'vfolder-window-reset', 'view-attach', 'view-attachments',
+ \ 'view-file', 'view-mailcap', 'view-name', 'view-pager', 'view-raw-message', 'view-text',
+ \ 'what-key', 'write-fcc'
\ ])
" Define the default highlighting.
@@ -758,6 +774,7 @@ highlight def link muttrcFolderFormatEscapes muttrcEscape
highlight def link muttrcGroupIndexFormatEscapes muttrcEscape
highlight def link muttrcIndexFormatEscapes muttrcEscape
highlight def link muttrcMixFormatEscapes muttrcEscape
+highlight def link muttrcPatternFormatEscapes muttrcEscape
highlight def link muttrcPGPCmdFormatEscapes muttrcEscape
highlight def link muttrcPGPFormatEscapes muttrcEscape
highlight def link muttrcPGPTimeEscapes muttrcEscape
@@ -774,6 +791,7 @@ highlight def link muttrcComposeFormatConditionals muttrcFormatConditionals2
highlight def link muttrcFolderFormatConditionals muttrcFormatConditionals2
highlight def link muttrcIndexFormatConditionals muttrcFormatConditionals2
highlight def link muttrcMixFormatConditionals muttrcFormatConditionals2
+highlight def link muttrcPatternFormatConditionals muttrcFormatConditionals2
highlight def link muttrcPGPCmdFormatConditionals muttrcFormatConditionals2
highlight def link muttrcPGPFormatConditionals muttrcFormatConditionals2
highlight def link muttrcSmimeFormatConditionals muttrcFormatConditionals2
@@ -789,6 +807,7 @@ highlight def link muttrcFolderFormatStr muttrcString
highlight def link muttrcGroupIndexFormatStr muttrcString
highlight def link muttrcIndexFormatStr muttrcString
highlight def link muttrcMixFormatStr muttrcString
+highlight def link muttrcPatternFormatStr muttrcString
highlight def link muttrcPGPCmdFormatStr muttrcString
highlight def link muttrcPGPFormatStr muttrcString
highlight def link muttrcQueryFormatStr muttrcString
diff --git a/runtime/syntax/openscad.vim b/runtime/syntax/openscad.vim
new file mode 100644
index 0000000000..1e20c743c4
--- /dev/null
+++ b/runtime/syntax/openscad.vim
@@ -0,0 +1,129 @@
+" Vim syntax file
+" Language: OpenSCAD
+" Maintainer: Niklas Adam <adam@oddodd.org>
+" Last change: 2022-04-15
+"
+"
+" From salkin-mada/openscad.nvim
+" Building on the work of Sirtaj Singh Kang and others for vim-openscad
+"
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+syntax case ignore
+
+setlocal iskeyword=a-z,A-Z,48-57,_
+
+syn match openscadAoperator "{"
+syn match openscadAoperator "}"
+syn match openscadLi "\["
+syn match openscadLi "\]"
+syn match openscadPar "("
+syn match openscadPar ")"
+
+syn match openscadSpecialVariable "\$[a-zA-Z_]\+\>" display
+syn match openscadModifier "^\s*[\*\!\#\%]" display
+
+syn match openscadBinaryoperator "+"
+syn match openscadBinaryoperator "-"
+syn match openscadBinaryoperator "*"
+syn match openscadBinaryoperator "/"
+syn match openscadBinaryoperator "%"
+syn match openscadBinaryoperator "\*\*"
+syn match openscadBinaryoperator "<"
+syn match openscadBinaryoperator "<="
+syn match openscadBinaryoperator ">"
+syn match openscadBinaryoperator ">="
+syn match openscadBinaryoperator "="
+syn match openscadBinaryoperator "=="
+syn match openscadBinaryoperator "==="
+syn match openscadBinaryoperator "!="
+syn match openscadBinaryoperator "!=="
+syn match openscadBinaryoperator "&"
+syn match openscadBinaryoperator "|"
+syn match openscadBinaryoperator "<!"
+syn match openscadBinaryoperator "?"
+syn match openscadBinaryoperator "??"
+syn match openscadBinaryoperator "!?"
+syn match openscadBinaryoperator "!"
+syn match openscadBinaryoperator "#"
+syn match openscadBinaryoperator "_"
+syn match openscadBinaryoperator "\.\."
+syn match openscadBinaryoperator "\.\.\."
+syn match openscadBinaryoperator "`"
+syn match openscadBinaryoperator ":"
+
+syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
+syn match openscadFunction /\<\h\w*\>/ contained display
+
+syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
+syn match openscadModule /\<\h\w*\>/ contained display
+
+syn keyword openscadStatement echo assign let assert
+syn keyword openscadConditional if else
+syn keyword openscadRepeat for intersection_for
+syn keyword openscadInclude include use
+syn keyword openscadCsgKeyword union difference intersection render intersection_for
+syn keyword openscadTransform scale rotate translate resize mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
+syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
+syn keyword openscadPrimitive2D square circle polygon import_dxf text
+syn keyword openscadPrimitiveImport import child children
+
+syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
+syn match openscadNumber "\d\+" display contained
+syn match openscadNumber "\.\d\+" display contained
+
+syn region openscadString start=/"/ skip=/\\"/ end=/"/
+
+syn keyword openscadBoolean true false
+
+syn keyword openscadCommentTodo TODO FIXME XXX NOTE contained display
+syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
+syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
+
+syn region openscadBlock start="{" end="}" transparent fold
+syn region openscadVector start="\[" end="\]" transparent fold
+
+syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
+syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
+syn keyword openscadBuiltin str len search version version_num concat chr ord cross norm
+syn keyword openscadBuiltin parent_module
+syn keyword openscadBuiltin dxf_cross dxf_dim
+syn keyword openscadBuiltinSpecial PI undef
+
+"""""""""""""""""""""""""""""""""""""""""
+" linkage
+"""""""""""""""""""""""""""""""""""""""""
+hi def link openscadFunctionDef Structure
+hi def link openscadAoperator Function
+hi def link openscadLi Function
+" hi def link openscadPar Structure
+hi def link openscadBuiltinSpecial Special
+hi def link openscadBinaryoperator Special
+hi def link openscadFunction Function
+hi def link openscadModuleDef Structure
+hi def link openscadModule Function
+hi def link openscadBlockComment Comment
+hi def link openscadBoolean Boolean
+hi def link openscadBuiltin Function
+hi def link openscadConditional Conditional
+hi def link openscadCsgKeyword Structure
+hi def link openscadInclude Include
+hi def link openscadInlineComment Comment
+hi def link openscadModifier Special
+hi def link openscadStatement Statement
+hi def link openscadNumbers Number
+hi def link openscadNumber Number
+hi def link openscadPrimitiveSolid Keyword
+hi def link openscadPrimitive2D Keyword
+hi def link openscadPrimitiveImport Keyword
+hi def link openscadRepeat Repeat
+hi def link openscadSpecialVariable Special
+hi def link openscadString String
+hi def link openscadTransform Statement
+hi def link openscadCommentTodo Todo
+
+let b:current_syntax = 'openscad'
diff --git a/runtime/syntax/perl.vim b/runtime/syntax/perl.vim
index f4f9520de5..73f967a183 100644
--- a/runtime/syntax/perl.vim
+++ b/runtime/syntax/perl.vim
@@ -1,15 +1,17 @@
" Vim syntax file
-" Language: Perl 5
+" Language: Perl
" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Homepage: https://github.com/vim-perl/vim-perl/tree/master
+" Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
-" Last Change: 2020 Apr 15
+" License: Vim License (see :help license)
+" Last Change: 2022 Jun 13
" Contributors: Andy Lester <andy@petdance.com>
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
" Lukas Mai <l.mai.web.de>
" Nick Hibma <nick@van-laarhoven.org>
" Sonia Heimann <niania@netsurf.org>
" Rob Hoelz <rob@hoelz.ro>
+" Doug Kearns <dougkearns@gmail.com>
" and many others.
"
" Please download the most recent version first, before mailing
@@ -41,11 +43,11 @@ set cpo&vim
" POD starts with ^=<word> and ends with ^=cut
-if !exists("perl_include_pod") || perl_include_pod == 1
+if get(g:, 'perl_include_pod', 1)
" Include a while extra syntax file
syn include @Pod syntax/pod.vim
unlet b:current_syntax
- if exists("perl_fold")
+ if get(g:, 'perl_fold', 1)
syn region perlPOD start="^=[a-z]" end="^=cut" contains=@Pod,@Spell,perlTodo keepend fold extend
syn region perlPOD start="^=cut" end="^=cut" contains=perlTodo keepend fold extend
else
@@ -54,7 +56,7 @@ if !exists("perl_include_pod") || perl_include_pod == 1
endif
else
" Use only the bare minimum of rules
- if exists("perl_fold")
+ if get(g:, 'perl_fold', 1)
syn region perlPOD start="^=[a-z]" end="^=cut" fold
else
syn region perlPOD start="^=[a-z]" end="^=cut"
@@ -92,7 +94,7 @@ syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdi
syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>"
syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\|evalbytes\)\>"
syn match perlStatementInclude "\<\%(require\|import\|unimport\)\>"
-syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autodie\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|overloading\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\="
+syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autodie\%(::\%(exception\%(::system\)\=\|hints\|skip\)\)\=\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|deprecate\|diagnostics\|encoding\%(::warnings\)\=\|experimental\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|ok\|open\|ops\|overload\|overloading\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\="
syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>"
syn match perlStatementSocket "\<\%(accept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>"
syn match perlStatementIPC "\<\%(msg\%(ctl\|get\|rcv\|snd\)\|sem\%(ctl\|get\|op\)\|shm\%(ctl\|get\|read\|write\)\)\>"
@@ -138,38 +140,36 @@ syn match perlPackageRef "[$@#%*&]\%(\%(::\|'\)\=\I\i*\%(\%(::\|'\)\I\i*\)*\)\
" If you don't want complex things like @{${"foo"}} to be processed,
" just set the variable "perl_no_extended_vars"...
-if !exists("perl_no_scope_in_variables")
- syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
- syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
- syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
+if !get(g:, 'perl_no_scope_in_variables', 0)
+ syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref
+ syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref
+ syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref
else
- syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
- syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
- syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
+ syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref
+ syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref
+ syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref
endif
syn match perlVarPlain2 "%[-+]"
-if !exists("perl_no_extended_vars")
- syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlBraces
- syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
- syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
- syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
- syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
- syn region perlArrow matchgroup=perlArrow start="->\s*\$*\I\i*\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
- syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
- syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
- syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
- syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
- syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
- syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contains=perlVarSimpleMemberName contained extend
+if !get(g:, 'perl_no_extended_vars', 0)
+ syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQ,perlQQ,perlQW,perlQR,perlArrow,perlBraces
+ syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref contained
+ syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref contained
+ syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref contained
+ syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref contained
+ syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref extend
+ syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref extend
+ syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref extend
+ syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref extend
+ syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref extend
+ syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref contains=perlVarSimpleMemberName contained extend
syn match perlVarSimpleMemberName "\I\i*" contained
- syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
- syn match perlPackageConst "__PACKAGE__" nextgroup=perlMethod,perlPostDeref
- syn match perlMethod "->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
- syn match perlPostDeref "->\%($#\|[$@%&*]\)\*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
- syn region perlPostDeref start="->\%($#\|[$@%&*]\)\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
- syn region perlPostDeref matchgroup=perlPostDeref start="->\%($#\|[$@%&*]\){" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
+ syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlPostDeref extend
+ syn match perlPackageConst "__PACKAGE__" nextgroup=perlPostDeref
+ syn match perlPostDeref "->\%($#\|[$@%&*]\)\*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlPostDeref
+ syn region perlPostDeref start="->\%($#\|[$@%&*]\)\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlPostDeref
+ syn region perlPostDeref matchgroup=perlPostDeref start="->\%($#\|[$@%&*]\){" skip="\\}" end="}" keepend extend contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlPostDeref
endif
" File Descriptors
@@ -221,10 +221,16 @@ syn region perlShellCommand matchgroup=perlMatchStartEnd start="`" end="`" cont
" Constants
"
" Numbers
-syn match perlNumber "\<\%(0\%(x\x[[:xdigit:]_]*\|b[01][01_]*\|\o[0-7_]*\|\)\|[1-9][[:digit:]_]*\)\>"
-syn match perlFloat "\<\d[[:digit:]_]*[eE][\-+]\=\d\+"
-syn match perlFloat "\<\d[[:digit:]_]*\.[[:digit:]_]*\%([eE][\-+]\=\d\+\)\="
-syn match perlFloat "\.[[:digit:]][[:digit:]_]*\%([eE][\-+]\=\d\+\)\="
+syn case ignore
+syn match perlNumber "\<\%(0\|[1-9]\%(_\=\d\)*\)\>"
+syn match perlNumber "\<0\%(x\x\%(_\=\x\)*\|b[01]\%(_\=[01]\)*\|o\=\%(_\=\o\)*\)\>"
+syn match perlFloat "\<\d\%(_\=\d\)*e[-+]\=\d\%(_\=\d\)*"
+syn match perlFloat "\<\d\%(_\=\d\)*\.\%(\d\%(_\=\d\)*\)\=\%(e[-+]\=\d\%(_\=\d\)*\)\="
+syn match perlFloat "\.\d\%(_\=\d\)*\%(e[-+]\=\d\%(_\=\d\)*\)\="
+syn match perlFloat "\<0x\x\%(_\=\x\)*p[-+]\=\d\%(_\=\d\)*"
+syn match perlFloat "\<0x\x\%(_\=\x\)*\.\%(\x\%(_\=\x\)*\)\=\%(p[-+]\=\d\%(_\=\d\)*\)\="
+syn match perlFloat "\<0x\.\x\%(_\=\x\)*\%(p[-+]\=\d\%(_\=\d\)*\)\="
+syn case match
syn match perlString "\<\%(v\d\+\%(\.\d\+\)*\|\d\+\%(\.\d\+\)\{2,}\)\>" contains=perlVStringV
syn match perlVStringV "\<v" contained
@@ -242,22 +248,24 @@ syn region perlAnglesDQ start=+<+ end=+>+ extend contained contains=perlAnglesD
" Simple version of searches and matches
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[msixpodualgcn]*+ contains=@perlInterpMatch keepend extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[msixpodualgcn]*+ contains=@perlInterpMatch keepend extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgcn]*+ contains=@perlInterpSQ keepend extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgcn]*+ contains=@perlInterpSlash keepend extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgcn]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgcn]*+ contains=@perlInterpMatch,perlBracesDQ extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgcn]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
-syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgcn]*+ contains=@perlInterpMatch,perlBracketsDQ keepend extend
+syn match perlMatchModifiers "[msixpadluncgo]\+" contained
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1+ contains=@perlInterpMatch keepend extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#+ contains=@perlInterpMatch keepend extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'+ contains=@perlInterpSQ keepend extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/+ contains=@perlInterpSlash keepend extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)+ contains=@perlInterpMatch,perlParensDQ keepend extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ keepend extend nextgroup=perlMatchModifiers
+syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ keepend extend nextgroup=perlMatchModifiers
" Below some hacks to recognise the // variant. This is virtually impossible to catch in all
" cases as the / is used in so many other ways, but these should be the most obvious ones.
-syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[msixpodualgcn]*+ contains=@perlInterpSlash extend
+syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/+ contains=@perlInterpSlash extend nextgroup=perlMatchModifiers
" Substitutions
" perlMatch is the first part, perlSubstitution* is the substitution part
+syn match perlSubstitutionModifiers "[msixpadluncgero]\+" contained
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionGQQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*'+ end=+'+me=e-1 contains=@perlInterpSQ nextgroup=perlSubstitutionSQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*/+ end=+/+me=e-1 contains=@perlInterpSlash nextgroup=perlSubstitutionGQQ keepend extend
@@ -266,38 +274,39 @@ syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
-syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[msixpodualgcern]*+ keepend contained contains=@perlInterpDQ extend
-syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlParensDQ keepend extend
-syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][msixpodualgcern]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend
-syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend
-syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend
-syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[msixpodualgcern]*+ contained contains=@perlInterpSQ keepend extend
+syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1+ keepend contained contains=@perlInterpDQ extend nextgroup=perlSubstitutionModifiers
+syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)+ contained contains=@perlInterpDQ,perlParensDQ keepend extend nextgroup=perlSubstitutionModifiers
+syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\]+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend nextgroup=perlSubstitutionModifiers
+syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend nextgroup=perlSubstitutionModifiers
+syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend nextgroup=perlSubstitutionModifiers
+syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'+ contained contains=@perlInterpSQ keepend extend nextgroup=perlSubstitutionModifiers
" Translations
" perlMatch is the first part, perlTranslation* is the second, translator part.
+syn match perlTranslationModifiers "[cdsr]\+" contained
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\>\s*\z([^[:space:]([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)#+ end=+#+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
-syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]([{<]\)+ end=+\z1[cdsr]*+ contained
-syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+(+ end=+)[cdsr]*+ contains=perlParensSQ contained
-syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][cdsr]*+ contains=perlBracketsSQ contained
-syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+{+ end=+}[cdsr]*+ contains=perlBracesSQ contained
-syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+<+ end=+>[cdsr]*+ contains=perlAnglesSQ contained
+syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]([{<]\)+ end=+\z1+ contained nextgroup=perlTranslationModifiers
+syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+(+ end=+)+ contains=perlParensSQ contained nextgroup=perlTranslationModifiers
+syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\[+ end=+\]+ contains=perlBracketsSQ contained nextgroup=perlTranslationModifiers
+syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+{+ end=+}+ contains=perlBracesSQ contained nextgroup=perlTranslationModifiers
+syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+<+ end=+>+ contains=perlAnglesSQ contained nextgroup=perlTranslationModifiers
" Strings and q, qq, qw and qr expressions
syn region perlStringUnexpanded matchgroup=perlStringStartEnd start="'" end="'" contains=@perlInterpSQ keepend extend
syn region perlString matchgroup=perlStringStartEnd start=+"+ end=+"+ contains=@perlInterpDQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q#+ end=+#+ contains=@perlInterpSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
+syn region perlQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend extend
+syn region perlQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q#+ end=+#+ contains=@perlInterpSQ keepend extend
+syn region perlQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend extend
+syn region perlQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend extend
+syn region perlQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
+syn region perlQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpDQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]#+ end=+#+ contains=@perlInterpDQ keepend extend
@@ -306,48 +315,83 @@ syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*{+ end=+}+ contains=@perlInterpDQ,perlBracesDQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*<+ end=+>+ contains=@perlInterpDQ,perlAnglesDQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw#+ end=+#+ contains=@perlInterpSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
+syn region perlQW matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend extend
+syn region perlQW matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw#+ end=+#+ contains=@perlInterpSQ keepend extend
+syn region perlQW matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend extend
+syn region perlQW matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend extend
+syn region perlQW matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
+syn region perlQW matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosxdual]*+ contains=@perlInterpMatch keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosxdual]*+ contains=@perlInterpSlash keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosxdual]*+ contains=@perlInterpMatch keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosxdual]*+ contains=@perlInterpSQ keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosxdual]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
+syn match perlQRModifiers "[msixpadluno]\+" contained
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1+ contains=@perlInterpMatch keepend extend nextgroup=perlQRModifiers
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/+ contains=@perlInterpSlash keepend extend nextgroup=perlQRModifiers
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#+ contains=@perlInterpMatch keepend extend nextgroup=perlQRModifiers
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'+ contains=@perlInterpSQ keepend extend nextgroup=perlQRModifiers
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)+ contains=@perlInterpMatch,perlParensDQ keepend extend nextgroup=perlQRModifiers
" A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosxdual]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosxdual]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend
-syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosxdual]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend nextgroup=perlQRModifiers
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend nextgroup=perlQRModifiers
+syn region perlQR matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend nextgroup=perlQRModifiers
" Constructs such as print <<EOF [...] EOF, 'here' documents
"
" XXX Any statements after the identifier are in perlString colour (i.e.
" 'if $a' in 'print <<EOF if $a'). This is almost impossible to get right it
" seems due to the 'auto-extending nature' of regions.
-syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\z(\I\i*\)+ end=+$+ contains=@perlTop oneline
-syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+$+ contains=@perlTop oneline
-syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+$+ contains=@perlTop oneline
-syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*""+ end=+$+ contains=@perlTop oneline
-syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*''+ end=+$+ contains=@perlTop oneline
-if exists("perl_fold")
- syn region perlHereDoc start=+<<\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ fold extend
+" XXX Indented heredocs are not perfect - they sometimes seem to take a moment
+" to update if switched from double to single quotes and vice versa.
+"
+" Note: bare delimiters such as << to mean <<"" are not supported. These are a
+" fatal error since 5.28 and, apparently, a rarely used feature.
+
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\I\i*+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\\\I\i*+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\s*"[^\\"]*\%(\\.[^\\"]*\)*"+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\s*'[^\\']*\%(\\.[^\\']*\)*'+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\s*`[^\\`]*\%(\\.[^\\`]*\)*`+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\s*""+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\s*''+ end=+$+ contains=@perlTop oneline
+syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\~\=\s*``+ end=+$+ contains=@perlTop oneline
+
+if get(g:, 'perl_fold', 0)
+ syn region perlHereDoc start=+<<\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ fold extend
+ syn region perlHereDoc start=+<<\\\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpSQ fold extend
syn region perlHereDoc start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ fold extend
syn region perlHereDoc start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpSQ fold extend
- syn region perlHereDoc start=+<<\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine fold extend
- syn region perlHereDoc start=+<<\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine fold extend
- syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL fold extend
+ syn region perlHereDoc start=+<<\s*`\z([^\\`]*\%(\\.[^\\`]*\)*\)`+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ fold extend
+ syn region perlHereDoc start=+<<\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine fold extend
+ syn region perlHereDoc start=+<<\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine fold extend
+ syn region perlHereDoc start=+<<\s*``+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine fold extend
else
- syn region perlHereDoc start=+<<\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ
+ syn region perlHereDoc start=+<<\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ
+ syn region perlHereDoc start=+<<\\\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpSQ
syn region perlHereDoc start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ
syn region perlHereDoc start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpSQ
- syn region perlHereDoc start=+<<\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine
- syn region perlHereDoc start=+<<\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine
- syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL
+ syn region perlHereDoc start=+<<\s*`\z([^\\`]*\%(\\.[^\\`]*\)*\)`+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ
+ syn region perlHereDoc start=+<<\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine
+ syn region perlHereDoc start=+<<\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine
+ syn region perlHereDoc start=+<<\s*``+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine
+endif
+
+if get(g:, 'perl_fold', 0)
+ syn region perlIndentedHereDoc start=+<<\~\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlIndentedHereDocStart,@perlInterpDQ fold extend
+ syn region perlIndentedHereDoc start=+<<\~\\\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlIndentedHereDocStart,@perlInterpSQ fold extend
+ syn region perlIndentedHereDoc start=+<<\~\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlIndentedHereDocStart,@perlInterpDQ fold extend
+ syn region perlIndentedHereDoc start=+<<\~\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlIndentedHereDocStart,@perlInterpSQ fold extend
+ syn region perlIndentedHereDoc start=+<<\~\s*`\z([^\\`]*\%(\\.[^\\`]*\)*\)`+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlIndentedHereDocStart,@perlInterpDQ fold extend
+ syn region perlIndentedHereDoc start=+<<\~\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlIndentedHereDocStart,@perlInterpDQ,perlNotEmptyLine fold extend
+ syn region perlIndentedHereDoc start=+<<\~\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlIndentedHereDocStart,@perlInterpSQ,perlNotEmptyLine fold extend
+ syn region perlIndentedHereDoc start=+<<\~\s*``+ matchgroup=perlStringStartEnd end=+^$+ contains=perlIndentedHereDocStart,@perlInterpDQ,perlNotEmptyLine fold extend
+else
+ syn region perlIndentedHereDoc start=+<<\~\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlHereDocStart,@perlInterpDQ
+ syn region perlIndentedHereDoc start=+<<\~\\\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlHereDocStart,@perlInterpSQ
+ syn region perlIndentedHereDoc start=+<<\~\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlHereDocStart,@perlInterpDQ
+ syn region perlIndentedHereDoc start=+<<\~\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlHereDocStart,@perlInterpSQ
+ syn region perlIndentedHereDoc start=+<<\~\s*`\z([^\\`]*\%(\\.[^\\`]*\)*\)`+ matchgroup=perlStringStartEnd end=+^\s*\z1$+ contains=perlHereDocStart,@perlInterpDQ
+ syn region perlIndentedHereDoc start=+<<\~\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine
+ syn region perlIndentedHereDoc start=+<<\~\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine
+ syn region perlIndentedHereDoc start=+<<\~\s*``+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine
endif
@@ -357,24 +401,15 @@ syn match perlPackageDecl "\<package\s\+\%(\h\|::\)\%(\w\|::\)*" contains=per
syn keyword perlStatementPackage package contained
" Functions
-" sub [name] [(prototype)] {
-"
-syn match perlSubError "[^[:space:];{#]" contained
-syn match perlSubAttributesCont "\h\w*\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained
-syn region perlSubAttributesCont matchgroup=perlSubAttributesCont start="\h\w*(" end=")\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained contains=@perlInterpSQ,perlParensSQ
-syn cluster perlSubAttrMaybe contains=perlSubAttributesCont,perlSubError,perlFakeGroup
-syn match perlSubAttributes "" contained nextgroup=perlSubError
-syn match perlSubAttributes ":\_s*" contained nextgroup=@perlSubAttrMaybe
if get(g:, "perl_sub_signatures", 0)
- syn match perlSignature +(\_[^)]*)\_s*+ nextgroup=perlSubAttributes,perlComment contained
+ syn match perlSubSignature "\s*([^)]*)" contained extend
else
- syn match perlSubPrototypeError "(\%(\_s*\%(\%(\\\%([$@%&*]\|\[[$@%&*]\+\]\)\|[$&*]\|[@%]\%(\_s*)\)\@=\|;\%(\_s*[)$@%&*\\]\)\@=\|_\%(\_s*[);]\)\@=\)\_s*\)*\)\@>\zs\_[^)]\+" contained
- syn match perlSubPrototype +(\_[^)]*)\_s*+ nextgroup=perlSubAttributes,perlComment contained contains=perlSubPrototypeError
+ syn match perlSubPrototype "\s*([\\$@%&*\[\];]*)" contained extend
endif
-
-syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype,perlSignature,perlSubAttributes,perlComment
-
-syn match perlFunction +\<sub\>\_s*+ nextgroup=perlSubName
+syn match perlSubAttribute "\s*:\s*\h\w*\%(([^)]*)\|\)" contained extend
+syn match perlSubName "\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\s*" contained extend
+syn region perlSubDeclaration start="" end="[;{]" contains=perlSubName,perlSubPrototype,perlSubAttribute,perlSubSignature,perlComment contained transparent
+syn match perlFunction "\<sub\>\_s*" nextgroup=perlSubDeclaration
" The => operator forces a bareword to the left of it to be interpreted as
" a string
@@ -394,39 +429,75 @@ syn match perlFormatField "@[^A-Za-z_|<>~#*]"me=e-1 contained
syn match perlFormatField "@$" contained
" __END__ and __DATA__ clauses
-if exists("perl_fold")
- syntax region perlDATA start="^__DATA__$" skip="." end="." contains=@perlDATA fold
- syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA fold
+
+" Vim excludes empty syn-region end lines from the fold region. This is
+" probably a bug and means a DATA section ending with an empty line does not
+" have that final line included in the fold.
+"
+" As a workaround we exploit an unterminated syntax region here with an end
+" pattern that will (probably) never match. This forces all lines to be
+" included in the fold region. Of course, if it does match then there's
+" nothing to work around as it is a non-empty line.
+"
+" This problem also exists with empty string delimited heredocs but there's no
+" known workaround for that case.
+if get(g:, 'perl_fold', 0)
+ syntax region perlDATA matchgroup=perlDATAStart start="^__DATA__$" end="VIM_PERL_EOF\%$" contains=@perlDATA fold
+ syntax region perlEND matchgroup=perlENDStart start="^__END__$" end="VIM_PERL_EOF\%$" contains=@perlDATA fold
else
- syntax region perlDATA start="^__DATA__$" skip="." end="." contains=@perlDATA
- syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA
+ syntax region perlDATA matchgroup=perlDATAStart start="^__DATA__$" end="\%$" contains=@perlDATA
+ syntax region perlEND matchgroup=perlENDStart start="^__END__$" end="\%$" contains=@perlDATA
+endif
+
+" TODO: generalise this to allow other filetypes
+if get(g:, 'perl_highlight_data', 0)
+ syn cluster perlDATA add=perlPOD
+else
+ syn cluster perlDATA remove=perlPOD
endif
"
" Folding
-
-if exists("perl_fold")
+if get(g:, 'perl_fold', 0)
" Note: this bit must come before the actual highlighting of the "package"
" keyword, otherwise this will screw up Pod lines that match /^package/
- if !exists("perl_nofold_packages")
+ if !get(g:, 'perl_nofold_packages', 0)
syn region perlPackageFold start="^package \S\+;\s*\%(#.*\)\=$" end="^1;\=\s*\%(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend
+ syn region perlPackageFold start="^\z(\s*\)package\s*\S\+\s*{" end="^\z1}" transparent fold keepend
endif
- if !exists("perl_nofold_subs")
+ if !get(g:, 'perl_nofold_subs', 0)
if get(g:, "perl_fold_anonymous_subs", 0)
- syn region perlSubFold start="\<sub\>[^{]*{" end="}" transparent fold keepend extend
- syn region perlSubFold start="\<\%(BEGIN\|END\|CHECK\|INIT\)\>\s*{" end="}" transparent fold keepend
+ " EXPLANATION:
+ " \<sub\> - "sub" keyword
+ " \_[^;{]* - any characters, including new line, but not ";" or "{", zero or more times
+ " \%(([\\$@%&*\[\];]*)\)\= - prototype definition, \$@%&*[]; characters between (), zero or 1 times
+ " \_[^;]* - any characters, including new line, but not ";" or "{", zero or more times
+ " { - start subroutine block
+ syn region perlSubFold start="\<sub\>\_[^;{]*\%(([\\$@%&*\[\];]*)\)\=\_[^;{]*{" end="}" transparent fold keepend extend
else
- syn region perlSubFold start="^\z(\s*\)\<sub\>.*[^};]$" end="^\z1}\s*\%(#.*\)\=$" transparent fold keepend
- syn region perlSubFold start="^\z(\s*\)\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend
+ " EXPLANATION:
+ " same, as above, but first non-space character after "sub" keyword must
+ " be [A-Za-z_]
+ syn region perlSubFold start="\<sub\>\s*\h\_[^;{]*\%(([\\$@%&*\[\];]*)\)\=\_[^;]*{" end="}" transparent fold keepend extend
endif
+
+ syn region perlSubFold start="\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>\_s*{" end="}" transparent fold keepend
endif
- if exists("perl_fold_blocks")
+ if get(g:, 'perl_fold_blocks', 0)
syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)for\%(each\)\=\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
+
+ " TODO this is works incorrectly
syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
+ else
+ if get(g:, 'perl_fold_do_blocks', 0)
+ syn region perlDoBlockDeclaration start="" end="{" contains=perlComment contained transparent
+ syn match perlOperator "\<do\>\_s*" nextgroup=perlDoBlockDeclaration
+
+ syn region perlDoBlockFold start="\<do\>\_[^{]*{" end="}" transparent fold keepend extend
+ endif
endif
- setlocal foldmethod=syntax
syn sync fromstart
else
" fromstart above seems to set minlines even if perl_fold is not set.
@@ -438,29 +509,28 @@ endif
" The default highlighting.
hi def link perlSharpBang PreProc
-hi def link perlControl PreProc
-hi def link perlInclude Include
-hi def link perlSpecial Special
-hi def link perlString String
+hi def link perlControl PreProc
+hi def link perlInclude Include
+hi def link perlSpecial Special
+hi def link perlString String
hi def link perlCharacter Character
-hi def link perlNumber Number
-hi def link perlFloat Float
+hi def link perlNumber Number
+hi def link perlFloat Float
hi def link perlType Type
hi def link perlIdentifier Identifier
-hi def link perlLabel Label
+hi def link perlLabel Label
hi def link perlStatement Statement
hi def link perlConditional Conditional
-hi def link perlRepeat Repeat
+hi def link perlRepeat Repeat
hi def link perlOperator Operator
hi def link perlFunction Keyword
-hi def link perlSubName Function
+hi def link perlSubName Function
hi def link perlSubPrototype Type
-hi def link perlSignature Type
-hi def link perlSubAttributes PreProc
-hi def link perlSubAttributesCont perlSubAttributes
-hi def link perlComment Comment
+hi def link perlSubSignature Type
+hi def link perlSubAttribute PreProc
+hi def link perlComment Comment
hi def link perlTodo Todo
-if exists("perl_string_as_statement")
+if get(g:, 'perl_string_as_statement', 0)
hi def link perlStringStartEnd perlStatement
else
hi def link perlStringStartEnd perlString
@@ -470,21 +540,29 @@ hi def link perlList perlStatement
hi def link perlMisc perlStatement
hi def link perlVarPlain perlIdentifier
hi def link perlVarPlain2 perlIdentifier
-hi def link perlArrow perlIdentifier
+hi def link perlArrow perlIdentifier
hi def link perlFiledescRead perlIdentifier
hi def link perlFiledescStatement perlIdentifier
-hi def link perlVarSimpleMember perlIdentifier
-hi def link perlVarSimpleMemberName perlString
-hi def link perlVarNotInMatches perlIdentifier
+hi def link perlVarSimpleMember perlIdentifier
+hi def link perlVarSimpleMemberName perlString
+hi def link perlVarNotInMatches perlIdentifier
hi def link perlVarSlash perlIdentifier
+hi def link perlQ perlString
hi def link perlQQ perlString
-hi def link perlHereDoc perlString
+hi def link perlQW perlString
+hi def link perlQR perlString
+hi def link perlMatchModifiers perlMatchStartEnd
+hi def link perlSubstitutionModifiers perlMatchStartEnd
+hi def link perlTranslationModifiers perlMatchStartEnd
+hi def link perlQRModifiers perlStringStartEnd
+hi def link perlHereDoc perlString
+hi def link perlIndentedHereDoc perlString
hi def link perlStringUnexpanded perlString
-hi def link perlSubstitutionSQ perlString
-hi def link perlSubstitutionGQQ perlString
-hi def link perlTranslationGQ perlString
-hi def link perlMatch perlString
-hi def link perlMatchStartEnd perlStatement
+hi def link perlSubstitutionSQ perlString
+hi def link perlSubstitutionGQQ perlString
+hi def link perlTranslationGQ perlString
+hi def link perlMatch perlString
+hi def link perlMatchStartEnd perlStatement
hi def link perlFormatName perlIdentifier
hi def link perlFormatField perlString
hi def link perlPackageDecl perlType
@@ -493,44 +571,48 @@ hi def link perlPackageRef perlType
hi def link perlStatementPackage perlStatement
hi def link perlStatementStorage perlStatement
hi def link perlStatementControl perlStatement
-hi def link perlStatementScalar perlStatement
-hi def link perlStatementRegexp perlStatement
+hi def link perlStatementScalar perlStatement
+hi def link perlStatementRegexp perlStatement
hi def link perlStatementNumeric perlStatement
-hi def link perlStatementList perlStatement
-hi def link perlStatementHash perlStatement
-hi def link perlStatementIOfunc perlStatement
+hi def link perlStatementList perlStatement
+hi def link perlStatementHash perlStatement
+hi def link perlStatementIOfunc perlStatement
hi def link perlStatementFiledesc perlStatement
-hi def link perlStatementVector perlStatement
-hi def link perlStatementFiles perlStatement
-hi def link perlStatementFlow perlStatement
+hi def link perlStatementVector perlStatement
+hi def link perlStatementFiles perlStatement
+hi def link perlStatementFlow perlStatement
hi def link perlStatementInclude perlStatement
-hi def link perlStatementProc perlStatement
-hi def link perlStatementSocket perlStatement
+hi def link perlStatementProc perlStatement
+hi def link perlStatementSocket perlStatement
hi def link perlStatementIPC perlStatement
hi def link perlStatementNetwork perlStatement
-hi def link perlStatementPword perlStatement
-hi def link perlStatementTime perlStatement
-hi def link perlStatementMisc perlStatement
+hi def link perlStatementPword perlStatement
+hi def link perlStatementTime perlStatement
+hi def link perlStatementMisc perlStatement
hi def link perlStatementIndirObj perlStatement
hi def link perlFunctionName perlIdentifier
-hi def link perlMethod perlIdentifier
+hi def link perlMethod perlIdentifier
hi def link perlPostDeref perlIdentifier
hi def link perlFunctionPRef perlType
+
if !get(g:, 'perl_include_pod', 1)
hi def link perlPOD perlComment
endif
hi def link perlShellCommand perlString
hi def link perlSpecialAscii perlSpecial
-hi def link perlSpecialDollar perlSpecial
-hi def link perlSpecialString perlSpecial
-hi def link perlSpecialStringU perlSpecial
+hi def link perlSpecialDollar perlSpecial
+hi def link perlSpecialString perlSpecial
+hi def link perlSpecialStringU perlSpecial
hi def link perlSpecialMatch perlSpecial
+hi def link perlEND perlComment
+hi def link perlENDStart perlEND
hi def link perlDATA perlComment
+hi def link perlDATAStart perlDATA
" NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part),
-" I had to remove the transparent property from the following regions
-" in order to get them to highlight correctly. Feel free to remove
-" these and reinstate the transparent property if you know how.
+" I had to remove the transparent property from the following regions
+" in order to get them to highlight correctly. Feel free to remove
+" these and reinstate the transparent property if you know how.
hi def link perlParensSQ perlString
hi def link perlBracketsSQ perlString
hi def link perlBracesSQ perlString
@@ -546,23 +628,21 @@ hi def link perlSpecialStringU2 perlString
" Possible errors
hi def link perlNotEmptyLine Error
hi def link perlElseIfError Error
-hi def link perlSubPrototypeError Error
-hi def link perlSubError Error
" Syncing to speed up processing
"
-if !exists("perl_no_sync_on_sub")
+if !get(g:, 'perl_no_sync_on_sub', 0)
syn sync match perlSync grouphere NONE "^\s*\<package\s"
syn sync match perlSync grouphere NONE "^\s*\<sub\>"
syn sync match perlSync grouphere NONE "^}"
endif
-if !exists("perl_no_sync_on_global_var")
+if !get(g:, 'perl_no_sync_on_global_var', 0)
syn sync match perlSync grouphere NONE "^$\I[[:alnum:]_:]+\s*=\s*{"
syn sync match perlSync grouphere NONE "^[@%]\I[[:alnum:]_:]+\s*=\s*("
endif
-if exists("perl_sync_dist")
+if get(g:, 'perl_sync_dist', 0)
execute "syn sync maxlines=" . perl_sync_dist
else
syn sync maxlines=100
diff --git a/runtime/syntax/plsql.vim b/runtime/syntax/plsql.vim
index 1868c9cb16..7b36c0a180 100644
--- a/runtime/syntax/plsql.vim
+++ b/runtime/syntax/plsql.vim
@@ -1,19 +1,43 @@
" Vim syntax file
-" Language: Oracle Procedureal SQL (PL/SQL)
-" Maintainer: Jeff Lanzarotta (jefflanzarotta at yahoo dot com)
-" Original Maintainer: C. Laurence Gonsalves (clgonsal@kami.com)
-" URL: http://lanzarotta.tripod.com/vim/syntax/plsql.vim.zip
-" Last Change: September 18, 2002
-" History: Geoff Evans & Bill Pribyl (bill at plnet dot org)
-" Added 9i keywords.
-" Austin Ziegler (austin at halostatue dot ca)
-" Added 8i+ features.
+" Language: Oracle Procedural SQL (PL/SQL)
+" Maintainer: Lee Lindley (lee dot lindley at gmail dot com)
+" Previous Maintainer: Jeff Lanzarotta (jefflanzarotta at yahoo dot com)
+" Previous Maintainer: C. Laurence Gonsalves (clgonsal@kami.com)
+" URL: https://github.com/lee-lindley/vim_plsql_syntax
+" Last Change: April 28, 2022
+" History Lee Lindley (lee dot lindley at gmail dot com)
+" updated to 19c keywords. refined quoting.
+" separated reserved, non-reserved keywords and functions
+" revised folding, giving up on procedure folding due to issue
+" with multiple ways to enter <begin>.
+" Eugene Lysyonok (lysyonok at inbox ru)
+" Added folding.
+" Geoff Evans & Bill Pribyl (bill at plnet dot org)
+" Added 9i keywords.
+" Austin Ziegler (austin at halostatue dot ca)
+" Added 8i+ features.
"
-" quit when a syntax file was already loaded
+" To put SQL keywords as Function group in legacy style
+" let plsql_legacy_sql_keywords = 1
+"
+" To enable folding (It does setlocal foldmethod=syntax)
+" let plsql_fold = 1
+"
+" From my vimrc file -- turn syntax and syntax folding on,
+" associate file suffixes as plsql, open all the folds on file open
+" let plsql_fold = 1
+" au BufNewFile,BufRead *.sql,*.pls,*.tps,*.tpb,*.pks,*.pkb,*.pkg,*.trg set filetype=plsql
+" au BufNewFile,BufRead *.sql,*.pls,*.tps,*.tpb,*.pks,*.pkb,*.pkg,*.trg syntax on
+" au Syntax plsql normal zR
+
if exists("b:current_syntax")
finish
endif
+" this file uses line continuations
+let s:cpo_sav = &cpo
+set cpo&vim
+
" Todo.
syn keyword plsqlTodo TODO FIXME XXX DEBUG NOTE
syn cluster plsqlCommentGroup contains=plsqlTodo
@@ -25,110 +49,512 @@ syn match plsqlIdentifier "[a-z][a-z0-9$_#]*"
syn match plsqlHostIdentifier ":[a-z][a-z0-9$_#]*"
" When wanted, highlight the trailing whitespace.
-if exists("c_space_errors")
- if !exists("c_no_trail_space_error")
+if exists("plsql_space_errors")
+ if !exists("plsql_no_trail_space_error")
syn match plsqlSpaceError "\s\+$"
endif
- if !exists("c_no_tab_space_error")
+ if !exists("plsql_no_tab_space_error")
syn match plsqlSpaceError " \+\t"me=e-1
endif
endif
" Symbols.
-syn match plsqlSymbol "\(;\|,\|\.\)"
-
-" Operators.
-syn match plsqlOperator "\(+\|-\|\*\|/\|=\|<\|>\|@\|\*\*\|!=\|\~=\)"
-syn match plsqlOperator "\(^=\|<=\|>=\|:=\|=>\|\.\.\|||\|<<\|>>\|\"\)"
-
-" Some of Oracle's SQL keywords.
-syn keyword plsqlSQLKeyword ABORT ACCESS ACCESSED ADD AFTER ALL ALTER AND ANY
-syn keyword plsqlSQLKeyword AS ASC ATTRIBUTE AUDIT AUTHORIZATION AVG BASE_TABLE
-syn keyword plsqlSQLKeyword BEFORE BETWEEN BY CASCADE CAST CHECK CLUSTER
-syn keyword plsqlSQLKeyword CLUSTERS COLAUTH COLUMN COMMENT COMPRESS CONNECT
-syn keyword plsqlSQLKeyword CONSTRAINT CRASH CREATE CURRENT DATA DATABASE
-syn keyword plsqlSQLKeyword DATA_BASE DBA DEFAULT DELAY DELETE DESC DISTINCT
-syn keyword plsqlSQLKeyword DROP DUAL ELSE EXCLUSIVE EXISTS EXTENDS EXTRACT
-syn keyword plsqlSQLKeyword FILE FORCE FOREIGN FROM GRANT GROUP HAVING HEAP
-syn keyword plsqlSQLKeyword IDENTIFIED IDENTIFIER IMMEDIATE IN INCLUDING
-syn keyword plsqlSQLKeyword INCREMENT INDEX INDEXES INITIAL INSERT INSTEAD
-syn keyword plsqlSQLKeyword INTERSECT INTO INVALIDATE IS ISOLATION KEY LIBRARY
-syn keyword plsqlSQLKeyword LIKE LOCK MAXEXTENTS MINUS MODE MODIFY MULTISET
-syn keyword plsqlSQLKeyword NESTED NOAUDIT NOCOMPRESS NOT NOWAIT OF OFF OFFLINE
-syn keyword plsqlSQLKeyword ON ONLINE OPERATOR OPTION OR ORDER ORGANIZATION
-syn keyword plsqlSQLKeyword PCTFREE PRIMARY PRIOR PRIVATE PRIVILEGES PUBLIC
-syn keyword plsqlSQLKeyword QUOTA RELEASE RENAME REPLACE RESOURCE REVOKE ROLLBACK
-syn keyword plsqlSQLKeyword ROW ROWLABEL ROWS SCHEMA SELECT SEPARATE SESSION SET
-syn keyword plsqlSQLKeyword SHARE SIZE SPACE START STORE SUCCESSFUL SYNONYM
-syn keyword plsqlSQLKeyword SYSDATE TABLE TABLES TABLESPACE TEMPORARY TO TREAT
-syn keyword plsqlSQLKeyword TRIGGER TRUNCATE UID UNION UNIQUE UNLIMITED UPDATE
-syn keyword plsqlSQLKeyword USE USER VALIDATE VALUES VIEW WHENEVER WHERE WITH
-
-" PL/SQL's own keywords.
-syn keyword plsqlKeyword AGENT AND ANY ARRAY ASSIGN AS AT AUTHID BEGIN BODY BY
-syn keyword plsqlKeyword BULK C CASE CHAR_BASE CHARSETFORM CHARSETID CLOSE
-syn keyword plsqlKeyword COLLECT CONSTANT CONSTRUCTOR CONTEXT CURRVAL DECLARE
-syn keyword plsqlKeyword DVOID EXCEPTION EXCEPTION_INIT EXECUTE EXIT FETCH
-syn keyword plsqlKeyword FINAL FUNCTION GOTO HASH IMMEDIATE IN INDICATOR
-syn keyword plsqlKeyword INSTANTIABLE IS JAVA LANGUAGE LIBRARY MAP MAXLEN
-syn keyword plsqlKeyword MEMBER NAME NEW NOCOPY NUMBER_BASE OBJECT OCICOLL
-syn keyword plsqlKeyword OCIDATE OCIDATETIME OCILOBLOCATOR OCINUMBER OCIRAW
-syn keyword plsqlKeyword OCISTRING OF OPAQUE OPEN OR ORDER OTHERS OUT
-syn keyword plsqlKeyword OVERRIDING PACKAGE PARALLEL_ENABLE PARAMETERS
-syn keyword plsqlKeyword PARTITION PIPELINED PRAGMA PROCEDURE RAISE RANGE REF
-syn keyword plsqlKeyword RESULT RETURN REVERSE ROWTYPE SB1 SELF SHORT SIZE_T
-syn keyword plsqlKeyword SQL SQLCODE SQLERRM STATIC STRUCT SUBTYPE TDO THEN
-syn keyword plsqlKeyword TABLE TIMEZONE_ABBR TIMEZONE_HOUR TIMEZONE_MINUTE
-syn keyword plsqlKeyword TIMEZONE_REGION TYPE UNDER UNSIGNED USING VARIANCE
-syn keyword plsqlKeyword VARRAY VARYING WHEN WRITE
-syn match plsqlKeyword "\<END\>"
-syn match plsqlKeyword "\.COUNT\>"hs=s+1
-syn match plsqlKeyword "\.EXISTS\>"hs=s+1
-syn match plsqlKeyword "\.FIRST\>"hs=s+1
-syn match plsqlKeyword "\.LAST\>"hs=s+1
-syn match plsqlKeyword "\.DELETE\>"hs=s+1
-syn match plsqlKeyword "\.PREV\>"hs=s+1
-syn match plsqlKeyword "\.NEXT\>"hs=s+1
-
-" PL/SQL functions.
-syn keyword plsqlFunction ABS ACOS ADD_MONTHS ASCII ASCIISTR ASIN ATAN ATAN2
-syn keyword plsqlFunction BFILENAME BITAND CEIL CHARTOROWID CHR COALESCE
-syn keyword plsqlFunction COMMIT COMMIT_CM COMPOSE CONCAT CONVERT COS COSH
-syn keyword plsqlFunction COUNT CUBE CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP
-syn keyword plsqlFunction DBTIMEZONE DECODE DECOMPOSE DEREF DUMP EMPTY_BLOB
-syn keyword plsqlFunction EMPTY_CLOB EXISTS EXP FLOOR FROM_TZ GETBND GLB
-syn keyword plsqlFunction GREATEST GREATEST_LB GROUPING HEXTORAW INITCAP
-syn keyword plsqlFunction INSTR INSTR2 INSTR4 INSTRB INSTRC ISNCHAR LAST_DAY
-syn keyword plsqlFunction LEAST LEAST_UB LENGTH LENGTH2 LENGTH4 LENGTHB LENGTHC
-syn keyword plsqlFunction LN LOCALTIME LOCALTIMESTAMP LOG LOWER LPAD
-syn keyword plsqlFunction LTRIM LUB MAKE_REF MAX MIN MOD MONTHS_BETWEEN
-syn keyword plsqlFunction NCHARTOROWID NCHR NEW_TIME NEXT_DAY NHEXTORAW
-syn keyword plsqlFunction NLS_CHARSET_DECL_LEN NLS_CHARSET_ID NLS_CHARSET_NAME
-syn keyword plsqlFunction NLS_INITCAP NLS_LOWER NLSSORT NLS_UPPER NULLFN NULLIF
-syn keyword plsqlFunction NUMTODSINTERVAL NUMTOYMINTERVAL NVL POWER
-syn keyword plsqlFunction RAISE_APPLICATION_ERROR RAWTOHEX RAWTONHEX REF
-syn keyword plsqlFunction REFTOHEX REPLACE ROLLBACK_NR ROLLBACK_SV ROLLUP ROUND
-syn keyword plsqlFunction ROWIDTOCHAR ROWIDTONCHAR ROWLABEL RPAD RTRIM
-syn keyword plsqlFunction SAVEPOINT SESSIONTIMEZONE SETBND SET_TRANSACTION_USE
-syn keyword plsqlFunction SIGN SIN SINH SOUNDEX SQLCODE SQLERRM SQRT STDDEV
-syn keyword plsqlFunction SUBSTR SUBSTR2 SUBSTR4 SUBSTRB SUBSTRC SUM
-syn keyword plsqlFunction SYS_AT_TIME_ZONE SYS_CONTEXT SYSDATE SYS_EXTRACT_UTC
-syn keyword plsqlFunction SYS_GUID SYS_LITERALTODATE SYS_LITERALTODSINTERVAL
-syn keyword plsqlFunction SYS_LITERALTOTIME SYS_LITERALTOTIMESTAMP
-syn keyword plsqlFunction SYS_LITERALTOTZTIME SYS_LITERALTOTZTIMESTAMP
-syn keyword plsqlFunction SYS_LITERALTOYMINTERVAL SYS_OVER__DD SYS_OVER__DI
-syn keyword plsqlFunction SYS_OVER__ID SYS_OVER_IID SYS_OVER_IIT
-syn keyword plsqlFunction SYS_OVER__IT SYS_OVER__TI SYS_OVER__TT
-syn keyword plsqlFunction SYSTIMESTAMP TAN TANH TO_ANYLOB TO_BLOB TO_CHAR
-syn keyword plsqlFunction TO_CLOB TO_DATE TO_DSINTERVAL TO_LABEL TO_MULTI_BYTE
-syn keyword plsqlFunction TO_NCHAR TO_NCLOB TO_NUMBER TO_RAW TO_SINGLE_BYTE
-syn keyword plsqlFunction TO_TIME TO_TIMESTAMP TO_TIMESTAMP_TZ TO_TIME_TZ
-syn keyword plsqlFunction TO_YMINTERVAL TRANSLATE TREAT TRIM TRUNC TZ_OFFSET UID
-syn keyword plsqlFunction UNISTR UPPER UROWID USER USERENV VALUE VARIANCE
-syn keyword plsqlFunction VSIZE WORK XOR
+syn match plsqlSymbol "[;,.()]"
+
+" Operators. and words that would be something else if not in operator mode
+syn match plsqlOperator "[-+*/=<>@"]"
+syn match plsqlOperator "\(\^=\|<=\|>=\|:=\|=>\|\.\.\|||\|<<\|>>\|\*\*\|!=\|\~=\)"
+syn match plsqlOperator "\<\(NOT\|AND\|OR\|LIKE\|BETWEEN\|IN\)\>"
+syn match plsqlBooleanLiteral "\<NULL\>"
+syn match plsqlOperator "\<IS\\_s\+\(NOT\_s\+\)\?NULL\>"
+"
+" conditional compilation Preprocessor directives and sqlplus define sigil
+syn match plsqlPseudo "$[$a-z][a-z0-9$_#]*"
+syn match plsqlPseudo "&"
+
+syn match plsqlReserved "\<\(CREATE\|THEN\|UPDATE\|INSERT\|SET\)\>"
+syn match plsqlKeyword "\<\(REPLACE\|PACKAGE\|FUNCTION\|PROCEDURE\|TYPE|BODY\|WHEN\|MATCHED\)\>"
+syn region plsqlUpdate
+ \ matchgroup=plsqlReserved
+ \ start="\<UPDATE\>"
+ \ end="\<SET\>"
+ \ contains=@plsqlIdentifiers
+syn match plsqlReserved "\<WHEN\_s\+\(NOT\_s\+\)\?MATCHED\_s\+THEN\_s\+\(UPDATE\|INSERT\)\(\_s\+SET\)\?"
+
+"
+" Oracle's non-reserved keywords
+syn keyword plsqlKeyword ABORT ABS ABSENT ACCESS ACCESSED ACCOUNT ACL ACOS ACROSS ACTION ACTIONS
+syn keyword plsqlKeyword ACTIVATE ACTIVE ACTIVE_COMPONENT ACTIVE_DATA ACTIVE_FUNCTION ACTIVE_TAG ACTIVITY
+syn keyword plsqlKeyword ADAPTIVE_PLAN ADD ADD_COLUMN ADD_GROUP ADD_MONTHS ADG_REDIRECT_DML ADG_REDIRECT_PLSQL
+syn keyword plsqlKeyword ADJ_DATE ADMIN ADMINISTER ADMINISTRATOR ADVANCED ADVISE ADVISOR AFD_DISKSTRING
+syn keyword plsqlKeyword AFFINITY AFTER AGGREGATE AGGREGATES ALGORITHM ALIAS ALLOCATE ALLOW ALL_ROWS
+syn keyword plsqlKeyword ALTERNATE ALWAYS ANALYTIC ANALYTIC_VIEW_SQL ANALYZE ANCESTOR ANCILLARY AND_EQUAL
+syn keyword plsqlKeyword ANOMALY ANSI_REARCH ANSWER_QUERY_USING_STATS ANTIJOIN ANYSCHEMA ANY_VALUE
+syn keyword plsqlKeyword APPEND APPENDCHILDXML APPEND_VALUES APPLICATION APPLY APPROX_COUNT APPROX_COUNT_DISTINCT
+syn keyword plsqlKeyword APPROX_COUNT_DISTINCT_AGG APPROX_COUNT_DISTINCT_DETAIL APPROX_MEDIAN APPROX_PERCENTILE
+syn keyword plsqlKeyword APPROX_PERCENTILE_AGG APPROX_PERCENTILE_DETAIL APPROX_RANK APPROX_SUM ARCHIVAL
+syn keyword plsqlKeyword ARCHIVE ARCHIVED ARCHIVELOG ARRAY ARRAYS ASCII ASCIISTR ASIN ASIS ASSEMBLY
+syn keyword plsqlKeyword ASSIGN ASSOCIATE ASYNC ASYNCHRONOUS AS_JSON AT ATAN ATAN2 ATTRIBUTE ATTRIBUTES
+syn keyword plsqlKeyword AUDIT AUTHENTICATED AUTHENTICATION AUTHID AUTHORIZATION AUTO AUTOALLOCATE
+syn keyword plsqlKeyword AUTOEXTEND AUTOMATIC AUTO_LOGIN AUTO_REOPTIMIZE AVAILABILITY AVCACHE_OP AVERAGE_RANK
+syn keyword plsqlKeyword AVG AVMDX_OP AVRO AV_AGGREGATE AV_CACHE AW BACKGROUND BACKINGFILE BACKUP BAND_JOIN
+syn keyword plsqlKeyword BASIC BASICFILE BATCH BATCHSIZE BATCH_TABLE_ACCESS_BY_ROWID BECOME BEFORE
+syn keyword plsqlKeyword BEGINNING BEGIN_OUTLINE_DATA BEHALF BEQUEATH BFILENAME BIGFILE BINARY
+syn keyword plsqlKeyword BINARY_DOUBLE_INFINITY BINARY_DOUBLE_NAN BINARY_FLOAT_INFINITY BINARY_FLOAT_NAN
+syn keyword plsqlKeyword BINDING BIND_AWARE BIN_TO_NUM BITAND BITMAP BITMAPS BITMAP_AND BITMAP_BIT_POSITION
+syn keyword plsqlKeyword BITMAP_BUCKET_NUMBER BITMAP_CONSTRUCT_AGG BITMAP_COUNT BITMAP_OR_AGG BITMAP_TREE
+syn keyword plsqlKeyword BITOR BITS BITXOR BIT_AND_AGG BIT_OR_AGG BIT_XOR_AGG BLOCK BLOCKCHAIN BLOCKING
+syn keyword plsqlKeyword BLOCKS BLOCKSIZE BLOCK_RANGE BOOL BOOTSTRAP BOTH BOUND BRANCH BREADTH
+syn keyword plsqlKeyword BROADCAST BSON BUFFER BUFFER_CACHE BUFFER_POOL BUILD BULK BUSHY_JOIN BYPASS_RECURSIVE_CHECK
+syn keyword plsqlKeyword BYPASS_UJVC CACHE CACHE_CB CACHE_INSTANCES CACHE_TEMP_TABLE CACHING CALCULATED
+syn keyword plsqlKeyword CALL CALLBACK CANCEL CAPACITY CAPTION CAPTURE CARDINALITY CASCADE CAST
+syn keyword plsqlKeyword CATALOG_DBLINK CATEGORY CDB$DEFAULT CDB_HTTP_HANDLER CEIL CELLMEMORY CELL_FLASH_CACHE
+syn keyword plsqlKeyword CERTIFICATE CFILE CHAINED CHANGE CHANGE_DUPKEY_ERROR_INDEX CHARTOROWID CHAR_CS
+syn keyword plsqlKeyword CHECKPOINT CHECKSUM CHECK_ACL_REWRITE CHILD CHOOSE CHR CHUNK CLASS CLASSIFICATION
+syn keyword plsqlKeyword CLASSIFIER CLAUSE CLEAN CLEANUP CLEAR CLIENT CLONE CLOSE CLOSEST CLOSE_CACHED_OPEN_CURSORS
+syn keyword plsqlKeyword CLOUD_IDENTITY CLUSTERING CLUSTERING_FACTOR CLUSTERS CLUSTER_BY_ROWID CLUSTER_DETAILS
+syn keyword plsqlKeyword CLUSTER_DISTANCE CLUSTER_ID CLUSTER_PROBABILITY CLUSTER_SET COALESCE COALESCE_SQ
+syn keyword plsqlKeyword COARSE COLAUTH COLD COLLATE COLLATION COLLECT COLUMN COLUMNAR COLUMNS COLUMN_AUTHORIZATION_INDICATOR
+syn keyword plsqlKeyword COLUMN_AUTH_INDICATOR COLUMN_STATS COLUMN_VALUE COMMENT COMMIT COMMITTED COMMON
+syn keyword plsqlKeyword COMMON_DATA_MAP COMPACT COMPATIBILITY COMPILE COMPLETE COMPLIANCE COMPONENT
+syn keyword plsqlKeyword COMPONENTS COMPOSE COMPOSITE COMPOSITE_LIMIT COMPOUND COMPUTATION COMPUTE
+syn keyword plsqlKeyword CONCAT CONDITION CONDITIONAL CONFIRM CONFORMING CONNECT_BY_CB_WHR_ONLY CONNECT_BY_COMBINE_SW
+syn keyword plsqlKeyword CONNECT_BY_COST_BASED CONNECT_BY_ELIM_DUPS CONNECT_BY_FILTERING CONNECT_BY_ISCYCLE
+syn keyword plsqlKeyword CONNECT_BY_ISLEAF CONNECT_BY_ROOT CONNECT_TIME CONSENSUS CONSIDER CONSISTENT
+syn keyword plsqlKeyword CONST CONSTANT CONSTRAINT CONSTRAINTS CONTAINER CONTAINERS CONTAINERS_DEFAULT
+syn keyword plsqlKeyword CONTAINER_DATA CONTAINER_DATA_ADMIT_NULL CONTAINER_MAP CONTAINER_MAP_OBJECT
+syn keyword plsqlKeyword CONTENT CONTENTS CONTEXT CONTINUE CONTROLFILE CONVERSION CONVERT CON_DBID_TO_ID
+syn keyword plsqlKeyword CON_GUID_TO_ID CON_ID CON_ID_FILTER CON_ID_TO_CON_NAME CON_ID_TO_DBID CON_ID_TO_GUID
+syn keyword plsqlKeyword CON_ID_TO_UID CON_NAME_TO_ID CON_UID_TO_ID COOKIE COPY CORR CORRUPTION CORRUPT_XID
+syn keyword plsqlKeyword CORRUPT_XID_ALL CORR_K CORR_S COS COSH COST COST_XML_QUERY_REWRITE COVAR_POP
+syn match plsqlKeyword "\<COUNT\>"
+syn keyword plsqlKeyword COVAR_SAMP CO_AUTH_IND CPU_COSTING CPU_COUNT CPU_PER_CALL CPU_PER_SESSION
+syn keyword plsqlKeyword CPU_TIME CRASH CREATE_FILE_DEST CREATE_STORED_OUTLINES CREATION CREDENTIAL
+syn keyword plsqlKeyword CREDENTIALS CRITICAL CROSS CROSSEDITION CSCONVERT CUBE CUBE_AJ CUBE_GB CUBE_SJ
+syn keyword plsqlKeyword CUME_DIST CUME_DISTM CURRENT CURRENTV CURRENT_DATE CURRENT_INSTANCE CURRENT_PARTSET_KEY
+syn keyword plsqlKeyword CURRENT_SCHEMA CURRENT_SHARD_KEY CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER
+syn keyword plsqlKeyword CURSOR CURSOR_SHARING_EXACT CURSOR_SPECIFIC_SEGMENT CV CYCLE DAGG_OPTIM_GSETS
+syn keyword plsqlKeyword DANGLING DATA DATABASE DATABASES DATAFILE DATAFILES DATAMOVEMENT DATAOBJNO
+syn keyword plsqlKeyword DATAOBJ_TO_MAT_PARTITION DATAOBJ_TO_PARTITION DATAPUMP DATASTORE DATA_LINK_DML
+syn keyword plsqlKeyword DATA_SECURITY_REWRITE_LIMIT DATA_VALIDATE DATE_MODE DAYS DBA DBA_RECYCLEBIN
+syn keyword plsqlKeyword DBMS_STATS DBSTR2UTF8 DBTIMEZONE DB_ROLE_CHANGE DB_UNIQUE_NAME DB_VERSION
+syn keyword plsqlKeyword DDL DEALLOCATE DEBUG DEBUGGER DECLARE DECODE DECOMPOSE DECOMPRESS DECORRELATE
+syn keyword plsqlKeyword DECR DECREMENT DECRYPT DEDUPLICATE DEFAULTS DEFAULT_COLLATION DEFAULT_PDB_HINT
+syn keyword plsqlKeyword DEFERRABLE DEFERRED DEFINE DEFINED DEFINER DEFINITION DEGREE DELAY DELEGATE
+syn keyword plsqlKeyword DELETEXML DELETE_ALL DEMAND DENORM_AV DENSE_RANK DENSE_RANKM DEPENDENT DEPTH
+syn keyword plsqlKeyword DEQUEUE DEREF DEREF_NO_REWRITE DESCENDANT DESCRIPTION DESTROY DETACHED DETERMINED
+syn keyword plsqlKeyword DETERMINES DETERMINISTIC DG_GATHER_STATS DIAGNOSTICS DICTIONARY DIGEST DIMENSION
+syn keyword plsqlKeyword DIMENSIONS DIRECT DIRECTORY DIRECT_LOAD DIRECT_PATH DISABLE DISABLE_ALL DISABLE_CONTAINERS_DEFAULT
+syn keyword plsqlKeyword DISABLE_CONTAINER_MAP DISABLE_PARALLEL_DML DISABLE_PRESET DISABLE_RPKE DISALLOW
+syn keyword plsqlKeyword DISASSOCIATE DISCARD DISCONNECT DISK DISKGROUP DISKS DISMOUNT DISTINGUISHED
+syn keyword plsqlKeyword DISTRIBUTE DISTRIBUTED DIST_AGG_PROLLUP_PUSHDOWN DML DML_UPDATE DOCFIDELITY
+syn keyword plsqlKeyword DOCUMENT DOMAIN_INDEX_FILTER DOMAIN_INDEX_NO_SORT DOMAIN_INDEX_SORT DOWNGRADE
+syn keyword plsqlKeyword DRAIN_TIMEOUT DRIVING_SITE DROP_COLUMN DROP_GROUP DST_UPGRADE_INSERT_CONV
+syn keyword plsqlKeyword DUMP DUPLICATE DUPLICATED DV DYNAMIC DYNAMIC_SAMPLING DYNAMIC_SAMPLING_EST_CDN
+syn keyword plsqlKeyword EACH EDITION EDITIONABLE EDITIONING EDITIONS ELAPSED_TIME ELEMENT ELIMINATE_JOIN
+syn keyword plsqlKeyword ELIMINATE_OBY ELIMINATE_OUTER_JOIN ELIMINATE_SQ ELIM_GROUPBY EM EMPTY EMPTY_BLOB
+syn keyword plsqlKeyword EMPTY_CLOB ENABLE ENABLE_ALL ENABLE_PARALLEL_DML ENABLE_PRESET ENCODE ENCODING
+syn keyword plsqlKeyword ENCRYPT ENCRYPTION
+syn keyword plsqlKeyword END_OUTLINE_DATA ENFORCE ENFORCED ENQUEUE ENTERPRISE
+syn keyword plsqlKeyword ENTITYESCAPING ENTRY EQUIPART EQUIVALENT ERROR ERRORS ERROR_ARGUMENT ERROR_ON_OVERLAP_TIME
+syn keyword plsqlKeyword ESCAPE ESTIMATE EVAL EVALNAME EVALUATE EVALUATION EVEN EVENTS EVERY EXCEPTION
+syn keyword plsqlKeyword EXCEPTIONS EXCHANGE EXCLUDE EXCLUDING EXECUTE EXEMPT EXISTING EXISTSNODE EXP
+syn keyword plsqlKeyword EXPAND EXPAND_GSET_TO_UNION EXPAND_TABLE EXPIRE EXPLAIN EXPLOSION EXPORT EXPRESS
+syn keyword plsqlKeyword EXPR_CORR_CHECK EXTEND EXTENDED EXTENDS EXTENT EXTENTS EXTERNAL EXTERNALLY
+syn keyword plsqlKeyword EXTRA EXTRACT EXTRACTCLOBXML EXTRACTVALUE FACILITY FACT FACTOR FACTORIZE_JOIN
+syn keyword plsqlKeyword FAILED FAILED_LOGIN_ATTEMPTS FAILGROUP FAILOVER FAILURE FAMILY FAR FAST
+syn keyword plsqlKeyword FBTSCAN FEATURE FEATURE_COMPARE FEATURE_DETAILS FEATURE_ID FEATURE_SET FEATURE_VALUE
+syn keyword plsqlKeyword FEDERATION FETCH FILE FILEGROUP FILESTORE FILESYSTEM_LIKE_LOGGING FILE_NAME_CONVERT
+syn keyword plsqlKeyword FILTER FINAL FINE FINISH FIRSTM FIRST_ROWS FIRST_VALUE FIXED_VIEW_DATA
+syn match plsqlKeyword "\<FIRST\>"
+syn keyword plsqlKeyword FLAGGER FLASHBACK FLASH_CACHE FLEX FLOB FLOOR FLUSH FOLDER FOLLOWING FOLLOWS
+syn keyword plsqlKeyword FORCE FORCE_JSON_TABLE_TRANSFORM FORCE_SPATIAL FORCE_XML_QUERY_REWRITE FOREIGN
+syn keyword plsqlKeyword FOREVER FORMAT FORWARD FRAGMENT_NUMBER FREE FREELIST FREELISTS FREEPOOLS FRESH
+syn keyword plsqlKeyword FRESH_MV FROM_TZ FTP FULL FULL_OUTER_JOIN_TO_OUTER FUNCTIONS GATHER_OPTIMIZER_STATISTICS
+syn keyword plsqlKeyword GATHER_PLAN_STATISTICS GBY_CONC_ROLLUP GBY_PUSHDOWN GENERATED GET GLOBAL GLOBALLY
+syn keyword plsqlKeyword GLOBAL_NAME GLOBAL_TOPIC_ENABLED GOLDENGATE GOTO GRANTED GRANULAR GREATEST
+syn keyword plsqlKeyword GROUPING GROUPING_ID GROUPS GROUP_BY GROUP_ID GUARANTEE GUARANTEED GUARD H
+syn keyword plsqlKeyword HALF_YEARS HASH HASHING HASHKEYS HASHSET_BUILD HASH_AJ HASH_SJ HEADER HEAP
+syn keyword plsqlKeyword HELP HEXTORAW HEXTOREF HIDDEN HIDE HIERARCHICAL HIERARCHIES HIERARCHY HIER_ANCESTOR
+syn keyword plsqlKeyword HIER_CAPTION HIER_CHILDREN HIER_CHILD_COUNT HIER_COLUMN HIER_CONDITION HIER_DEPTH
+syn keyword plsqlKeyword HIER_DESCRIPTION HIER_HAS_CHILDREN HIER_LAG HIER_LEAD HIER_LEVEL HIER_MEMBER_NAME
+syn keyword plsqlKeyword HIER_MEMBER_UNIQUE_NAME HIER_ORDER HIER_PARENT HIER_WINDOW HIGH HINTSET_BEGIN
+syn keyword plsqlKeyword HINTSET_END HOST HOT HOUR HOURS HTTP HWM_BROKERED HYBRID ID IDENTIFIER IDENTITY
+syn keyword plsqlKeyword IDGENERATORS IDLE IDLE_TIME IGNORE IGNORE_OPTIM_EMBEDDED_HINTS IGNORE_ROW_ON_DUPKEY_INDEX
+syn keyword plsqlKeyword IGNORE_WHERE_CLAUSE ILM IMMEDIATE IMMUTABLE IMPACT IMPORT INACTIVE INACTIVE_ACCOUNT_TIME
+syn keyword plsqlKeyword INCLUDE INCLUDES INCLUDE_VERSION INCLUDING INCOMING INCR INCREMENT INCREMENTAL
+syn keyword plsqlKeyword INDENT INDEXED INDEXES INDEXING INDEXTYPE INDEXTYPES INDEX_ASC INDEX_COMBINE
+syn keyword plsqlKeyword INDEX_DESC INDEX_FFS INDEX_FILTER INDEX_JOIN INDEX_ROWS INDEX_RRS INDEX_RS
+syn keyword plsqlKeyword INDEX_RS_ASC INDEX_RS_DESC INDEX_SCAN INDEX_SKIP_SCAN INDEX_SS INDEX_SS_ASC
+syn keyword plsqlKeyword INDEX_SS_DESC INDEX_STATS INDICATOR INFINITE INFORMATIONAL INHERIT INITCAP
+syn keyword plsqlKeyword INITIAL INITIALIZED INITIALLY INITRANS INLINE INLINE_XMLTYPE_NT INLINE_XT
+syn keyword plsqlKeyword INMEMORY INMEMORY_PRUNING INNER INPLACE INSENSITIVE INSERTCHILDXML INSERTCHILDXMLAFTER
+syn keyword plsqlKeyword INSERTCHILDXMLBEFORE INSERTXMLAFTER INSERTXMLBEFORE INSTALL INSTANCE INSTANCES
+syn keyword plsqlKeyword INSTANTIABLE INSTANTLY INSTEAD INSTR INSTR2 INSTR4 INSTRB INSTRC INTERLEAVED
+syn keyword plsqlKeyword INTERMEDIATE INTERNAL_CONVERT INTERNAL_USE INTERPRETED INTRA_CDB INVALIDATE
+syn keyword plsqlKeyword INVALIDATION INVISIBLE IN_MEMORY_METADATA IN_XQUERY IOSEEKTIM IOTFRSPEED IO_LOGICAL
+syn keyword plsqlKeyword IO_MEGABYTES IO_REQUESTS ISOLATE ISOLATION ISOLATION_LEVEL ITERATE ITERATION_NUMBER
+syn keyword plsqlKeyword JAVA JOB JOIN JSON JSONGET JSONPARSE JSONTOXML JSON_ARRAY JSON_ARRAYAGG JSON_EQUAL
+syn keyword plsqlKeyword JSON_EQUAL2 JSON_EXISTS JSON_EXISTS2 JSON_HASH JSON_LENGTH JSON_MERGEPATCH
+syn keyword plsqlKeyword JSON_MKMVI JSON_OBJECT JSON_OBJECTAGG JSON_PATCH JSON_QUERY JSON_SCALAR JSON_SERIALIZE
+syn keyword plsqlKeyword JSON_TABLE JSON_TEXTCONTAINS JSON_TEXTCONTAINS2 JSON_TRANSFORM JSON_VALUE
+syn keyword plsqlKeyword KEEP KEEP_DUPLICATES KERBEROS KEY KEYS KEYSIZE KEYSTORE KEY_LENGTH KILL
+syn keyword plsqlKeyword KURTOSIS_POP KURTOSIS_SAMP LABEL LAG LAG_DIFF LAG_DIFF_PERCENT LANGUAGE
+syn match plsqlKeyword "\<LAST\>"
+syn keyword plsqlKeyword LAST_DAY LAST_VALUE LATERAL LAX LAYER LDAP_REGISTRATION LDAP_REGISTRATION_ENABLED
+syn keyword plsqlKeyword LDAP_REG_SYNC_INTERVAL LEAD LEADING LEAD_CDB LEAD_CDB_URI LEAD_DIFF LEAD_DIFF_PERCENT
+syn keyword plsqlKeyword LEAF LEAST LEAVES LEDGER LEFT LENGTH LENGTH2 LENGTH4 LENGTHB LENGTHC LESS
+syn keyword plsqlKeyword LEVEL LEVELS LIBRARY LIFE LIFECYCLE LIFETIME LIKE2 LIKE4 LIKEC LIMIT LINEAR
+syn keyword plsqlKeyword LINK LIST LISTAGG LN LNNVL LOAD LOB LOBNVL LOBS LOB_VALUE LOCALTIME LOCALTIMESTAMP
+syn keyword plsqlKeyword LOCAL_INDEXES LOCATION LOCATOR LOCKDOWN LOCKED LOCKING LOG LOGFILE LOGFILES
+syn keyword plsqlKeyword LOGGING LOGICAL LOGICAL_READS_PER_CALL LOGICAL_READS_PER_SESSION LOGMINING
+syn keyword plsqlKeyword LOGOFF LOGON LOG_READ_ONLY_VIOLATIONS LOST LOW LOWER LPAD LTRIM MAIN MAKE_REF
+syn keyword plsqlKeyword MANAGE MANAGED MANAGEMENT MANAGER MANDATORY MANUAL MAP MAPPER MAPPING MASTER
+syn keyword plsqlKeyword MATCH MATCHES MATCH_NUMBER MATCH_RECOGNIZE MATERIALIZE MATERIALIZED
+syn keyword plsqlKeyword MATRIX MAX MAXARCHLOGS MAXDATAFILES MAXEXTENTS MAXIMIZE MAXINSTANCES MAXLOGFILES
+syn keyword plsqlKeyword MAXLOGHISTORY MAXLOGMEMBERS MAXSIZE MAXTRANS MAXVALUE MAX_AUDIT_SIZE MAX_DIAG_SIZE
+syn keyword plsqlKeyword MAX_PDB_SNAPSHOTS MAX_SHARED_TEMP_SIZE MBRC MEASURE MEASURES MEDIAN MEDIUM
+syn keyword plsqlKeyword MEMBER MEMCOMPRESS MEMOPTIMIZE MEMOPTIMIZE_WRITE MEMORY MERGE MERGE$ACTIONS
+syn keyword plsqlKeyword MERGE_AJ MERGE_CONST_ON MERGE_SJ METADATA METADATA_SOURCE_PDB METHOD MIGRATE
+syn keyword plsqlKeyword MIGRATE_CROSS_CON MIGRATION MIN MINEXTENTS MINIMIZE MINIMUM MINING MINUS_NULL
+syn keyword plsqlKeyword MINUTE MINUTES MINVALUE MIRROR MIRRORCOLD MIRRORHOT MISMATCH MISSING MLE MLSLABEL
+syn keyword plsqlKeyword MOD MODEL MODEL_COMPILE_SUBQUERY MODEL_DONTVERIFY_UNIQUENESS MODEL_DYNAMIC_SUBQUERY
+syn keyword plsqlKeyword MODEL_MIN_ANALYSIS MODEL_NB MODEL_NO_ANALYSIS MODEL_PBY MODEL_PUSH_REF MODEL_SV
+syn keyword plsqlKeyword MODIFICATION MODIFY MODIFY_COLUMN_TYPE MODULE MONITOR MONITORING MONTHS MONTHS_BETWEEN
+syn keyword plsqlKeyword MOUNT MOUNTPATH MOUNTPOINT MOVE MOVEMENT MULTIDIMENSIONAL MULTISET MULTIVALUE
+syn keyword plsqlKeyword MV_MERGE NAME NAMED NAMES NAMESPACE NAN NANVL NATIVE NATIVE_FULL_OUTER_JOIN
+syn keyword plsqlKeyword NATURAL NAV NCHAR_CS NCHR NEEDED NEG NESTED NESTED_ROLLUP_TOP NESTED_TABLE_FAST_INSERT
+syn keyword plsqlKeyword NESTED_TABLE_GET_REFS NESTED_TABLE_ID NESTED_TABLE_SET_REFS NESTED_TABLE_SET_SETID
+syn keyword plsqlKeyword NETWORK NEVER NEW NEW_TIME NEXT_DAY NLJ_BATCHING NLJ_INDEX_FILTER NLJ_INDEX_SCAN
+syn match plsqlKeyword "\<NEXT\>"
+syn keyword plsqlKeyword NLJ_PREFETCH NLSSORT NLS_CALENDAR NLS_CHARACTERSET NLS_CHARSET_DECL_LEN NLS_CHARSET_ID
+syn keyword plsqlKeyword NLS_CHARSET_NAME NLS_COLLATION_ID NLS_COLLATION_NAME NLS_COMP NLS_CURRENCY
+syn keyword plsqlKeyword NLS_DATE_FORMAT NLS_DATE_LANGUAGE NLS_INITCAP NLS_ISO_CURRENCY NLS_LANG NLS_LANGUAGE
+syn keyword plsqlKeyword NLS_LENGTH_SEMANTICS NLS_LOWER NLS_NCHAR_CONV_EXCP NLS_NUMERIC_CHARACTERS
+syn keyword plsqlKeyword NLS_SORT NLS_SPECIAL_CHARS NLS_TERRITORY NLS_UPPER NL_AJ NL_SJ NO NOAPPEND
+syn keyword plsqlKeyword NOARCHIVELOG NOAUDIT NOCACHE NOCOPY NOCPU_COSTING NOCYCLE NODELAY NOENTITYESCAPING
+syn keyword plsqlKeyword NOEXTEND NOFORCE NOGUARANTEE NOKEEP NOLOCAL NOLOGGING NOMAPPING NOMAXVALUE
+syn keyword plsqlKeyword NOMINIMIZE NOMINVALUE NOMONITORING NONBLOCKING NONE NONEDITIONABLE NONPARTITIONED
+syn keyword plsqlKeyword NONSCHEMA NOORDER NOOVERRIDE NOPARALLEL NOPARALLEL_INDEX NORELOCATE NORELY
+syn keyword plsqlKeyword NOREPAIR NOREPLAY NORESETLOGS NOREVERSE NOREWRITE NORMAL NOROWDEPENDENCIES
+syn keyword plsqlKeyword NOSCALE NOSCHEMACHECK NOSEGMENT NOSHARD NOSORT NOSTRICT NOSWITCH NOTHING NOTIFICATION
+syn keyword plsqlKeyword NOVALIDATE NOW NO_ACCESS NO_ADAPTIVE_PLAN NO_ANSI_REARCH NO_ANSWER_QUERY_USING_STATS
+syn keyword plsqlKeyword NO_AUTO_REOPTIMIZE NO_BAND_JOIN NO_BASETABLE_MULTIMV_REWRITE NO_BATCH_TABLE_ACCESS_BY_ROWID
+syn keyword plsqlKeyword NO_BIND_AWARE NO_BUFFER NO_BUSHY_JOIN NO_CARTESIAN NO_CHECK_ACL_REWRITE NO_CLUSTERING
+syn keyword plsqlKeyword NO_CLUSTER_BY_ROWID NO_COALESCE_SQ NO_COMMON_DATA NO_CONNECT_BY_CB_WHR_ONLY
+syn keyword plsqlKeyword NO_CONNECT_BY_COMBINE_SW NO_CONNECT_BY_COST_BASED NO_CONNECT_BY_ELIM_DUPS
+syn keyword plsqlKeyword NO_CONNECT_BY_FILTERING NO_CONTAINERS NO_COST_XML_QUERY_REWRITE NO_CPU_COSTING
+syn keyword plsqlKeyword NO_CROSS_CONTAINER NO_DAGG_OPTIM_GSETS NO_DATA_SECURITY_REWRITE NO_DECORRELATE
+syn keyword plsqlKeyword NO_DIST_AGG_PROLLUP_PUSHDOWN NO_DOMAIN_INDEX_FILTER NO_DST_UPGRADE_INSERT_CONV
+syn keyword plsqlKeyword NO_ELIMINATE_JOIN NO_ELIMINATE_OBY NO_ELIMINATE_OUTER_JOIN NO_ELIMINATE_SQ
+syn keyword plsqlKeyword NO_ELIM_GROUPBY NO_EXPAND NO_EXPAND_GSET_TO_UNION NO_EXPAND_TABLE NO_FACT
+syn keyword plsqlKeyword NO_FACTORIZE_JOIN NO_FILTERING NO_FULL_OUTER_JOIN_TO_OUTER NO_GATHER_OPTIMIZER_STATISTICS
+syn keyword plsqlKeyword NO_GBY_PUSHDOWN NO_INDEX NO_INDEX_FFS NO_INDEX_SS NO_INMEMORY NO_INMEMORY_PRUNING
+syn keyword plsqlKeyword NO_JSON_TABLE_TRANSFORM NO_LOAD NO_MERGE NO_MODEL_PUSH_REF NO_MONITOR NO_MONITORING
+syn keyword plsqlKeyword NO_MULTIMV_REWRITE NO_NATIVE_FULL_OUTER_JOIN NO_NLJ_BATCHING NO_NLJ_PREFETCH
+syn keyword plsqlKeyword NO_OBJECT_LINK NO_OBY_GBYPD_SEPARATE NO_ORDER_ROLLUPS NO_OR_EXPAND NO_OUTER_JOIN_TO_ANTI
+syn keyword plsqlKeyword NO_OUTER_JOIN_TO_INNER NO_PARALLEL NO_PARALLEL_INDEX NO_PARTIAL_COMMIT NO_PARTIAL_JOIN
+syn keyword plsqlKeyword NO_PARTIAL_OSON_UPDATE NO_PARTIAL_ROLLUP_PUSHDOWN NO_PLACE_DISTINCT NO_PLACE_GROUP_BY
+syn keyword plsqlKeyword NO_PQ_CONCURRENT_UNION NO_PQ_EXPAND_TABLE NO_PQ_MAP NO_PQ_NONLEAF_SKEW NO_PQ_REPLICATE
+syn keyword plsqlKeyword NO_PQ_SKEW NO_PRUNE_GSETS NO_PULL_PRED NO_PUSH_HAVING_TO_GBY NO_PUSH_PRED
+syn keyword plsqlKeyword NO_PUSH_SUBQ NO_PX_FAULT_TOLERANCE NO_PX_JOIN_FILTER NO_QKN_BUFF NO_QUERY_TRANSFORMATION
+syn keyword plsqlKeyword NO_REF_CASCADE NO_REORDER_WIF NO_RESULT_CACHE NO_REWRITE NO_ROOT_SW_FOR_LOCAL
+syn keyword plsqlKeyword NO_SEMIJOIN NO_SEMI_TO_INNER NO_SET_GBY_PUSHDOWN NO_SET_TO_JOIN NO_SQL_TRANSLATION
+syn keyword plsqlKeyword NO_SQL_TUNE NO_STAR_TRANSFORMATION NO_STATEMENT_QUEUING NO_STATS_GSETS NO_SUBQUERY_PRUNING
+syn keyword plsqlKeyword NO_SUBSTRB_PAD NO_SWAP_JOIN_INPUTS NO_TABLE_LOOKUP_BY_NL NO_TEMP_TABLE NO_TRANSFORM_DISTINCT_AGG
+syn keyword plsqlKeyword NO_UNNEST NO_USE_CUBE NO_USE_DAGG_UNION_ALL_GSETS NO_USE_HASH NO_USE_HASH_AGGREGATION
+syn keyword plsqlKeyword NO_USE_HASH_GBY_FOR_DAGGPSHD NO_USE_HASH_GBY_FOR_PUSHDOWN NO_USE_INVISIBLE_INDEXES
+syn keyword plsqlKeyword NO_USE_MERGE NO_USE_NL NO_USE_PARTITION_WISE_DISTINCT NO_USE_PARTITION_WISE_GBY
+syn keyword plsqlKeyword NO_USE_PARTITION_WISE_WIF NO_USE_SCALABLE_GBY_INVDIST NO_USE_VECTOR_AGGREGATION
+syn keyword plsqlKeyword NO_VECTOR_TRANSFORM NO_VECTOR_TRANSFORM_DIMS NO_VECTOR_TRANSFORM_FACT NO_XDB_FASTPATH_INSERT
+syn keyword plsqlKeyword NO_XMLINDEX_REWRITE NO_XMLINDEX_REWRITE_IN_SELECT NO_XML_DML_REWRITE NO_XML_QUERY_REWRITE
+syn keyword plsqlKeyword NO_ZONEMAP NTH_VALUE NTILE NULLIF NULLS NUMTODSINTERVAL NUMTOYMINTERVAL NUM_INDEX_KEYS
+syn keyword plsqlKeyword NVL NVL2 OBJECT OBJECT2XML OBJNO OBJNO_REUSE OBJ_ID OBY_GBYPD_SEPARATE OCCURENCES
+syn keyword plsqlKeyword OCCURRENCES ODD OFF OFFLINE OFFSET OID OIDINDEX OLAP OLD OLD_PUSH_PRED OLS
+syn keyword plsqlKeyword OLTP OMIT ONE ONLINE ONLY OPAQUE OPAQUE_TRANSFORM OPAQUE_XCANONICAL OPCODE
+syn keyword plsqlKeyword OPEN OPERATIONS OPERATOR OPTIMAL OPTIMIZE OPTIMIZER_FEATURES_ENABLE OPTIMIZER_GOAL
+syn keyword plsqlKeyword OPT_ESTIMATE OPT_PARAM ORADEBUG ORA_BRANCH ORA_CHECK_ACL ORA_CHECK_PRIVILEGE
+syn keyword plsqlKeyword ORA_CHECK_SYS_PRIVILEGE ORA_CLUSTERING ORA_CONCAT_RWKEY ORA_DM_PARTITION_NAME
+syn keyword plsqlKeyword ORA_DST_AFFECTED ORA_DST_CONVERT ORA_DST_ERROR ORA_GET_ACLIDS ORA_GET_PRIVILEGES
+syn keyword plsqlKeyword ORA_HASH ORA_INVOKING_USER ORA_INVOKING_USERID ORA_INVOKING_XS_USER ORA_INVOKING_XS_USER_GUID
+syn keyword plsqlKeyword ORA_NORMALIZE ORA_PARTITION_VALIDATION ORA_RAWCOMPARE ORA_RAWCONCAT ORA_ROWSCN
+syn keyword plsqlKeyword ORA_ROWSCN_RAW ORA_ROWVERSION ORA_SEARCH_RWKEY ORA_SHARDSPACE_NAME ORA_SHARD_ID
+syn keyword plsqlKeyword ORA_TABVERSION ORA_WRITE_TIME ORDERED ORDERED_PREDICATES ORDER_KEY_VECTOR_USE
+syn keyword plsqlKeyword ORDER_SUBQ ORDINALITY ORGANIZATION OR_EXPAND OR_PREDICATES OSON OSON_DIAG
+syn keyword plsqlKeyword OSON_GET_CONTENT OTHER OTHERS OUTER OUTER_JOIN_TO_ANTI OUTER_JOIN_TO_INNER
+syn keyword plsqlKeyword OUTLINE OUTLINE_LEAF OUT_OF_LINE OVER OVERFLOW OVERFLOW_NOMOVE OVERLAPS OWN
+syn keyword plsqlKeyword OWNER OWNERSHIP PACKAGES PARALLEL PARALLEL_INDEX PARAM PARAMETERS
+syn keyword plsqlKeyword PARENT PARITY PART$NUM$INST PARTIAL PARTIALLY PARTIAL_JOIN PARTIAL_ROLLUP_PUSHDOWN
+syn keyword plsqlKeyword PARTITION PARTITIONING PARTITIONS PARTITIONSET PARTITION_CONTAINED PARTITION_HASH
+syn keyword plsqlKeyword PARTITION_LIST PARTITION_RANGE PASSING PASSIVE PASSWORD PASSWORDFILE_METADATA_CACHE
+syn keyword plsqlKeyword PASSWORD_GRACE_TIME PASSWORD_LIFE_TIME PASSWORD_LOCK_TIME PASSWORD_REUSE_MAX
+syn keyword plsqlKeyword PASSWORD_REUSE_TIME PASSWORD_ROLLOVER_TIME PASSWORD_VERIFY_FUNCTION PAST PATCH
+syn keyword plsqlKeyword PATH PATHS PATH_PREFIX PATTERN PBL_HS_BEGIN PBL_HS_END PCTINCREASE PCTTHRESHOLD
+syn keyword plsqlKeyword PCTUSED PCTVERSION PDB_LOCAL_ONLY PEER PEERS PENDING PER PERCENT PERCENTAGE
+syn keyword plsqlKeyword PERCENTILE_CONT PERCENTILE_DISC PERCENT_RANK PERCENT_RANKM PERFORMANCE PERIOD
+syn keyword plsqlKeyword PERMANENT PERMISSION PERMUTE PERSISTABLE PFILE PHV PHYSICAL PIKEY PIVOT PIV_GB
+syn keyword plsqlKeyword PIV_SSF PLACE_DISTINCT PLACE_GROUP_BY PLAN PLSCOPE_SETTINGS PLSQL_CCFLAGS
+syn keyword plsqlKeyword PLSQL_CODE_TYPE PLSQL_DEBUG PLSQL_OPTIMIZE_LEVEL PLSQL_WARNINGS PLUGGABLE
+syn keyword plsqlKeyword PMEM POINT POLICY POOL_16K POOL_2K POOL_32K POOL_4K POOL_8K PORT POSITION
+syn keyword plsqlKeyword POST_TRANSACTION POWER POWERMULTISET POWERMULTISET_BY_CARDINALITY PQ_CONCURRENT_UNION
+syn keyword plsqlKeyword PQ_DISTRIBUTE PQ_DISTRIBUTE_WINDOW PQ_EXPAND_TABLE PQ_FILTER PQ_MAP PQ_NOMAP
+syn keyword plsqlKeyword PQ_NONLEAF_SKEW PQ_REPLICATE PQ_SKEW PREBUILT PRECEDES PRECEDING PRECOMPUTE_SUBQUERY
+syn keyword plsqlKeyword PREDICATE_REORDERS PREDICTION PREDICTION_BOUNDS PREDICTION_COST PREDICTION_DETAILS
+syn keyword plsqlKeyword PREDICTION_PROBABILITY PREDICTION_SET PRELOAD PREPARE PRESENT PRESENTNNV PRESENTV
+syn keyword plsqlKeyword PRESERVE PRESERVE_OID PRETTY PREVIOUS PRIMARY PRINTBLOBTOCLOB PRIORITY
+syn match plsqlKeyword "\<PREV\>"
+syn keyword plsqlKeyword PRIVATE PRIVATE_SGA PRIVILEGE PRIVILEGED PRIVILEGES PROCEDURAL PROCESS
+syn keyword plsqlKeyword PROFILE PROGRAM PROJECT PROPAGATE PROPAGATION PROPERTY PROTECTED PROTECTION
+syn keyword plsqlKeyword PROTOCOL PROXY PRUNING PULL_PRED PURGE PUSH_HAVING_TO_GBY PUSH_PRED PUSH_SUBQ
+syn keyword plsqlKeyword PX_FAULT_TOLERANCE PX_GRANULE PX_JOIN_FILTER QB_NAME QUALIFY QUARANTINE QUARTERS
+syn keyword plsqlKeyword QUERY QUERY_BLOCK QUEUE QUEUE_CURR QUEUE_ROWP QUIESCE QUORUM QUOTA QUOTAGROUP
+syn keyword plsqlKeyword QUOTES RANDOM RANDOM_LOCAL RANGE RANK RANKM RAPIDLY RATIO_TO_REPORT RAWTOHEX
+syn keyword plsqlKeyword RAWTONHEX RAWTOREF RBA RBO_OUTLINE RDBA READ READS READ_OR_WRITE REALM REBALANCE
+syn keyword plsqlKeyword REBUILD RECONNECT RECORDS_PER_BLOCK RECOVER RECOVERABLE RECOVERY RECYCLE RECYCLEBIN
+syn keyword plsqlKeyword REDACTION REDEFINE REDO REDUCED REDUNDANCY REFERENCE REFERENCED REFERENCES
+syn keyword plsqlKeyword REFERENCING REFRESH REFTOHEX REFTORAW REF_CASCADE_CURSOR REGEXP_COUNT REGEXP_INSTR
+syn keyword plsqlKeyword REGEXP_LIKE REGEXP_REPLACE REGEXP_SUBSTR REGISTER REGR_AVGX REGR_AVGY REGR_COUNT
+syn keyword plsqlKeyword REGR_INTERCEPT REGR_R2 REGR_SLOPE REGR_SXX REGR_SXY REGR_SYY REGULAR REJECT
+syn keyword plsqlKeyword REKEY RELATIONAL RELOCATE RELY REMAINDER REMOTE REMOTE_MAPPED REMOVE REORDER_WIF
+syn keyword plsqlKeyword REPAIR REPEAT REPLICATION REQUIRED RESERVOIR_SAMPLING RESET RESETLOGS
+syn keyword plsqlKeyword RESIZE RESOLVE RESOLVER RESPECT RESTART RESTORE RESTORE_AS_INTERVALS RESTRICT
+syn keyword plsqlKeyword RESTRICTED RESTRICT_ALL_REF_CONS RESULT_CACHE RESUMABLE RESUME RETENTION RETRY_ON_ROW_CHANGE
+syn keyword plsqlKeyword RETURN RETURNING REUSE REVERSE REWRITE REWRITE_OR_ERROR RIGHT RLS_FORCE ROLE
+syn keyword plsqlKeyword ROLES ROLESET ROLLBACK ROLLING ROLLOVER ROLLUP ROOT ROUND ROUND_TIES_TO_EVEN
+syn keyword plsqlKeyword ROW ROWDEPENDENCIES ROWIDTOCHAR ROWIDTONCHAR ROWID_MAPPING_TABLE ROWNUM ROWS
+syn keyword plsqlKeyword ROW_LENGTH ROW_NUMBER RPAD RTRIM RULE RULES RUNNING SALT SAMPLE SAVE SAVEPOINT
+syn keyword plsqlKeyword SAVE_AS_INTERVALS SB4 SCALAR SCALARS SCALE SCALE_ROWS SCAN SCAN_INSTANCES
+syn keyword plsqlKeyword SCHEDULER SCHEMA SCHEMACHECK SCN SCN_ASCENDING SCOPE SCRUB SDO_GEOM_KEY SDO_GEOM_MAX_X
+syn keyword plsqlKeyword SDO_GEOM_MAX_Y SDO_GEOM_MAX_Z SDO_GEOM_MBB SDO_GEOM_MBR SDO_GEOM_MIN_X SDO_GEOM_MIN_Y
+syn keyword plsqlKeyword SDO_GEOM_MIN_Z SDO_TOLERANCE SD_ALL SD_INHIBIT SD_SHOW SEARCH SECONDS SECRET
+syn keyword plsqlKeyword SECUREFILE SECUREFILE_DBA SECURITY SEED SEGMENT SEG_BLOCK SEG_FILE SELECTIVITY
+syn keyword plsqlKeyword SELF SEMIJOIN SEMIJOIN_DRIVER SEMI_TO_INNER SENSITIVE SEQUENCE SEQUENCED SEQUENTIAL
+syn keyword plsqlKeyword SERIAL SERIALIZABLE SERVERERROR SERVICE SERVICES SERVICE_NAME_CONVERT SESSION
+syn keyword plsqlKeyword SESSIONS_PER_USER SESSIONTIMEZONE SESSIONTZNAME SESSION_CACHED_CURSORS SETS
+syn keyword plsqlKeyword SETTINGS SET_GBY_PUSHDOWN SET_TO_JOIN SEVERE SHARD SHARDED SHARDS SHARDSPACE
+syn keyword plsqlKeyword SHARD_CHUNK_ID SHARED SHARED_POOL SHARE_OF SHARING SHD$COL$MAP SHELFLIFE SHOW
+syn keyword plsqlKeyword SHRINK SHUTDOWN SIBLING SIBLINGS SID SIGN SIGNAL_COMPONENT SIGNAL_FUNCTION
+syn keyword plsqlKeyword SIGNATURE SIMPLE SIN SINGLE SINGLETASK SINH SITE SKEWNESS_POP SKEWNESS_SAMP
+syn keyword plsqlKeyword SKIP SKIP_EXT_OPTIMIZER SKIP_PROXY SKIP_UNQ_UNUSABLE_IDX SKIP_UNUSABLE_INDEXES
+syn keyword plsqlKeyword SMALLFILE SNAPSHOT SOME SORT SOUNDEX SOURCE SOURCE_FILE_DIRECTORY SOURCE_FILE_NAME_CONVERT
+syn keyword plsqlKeyword SPACE SPATIAL SPECIFICATION SPFILE SPLIT SPREADSHEET SQL SQLLDR SQL_SCOPE
+syn keyword plsqlKeyword SQL_TRACE SQL_TRANSLATION_PROFILE SQRT STALE STANDALONE STANDARD_HASH STANDBY
+syn keyword plsqlKeyword STANDBYS STANDBY_MAX_DATA_DELAY STAR STARTUP STAR_TRANSFORMATION STATE STATEMENT
+syn keyword plsqlKeyword STATEMENTS STATEMENT_ID STATEMENT_QUEUING STATIC STATISTICS STATS_BINOMIAL_TEST
+syn keyword plsqlKeyword STATS_CROSSTAB STATS_F_TEST STATS_KS_TEST STATS_MODE STATS_MW_TEST STATS_ONE_WAY_ANOVA
+syn keyword plsqlKeyword STATS_T_TEST_INDEP STATS_T_TEST_INDEPU STATS_T_TEST_ONE STATS_T_TEST_PAIRED
+syn keyword plsqlKeyword STATS_WSR_TEST STDDEV STDDEV_POP STDDEV_SAMP STOP STORAGE STORAGE_INDEX STORE
+syn keyword plsqlKeyword STREAM STREAMS STRICT STRING STRINGS STRIP STRIPE_COLUMNS STRIPE_WIDTH STRUCTURE
+syn keyword plsqlKeyword SUBMULTISET SUBPARTITION SUBPARTITIONING SUBPARTITIONS SUBPARTITION_REL SUBQUERIES
+syn keyword plsqlKeyword SUBQUERY_PRUNING SUBSCRIBE SUBSET SUBSTITUTABLE SUBSTR SUBSTR2 SUBSTR4 SUBSTRB
+syn keyword plsqlKeyword SUBSTRC SUBTYPE SUCCESS SUCCESSFUL SUM SUMMARY SUPPLEMENTAL SUPPRESS_LOAD
+syn keyword plsqlKeyword SUSPEND SWAP_JOIN_INPUTS SWITCH SWITCHOVER SYNC SYNCHRONOUS SYSASM SYSAUX
+syn keyword plsqlKeyword SYSBACKUP SYSDATE SYSDBA SYSDG SYSGUID SYSKM SYSOBJ SYSOPER SYSRAC SYSTEM
+syn keyword plsqlKeyword SYSTEM_DEFINED SYSTEM_STATS SYSTIMESTAMP SYS_AUDIT SYS_CHECKACL SYS_CHECK_PRIVILEGE
+syn keyword plsqlKeyword SYS_CONNECT_BY_PATH SYS_CONS_ANY_SCALAR SYS_CONTEXT SYS_CTXINFOPK SYS_CTX_CONTAINS2
+syn keyword plsqlKeyword SYS_CTX_MKIVIDX SYS_DBURIGEN SYS_DL_CURSOR SYS_DM_RXFORM_CHR SYS_DM_RXFORM_LAB
+syn keyword plsqlKeyword SYS_DM_RXFORM_NUM SYS_DOM_COMPARE SYS_DST_PRIM2SEC SYS_DST_SEC2PRIM SYS_ET_BFILE_TO_RAW
+syn keyword plsqlKeyword SYS_ET_BLOB_TO_IMAGE SYS_ET_IMAGE_TO_BLOB SYS_ET_RAW_TO_BFILE SYS_EXTPDTXT
+syn keyword plsqlKeyword SYS_EXTRACT_UTC SYS_FBT_INSDEL SYS_FILTER_ACLS SYS_FNMATCHES SYS_FNREPLACE
+syn keyword plsqlKeyword SYS_GETTOKENID SYS_GETXTIVAL SYS_GET_ACLIDS SYS_GET_ANY_SCALAR SYS_GET_COL_ACLIDS
+syn keyword plsqlKeyword SYS_GET_PRIVILEGES SYS_GUID SYS_MAKEXML SYS_MAKE_XMLNODEID SYS_MKXMLATTR SYS_MKXTI
+syn keyword plsqlKeyword SYS_OPTLOBPRBSC SYS_OPTXICMP SYS_OPTXQCASTASNQ SYS_OP_ADT2BIN SYS_OP_ADTCONS
+syn keyword plsqlKeyword SYS_OP_ALSCRVAL SYS_OP_ATG SYS_OP_BIN2ADT SYS_OP_BITVEC SYS_OP_BL2R SYS_OP_BLOOM_FILTER
+syn keyword plsqlKeyword SYS_OP_BLOOM_FILTER_LIST SYS_OP_C2C SYS_OP_CAST SYS_OP_CEG SYS_OP_CL2C SYS_OP_COMBINED_HASH
+syn keyword plsqlKeyword SYS_OP_COMP SYS_OP_CONVERT SYS_OP_COUNTCHG SYS_OP_CSCONV SYS_OP_CSCONVTEST
+syn keyword plsqlKeyword SYS_OP_CSR SYS_OP_CSX_PATCH SYS_OP_CYCLED_SEQ SYS_OP_DECOMP SYS_OP_DESCEND
+syn keyword plsqlKeyword SYS_OP_DISTINCT SYS_OP_DRA SYS_OP_DSB_DESERIALIZE SYS_OP_DSB_SERIALIZE SYS_OP_DUMP
+syn keyword plsqlKeyword SYS_OP_DV_CHECK SYS_OP_ENFORCE_NOT_NULL$ SYS_OP_EXTRACT SYS_OP_GROUPING SYS_OP_GUID
+syn keyword plsqlKeyword SYS_OP_HASH SYS_OP_HCS_TABLE SYS_OP_IIX SYS_OP_INTERVAL_HIGH_BOUND SYS_OP_ITR
+syn keyword plsqlKeyword SYS_OP_KEY_VECTOR_CREATE SYS_OP_KEY_VECTOR_FILTER SYS_OP_KEY_VECTOR_FILTER_LIST
+syn keyword plsqlKeyword SYS_OP_KEY_VECTOR_PAYLOAD SYS_OP_KEY_VECTOR_SUCCEEDED SYS_OP_KEY_VECTOR_USE
+syn keyword plsqlKeyword SYS_OP_LBID SYS_OP_LOBLOC2BLOB SYS_OP_LOBLOC2CLOB SYS_OP_LOBLOC2ID SYS_OP_LOBLOC2NCLOB
+syn keyword plsqlKeyword SYS_OP_LOBLOC2TYP SYS_OP_LSVI SYS_OP_LVL SYS_OP_MAKEOID SYS_OP_MAP_NONNULL
+syn keyword plsqlKeyword SYS_OP_MSR SYS_OP_NICOMBINE SYS_OP_NIEXTRACT SYS_OP_NII SYS_OP_NIX SYS_OP_NOEXPAND
+syn keyword plsqlKeyword SYS_OP_NTCIMG$ SYS_OP_NUMTORAW SYS_OP_OBJ_UPD_IN_TXN SYS_OP_OIDVALUE SYS_OP_OPNSIZE
+syn keyword plsqlKeyword SYS_OP_PAR SYS_OP_PARGID SYS_OP_PARGID_1 SYS_OP_PART_ID SYS_OP_PAR_1 SYS_OP_PIVOT
+syn keyword plsqlKeyword SYS_OP_R2O SYS_OP_RAWTONUM SYS_OP_RDTM SYS_OP_REF SYS_OP_RMTD SYS_OP_ROWIDTOOBJ
+syn keyword plsqlKeyword SYS_OP_RPB SYS_OP_TOSETID SYS_OP_TPR SYS_OP_TRTB SYS_OP_UNDESCEND SYS_OP_VECAND
+syn keyword plsqlKeyword SYS_OP_VECBIT SYS_OP_VECOR SYS_OP_VECTOR_GROUP_BY SYS_OP_VECXOR SYS_OP_VERSION
+syn keyword plsqlKeyword SYS_OP_VREF SYS_OP_VVD SYS_OP_XMLCONS_FOR_CSX SYS_OP_XPTHATG SYS_OP_XPTHIDX
+syn keyword plsqlKeyword SYS_OP_XPTHOP SYS_OP_XTNN SYS_OP_XTXT2SQLT SYS_OP_ZONE_ID SYS_ORDERKEY_DEPTH
+syn keyword plsqlKeyword SYS_ORDERKEY_MAXCHILD SYS_ORDERKEY_PARENT SYS_PARALLEL_TXN SYS_PATHID_IS_ATTR
+syn keyword plsqlKeyword SYS_PATHID_IS_NMSPC SYS_PATHID_LASTNAME SYS_PATHID_LASTNMSPC SYS_PATH_REVERSE
+syn keyword plsqlKeyword SYS_PLSQL_COUNT SYS_PLSQL_CPU SYS_PLSQL_IO SYS_PXQEXTRACT SYS_RAW_TO_XSID
+syn keyword plsqlKeyword SYS_REMAP_XMLTYPE SYS_RID_ORDER SYS_ROW_DELTA SYS_SC_2_XMLT SYS_SYNRCIREDO
+syn keyword plsqlKeyword SYS_TYPEID SYS_UMAKEXML SYS_XMLANALYZE SYS_XMLCONTAINS SYS_XMLCONV SYS_XMLEXNSURI
+syn keyword plsqlKeyword SYS_XMLGEN SYS_XMLINSTR SYS_XMLI_LOC_ISNODE SYS_XMLI_LOC_ISTEXT SYS_XMLLOCATOR_GETSVAL
+syn keyword plsqlKeyword SYS_XMLNODEID SYS_XMLNODEID_GETCID SYS_XMLNODEID_GETLOCATOR SYS_XMLNODEID_GETOKEY
+syn keyword plsqlKeyword SYS_XMLNODEID_GETPATHID SYS_XMLNODEID_GETPTRID SYS_XMLNODEID_GETRID SYS_XMLNODEID_GETSVAL
+syn keyword plsqlKeyword SYS_XMLNODEID_GETTID SYS_XMLTRANSLATE SYS_XMLTYPE2SQL SYS_XMLT_2_SC SYS_XQBASEURI
+syn keyword plsqlKeyword SYS_XQCASTABLEERRH SYS_XQCODEP2STR SYS_XQCODEPEQ SYS_XQCON2SEQ SYS_XQCONCAT
+syn keyword plsqlKeyword SYS_XQDELETE SYS_XQDFLTCOLATION SYS_XQDOC SYS_XQDOCURI SYS_XQDURDIV SYS_XQED4URI
+syn keyword plsqlKeyword SYS_XQENDSWITH SYS_XQERR SYS_XQERRH SYS_XQESHTMLURI SYS_XQEXLOBVAL SYS_XQEXSTWRP
+syn keyword plsqlKeyword SYS_XQEXTRACT SYS_XQEXTRREF SYS_XQEXVAL SYS_XQFB2STR SYS_XQFNBOOL SYS_XQFNCMP
+syn keyword plsqlKeyword SYS_XQFNDATIM SYS_XQFNLNAME SYS_XQFNNM SYS_XQFNNSURI SYS_XQFNPREDTRUTH SYS_XQFNQNM
+syn keyword plsqlKeyword SYS_XQFNROOT SYS_XQFORMATNUM SYS_XQFTCONTAIN SYS_XQFUNCR SYS_XQGETCONTENT
+syn keyword plsqlKeyword SYS_XQINDXOF SYS_XQINSERT SYS_XQINSPFX SYS_XQIRI2URI SYS_XQLANG SYS_XQLLNMFRMQNM
+syn keyword plsqlKeyword SYS_XQMKNODEREF SYS_XQNILLED SYS_XQNODENAME SYS_XQNORMSPACE SYS_XQNORMUCODE
+syn keyword plsqlKeyword SYS_XQNSP4PFX SYS_XQNSPFRMQNM SYS_XQPFXFRMQNM SYS_XQPOLYABS SYS_XQPOLYADD
+syn keyword plsqlKeyword SYS_XQPOLYCEL SYS_XQPOLYCST SYS_XQPOLYCSTBL SYS_XQPOLYDIV SYS_XQPOLYFLR SYS_XQPOLYMOD
+syn keyword plsqlKeyword SYS_XQPOLYMUL SYS_XQPOLYRND SYS_XQPOLYSQRT SYS_XQPOLYSUB SYS_XQPOLYUMUS SYS_XQPOLYUPLS
+syn keyword plsqlKeyword SYS_XQPOLYVEQ SYS_XQPOLYVGE SYS_XQPOLYVGT SYS_XQPOLYVLE SYS_XQPOLYVLT SYS_XQPOLYVNE
+syn keyword plsqlKeyword SYS_XQREF2VAL SYS_XQRENAME SYS_XQREPLACE SYS_XQRESVURI SYS_XQRNDHALF2EVN SYS_XQRSLVQNM
+syn keyword plsqlKeyword SYS_XQRYENVPGET SYS_XQRYVARGET SYS_XQRYWRP SYS_XQSEQ2CON SYS_XQSEQ2CON4XC
+syn keyword plsqlKeyword SYS_XQSEQDEEPEQ SYS_XQSEQINSB SYS_XQSEQRM SYS_XQSEQRVS SYS_XQSEQSUB SYS_XQSEQTYPMATCH
+syn keyword plsqlKeyword SYS_XQSTARTSWITH SYS_XQSTATBURI SYS_XQSTR2CODEP SYS_XQSTRJOIN SYS_XQSUBSTRAFT
+syn keyword plsqlKeyword SYS_XQSUBSTRBEF SYS_XQTOKENIZE SYS_XQTREATAS SYS_XQXFORM SYS_XQ_ASQLCNV SYS_XQ_ATOMCNVCHK
+syn keyword plsqlKeyword SYS_XQ_NRNG SYS_XQ_PKSQL2XML SYS_XQ_UPKXML2SQL SYS_XSID_TO_RAW SYS_ZMAP_FILTER
+syn keyword plsqlKeyword SYS_ZMAP_REFRESH TABAUTH TABLES TABLESPACE TABLESPACE_NO TABLE_LOOKUP_BY_NL
+syn keyword plsqlKeyword TABLE_STATS TABNO TAG TAN TANH TARGET TBL$OR$IDX$PART$NUM TEMP TEMPFILE TEMPLATE
+syn keyword plsqlKeyword TEMPORARY TEMP_TABLE TENANT_ID TEST TEXT THAN THE THREAD THROUGH TIER TIES
+syn keyword plsqlKeyword TIMEOUT TIMES TIMESTAMP_TO_NUMBER TIMEZONE_ABBR TIMEZONE_HOUR TIMEZONE_MINUTE
+syn keyword plsqlKeyword TIMEZONE_OFFSET TIMEZONE_REGION TIME_ZONE TIV_GB TIV_SSF TOKEN TOPLEVEL TO_ACLID
+syn keyword plsqlKeyword TO_APPROX_COUNT_DISTINCT TO_APPROX_PERCENTILE TO_BINARY_DOUBLE TO_BINARY_FLOAT
+syn keyword plsqlKeyword TO_BLOB TO_CHAR TO_CLOB TO_DATE TO_DSINTERVAL TO_ISO_STRING TO_LOB TO_MULTI_BYTE
+syn keyword plsqlKeyword TO_NCHAR TO_NCLOB TO_NUMBER TO_SINGLE_BYTE TO_TIME TO_TIMESTAMP TO_TIMESTAMP_TZ
+syn keyword plsqlKeyword TO_TIME_TZ TO_UTC_TIMESTAMP_TZ TO_YMINTERVAL TRACE TRACING TRACKING TRAILING
+syn keyword plsqlKeyword TRANSACTION TRANSFORM TRANSFORM_DISTINCT_AGG TRANSITION TRANSITIONAL TRANSLATE
+syn keyword plsqlKeyword TRANSLATION TRANSPORTABLE TREAT TRIGGERS TRIM TRUNC TRUNCATE TRUST TRUSTED
+syn keyword plsqlKeyword TUNING TX TYPENAME TYPES TZ_OFFSET UB2 UBA UCS2 UID UNARCHIVED UNBOUND
+syn keyword plsqlKeyword UNBOUNDED UNCONDITIONAL UNDER UNDO UNDROP UNIFORM UNINSTALL UNION_ALL UNISTR
+syn keyword plsqlKeyword UNITE UNIXTIME UNLIMITED UNLOAD UNLOCK UNMATCHED UNNEST UNNEST_INNERJ_DISTINCT_VIEW
+syn keyword plsqlKeyword UNNEST_NOSEMIJ_NODISTINCTVIEW UNNEST_SEMIJ_VIEW UNPACKED UNPIVOT UNPLUG UNPROTECTED
+syn keyword plsqlKeyword UNQUIESCE UNRECOVERABLE UNRESTRICTED UNSUBSCRIBE UNTIL UNUSABLE UNUSED UPDATABLE
+syn keyword plsqlKeyword UPDATED UPDATEXML UPD_INDEXES UPD_JOININDEX UPGRADE UPPER UPSERT USABLE USAGE
+syn keyword plsqlKeyword USE USER USERENV USERGROUP USERS USER_DATA USER_DEFINED USER_RECYCLEBIN USER_TABLESPACES
+syn keyword plsqlKeyword USE_ANTI USE_CONCAT USE_CUBE USE_DAGG_UNION_ALL_GSETS USE_HASH USE_HASH_AGGREGATION
+syn keyword plsqlKeyword USE_HASH_GBY_FOR_DAGGPSHD USE_HASH_GBY_FOR_PUSHDOWN USE_HIDDEN_PARTITIONS
+syn keyword plsqlKeyword USE_INVISIBLE_INDEXES USE_MERGE USE_MERGE_CARTESIAN USE_NL USE_NL_WITH_INDEX
+syn keyword plsqlKeyword USE_PARTITION_WISE_DISTINCT USE_PARTITION_WISE_GBY USE_PARTITION_WISE_WIF
+syn keyword plsqlKeyword USE_PRIVATE_OUTLINES USE_SCALABLE_GBY_INVDIST USE_SEMI USE_STORED_OUTLINES
+syn keyword plsqlKeyword USE_TTT_FOR_GSETS USE_VECTOR_AGGREGATION USE_WEAK_NAME_RESL USING USING_NO_EXPAND
+syn keyword plsqlKeyword UTF16BE UTF16LE UTF32 UTF8 V1 V2 VALIDATE VALIDATE_CONVERSION VALIDATION VALID_TIME_END
+syn keyword plsqlKeyword VALUE VARIANCE VARRAY VARRAYS VAR_POP VAR_SAMP VECTOR VECTOR_ENCODE VECTOR_READ
+syn keyword plsqlKeyword VECTOR_READ_TRACE VECTOR_TRANSFORM VECTOR_TRANSFORM_DIMS VECTOR_TRANSFORM_FACT
+syn keyword plsqlKeyword VERIFIER VERIFY VERSION VERSIONING VERSIONS VERSIONS_ENDSCN VERSIONS_ENDTIME
+syn keyword plsqlKeyword VERSIONS_OPERATION VERSIONS_STARTSCN VERSIONS_STARTTIME VERSIONS_XID VIEWS
+syn keyword plsqlKeyword VIOLATION VIRTUAL VISIBILITY VISIBLE VOLUME VSIZE WAIT WALLET WEEK WEEKS WELLFORMED
+syn keyword plsqlKeyword WHENEVER WHITESPACE WIDTH_BUCKET WINDOW WITHIN WITHOUT WITH_EXPRESSION
+syn keyword plsqlKeyword WITH_PLSQL WORK WRAPPED WRAPPER WRITE XDB_FASTPATH_INSERT XID XML XML2OBJECT
+syn keyword plsqlKeyword XMLATTRIBUTES XMLCAST XMLCDATA XMLCOLATTVAL XMLCOMMENT XMLCONCAT XMLDIFF XMLELEMENT
+syn keyword plsqlKeyword XMLEXISTS XMLEXISTS2 XMLFOREST XMLINDEX_REWRITE XMLINDEX_REWRITE_IN_SELECT
+syn keyword plsqlKeyword XMLINDEX_SEL_IDX_TBL XMLISNODE XMLISVALID XMLNAMESPACES XMLPARSE XMLPATCH
+syn keyword plsqlKeyword XMLPI XMLQUERY XMLQUERYVAL XMLROOT XMLSCHEMA XMLSERIALIZE XMLTABLE XMLTOJSON
+syn keyword plsqlKeyword XMLTOKENSET XMLTRANSFORM XMLTRANSFORMBLOB XMLTSET_DML_ENABLE XML_DIAG XML_DML_RWT_STMT
+syn keyword plsqlKeyword XPATHTABLE XS XS_SYS_CONTEXT X_DYN_PRUNE YEARS YES ZONEMAP
+
+" Some of Oracle's Reserved keywords.
+syn keyword plsqlReserved ACCESSIBLE AGENT ALL ALTER ANY ASC BFILE_BASE BLOB_BASE BY
+"syn match plsqlReserved "\<AS\>"
+syn keyword plsqlReserved C CALLING CHARSET CHARSETFORM CHARSETID CHAR_BASE CHECK CLOB_BASE CLUSTER
+syn keyword plsqlReserved COLLATE COMPILED COMPRESS CONNECT CONNECT_BY_ROOT CONSTRUCTOR CUSTOMDATUM
+syn keyword plsqlReserved DATE_BASE DEFAULT DESC DISTINCT DROP DURATION EXCEPT EXCLUSIVE
+syn match plsqlReserved "\<DELETE\>"
+syn keyword plsqlReserved EXIT FIXED FROM GENERAL GRANT GROUP HAVING IDENTIFIED INDEX
+syn match plsqlReserved "\<EXISTS\>"
+syn keyword plsqlReserved INDICES INTERFACE INTERSECT INTO LARGE LIMITED LOCK MAXLEN
+syn keyword plsqlReserved MINUS MODE NOCOMPRESS NOWAIT NUMBER_BASE OCICOLL OCIDATE OCIDATETIME
+syn keyword plsqlReserved OCIDURATION OCIINTERVAL OCILOBLOCATOR OCINUMBER OCIRAW OCIREF OCIREFCURSOR
+syn keyword plsqlReserved OCIROWID OCISTRING OCITYPE OF ON OPTION ORACLE ORADATA ORDER ORLANY ORLVARY
+syn keyword plsqlReserved OUT OVERRIDING PARALLEL_ENABLE PARAMETER PASCAL PCTFREE PIPE PIPELINED POLYMORPHIC
+syn keyword plsqlReserved PRAGMA PRIOR PUBLIC RAISE RECORD RELIES_ON REM RENAME RESOURCE RESULT REVOKE ROWID
+syn keyword plsqlReserved SB1 SB2
+syn match plsqlReserved "\<SELECT\>"
+syn keyword plsqlReserved SEPARATE SHARE SHORT SIZE SIZE_T SPARSE SQLCODE SQLDATA
+syn keyword plsqlReserved SQLNAME SQLSTATE STANDARD START STORED STRUCT STYLE SYNONYM TABLE TDO
+syn keyword plsqlReserved TRANSACTIONAL TRIGGER UB1 UB4 UNION UNIQUE UNSIGNED UNTRUSTED VALIST
+syn keyword plsqlReserved VALUES VARIABLE VIEW VOID WHERE WITH
+
+" PL/SQL and SQL functions.
+syn keyword plsqlFunction ABS ACOS ADD_MONTHS APPROX_COUNT APPROX_COUNT_DISTINCT APPROX_COUNT_DISTINCT_AGG
+syn keyword plsqlFunction APPROX_COUNT_DISTINCT_DETAIL APPROX_MEDIAN APPROX_PERCENTILE APPROX_PERCENTILE_AGG
+syn keyword plsqlFunction APPROX_PERCENTILE_DETAIL APPROX_RANK APPROX_SUM ASCII ASCIISTR ASIN ATAN ATAN2
+syn keyword plsqlFunction AVG BFILENAME BIN_TO_NUM BITAND CARDINALITY CAST CEIL CHARTOROWID CHR CLUSTER_DETAILS
+syn keyword plsqlFunction CLUSTER_DISTANCE CLUSTER_ID CLUSTER_PROBABILITY CLUSTER_SET COALESCE COLLATION
+syn keyword plsqlFunction COLLECT COMPOSE CONCAT CONVERT CON_DBID_TO_ID CON_GUID_TO_ID CON_NAME_TO_ID
+syn keyword plsqlFunction CON_UID_TO_ID CORR COS COSH COVAR_POP COVAR_SAMP CUME_DIST CURRENT_DATE
+syn keyword plsqlFunction CURRENT_TIMESTAMP CV DATAOBJ_TO_MAT_PARTITION DATAOBJ_TO_PARTITION DBTIMEZONE
+syn keyword plsqlFunction DECODE DECOMPOSE DENSE_RANK DEPTH DEREF DUMP EMPTY_BLOB EMPTY_CLOB EXISTSNODE
+syn keyword plsqlFunction EXP EXTRACT EXTRACTVALUE FEATURE_COMPARE FEATURE_DETAILS FEATURE_ID FEATURE_SET
+syn keyword plsqlFunction FEATURE_VALUE FIRST_VALUE FLOOR FROM_TZ GREATEST GROUPING GROUPING_ID
+syn keyword plsqlFunction GROUP_ID HEXTORAW INITCAP INSTR ITERATION_NUMBER JSON_ARRAY JSON_ARRAYAGG
+syn keyword plsqlFunction JSON_OBJECT JSON_OBJECTAGG JSON_QUERY JSON_TABLE JSON_VALUE LAG LAST_DAY
+syn keyword plsqlFunction LAST_VALUE LEAD LEAST LENGTH LISTAGG LN LNNVL LOCALTIMESTAMP LOG LOWER LPAD
+syn keyword plsqlFunction LTRIM MAKE_REF MAX MEDIAN MIN MOD MONTHS_BETWEEN NANVL NCHR NEW_TIME NEXT_DAY
+syn keyword plsqlFunction NLSSORT NLS_CHARSET_DECL_LEN NLS_CHARSET_ID NLS_CHARSET_NAME NLS_COLLATION_ID
+syn keyword plsqlFunction NLS_COLLATION_NAME NLS_INITCAP NLS_LOWER NLS_UPPER NTH_VALUE NTILE NULLIF
+syn keyword plsqlFunction NUMTODSINTERVAL NUMTOYMINTERVAL NVL NVL2 ORA_DM_PARTITION_NAME ORA_DST_AFFECTED
+syn keyword plsqlFunction ORA_DST_CONVERT ORA_DST_ERROR ORA_HASH ORA_INVOKING_USER ORA_INVOKING_USERID
+syn keyword plsqlFunction PATH PERCENTILE_CONT PERCENTILE_DISC PERCENT_RANK POWER POWERMULTISET POWERMULTISET_BY_CARDINALITY
+syn keyword plsqlFunction PREDICTION PREDICTION_BOUNDS PREDICTION_COST PREDICTION_DETAILS PREDICTION_PROBABILITY
+syn keyword plsqlFunction PREDICTION_SET PRESENTNNV PRESENTV PREVIOUS RANK RATIO_TO_REPORT RAWTOHEX
+syn keyword plsqlFunction RAWTONHEX REFTOHEX REGEXP_COUNT REGEXP_INSTR REGEXP_REPLACE REGEXP_SUBSTR
+syn keyword plsqlFunction REMAINDER ROUND ROUND ROWIDTOCHAR ROWIDTONCHAR ROW_NUMBER RPAD RTRIM
+syn keyword plsqlFunction SCN_TO_TIMESTAMP SESSIONTIMEZONE SIGN SIN SINH SOUNDEX SQRT STANDARD_HASH
+syn keyword plsqlFunction STATS_BINOMIAL_TEST STATS_CROSSTAB STATS_F_TEST STATS_KS_TEST STATS_MODE STATS_MW_TEST
+syn keyword plsqlFunction STATS_ONE_WAY_ANOVA STATS_WSR_TEST STDDEV STDDEV_POP STDDEV_SAMP SUBSTR SUM
+syn keyword plsqlFunction SYSDATE SYSTIMESTAMP SYS_CONNECT_BY_PATH SYS_CONTEXT SYS_DBURIGEN SYS_EXTRACT_UTC
+syn keyword plsqlFunction SYS_GUID SYS_OP_ZONE_ID SYS_TYPEID SYS_XMLAGG SYS_XMLGEN TAN TANH TIMESTAMP_TO_SCN
+syn keyword plsqlFunction TO_APPROX_COUNT_DISTINCT TO_APPROX_PERCENTILE TO_BINARY_DOUBLE TO_BINARY_FLOAT
+syn keyword plsqlFunction TO_BLOB TO_CHAR TO_CLOB TO_DATE TO_DSINTERVAL TO_LOB TO_MULTI_BYTE TO_NCHAR
+syn keyword plsqlFunction TO_NCLOB TO_NUMBER TO_SINGLE_BYTE TO_TIMESTAMP TO_TIMESTAMP_TZ TO_YMINTERVAL
+syn keyword plsqlFunction TRANSLATE TREAT TRIM TRUNC TZ_OFFSET UID UNISTR UPPER USER USERENV VALIDATE_CONVERSION
+syn keyword plsqlFunction VALUE VARIANCE VAR_POP VAR_SAMP VSIZE WIDTH_BUCKET XMLAGG XMLCAST XMLCDATA
+syn keyword plsqlFunction XMLCOLATTVAL XMLCOMMENT XMLCONCAT XMLDIFF XMLELEMENT XMLEXISTS XMLFOREST XMLISVALID
+syn keyword plsqlFunction XMLPARSE XMLPATCH XMLPI XMLQUERY XMLROOT XMLSEQUENCE XMLSERIALIZE XMLTABLE
+syn keyword plsqlFunction XMLTRANSFORM
+syn keyword plsqlFunction CURRVAL NEXTVAL
syn match plsqlFunction "\<SYS\$LOB_REPLICATION\>"
+syn match plsqlFunction "\.COUNT\>"hs=s+1
+syn match plsqlFunction "\.EXISTS\>"hs=s+1
+syn match plsqlFunction "\.FIRST\>"hs=s+1
+syn match plsqlFunction "\.LAST\>"hs=s+1
+syn match plsqlFunction "\.DELETE\>"hs=s+1
+syn match plsqlFunction "\.PREV\>"hs=s+1
+syn match plsqlFunction "\.NEXT\>"hs=s+1
+
+if exists("plsql_legacy_sql_keywords")
+ " Some of Oracle's SQL keywords.
+ syn keyword plsqlSQLKeyword ABORT ACCESS ACCESSED ADD AFTER ALL ALTER AND ANY
+ syn keyword plsqlSQLKeyword ASC ATTRIBUTE AUDIT AUTHORIZATION AVG BASE_TABLE
+ syn keyword plsqlSQLKeyword BEFORE BETWEEN BY CASCADE CAST CHECK CLUSTER
+ syn keyword plsqlSQLKeyword CLUSTERS COLAUTH COLUMN COMMENT COMPRESS CONNECT
+ syn keyword plsqlSQLKeyword CONSTRAINT CRASH CURRENT DATA DATABASE
+ syn keyword plsqlSQLKeyword DATA_BASE DBA DEFAULT DELAY DELETE DESC DISTINCT
+ syn keyword plsqlSQLKeyword DROP DUAL EXCLUSIVE EXISTS EXTENDS EXTRACT
+ syn keyword plsqlSQLKeyword FILE FORCE FOREIGN FROM GRANT GROUP HAVING HEAP
+ syn keyword plsqlSQLKeyword IDENTIFIED IDENTIFIER IMMEDIATE IN INCLUDING
+ syn keyword plsqlSQLKeyword INCREMENT INDEX INDEXES INITIAL INSERT INSTEAD
+ syn keyword plsqlSQLKeyword INTERSECT INTO INVALIDATE ISOLATION KEY LIBRARY
+ syn keyword plsqlSQLKeyword LIKE LOCK MAXEXTENTS MINUS MODE MODIFY MULTISET
+ syn keyword plsqlSQLKeyword NESTED NOAUDIT NOCOMPRESS NOT NOWAIT OF OFF OFFLINE
+ syn keyword plsqlSQLKeyword ON ONLINE OPERATOR OPTION ORDER ORGANIZATION
+ syn keyword plsqlSQLKeyword PCTFREE PRIMARY PRIOR PRIVATE PRIVILEGES PUBLIC
+ syn keyword plsqlSQLKeyword QUOTA RELEASE RENAME REPLACE RESOURCE REVOKE ROLLBACK
+ syn keyword plsqlSQLKeyword ROW ROWLABEL ROWS SCHEMA
+ syn match plsqlSQLKeyword "\<SELECT\>"
+ syn keyword plsqlSQLKeyword SEPARATE SESSION SET
+ syn keyword plsqlSQLKeyword SHARE SIZE SPACE START STORE SUCCESSFUL SYNONYM
+ syn keyword plsqlSQLKeyword SYSDATE TABLE TABLES TABLESPACE TEMPORARY TO TREAT
+ syn keyword plsqlSQLKeyword TRIGGER TRUNCATE UID UNION UNIQUE UNLIMITED UPDATE
+ syn keyword plsqlSQLKeyword USE USER VALIDATE VALUES VIEW WHENEVER WHERE WITH
+endif
+
+" The built-in types.
+syn keyword plsqlStorage CHAR BYTE VARCHAR2 NCHAR NVARCHAR2
+syn keyword plsqlStorage NUMBER FLOAT BINARY_FLOAT BINARY_DOUBLE LONG RAW
+syn keyword plsqlStorage DATE TIMESTAMP INTERVAL LOCAL TIME ZONE TO MONTH SECOND YEAR DAY
+syn keyword plsqlStorage BLOB CLOB NCLOB BFILE UROWID
+syn keyword plsqlStorage CHARACTER VARYING VARCHAR NATIONAL CHARACTER
+syn keyword plsqlStorage NUMERIC DECIMAL DEC INTEGER INT SMALLINT
+syn keyword plsqlStorage FLOAT DOUBLE PRECISION REAL
+syn keyword plsqlStorage SDO_GEOMETRY SDO_TOPO_GEOMETRY SDO_GEORASTER
+syn keyword plsqlStorage REF ANYTYPE ANYDATA ANYDATASET XMLTYPE HTTPURITYPE XDBURITYPE DUBRITYPE
+syn keyword plsqlStorage BOOLEAN PLS_INTEGER BINARY_INTEGER SIMPLE_FLOAT SIMPLE_INTEGER SIMPLE_DOUBLE SYS_REFCURSOR
+"
" PL/SQL Exceptions
syn keyword plsqlException ACCESS_INTO_NULL CASE_NOT_FOUND COLLECTION_IS_NULL
syn keyword plsqlException CURSOR_ALREADY_OPEN DUP_VAL_ON_INDEX INVALID_CURSOR
@@ -139,32 +565,30 @@ syn keyword plsqlException SUBSCRIPT_OUTSIDE_LIMIT SYS_INVALID_ROWID
syn keyword plsqlException TIMEOUT_ON_RESOURCE TOO_MANY_ROWS VALUE_ERROR
syn keyword plsqlException ZERO_DIVIDE
-" Oracle Pseudo Colums.
-syn keyword plsqlPseudo CURRVAL LEVEL NEXTVAL ROWID ROWNUM
-
if exists("plsql_highlight_triggers")
- syn keyword plsqlTrigger INSERTING UPDATING DELETING
+ syn keyword plsqlTrigger INSERTING UPDATING DELETING
endif
-" Conditionals.
-syn keyword plsqlConditional ELSIF ELSE IF
-syn match plsqlConditional "\<END\s\+IF\>"
-
-" Loops.
-syn keyword plsqlRepeat FOR LOOP WHILE FORALL
-syn match plsqlRepeat "\<END\s\+LOOP\>"
+" so can not contain it for folding. May no longer be necessary and can change them to plsqlKeyword
+syn match plsqlBEGIN "\<BEGIN\>"
+syn match plsqlEND "\<END\>"
+syn match plsqlISAS "\<\(IS\|AS\)\>"
" Various types of comments.
-if exists("c_comment_strings")
- syntax match plsqlCommentSkip contained "^\s*\*\($\|\s\+\)"
- syntax region plsqlCommentString contained start=+L\="+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=plsqlCommentSkip
- syntax region plsqlComment2String contained start=+L\="+ skip=+\\\\\|\\"+ end=+"+ end="$"
- syntax region plsqlCommentL start="--" skip="\\$" end="$" keepend contains=@plsqlCommentGroup,plsqlComment2String,plsqlCharLiteral,plsqlBooleanLiteral,plsqlNumbersCom,plsqlSpaceError
- syntax region plsqlComment start="/\*" end="\*/" contains=@plsqlCommentGroup,plsqlComment2String,plsqlCharLiteral,plsqlBooleanLiteral,plsqlNumbersCom,plsqlSpaceError
+syntax region plsqlCommentL start="--" skip="\\$" end="$" keepend extend contains=@plsqlCommentGroup,plsqlSpaceError
+if exists("plsql_fold")
+ syntax region plsqlComment
+ \ start="/\*" end="\*/"
+ \ extend
+ \ contains=@plsqlCommentGroup,plsqlSpaceError
+ \ fold
else
- syntax region plsqlCommentL start="--" skip="\\$" end="$" keepend contains=@plsqlCommentGroup,plsqlSpaceError
- syntax region plsqlComment start="/\*" end="\*/" contains=@plsqlCommentGroup,plsqlSpaceError
+ syntax region plsqlComment
+ \ start="/\*" end="\*/"
+ \ extend
+ \ contains=@plsqlCommentGroup,plsqlSpaceError
endif
+syn cluster plsqlCommentAll contains=plsqlCommentL,plsqlComment
syn sync ccomment plsqlComment
syn sync ccomment plsqlCommentL
@@ -173,28 +597,38 @@ syn sync ccomment plsqlCommentL
syn match plsqlStringError "'.*$"
" Various types of literals.
-syn match plsqlNumbers transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=plsqlIntLiteral,plsqlFloatLiteral
-syn match plsqlNumbersCom contained transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=plsqlIntLiteral,plsqlFloatLiteral
-syn match plsqlIntLiteral contained "[+-]\=\d\+"
-syn match plsqlFloatLiteral contained "[+-]\=\d\+\.\d*"
-syn match plsqlFloatLiteral contained "[+-]\=\d*\.\d*"
-syn match plsqlCharLiteral "'[^']'"
-syn match plsqlStringLiteral "'\([^']\|''\)*'"
-syn keyword plsqlBooleanLiteral TRUE FALSE NULL
+" the + and - get sucked up as operators. Not sure how to take precedence here. Something to do with word boundaries.
+" most other syntax files do not try to includ +/- in the number token, so leave them as unary operators
+" even though the oracle documentation counts the sign as part of the numeric literal
+syn match plsqlNumbers transparent "\<\d\|\.\d" contains=plsqlIntLiteral,plsqlFloatLiteral
+syn match plsqlNumbersCom contained transparent "\<\d\|\.\d" contains=plsqlIntLiteral,plsqlFloatLiteral
+syn match plsqlIntLiteral contained "\d\+"
+syn match plsqlFloatLiteral contained "\d\+\.\(\d\+\([eE][+-]\?\d\+\)\?\)\?[fd]\?"
+syn match plsqlFloatLiteral contained "\.\(\d\+\([eE][+-]\?\d\+\)\?\)[fd]\?"
-" The built-in types.
-syn keyword plsqlStorage ANYDATA ANYTYPE BFILE BINARY_INTEGER BLOB BOOLEAN
-syn keyword plsqlStorage BYTE CHAR CHARACTER CLOB CURSOR DATE DAY DEC DECIMAL
-syn keyword plsqlStorage DOUBLE DSINTERVAL_UNCONSTRAINED FLOAT HOUR
-syn keyword plsqlStorage INT INTEGER INTERVAL LOB LONG MINUTE
-syn keyword plsqlStorage MLSLABEL MONTH NATURAL NATURALN NCHAR NCHAR_CS NCLOB
-syn keyword plsqlStorage NUMBER NUMERIC NVARCHAR PLS_INT PLS_INTEGER
-syn keyword plsqlStorage POSITIVE POSITIVEN PRECISION RAW REAL RECORD
-syn keyword plsqlStorage SECOND SIGNTYPE SMALLINT STRING SYS_REFCURSOR TABLE TIME
-syn keyword plsqlStorage TIMESTAMP TIMESTAMP_UNCONSTRAINED
-syn keyword plsqlStorage TIMESTAMP_TZ_UNCONSTRAINED
-syn keyword plsqlStorage TIMESTAMP_LTZ_UNCONSTRAINED UROWID VARCHAR
-syn keyword plsqlStorage VARCHAR2 YEAR YMINTERVAL_UNCONSTRAINED ZONE
+" double quoted strings in SQL are database object names. Should be a subgroup of Normal.
+" We will use Character group as a proxy for that so color can be chosen close to Normal
+syn region plsqlQuotedIdentifier matchgroup=plsqlOperator start=+n\?"+ end=+"+ keepend extend
+syn cluster plsqlIdentifiers contains=plsqlIdentifier,plsqlQuotedIdentifier
+
+" quoted string literals
+if exists("plsql_fold")
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?'+ skip=+''+ end=+'+ fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\z([^[(<{]\)+ end=+\z1'+ fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'<+ end=+>'+ fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'{+ end=+}'+ fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'(+ end=+)'+ fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\[+ end=+]'+ fold keepend extend
+else
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?'+ skip=+''+ end=+'+
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\z([^[(<{]\)+ end=+\z1'+
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'<+ end=+>'+
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'{+ end=+}'+
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'(+ end=+)'+
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\[+ end=+]'+
+endif
+
+syn keyword plsqlBooleanLiteral TRUE FALSE
" A type-attribute is really a type.
syn match plsqlTypeAttribute "%\(TYPE\|ROWTYPE\)\>"
@@ -204,61 +638,183 @@ syn match plsqlAttribute "%\(BULK_EXCEPTIONS\|BULK_ROWCOUNT\|ISOPEN\|FOUND\|NOTF
" This'll catch mis-matched close-parens.
syn cluster plsqlParenGroup contains=plsqlParenError,@plsqlCommentGroup,plsqlCommentSkip,plsqlIntLiteral,plsqlFloatLiteral,plsqlNumbersCom
-if exists("c_no_bracket_error")
- syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,@plsqlParenGroup
- syn match plsqlParenError ")"
- syn match plsqlErrInParen contained "[{}]"
+
+if exists("plsql_bracket_error")
+ " I suspect this code was copied from c.vim and never properly considered. Do
+ " we even use braces or brackets in sql or pl/sql?
+ if exists("plsql_fold")
+ syn region plsqlParen start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInBracket fold keepend extend transparent
+ else
+ syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInBracket
+ endif
+ syn match plsqlParenError "[\])]"
+ syn match plsqlErrInParen contained "[{}]"
+ syn region plsqlBracket transparent start='\[' end=']' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen
+ syn match plsqlErrInBracket contained "[);{}]"
else
- syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInBracket
- syn match plsqlParenError "[\])]"
- syn match plsqlErrInParen contained "[{}]"
- syn region plsqlBracket transparent start='\[' end=']' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen
- syn match plsqlErrInBracket contained "[);{}]"
+ if exists("plsql_fold")
+ syn region plsqlParen start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen fold keepend extend transparent
+ else
+ syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen
+ endif
+ syn match plsqlParenError ")"
+ " should this not be parens isntead of brackets? I never quite followed what this was doing
+ syn match plsqlErrInParen contained "[{}]"
endif
-" Syntax Synchronizing
-syn sync minlines=10 maxlines=100
+syn match plsqlReserved "\<BODY\>"
+syn match plsqlReserved "\<CREATE\_s\+\(OR\_s\+REPLACE\_s\+\)\?"
+" Loops
+syn match plsqlRepeat "\<\(FOR\|WHILE\|LOOP\|FORALL\)\>"
+syn match plsqlRepeat "\<END\_s\+LOOP\>"
+" conditionals
+syn match plsqlConditional "\<\(ELSIF\|IF\|ELSE\)\>"
+syn match plsqlConditional "\<END\>\_s\+\<IF\>"
+syn match plsqlCase "\<END\>\_s\+\<CASE\>"
+syn match plsqlCase "\<CASE\>"
+
+if exists("plsql_fold")
+ setlocal foldmethod=syntax
+ syn sync fromstart
+
+ syn cluster plsqlProcedureGroup contains=plsqlProcedure
+ syn cluster plsqlOnlyGroup contains=@plsqlProcedure,plsqlConditionalBlock,plsqlLoopBlock,plsqlBlock
+
+ syntax region plsqlUpdateSet
+ \ start="\(\<update\>\_s\+\(\<set\>\)\@![a-z][a-z0-9$_#]*\_s\+\(\(\<set\>\)\@![a-z][a-z0-9$_#]*\_s\+\)\?\)\|\(\<when\>\_s\+\<matched\>\_s\+\<then\>\_s\+\<update\>\_s\+\)\<set\>"
+ \ end="\(\_s*\(;\|\<from\>\|\<where\>\|\<when\>\)\)\@="
+ \ fold
+ \ keepend
+ \ extend
+ \ transparent
+ \ contains=ALLBUT,@plsqlOnlyGroup,plsqlSelect
+
+ syntax region plsqlSelect
+ \ start="\<select\>"
+ \ end="\(\_s*\<from\>\)\@="
+ \ fold
+ \ keepend
+ \ extend
+ \ transparent
+ \ contains=ALLBUT,@plsqlOnlyGroup,plsqlUpdateSet
+
+ " this is brute force and requires you have the procedure/function name in the END
+ " statement. ALthough Oracle makes it optional, we cannot. If you do not
+ " have it, then you can fold the BEGIN/END block of the procedure but not
+ " the specification of it (other than a paren group). You also cannot fold
+ " BEGIN/END blocks in the procedure body. Local procedures will fold as
+ " long as the END statement includes the procedure/function name.
+ " As for why we cannot make it work any other way, I don't know. It is
+ " something to do with both plsqlBlock and plsqlProcedure both consuming BEGIN and END,
+ " even if we use a lookahead for one of them.
+ syntax region plsqlProcedure
+ "\ start="\(create\(\_s\+or\_s\+replace\)\?\_s\+\)\?\<\(procedure\|function\)\>\_s\+\z([a-z][a-z0-9$_#]*\)"
+ \ start="\<\(procedure\|function\)\>\_s\+\(\z([a-z][a-z0-9$_#]*\)\)\([^;]\|\n\)\{-}\<\(is\|as\)\>\_.\{-}\(\<end\>\_s\+\2\_s*;\)\@="
+ \ end="\<end\>\_s\+\z1\_s*;"
+ \ fold
+ \ keepend
+ \ extend
+ \ transparent
+ \ contains=ALLBUT,plsqlBlock
+ syntax region plsqlBlock
+ \ start="\<begin\>"
+ "\ end="\<end\>\_s*\;"
+ \ end="\<end\>\(\_s\+\(if\|loop\|case\)\@![a-z][a-z0-9$_#]*\)\?\_s*;"
+ \ fold
+ \ transparent
+ \ contains=ALLBUT,@plsqlProcedureGroup,plsqlPackage,plsqlErrInBracket,PlsqlProcedureJava
+ \ keepend
+ \ extend
+
+ syn region plsqlCaseBlock
+ \ transparent
+ \ start="\<case\>\(\_s*;\)\@!"
+ \ end="\<end\>\(\_s\+case\_s*;\)\?"
+ \ fold
+ \ contains=ALLBUT,@plsqlProcedureGroup,plsqlPackage,plsqlErrInBracket,PlsqlProcedureJava
+ \ keepend
+ \ extend
+ "\ contained
+
+ syntax region plsqlLoopBlock
+ \ transparent
+ \ start="\<loop\>\(\_s*;\)\@!"
+ \ end="\<end\>\(\_s\+\<loop\>\)\?\_s*;"
+ \ fold
+ \ keepend extend
+ \ contained
+ \ contains=ALLBUT,@plsqlProcedureGroup,plsqlPackage,plsqlErrInBracket,PlsqlProcedureJava
+
+ syn region plsqlConditionalBlock
+ \ transparent
+ \ start="\<if\>\(\_s*;\)\@!"
+ \ end="\<end\>\_s\+\<if\>\_s*;"
+ \ fold
+ \ keepend extend
+ \ contained
+ \ contains=ALLBUT,@plsqlProcedureGroup,plsqlPackage,plsqlErrInBracket,PlsqlProcedureJava
+
+else
+ " Syntax Synchronizing
+ syn sync minlines=1000 maxlines=2000
+endif
+"
" Define the default highlighting.
" Only when an item doesn't have highlighting yet.
-hi def link plsqlAttribute Macro
-hi def link plsqlBlockError Error
-hi def link plsqlBooleanLiteral Boolean
-hi def link plsqlCharLiteral Character
-hi def link plsqlComment Comment
-hi def link plsqlCommentL Comment
-hi def link plsqlConditional Conditional
-hi def link plsqlError Error
-hi def link plsqlErrInBracket Error
-hi def link plsqlErrInBlock Error
-hi def link plsqlErrInParen Error
-hi def link plsqlException Function
-hi def link plsqlFloatLiteral Float
-hi def link plsqlFunction Function
-hi def link plsqlGarbage Error
-hi def link plsqlHostIdentifier Label
-hi def link plsqlIdentifier Normal
-hi def link plsqlIntLiteral Number
-hi def link plsqlOperator Operator
-hi def link plsqlParen Normal
-hi def link plsqlParenError Error
-hi def link plsqlSpaceError Error
-hi def link plsqlPseudo PreProc
-hi def link plsqlKeyword Keyword
-hi def link plsqlRepeat Repeat
-hi def link plsqlStorage StorageClass
-hi def link plsqlSQLKeyword Function
-hi def link plsqlStringError Error
-hi def link plsqlStringLiteral String
-hi def link plsqlCommentString String
-hi def link plsqlComment2String String
-hi def link plsqlSymbol Normal
-hi def link plsqlTrigger Function
-hi def link plsqlTypeAttribute StorageClass
-hi def link plsqlTodo Todo
-
+hi def link plsqlAttribute Macro
+hi def link plsqlBlockError Error
+hi def link plsqlBooleanLiteral Boolean
+hi def link plsqlQuotedIdentifier Character
+hi def link plsqlComment Comment
+hi def link plsqlCommentL Comment
+hi def link plsqlConditional Conditional
+hi def link plsqlCase Conditional
+hi def link plsqlError Error
+hi def link plsqlErrInBracket Error
+hi def link plsqlErrInBlock Error
+hi def link plsqlErrInParen Error
+hi def link plsqlException Function
+hi def link plsqlFloatLiteral Float
+hi def link plsqlFunction Function
+hi def link plsqlGarbage Error
+hi def link plsqlHostIdentifier Label
+hi def link plsqlIdentifier Normal
+hi def link plsqlIntLiteral Number
+hi def link plsqlOperator Operator
+hi def link plsqlParenError Error
+hi def link plsqlSpaceError Error
+hi def link plsqlPseudo PreProc
+hi def link plsqlKeyword Keyword
+hi def link plsqlEND Keyword
+hi def link plsqlBEGIN Keyword
+hi def link plsqlISAS Statement
+hi def link plsqlReserved Statement
+hi def link plsqlRepeat Repeat
+hi def link plsqlStorage StorageClass
+hi def link plsqlFunction Function
+hi def link plsqlStringError Error
+hi def link plsqlStringLiteral String
+hi def link plsqlCommentString String
+hi def link plsqlComment2String String
+hi def link plsqlTrigger Function
+hi def link plsqlTypeAttribute StorageClass
+hi def link plsqlTodo Todo
+" to be able to change them after loading, need override whether defined or not
+if exists("plsql_legacy_sql_keywords")
+ hi link plsqlSQLKeyword Function
+ hi link plsqlSymbol Normal
+ hi link plsqlParen Normal
+else
+ hi link plsqlSymbol Special
+ hi link plsqlParen Special
+endif
let b:current_syntax = "plsql"
-" vim: ts=8 sw=2
+" restore setting from when we entered this file
+let &cpo = s:cpo_sav
+unlet! s:cpo_sav
+
+" vim: ts=4 sw=4
diff --git a/runtime/syntax/pod.vim b/runtime/syntax/pod.vim
index 604713260b..90c9b99a3e 100644
--- a/runtime/syntax/pod.vim
+++ b/runtime/syntax/pod.vim
@@ -2,9 +2,10 @@
" Language: Perl POD format
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Previously: Scott Bigham <dsb@killerbunnies.org>
-" Homepage: http://github.com/vim-perl/vim-perl
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2017-09-12
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2022 Jun 13
" To add embedded POD documentation highlighting to your syntax file, add
" the commands:
@@ -27,71 +28,117 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-" POD commands
-syn match podCommand "^=encoding" nextgroup=podCmdText contains=@NoSpell
-syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell
-syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell
-syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell
-syn match podCommand "^=back" contains=@NoSpell
-syn match podCommand "^=cut" contains=@NoSpell
-syn match podCommand "^=pod" contains=@NoSpell
-syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell
-syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell
-syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell
+" TODO: add supported encodings when we can utilize better performing Vim 8 features
+syn match podEncoding "[0-9A-Za-z_-]\+" contained contains=@NoSpell
" Text of a =head1, =head2 or =item command
-syn match podCmdText ".*$" contained contains=podFormat,@NoSpell
+syn region podCmdText start="\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contained contains=podFormat,@NoSpell
" Indent amount of =over command
-syn match podOverIndent "\d\+" contained contains=@NoSpell
+syn match podOverIndent "\d*\.\=\d\+\>" contained contains=@NoSpell
" Formatter identifier keyword for =for, =begin and =end commands
syn match podForKeywd "\S\+" contained contains=@NoSpell
" An indented line, to be displayed verbatim
-syn match podVerbatimLine "^\s.*$" contains=@NoSpell
+syn region podVerbatim start="^\s\+\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contains=@NoSpell
+
+syn region podOrdinary start="^\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contains=podFormat,podSpecial,@Spell
" Inline textual items handled specially by POD
syn match podSpecial "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)" contains=@NoSpell
syn match podSpecial "[$@%]\I\i*\(::\I\i*\)*\>" contains=@NoSpell
" Special formatting sequences
-syn region podFormat start="[IBSCLFX]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
-syn region podFormat start="[IBSCLFX]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
+
+syn cluster podFormat contains=podFormat,podFormatError
+
+syn match podFormatError "[ADGHJKM-RT-WY]<"
+
+syn region podFormat matchgroup=podFormatDelimiter start="[IBSCLFX]<" end=">" contains=@podFormat,@NoSpell
+syn region podFormat matchgroup=podFormatDelimiter start="[IBSCLFX]<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=@podFormat,@NoSpell
+
syn match podFormat "Z<>"
-syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
-syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
-syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
+
+syn region podFormat matchgroup=podFormatDelimiter start="E<" end=">" oneline contains=podEscape,podEscape2,@NoSpell
+
+" HTML entities {{{1
+" Source: Pod/Escapes.pm
+syn keyword podEscape contained lt gt quot amp apos sol verbar lchevron rchevron nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc uuml yacute thorn yuml fnof Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lambda Mu Nu Xi Omicron Pi Rho Sigma Tau Upsilon Phi Chi Psi Omega alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigmaf sigma tau upsilon phi chi psi omega thetasym upsih piv bull hellip prime Prime oline frasl weierp image real trade alefsym larr uarr rarr darr harr crarr lArr uArr rArr dArr hArr forall part exist empty nabla isin notin ni prod sum minus lowast radic prop infin ang and or cap cup int there4 sim cong asymp ne equiv le ge sub sup nsub sube supe oplus otimes perp sdot lceil rceil lfloor rfloor lang rang loz spades clubs hearts diams OElig oelig Scaron scaron Yuml circ tilde ensp emsp thinsp zwnj zwj lrm rlm ndash mdash lsquo rsquo sbquo ldquo rdquo bdquo dagger Dagger permil lsaquo rsaquo
+" }}}
+
+syn match podEscape2 "\d\+" contained contains=@NoSpell
+syn match podEscape2 "0\=x\x\+" contained contains=@NoSpell
+syn match podEscape2 "0\o\+" contained contains=@NoSpell
+
+
+" POD commands
+syn match podCommand "^=encoding\>" nextgroup=podEncoding skipwhite contains=@NoSpell
+syn match podCommand "^=head[1234]\>" nextgroup=podCmdText skipwhite skipnl contains=@NoSpell
+syn match podCommand "^=item\>" nextgroup=podCmdText skipwhite skipnl contains=@NoSpell
+syn match podCommand "^=over\>" nextgroup=podOverIndent skipwhite contains=@NoSpell
+syn match podCommand "^=back" contains=@NoSpell
+syn match podCommand "^=cut" contains=@NoSpell
+syn match podCommand "^=pod" contains=@NoSpell
+syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell
+syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell
+syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell
+
+" Comments
+
+syn keyword podForKeywd comment contained nextgroup=podForComment skipwhite skipnl
+
+if exists("perl_pod_no_comment_fold")
+ syn region podBeginComment start="^=begin\s\+comment\s*$" end="^=end\s\+comment\ze\s*$" keepend extend contains=podCommand
+ syn region podForComment start="\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contained contains=@Spell,podTodo
+else
+ syn region podBeginComment start="^=begin\s\+comment\s*$" end="^=end\s\+comment\ze\s*$" keepend extend contains=podCommand,podTodo fold
+ syn region podForComment start="\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contained contains=@Spell,podTodo fold
+endif
+
+syn keyword podTodo contained TODO FIXME XXX
+
+" Plain Pod files
+syn region podNonPod start="\%^\%(=\w\+\>\)\@!" end="^\ze=\a\w*\>"
+syn region podNonPod matchgroup=podCommand start="^=cut\>" end="\%$"
+syn region podNonPod matchgroup=podCommand start="^=cut\>" end="^\ze=\a\w*\>"
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link podCommand Statement
+hi def link podBeginComment Comment
+hi def link podForComment Comment
+hi def link podNonPod Comment
+hi def link podTodo Todo
hi def link podCmdText String
+hi def link podEncoding Constant
hi def link podOverIndent Number
hi def link podForKeywd Identifier
+hi def link podVerbatim PreProc
hi def link podFormat Identifier
-hi def link podVerbatimLine PreProc
+hi def link podFormatDelimiter podFormat
+hi def link podFormatError Error
hi def link podSpecial Identifier
-hi def link podEscape String
+hi def link podEscape Constant
hi def link podEscape2 Number
if exists("perl_pod_spellcheck_headings")
" Spell-check headings
syn clear podCmdText
- syn match podCmdText ".*$" contained contains=podFormat
+ syn region podCmdText start="\S.*$" end="^\s*$" end="^\ze=cut\>" contained contains=podFormat
endif
if exists("perl_pod_formatting")
" By default, escapes like C<> are not checked for spelling. Remove B<>
" and I<> from the list of escapes.
syn clear podFormat
- syn region podFormat start="[CLF]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
- syn region podFormat start="[CLF]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
+ syn region podFormat start="[CLF]<[^<]"me=e-1 end=">" contains=@podFormat,@NoSpell
+ syn region podFormat start="[CLF]<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=@podFormat,@NoSpell
" Don't spell-check inside E<>, but ensure that the E< itself isn't
" marked as a spelling mistake.
- syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
+ syn region podFormat start="E<" end=">" oneline contains=podEscape,podEscape2,@NoSpell
" Z<> is a mock formatting code. Ensure Z<> on its own isn't marked as a
" spelling mistake.
@@ -105,41 +152,41 @@ if exists("perl_pod_formatting")
syn match podIndexOpen "X<" contains=@NoSpell
" Same as above but for the << >> syntax.
- syn match podBoldAlternativeDelimOpen "B<< " contains=@NoSpell
- syn match podItalicAlternativeDelimOpen "I<< " contains=@NoSpell
- syn match podNoSpaceAlternativeDelimOpen "S<< " contains=@NoSpell
- syn match podIndexAlternativeDelimOpen "X<< " contains=@NoSpell
+ syn match podBoldAlternativeDelimOpen "B<<\%(\s\+\|$\)" contains=@NoSpell
+ syn match podItalicAlternativeDelimOpen "I<<\%(\s\+\|$\)" contains=@NoSpell
+ syn match podNoSpaceAlternativeDelimOpen "S<<\%(\s\+\|$\)" contains=@NoSpell
+ syn match podIndexAlternativeDelimOpen "X<<\%(\s\+\|$\)" contains=@NoSpell
" Add support for spell checking text inside B<>, I<>, S<> and X<>.
- syn region podBold start="B<[^<]"me=e end=">" oneline contains=podBoldItalic,podBoldOpen
- syn region podBoldAlternativeDelim start="B<<\s" end="\s>>" oneline contains=podBoldAlternativeDelimOpen
+ syn region podBold start="B<[^<]"me=e end=">" contains=podBoldItalic,podBoldOpen
+ syn region podBoldAlternativeDelim start="B<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=podBoldAlternativeDelimOpen
- syn region podItalic start="I<[^<]"me=e end=">" oneline contains=podItalicBold,podItalicOpen
- syn region podItalicAlternativeDelim start="I<<\s" end="\s>>" oneline contains=podItalicAlternativeDelimOpen
+ syn region podItalic start="I<[^<]"me=e end=">" contains=podItalicBold,podItalicOpen
+ syn region podItalicAlternativeDelim start="I<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=podItalicAlternativeDelimOpen
" Nested bold/italic and vice-versa
- syn region podBoldItalic contained start="I<[^<]"me=e end=">" oneline
- syn region podItalicBold contained start="B<[^<]"me=e end=">" oneline
+ syn region podBoldItalic contained start="I<[^<]"me=e end=">"
+ syn region podItalicBold contained start="B<[^<]"me=e end=">"
- syn region podNoSpace start="S<[^<]"ms=s-2 end=">"me=e oneline contains=podNoSpaceOpen
- syn region podNoSpaceAlternativeDelim start="S<<\s"ms=s-2 end="\s>>"me=e oneline contains=podNoSpaceAlternativeDelimOpen
+ syn region podNoSpace start="S<[^<]"ms=s-2 end=">"me=e contains=podNoSpaceOpen
+ syn region podNoSpaceAlternativeDelim start="S<<\%(\s\+\|$\)"ms=s-2 end="\%(\s\+\|^\)>>"me=e contains=podNoSpaceAlternativeDelimOpen
- syn region podIndex start="X<[^<]"ms=s-2 end=">"me=e oneline contains=podIndexOpen
- syn region podIndexAlternativeDelim start="X<<\s"ms=s-2 end="\s>>"me=e oneline contains=podIndexAlternativeDelimOpen
+ syn region podIndex start="X<[^<]"ms=s-2 end=">"me=e contains=podIndexOpen
+ syn region podIndexAlternativeDelim start="X<<\%(\s\+\|$\)"ms=s-2 end="\%(\s\+\|^\)>>"me=e contains=podIndexAlternativeDelimOpen
" Restore this (otherwise B<> is shown as bold inside verbatim)
- syn match podVerbatimLine "^\s.*$" contains=@NoSpell
+ syn region podVerbatim start="^\s\+\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contains=@NoSpell
" Ensure formatted text can be displayed in headings and items
syn clear podCmdText
if exists("perl_pod_spellcheck_headings")
- syn match podCmdText ".*$" contained contains=podFormat,podBold,
+ syn match podCmdText ".*$" contained contains=@podFormat,podBold,
\podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,
\podBoldOpen,podItalicOpen,podBoldAlternativeDelimOpen,
\podItalicAlternativeDelimOpen,podNoSpaceOpen
else
- syn match podCmdText ".*$" contained contains=podFormat,podBold,
+ syn match podCmdText ".*$" contained contains=@podFormat,podBold,
\podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,
\@NoSpell
endif
@@ -172,4 +219,4 @@ let b:current_syntax = "pod"
let &cpo = s:cpo_save
unlet s:cpo_save
-" vim: ts=8
+" vim: ts=8 fdm=marker:
diff --git a/runtime/syntax/qb64.vim b/runtime/syntax/qb64.vim
new file mode 100644
index 0000000000..a777e14481
--- /dev/null
+++ b/runtime/syntax/qb64.vim
@@ -0,0 +1,409 @@
+" Vim syntax file
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 21
+
+" Prelude {{{1
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" syn iskeyword set after sourcing of basic.vim
+
+syn case ignore
+
+let s:prefix = search('\c^\s*$NOPREFIX\>', 'n') ? '_\=' : '_'
+
+" Statements {{{1
+
+let s:statements =<< trim EOL " {{{2
+ acceptfiledrop
+ allowfullscreen
+ assert
+ console
+ consolecursor
+ consolefont
+ consoletitle
+ continue
+ copypalette
+ define
+ delay
+ depthbuffer
+ displayorder
+ dontblend
+ echo
+ exit\s\+\%(select\|case\)
+ finishdrop
+ freefont
+ freeimage
+ icon
+ keyclear
+ limit
+ maptriangle
+ memcopy
+ memfill
+ memfree
+ memput
+ mousehide
+ mousemove
+ mouseshow
+ printimage
+ printstring
+ putimage
+ screenclick
+ screenhide
+ screenmove
+ screenprint
+ screenshow
+ setalpha
+ sndbal
+ sndclose
+ sndlimit
+ sndloop
+ sndpause
+ sndplay
+ sndplaycopy
+ sndplayfile
+ sndraw
+ sndrawdone
+ sndsetpos
+ sndstop
+ sndvol
+ title
+EOL
+" }}}
+
+for s in s:statements
+ exe 'syn match qb64Statement "\<' .. s:prefix .. s .. '\>" contained contains=qb64Underscore'
+endfor
+
+" Functions {{{1
+
+let s:functions =<< trim EOL " {{{2
+ acos
+ acosh
+ alpha
+ alpha32
+ arccot
+ arccsc
+ arcsec
+ asin
+ asinh
+ atan2
+ atanh
+ axis
+ backgroundcolor
+ blue
+ blue32
+ button
+ buttonchange
+ ceil
+ cinp
+ commandcount
+ connected
+ connectionaddress
+ connectionaddress$
+ consoleinput
+ copyimage
+ cot
+ coth
+ cosh
+ csc
+ csch
+ cv
+ cwd$
+ d2g
+ d2r
+ defaultcolor
+ deflate$
+ desktopheight
+ desktopwidth
+ device$
+ deviceinput
+ devices
+ dir$
+ direxists
+ droppedfile
+ droppedfile$
+ errorline
+ errormessage$
+ exit
+ fileexists
+ fontheight
+ fontwidth
+ freetimer
+ g2d
+ g2r
+ green
+ green32
+ height
+ hypot
+ inclerrorfile$
+ inclerrorline
+ inflate$
+ instrrev
+ keyhit
+ keydown
+ lastaxis
+ lastbutton
+ lastwheel
+ loadfont
+ loadimage
+ mem
+ memelement
+ memexists
+ memimage
+ memnew
+ memsound
+ mk$
+ mousebutton
+ mouseinput
+ mousemovementx
+ mousemovementy
+ mousepipeopen
+ mousewheel
+ mousex
+ mousey
+ newimage
+ offset
+ openclient
+ os$
+ pi
+ pixelsize
+ printwidth
+ r2d
+ r2g
+ red
+ red32
+ readbit
+ resetbit
+ resizeheight
+ resizewidth
+ rgb
+ rgb32
+ rgba
+ rgba32
+ round
+ sec
+ sech
+ screenexists
+ screenimage
+ screenx
+ screeny
+ setbit
+ shellhide
+ shl
+ shr
+ sinh
+ sndcopy
+ sndgetpos
+ sndlen
+ sndopen
+ sndopenraw
+ sndpaused
+ sndplaying
+ sndrate
+ sndrawlen
+ startdir$
+ strcmp
+ stricmp
+ tanh
+ title$
+ togglebit
+ totaldroppedfiles
+ trim$
+ wheel
+ width
+ windowhandle
+ windowhasfocus
+EOL
+" }}}
+
+for f in s:functions
+ exe 'syn match qb64Function "\<' .. s:prefix .. f .. '\>" contains=qb64Underscore'
+endfor
+
+" Functions and statements (same name) {{{1
+
+let s:common =<< trim EOL " {{{2
+ autodisplay
+ blend
+ blink
+ capslock
+ clearcolor
+ clipboard$
+ clipboardimage
+ controlchr
+ dest
+ display
+ font
+ fullscreen
+ mapunicode
+ memget
+ numlock
+ palettecolor
+ printmode
+ resize
+ screenicon
+ scrolllock
+ source
+EOL
+" }}}
+
+for c in s:common
+ exe 'syn match qb64Statement "\<' .. s:prefix .. c .. '\>" contains=qb64Underscore contained'
+ exe 'syn match qb64Function "\<' .. s:prefix .. c .. '\>" contains=qb64Underscore'
+endfor
+
+" Keywords {{{1
+
+" Non-prefixed keywords {{{2
+" TIMER FREE
+" _DEPTH_BUFFER LOCK
+syn keyword qb64Keyword free lock
+
+let s:keywords =<< trim EOL " {{{2
+ all
+ anticlockwise
+ behind
+ clear
+ clip
+ console
+ dontwait
+ explicit
+ explicitarray
+ fillbackground
+ hardware
+ hardware1
+ hide
+ keepbackground
+ middle
+ none
+ off
+ only
+ onlybackground
+ ontop
+ openconnection
+ openhost
+ preserve
+ seamless
+ smooth
+ smoothshrunk
+ smoothstretched
+ software
+ squarepixels
+ stretch
+ toggle
+EOL
+" }}}
+
+for k in s:keywords
+ exe 'syn match qb64Keyword "\<' .. s:prefix .. k .. '\>" contains=qb64Underscore'
+endfor
+
+syn match qb64Underscore "\<_" contained conceal transparent
+
+" Source QuickBASIC syntax {{{1
+runtime! syntax/basic.vim
+
+" add after the BASIC syntax file is sourced so cluster already exists
+syn cluster basicStatements add=qb64Statement,qb64Metacommand,qb64IfMetacommand
+syn cluster basicLineIdentifier add=qb64LineLabel
+syn cluster qb64NotTop contains=@basicNotTop,qb64Metavariable
+
+syn iskeyword @,48-57,.,_,!,#,$,%,&,`
+
+" Unsupported QuickBASIC features {{{1
+" TODO: add linux only missing features
+syn keyword qb64Unsupported alias any byval calls cdecl erdev erdev$ fileattr
+syn keyword qb64Unsupported fre ioctl ioctl$ pen play setmem signal uevent
+syn keyword qb64Unsupported tron troff
+syn match qb64Unsupported "\<declare\%(\s\+\%(sub\|function\)\>\)\@="
+syn match qb64Unsupported "\<\%(date\|time\)$\ze\s*=" " statements only
+syn match qb64Unsupported "\<def\zs\s\+FN"
+syn match qb64Unsupported "\<\%(exit\|end\)\s\+def\>"
+syn match qb64Unsupported "\<width\s\+lprint\>"
+
+" Types {{{1
+syn keyword qb64Type _BIT _BYTE _FLOAT _INTEGER64 _MEM _OFFSET _UNSIGNED
+
+" Type suffixes {{{1
+if exists("basic_type_suffixes")
+ " TODO: handle leading word boundary and __+ prefix
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\~\=`\%(\d\+\)\="
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\~\=\%(%\|%%\|&\|&&\|%&\)"
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\%(!\|##\|#\)"
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=$\%(\d\+\)\="
+endif
+
+" Numbers {{{1
+
+" Integers
+syn match qb64Number "-\=&b[01]\+&\>\="
+
+syn match qb64Number "-\=\<[01]\~\=`\>"
+syn match qb64Number "-\=\<\d\+`\d\+\>"
+
+syn match qb64Number "-\=\<\d\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<\d\+\~\%(%%\|&&\|%&\)\>"
+
+syn match qb64Number "-\=\<&b[01]\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<&b[01]\+\~\%(%%\|&&\|%&\)\>"
+
+syn match qb64Number "-\=\<&o\=\o\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<&o\=\o\+\~\%(%%\|&&\|%&\)\>"
+
+syn match qb64Number "-\=\<&h\x\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<&h\x\+\~\%(%%\|&&\|%&\)\>"
+
+" Floats
+syn match qb64Float "-\=\<\d\+\.\=\d*##\>"
+syn match qb64Float "-\=\<\.\d\+##\>"
+
+" Line numbers and labels {{{1
+syn match qb64LineLabel "\%(_\{2,}\)\=\a[[:alnum:]._]*[[:alnum:]]\ze\s*:" nextgroup=@basicStatements skipwhite contained
+
+" Metacommands {{{1
+syn match qb64Metacommand contained "$NOPREFIX\>"
+syn match qb64Metacommand contained "$ASSERTS\%(:CONSOLE\)\=\>"
+syn match qb64Metacommand contained "$CHECKING:\%(ON\|OFF\)\>"
+syn match qb64Metacommand contained "$COLOR:\%(0\|32\)\>"
+syn match qb64Metacommand contained "$CONSOLE\%(:ONLY\)\=\>"
+syn match qb64Metacommand contained "$EXEICON\s*:\s*'[^']\+'"
+syn match qb64Metacommand contained "$ERROR\>"
+syn match qb64Metacommand contained "$LET\>"
+syn match qb64Metacommand contained "$RESIZE:\%(ON\|OFF\|STRETCH\|SMOOTH\)\>"
+syn match qb64Metacommand contained "$SCREEN\%(HIDE\|SHOW\)\>"
+syn match qb64Metacommand contained "$VERSIONINFO\s*:.*"
+syn match qb64Metacommand contained "$VIRTUALKEYBOARD:\%(ON\|OFF\)\>"
+
+syn region qb64IfMetacommand contained matchgroup=qb64Metacommand start="$\%(IF\|ELSEIF\)\>" end="\<THEN\>" oneline transparent contains=qb64Metavariable
+syn match qb64Metacommand contained "$\%(ELSE\|END\s*IF\)\>"
+
+syn keyword qb64Metavariable contained defined undefined
+syn keyword qb64Metavariable contained windows win linux mac maxosx
+syn keyword qb64Metavariable contained 32bit 64bit version
+
+" Default Highlighting {{{1
+hi def link qb64Float basicFloat
+hi def link qb64Function Function
+hi def link qb64Keyword Keyword
+hi def link qb64LineLabel basicLineLabel
+hi def link qb64Metacommand PreProc
+hi def link qb64Metavariable Identifier
+hi def link qb64Number basicNumber
+hi def link qb64Statement Statement
+hi def link qb64TypeSuffix basicTypeSuffix
+hi def link qb64Type Type
+hi def link qb64Unsupported Error
+
+" Postscript {{{1
+let b:current_syntax = "qb64"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/syntax/query.lua b/runtime/syntax/query.lua
new file mode 100644
index 0000000000..8f40b1cb8a
--- /dev/null
+++ b/runtime/syntax/query.lua
@@ -0,0 +1,6 @@
+-- Neovim syntax file
+-- Language: Tree-sitter query
+-- Last Change: 2022 Apr 13
+
+-- it's a lisp!
+vim.cmd([[ runtime! syntax/lisp.vim ]])
diff --git a/runtime/syntax/rc.vim b/runtime/syntax/rc.vim
index 4c6856bc83..d69edd00fd 100644
--- a/runtime/syntax/rc.vim
+++ b/runtime/syntax/rc.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: M$ Resource files (*.rc)
" Maintainer: Christian Brabandt
-" Last Change: 2015-05-29
+" Last Change: 20220116
" Repository: https://github.com/chrisbra/vim-rc-syntax
" License: Vim (see :h license)
" Previous Maintainer: Heiko Erhardt <Heiko.Erhardt@munich.netsurf.de>
@@ -173,16 +173,17 @@ hi def link rcAttribute rcCommonAttribute
hi def link rcStdId rcStatement
hi def link rcStatement Statement
-" Default color overrides
-hi def rcLanguage term=reverse ctermbg=Red ctermfg=Yellow guibg=Red guifg=Yellow
-hi def rcMainObject term=underline ctermfg=Blue guifg=Blue
-hi def rcSubObject ctermfg=Green guifg=Green
-hi def rcCaptionParam term=underline ctermfg=DarkGreen guifg=Green
-hi def rcParam ctermfg=DarkGreen guifg=DarkGreen
-hi def rcStatement ctermfg=DarkGreen guifg=DarkGreen
-hi def rcCommonAttribute ctermfg=Brown guifg=Brown
+hi def link rcLanguage Constant
+hi def link rcCaptionParam Constant
+hi def link rcCommonAttribute Constant
+
+hi def link rcMainObject Identifier
+hi def link rcSubObject Define
+hi def link rcParam Constant
+hi def link rcStatement Statement
+"
+"hi def link rcIdentifier Identifier
-"hi def link rcIdentifier Identifier
let b:current_syntax = "rc"
diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim
index 13d6d9efd8..c951fcfe1d 100644
--- a/runtime/syntax/ruby.vim
+++ b/runtime/syntax/ruby.vim
@@ -3,7 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Jun 06
+" Last Change: 2021 Nov 03
" ----------------------------------------------------------------------------
"
" Previous Maintainer: Mirko Nasato
@@ -66,7 +66,7 @@ endfunction
com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)
" Not-Top Cluster {{{1
-syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell
+syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyDoubleQuoteSymbolDelimiter,rubySingleQuoteSymbolDelimiter,rubyParentheses,@Spell
" Whitespace Errors {{{1
if exists("ruby_space_errors")
@@ -364,6 +364,9 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
SynFold 'class' syn region rubyClassBlock start="\<class\>" matchgroup=rubyClass skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop
SynFold 'module' syn region rubyModuleBlock start="\<module\>" matchgroup=rubyModule skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop
+ " endless def
+ syn match rubyDefine "\<def\s\+\ze[^[:space:];#(]\+\%(\s\+\|\s*(.*)\s*\)=" nextgroup=rubyMethodDeclaration skipwhite
+
" modifiers
syn match rubyLineContinuation "\\$" nextgroup=@rubyModifier skipwhite skipnl
syn match rubyConditionalModifier "\<\%(if\|unless\)\>"
@@ -430,9 +433,10 @@ endif
" Comments and Documentation {{{1
syn match rubySharpBang "\%^#!.*" display
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
-syn match rubyEncoding "[[:alnum:]-]\+" contained display
+syn match rubyEncoding "[[:alnum:]-_]\+" contained display
syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite
syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen_string_literal\|warn_indent\|warn_past_scope\):" contained nextgroup=rubyBoolean skipwhite
+syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable_constant_value\):" contained nextgroup=rubyEncoding skipwhite
syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell
syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment
@@ -465,6 +469,10 @@ syn match rubyDefinedOperator "\%#=1\<defined?" display
syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock
syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1
+syn match rubySingleQuoteSymbolDelimiter "'" contained
+syn match rubySymbol "'\%(\\.\|[^']\)*'::\@!"he=e-1 contains=rubyQuoteEscape,rubyBackslashEscape,rubySingleQuoteSymbolDelimiter
+syn match rubyDoubleQuoteSymbolDelimiter "\"" contained
+syn match rubySymbol "\"\%(\\.\|[^\"]\)*\"::\@!"he=e-1 contains=@rubyStringSpecial,rubyDoubleQuoteSymbolDelimiter
" __END__ Directive {{{1
SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$"
@@ -565,6 +573,8 @@ hi def link rubyHeredocDelimiter rubyStringDelimiter
hi def link rubyPercentRegexpDelimiter rubyRegexpDelimiter
hi def link rubyPercentStringDelimiter rubyStringDelimiter
hi def link rubyPercentSymbolDelimiter rubySymbolDelimiter
+hi def link rubyDoubleQuoteSymbolDelimiter rubySymbolDelimiter
+hi def link rubySingleQuoteSymbolDelimiter rubySymbolDelimiter
hi def link rubyRegexpDelimiter rubyStringDelimiter
hi def link rubySymbolDelimiter rubySymbol
hi def link rubyString String
diff --git a/runtime/syntax/sass.vim b/runtime/syntax/sass.vim
index b51a0ae26b..8f41aba4f7 100644
--- a/runtime/syntax/sass.vim
+++ b/runtime/syntax/sass.vim
@@ -2,7 +2,7 @@
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.sass
-" Last Change: 2019 Dec 05
+" Last Change: 2022 Mar 15
if exists("b:current_syntax")
finish
@@ -58,6 +58,7 @@ syn match sassAmpersand "&"
" TODO: Arithmetic (including strings and concatenation)
syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators
+syn region sassKeyframe matchgroup=cssAtKeyword start=/@\(-[a-z]\+-\)\=keyframes\>/ end=";\|$" contains=cssVendor,cssComment nextgroup=cssDefinition
syn keyword sassMediaOperators and not only contained
syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType
syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType
diff --git a/runtime/syntax/scala.vim b/runtime/syntax/scala.vim
index 16e114778d..c08e60e55a 100644
--- a/runtime/syntax/scala.vim
+++ b/runtime/syntax/scala.vim
@@ -3,7 +3,7 @@
" Maintainer: Derek Wyatt
" URL: https://github.com/derekwyatt/vim-scala
" License: Same as Vim
-" Last Change: 23 August 2021
+" Last Change: 23 January 2022
" ----------------------------------------------------------------------------
if !exists('main_syntax')
@@ -43,55 +43,55 @@ syn keyword scalaKeyword class trait object extends with nextgroup=scalaInstance
syn keyword scalaKeyword case nextgroup=scalaKeyword,scalaCaseFollowing skipwhite
syn keyword scalaKeyword val nextgroup=scalaNameDefinition,scalaQuasiQuotes skipwhite
syn keyword scalaKeyword def var nextgroup=scalaNameDefinition skipwhite
-hi link scalaKeyword Keyword
+hi def link scalaKeyword Keyword
exe 'syn region scalaBlock start=/{/ end=/}/ contains=' . s:ContainedGroup() . ' fold'
syn keyword scalaAkkaSpecialWord when goto using startWith initialize onTransition stay become unbecome
-hi link scalaAkkaSpecialWord PreProc
+hi def link scalaAkkaSpecialWord PreProc
syn keyword scalatestSpecialWord shouldBe
syn match scalatestShouldDSLA /^\s\+\zsit should/
syn match scalatestShouldDSLB /\<should\>/
-hi link scalatestSpecialWord PreProc
-hi link scalatestShouldDSLA PreProc
-hi link scalatestShouldDSLB PreProc
+hi def link scalatestSpecialWord PreProc
+hi def link scalatestShouldDSLA PreProc
+hi def link scalatestShouldDSLB PreProc
syn match scalaSymbol /'[_A-Za-z0-9$]\+/
-hi link scalaSymbol Number
+hi def link scalaSymbol Number
syn match scalaChar /'.'/
syn match scalaChar /'\\[\\"'ntbrf]'/ contains=scalaEscapedChar
syn match scalaChar /'\\u[A-Fa-f0-9]\{4}'/ contains=scalaUnicodeChar
syn match scalaEscapedChar /\\[\\"'ntbrf]/
syn match scalaUnicodeChar /\\u[A-Fa-f0-9]\{4}/
-hi link scalaChar Character
-hi link scalaEscapedChar Special
-hi link scalaUnicodeChar Special
+hi def link scalaChar Character
+hi def link scalaEscapedChar Special
+hi def link scalaUnicodeChar Special
syn match scalaOperator "||"
syn match scalaOperator "&&"
syn match scalaOperator "|"
syn match scalaOperator "&"
-hi link scalaOperator Special
+hi def link scalaOperator Special
syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition,scalaVariableDeclarationList
syn match scalaNameDefinition /`[^`]\+`/ contained nextgroup=scalaPostNameDefinition
syn match scalaVariableDeclarationList /\s*,\s*/ contained nextgroup=scalaNameDefinition
syn match scalaPostNameDefinition /\_s*:\_s*/ contained nextgroup=scalaTypeDeclaration
-hi link scalaNameDefinition Function
+hi def link scalaNameDefinition Function
syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaInstanceHash
syn match scalaInstanceDeclaration /`[^`]\+`/ contained
syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration
-hi link scalaInstanceDeclaration Special
-hi link scalaInstanceHash Type
+hi def link scalaInstanceDeclaration Special
+hi def link scalaInstanceHash Type
syn match scalaUnimplemented /???/
-hi link scalaUnimplemented ERROR
+hi def link scalaUnimplemented ERROR
syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/
-hi link scalaCapitalWord Special
+hi def link scalaCapitalWord Special
" Handle type declarations specially
syn region scalaTypeStatement matchgroup=Keyword start=/\<type\_s\+\ze/ end=/$/ contains=scalaTypeTypeDeclaration,scalaSquareBrackets,scalaTypeTypeEquals,scalaTypeStatement
@@ -105,18 +105,18 @@ syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDe
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypeDeclaration skipwhite
syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypePostDeclaration skipwhite
-hi link scalaTypeTypeDeclaration Type
-hi link scalaTypeTypeExtension Keyword
-hi link scalaTypeTypePostDeclaration Special
-hi link scalaTypeTypePostExtension Keyword
+hi def link scalaTypeTypeDeclaration Type
+hi def link scalaTypeTypeExtension Keyword
+hi def link scalaTypeTypePostDeclaration Special
+hi def link scalaTypeTypePostExtension Keyword
syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite
syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite
syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeDeclaration skipwhite
-hi link scalaTypeDeclaration Type
-hi link scalaTypeExtension Keyword
-hi link scalaTypePostExtension Keyword
+hi def link scalaTypeDeclaration Type
+hi def link scalaTypeExtension Keyword
+hi def link scalaTypePostExtension Keyword
syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration contains=scalaRoundBrackets
syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration
@@ -124,51 +124,51 @@ hi clear scalaTypeAnnotation
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained contains=scalaCapitalWord
syn match scalaCaseFollowing /`[^`]\+`/ contained contains=scalaCapitalWord
-hi link scalaCaseFollowing Special
+hi def link scalaCaseFollowing Special
syn keyword scalaKeywordModifier abstract override final lazy implicit private protected sealed null super
syn keyword scalaSpecialFunction implicitly require
-hi link scalaKeywordModifier Function
-hi link scalaSpecialFunction Function
+hi def link scalaKeywordModifier Function
+hi def link scalaSpecialFunction Function
syn keyword scalaSpecial this true false ne eq
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)"
syn match scalaSpecial /`[^`]\+`/ " Backtick literals
-hi link scalaSpecial PreProc
+hi def link scalaSpecial PreProc
syn keyword scalaExternal package import
-hi link scalaExternal Include
+hi def link scalaExternal Include
syn match scalaStringEmbeddedQuote /\\"/ contained
syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar
-hi link scalaString String
-hi link scalaStringEmbeddedQuote String
+hi def link scalaString String
+hi def link scalaStringEmbeddedQuote String
syn region scalaIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar
syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\ze\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar
-hi link scalaIString String
-hi link scalaTripleIString String
+hi def link scalaIString String
+hi def link scalaTripleIString String
syn match scalaInterpolation /\$[a-zA-Z0-9_$]\+/ contained
exe 'syn region scalaInterpolationB matchgroup=scalaInterpolationBoundary start=/\${/ end=/}/ contained contains=' . s:ContainedGroup()
-hi link scalaInterpolation Function
+hi def link scalaInterpolation Function
hi clear scalaInterpolationB
syn region scalaFString matchgroup=scalaInterpolationBrackets start=/f"/ skip=/\\"/ end=/"/ contains=scalaFInterpolation,scalaFInterpolationB,scalaEscapedChar,scalaUnicodeChar
syn match scalaFInterpolation /\$[a-zA-Z0-9_$]\+\(%[-A-Za-z0-9\.]\+\)\?/ contained
exe 'syn region scalaFInterpolationB matchgroup=scalaInterpolationBoundary start=/${/ end=/}\(%[-A-Za-z0-9\.]\+\)\?/ contained contains=' . s:ContainedGroup()
-hi link scalaFString String
-hi link scalaFInterpolation Function
+hi def link scalaFString String
+hi def link scalaFInterpolation Function
hi clear scalaFInterpolationB
syn region scalaTripleString start=/"""/ end=/"""\%([^"]\|$\)/ contains=scalaEscapedChar,scalaUnicodeChar
syn region scalaTripleFString matchgroup=scalaInterpolationBrackets start=/f"""/ end=/"""\%([^"]\|$\)/ contains=scalaFInterpolation,scalaFInterpolationB,scalaEscapedChar,scalaUnicodeChar
-hi link scalaTripleString String
-hi link scalaTripleFString String
+hi def link scalaTripleString String
+hi def link scalaTripleFString String
-hi link scalaInterpolationBrackets Special
-hi link scalaInterpolationBoundary Function
+hi def link scalaInterpolationBrackets Special
+hi def link scalaInterpolationBoundary Function
syn match scalaNumber /\<0[dDfFlL]\?\>/ " Just a bare 0
syn match scalaNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala
@@ -176,16 +176,16 @@ syn match scalaNumber /\<0[xX][0-9a-fA-F]\+[dDfFlL]\?\>/ " Hex number
syn match scalaNumber /\%(\<\d\+\.\d*\|\.\d\+\)\%([eE][-+]\=\d\+\)\=[fFdD]\=/ " exponential notation 1
syn match scalaNumber /\<\d\+[eE][-+]\=\d\+[fFdD]\=\>/ " exponential notation 2
syn match scalaNumber /\<\d\+\%([eE][-+]\=\d\+\)\=[fFdD]\>/ " exponential notation 3
-hi link scalaNumber Number
+hi def link scalaNumber Number
syn region scalaRoundBrackets start="(" end=")" skipwhite contained contains=scalaTypeDeclaration,scalaSquareBrackets,scalaRoundBrackets
syn region scalaSquareBrackets matchgroup=scalaSquareBracketsBrackets start="\[" end="\]" skipwhite nextgroup=scalaTypeExtension contains=scalaTypeDeclaration,scalaSquareBrackets,scalaTypeOperator,scalaTypeAnnotationParameter
syn match scalaTypeOperator /[-+=:<>]\+/ contained
syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained
-hi link scalaSquareBracketsBrackets Type
-hi link scalaTypeOperator Keyword
-hi link scalaTypeAnnotationParameter Function
+hi def link scalaSquareBracketsBrackets Type
+hi def link scalaTypeOperator Keyword
+hi def link scalaTypeAnnotationParameter Function
syn match scalaShebang "\%^#!.*" display
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@Spell keepend fold
@@ -195,20 +195,20 @@ syn match scalaParamAnnotationValue /[.`_A-Za-z0-9$]\+/ contained
syn region scalaDocLinks start="\[\[" end="\]\]" contained
syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained
syn match scalaTodo "\vTODO|FIXME|XXX" contained
-hi link scalaShebang Comment
-hi link scalaMultilineComment Comment
-hi link scalaDocLinks Function
-hi link scalaParameterAnnotation Function
-hi link scalaParamAnnotationValue Keyword
-hi link scalaCommentAnnotation Function
-hi link scalaCommentCodeBlock String
-hi link scalaTodo Todo
+hi def link scalaShebang Comment
+hi def link scalaMultilineComment Comment
+hi def link scalaDocLinks Function
+hi def link scalaParameterAnnotation Function
+hi def link scalaParamAnnotationValue Keyword
+hi def link scalaCommentAnnotation Function
+hi def link scalaCommentCodeBlock String
+hi def link scalaTodo Todo
syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/
-hi link scalaAnnotation PreProc
+hi def link scalaAnnotation PreProc
syn match scalaTrailingComment "//.*$" contains=scalaTodo,@Spell
-hi link scalaTrailingComment Comment
+hi def link scalaTrailingComment Comment
syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing
syn match scalaAkkaFSM /stay\_s\+using/
@@ -221,8 +221,8 @@ syn match scalaAkkaFSM /onTermination/
syn match scalaAkkaFSM /whenUnhandled/
syn match scalaAkkaFSMGotoUsing /\<using\>/
syn match scalaAkkaFSMGotoUsing /\<goto\>/
-hi link scalaAkkaFSM PreProc
-hi link scalaAkkaFSMGotoUsing PreProc
+hi def link scalaAkkaFSM PreProc
+hi def link scalaAkkaFSMGotoUsing PreProc
let b:current_syntax = 'scala'
diff --git a/runtime/syntax/scdoc.vim b/runtime/syntax/scdoc.vim
index 25c9c5433b..0180f35027 100644
--- a/runtime/syntax/scdoc.vim
+++ b/runtime/syntax/scdoc.vim
@@ -1,6 +1,7 @@
" Syntax file for scdoc files
-" Maintainer: Gregory Anders <greg@gpanders.com>
-" Last Updated: 2021-08-04
+" Maintainer: Gregory Anders <contact@gpanders.com>
+" Last Updated: 2022-05-09
+" Upstream: https://github.com/gpanders/vim-scdoc
if exists('b:current_syntax')
finish
@@ -20,33 +21,43 @@ syntax match scdocIndentError "^[ ]\+"
syntax match scdocLineBreak "++$"
-syntax match scdocOrderedListMarker "^\s*\.\%(\s\+\S\)\@="
-syntax match scdocListMarker "^\s*-\%(\s\+\S\)\@="
+syntax region scdocOrderedListItem matchgroup=scdocOrderedListMarker start="^\z(\s*\)\." skip="^\z1 .*$" end="^" contains=scdocBold,scdocUnderline
+syntax region scdocListItem matchgroup=scdocListMarker start="^\z(\s*\)-" skip="^\z1 .*$" end="^" contains=scdocBold,scdocUnderline
-syntax match scdocTableStartMarker "^[\[|\]][\[\-\]]"
-syntax match scdocTableMarker "^[|:][\[\-\] ]"
+" Tables cannot start with a column
+syntax match scdocTableError "^:"
+
+syntax region scdocTable matchgroup=scdocTableEntry start="^[\[|\]][\[\-\]<=>]" end="^$" contains=scdocTableEntry,scdocTableError,scdocTableContinuation,scdocBold,scdocUnderline,scdocPre
+syntax match scdocTableError "^.*$" contained
+syntax match scdocTableContinuation "^ \+\S\+" contained
+syntax match scdocTableEntry "^[|:][\[\-\]<=> ]" contained
+syntax match scdocTableError "^[|:][\[\-\]<=> ]\S.*$" contained
syntax region scdocBold concealends matchgroup=scdocBoldDelimiter start="\\\@<!\*" end="\\\@<!\*"
syntax region scdocUnderline concealends matchgroup=scdocUnderlineDelimiter start="\<\\\@<!_" end="\\\@<!_\>"
syntax region scdocPre matchgroup=scdocPreDelimiter start="^\t*```" end="^\t*```"
-hi link scdocFirstLineValid Comment
-hi link scdocComment Comment
-hi link scdocHeader Title
-hi link scdocOrderedListMarker Statement
-hi link scdocListMarker scdocOrderedListMarker
-hi link scdocLineBreak Special
-hi link scdocTableMarker Statement
-hi link scdocTableStartMarker scdocTableMarker
-
-hi link scdocFirstLineError Error
-hi link scdocCommentError Error
-hi link scdocHeaderError Error
-hi link scdocIndentError Error
-
-hi link scdocPreDelimiter Delimiter
-
-hi scdocBold term=bold cterm=bold gui=bold
-hi scdocUnderline term=underline cterm=underline gui=underline
-hi link scdocBoldDelimiter scdocBold
-hi link scdocUnderlineDelimiter scdocUnderline
+syntax sync minlines=50
+
+hi default link scdocFirstLineValid Comment
+hi default link scdocComment Comment
+hi default link scdocHeader Title
+hi default link scdocOrderedListMarker Statement
+hi default link scdocListMarker scdocOrderedListMarker
+hi default link scdocLineBreak Special
+hi default link scdocTableSpecifier Statement
+hi default link scdocTableEntry Statement
+
+hi default link scdocFirstLineError Error
+hi default link scdocCommentError Error
+hi default link scdocHeaderError Error
+hi default link scdocIndentError Error
+hi default link scdocTableError Error
+hi default link scdocTableError Error
+
+hi default link scdocPreDelimiter Delimiter
+
+hi default scdocBold term=bold cterm=bold gui=bold
+hi default scdocUnderline term=underline cterm=underline gui=underline
+hi default link scdocBoldDelimiter scdocBold
+hi default link scdocUnderlineDelimiter scdocUnderline
diff --git a/runtime/syntax/sendpr.vim b/runtime/syntax/sendpr.vim
index 2e07802047..2541b95c67 100644
--- a/runtime/syntax/sendpr.vim
+++ b/runtime/syntax/sendpr.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: FreeBSD send-pr file
" Maintainer: Hendrik Scholz <hendrik@scholz.net>
-" Last Change: 2012 Feb 03
+" Last Change: 2022 Jun 14
"
" http://raisdorf.net/files/misc/send-pr.vim
@@ -31,5 +31,7 @@ hi def link sendprType Type
hi def link sendprString String
hi def link sendprLabel Label
+let b:current_syntax = 'sendpr'
+
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 731a514cb2..e44699faa5 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change: Oct 26, 2021
-" Version: 199
+" Last Change: Jun 29, 2022
+" Version: 202
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras
@@ -138,7 +138,7 @@ syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsa
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster ErrorList add=shDTestError
endif
-syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
+syn cluster shArithParenList contains=shArithmetic,shArithParen,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shArithList contains=@shArithParenList,shParenError
syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
@@ -147,8 +147,8 @@ if exists("b:is_kornshell") || exists("b:is_bash")
endif
syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
-" COMBAK: removing shEscape from shDblQuoteList fails ksh04:43
-syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
+" COMBAK: removing shEscape from shDblQuoteList fails ksh04:43 -- Jun 09, 2022: I don't see the problem with ksh04, so am reinstating shEscape
+syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS
syn cluster shDerefVarList contains=shDerefOffset,shDerefOp,shDerefVarArray,shDerefOpError
syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
@@ -157,11 +157,12 @@ syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shFunctionList add=shRepeat,shDblBrace,shDblParen,shForPP
+ syn cluster shDerefList add=shCommandSubList,shEchoDeref
endif
syn cluster shHereBeginList contains=@shCommandSubList
syn cluster shHereList contains=shBeginHere,shHerePayload
syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
-syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
+syn cluster shIdList contains=shArithmetic,shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shIf,shOption,shSet,shTest,shTestOpr,shTouch
if exists("b:is_kornshell") || exists("b:is_bash")
@@ -179,6 +180,10 @@ syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shComman
" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
+ syn region shEchoDeref contained matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+ syn region shEchoDeref contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+endif
syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]'
" This must be after the strings, so that ... \" will be correct
@@ -291,13 +296,15 @@ syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBa
syn match shCaseLabel contained skipwhite "\%(\\.\|[-a-zA-Z0-9_*.]\)\+" contains=shCharClass
if exists("b:is_bash")
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end=";;&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
+elseif exists("b:is_kornshell")
+ ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
else
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
endif
ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
-if exists("b:is_bash")
+if exists("b:is_bash") || exists("b:is_kornshell")
syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained
elseif !exists("g:sh_no_error")
syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
@@ -329,10 +336,11 @@ syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
" systems too, however, so the following syntax will flag $(..) as
" an Error under /bin/sh. By consensus of vimdev'ers!
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
- syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
+ syn region shCommandSub matchgroup=shCmdSubRegion start="\$(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
syn match shSkipInitWS contained "^\s\+"
+ syn region shArithParen matchgroup=shArithRegion contained start="(" end=")" contains=@shArithParenList
elseif !exists("g:sh_no_error")
syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
endif
@@ -342,7 +350,7 @@ if exists("b:is_bash")
syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
syn cluster shCaseList add=bashAdminStatement,bashStatement
syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID
- syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail
+ syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep head less ls mkdir mv rm rmdir rpm sed sleep sort strip tail
syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
syn keyword bashStatement command compgen
endif
@@ -351,7 +359,7 @@ if exists("b:is_kornshell") || exists("b:is_posix")
syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
syn cluster shCaseList add=kshStatement
syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL
- syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail tput
+ syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep head killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail tput
syn keyword kshStatement command setgroups setsenv
endif
@@ -368,7 +376,7 @@ endif
syn match shNumber "\<\d\+\>#\="
syn match shNumber "\<-\=\.\=\d\+\>#\="
syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
-if exists("b:is_bash")
+if exists("b:is_bash") || exists("b:is_kornshell")
syn match shSpecial "[^\\]\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial nextgroup=shSpecialNxt
@@ -441,19 +449,24 @@ syn match shVar contained "\h\w*"
syn region shAtExpr contained start="@(" end=")" contains=@shIdList
if exists("b:is_bash")
syn match shSet "^\s*set\ze\s\+$"
- syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList
+ syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList
syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\)\>[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment
elseif exists("b:is_kornshell") || exists("b:is_posix")
syn match shSet "^\s*set\ze\s\+$"
if exists("b:is_dash")
- syn region shSetList oneline matchgroup=shSet start="\<\%(local\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
+ syn region shSetList oneline matchgroup=shSet start="\<\%(local\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
endif
- syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
+ syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\>\)\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList nextgroup=shComment
else
syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
endif
+" KornShell namespace: {{{1
+if exists("b:is_kornshell")
+ syn keyword shFunctionKey namespace skipwhite skipnl nextgroup=shFunctionTwo
+endif
+
" Functions: {{{1
if !exists("b:is_posix")
syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
@@ -473,7 +486,7 @@ endif
" Parameter Dereferencing: {{{1
" ========================
-if !exists("g:sh_no_error")
+if !exists("g:sh_no_error") && !(exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix"))
syn match shDerefWordError "[^}$[~]" contained
endif
syn match shDerefSimple "\$\%(\h\w*\|\d\)" nextgroup=@shNoZSList
@@ -486,6 +499,13 @@ if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix")
syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS,shSpecialStart
endif
+" ksh: ${.sh.*} variables: {{{1
+" ========================================
+if exists("b:is_kornshell")
+" syn match shDerefVar contained "[.]*" nextgroup=@shDerefVarList
+ syn match shDerefVar contained "\.\+" nextgroup=@shDerefVarList
+endif
+
" ksh: ${!var[*]} array index list syntax: {{{1
" ========================================
if exists("b:is_kornshell") || exists("b:is_posix")
diff --git a/runtime/syntax/sml.vim b/runtime/syntax/sml.vim
index 53ff12a859..8f1af3f9bd 100644
--- a/runtime/syntax/sml.vim
+++ b/runtime/syntax/sml.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: SML
" Filenames: *.sml *.sig
-" Maintainers: Markus Mottl <markus.mottl@gmail.com>
-" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it>
-" Last Change: 2021 Oct 04
+" Maintainer: Markus Mottl <markus.mottl@gmail.com>
+" Previous Maintainer: Fabrizio Zeno Cornelli
+" <zeno@filibusta.crema.unimi.it> (invalid)
+" Last Change: 2022 Apr 01
" 2015 Aug 31 - Fixed opening of modules (Ramana Kumar)
" 2006 Oct 23 - Fixed character highlighting bug (MM)
diff --git a/runtime/syntax/strace.vim b/runtime/syntax/strace.vim
index 206c58919e..20516a1853 100644
--- a/runtime/syntax/strace.vim
+++ b/runtime/syntax/strace.vim
@@ -1,8 +1,7 @@
" Vim syntax file
-" This is a GENERATED FILE. Please always refer to source file at the URI below.
" Language: strace output
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
-" Last Change: 2015-01-16
+" Last Change: 2022 Jan 29
" Setup
" quit when a syntax file was already loaded
diff --git a/runtime/syntax/structurizr.vim b/runtime/syntax/structurizr.vim
index 73629b1495..ab9e4ee609 100644
--- a/runtime/syntax/structurizr.vim
+++ b/runtime/syntax/structurizr.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Structurizr DSL
" Maintainer: Bastian Venthur <venthur@debian.org>
-" Last Change: 2021-08-16
+" Last Change: 2022-02-15
" Remark: For a language reference, see
" https://github.com/structurizr/dsl
@@ -30,6 +30,7 @@ syn keyword skeyword deployment
syn keyword skeyword deploymentenvironment
syn keyword skeyword deploymentgroup
syn keyword skeyword deploymentnode
+syn keyword skeyword description
syn keyword skeyword dynamic
syn keyword skeyword element
syn keyword skeyword enterprise
@@ -37,7 +38,6 @@ syn keyword skeyword exclude
syn keyword skeyword filtered
syn keyword skeyword group
syn keyword skeyword healthcheck
-syn keyword skeyword impliedrelationships
syn keyword skeyword include
syn keyword skeyword infrastructurenode
syn keyword skeyword model
@@ -51,6 +51,7 @@ syn keyword skeyword styles
syn keyword skeyword systemcontext
syn keyword skeyword systemlandscape
syn keyword skeyword tags
+syn keyword skeyword technology
syn keyword skeyword terminology
syn keyword skeyword theme
syn keyword skeyword title
@@ -63,7 +64,11 @@ syn match skeyword "\!adrs\s\+"
syn match skeyword "\!constant\s\+"
syn match skeyword "\!docs\s\+"
syn match skeyword "\!identifiers\s\+"
+syn match skeyword "\!impliedrelationships\s\+"
syn match skeyword "\!include\s\+"
+syn match skeyword "\!plugin\s\+"
+syn match skeyword "\!ref\s\+"
+syn match skeyword "\!script\s\+"
syn region sstring oneline start='"' end='"'
diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim
index bfcd3b06da..b88cd95103 100644
--- a/runtime/syntax/synload.vim
+++ b/runtime/syntax/synload.vim
@@ -1,6 +1,6 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2020 Apr 13
+" Last Change: 2022 Apr 12
" This file sets up for syntax highlighting.
" It is loaded from "syntax.vim" and "manual.vim".
diff --git a/runtime/syntax/syntax.vim b/runtime/syntax/syntax.vim
index f274d93f4f..ac7dc314b9 100644
--- a/runtime/syntax/syntax.vim
+++ b/runtime/syntax/syntax.vim
@@ -1,6 +1,6 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2001 Sep 04
+" Last Change: 2022 Apr 12
" This file is used for ":syntax on".
" It installs the autocommands and starts highlighting for all buffers.
diff --git a/runtime/syntax/tap.vim b/runtime/syntax/tap.vim
index db37bb8980..6b00b1d588 100644
--- a/runtime/syntax/tap.vim
+++ b/runtime/syntax/tap.vim
@@ -2,9 +2,9 @@
" Language: Verbose TAP Output
" Maintainer: Rufus Cable <rufus@threebytesfull.com>
" Remark: Simple syntax highlighting for TAP output
-" License:
+" License: Vim License (see :help license)
" Copyright: (c) 2008-2013 Rufus Cable
-" Last Change: 2014-12-13
+" Last Change: 2020 Mar 15
if exists("b:current_syntax")
finish
@@ -29,12 +29,12 @@ syn match tapTestStatusOK /ok/ contained
syn match tapTestStatusNotOK /not ok/ contained
" highlight todo tests
-syn match tapTestTodo /\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev
-syn match tapTestTodoRev /\<TODO\>/ contained
+syn match tapTestTodo /\c\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev
+syn match tapTestTodoRev /\c\<TODO\>/ contained
" highlight skipped tests
-syn match tapTestSkip /# skip .*$/ contained contains=tapTestSkipTag
-syn match tapTestSkipTag /\(# \)\@<=skip\>/ contained
+syn match tapTestSkip /\c# skip .*$/ contained contains=tapTestSkipTag
+syn match tapTestSkipTag /\c\(# \)\@<=skip\>/ contained
" look behind so "ok 123" and "not ok 124" match test number
syn match tapTestNumber /\(ok \)\@<=\d\d*/ contained
@@ -51,17 +51,6 @@ syn region tapTestResultsSummaryNotOK start=/TODO passed:/ end=/$/ contained
syn region tapTestInstructionsRegion start=/\%1l/ end=/^$/
-set foldtext=TAPTestLine_foldtext()
-function! TAPTestLine_foldtext()
- let line = getline(v:foldstart)
- let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
- return sub
-endfunction
-
-set foldminlines=5
-set foldcolumn=2
-set foldenable
-set foldmethod=syntax
syn sync fromstart
if !exists("did_tapverboseoutput_syntax_inits")
diff --git a/runtime/syntax/tar.vim b/runtime/syntax/tar.vim
index 497683a186..815c2219cb 100644
--- a/runtime/syntax/tar.vim
+++ b/runtime/syntax/tar.vim
@@ -14,4 +14,6 @@ hi def link tarComment Comment
hi def link tarFilename Constant
hi def link tarDirectory Type
+let b:current_syntax = 'tar'
+
" vim: ts=8
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index ec0f7b99bd..5544fb63fc 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: TeX
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Last Change: Jun 29, 2020
-" Version: 119
+" Last Change: Apr 22, 2022
+" Version: 121
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
@@ -173,13 +173,25 @@ if !s:tex_excludematcher
syn cluster texItalGroup add=texMatcher
endif
if !s:tex_nospell
- syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
- syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
- syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell
+ if !s:tex_no_error
+ syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
+ syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
+ syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell
+ else
+ syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
+ syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
+ syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell
+ endif
else
- syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
- syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
- syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher
+ if !s:tex_no_error
+ syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
+ syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
+ syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher
+ else
+ syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
+ syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
+ syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher
+ endif
endif
syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ
syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter
@@ -189,7 +201,7 @@ if !exists("g:tex_no_math")
syn cluster texMatchGroup add=@texMathZones
syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone
- syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
+ syn cluster texMathZoneGroup contains=texBadPar,texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
if !s:tex_no_error
syn cluster texMathMatchGroup add=texMathError
syn cluster texMathZoneGroup add=texMathError
@@ -214,21 +226,21 @@ endif
if s:tex_fast =~# 'm'
if !s:tex_no_error
if s:tex_matchcheck =~ '{'
- syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError
- syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup,texError
+ syn region texMatcher matchgroup=texDelimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError
+ syn region texMatcherNM matchgroup=texDelimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup,texError
endif
if s:tex_matchcheck =~ '\['
- syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell
- syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup,texError,@NoSpell
+ syn region texMatcher matchgroup=texDelimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell
+ syn region texMatcherNM matchgroup=texDelimiter start="\[" end="]" transparent contains=@texMatchNMGroup,texError,@NoSpell
endif
else
if s:tex_matchcheck =~ '{'
- syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup
- syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup
+ syn region texMatcher matchgroup=texDelimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup
+ syn region texMatcherNM matchgroup=texDelimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup
endif
if s:tex_matchcheck =~ '\['
- syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup
- syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup
+ syn region texMatcher matchgroup=texDelimiter start="\[" end="]" transparent contains=@texMatchGroup
+ syn region texMatcherNM matchgroup=texDelimiter start="\[" end="]" transparent contains=@texMatchNMGroup
endif
endif
if s:tex_matchcheck =~ '('
@@ -251,7 +263,7 @@ if s:tex_fast =~# 'M'
if !s:tex_no_error
syn match texMathError "}" contained
endif
- syn region texMathMatcher matchgroup=Delimiter start="{" skip="\%(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
+ syn region texMathMatcher matchgroup=texDelimiter start="{" skip="\%(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
endif
endif
@@ -291,14 +303,14 @@ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
" \begin{}/\end{} section markers: {{{1
syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName
if s:tex_fast =~# 'm'
- syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment
- syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@texMathZones,@NoSpell
+ syn region texBeginEndName matchgroup=texDelimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment
+ syn region texBeginEndModifier matchgroup=texDelimiter start="\[" end="]" contained contains=texComment,@texMathZones,@NoSpell
endif
" \documentclass, \documentstyle, \usepackage: {{{1
syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs
if s:tex_fast =~# 'm'
- syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell
+ syn region texDocTypeArgs matchgroup=texDelimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell
endif
" Preamble syntax-based folding support: {{{1
@@ -312,7 +324,7 @@ syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}"
syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
syn match texInputCurlies "[{}]" contained
if s:tex_fast =~# 'm'
- syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment
+ syn region texInputFileOpt matchgroup=texDelimiter start="\[" end="\]" contained contains=texComment
endif
" Type Styles (LaTeX 2.09): {{{1
@@ -334,10 +346,8 @@ endif
syn match texTypeStyle "\\textmd\>"
syn match texTypeStyle "\\textrm\>"
-syn match texTypeStyle "\\mathbb\>"
syn match texTypeStyle "\\mathbf\>"
syn match texTypeStyle "\\mathcal\>"
-syn match texTypeStyle "\\mathfrak\>"
syn match texTypeStyle "\\mathit\>"
syn match texTypeStyle "\\mathnormal\>"
syn match texTypeStyle "\\mathrm\>"
@@ -430,6 +440,7 @@ if !exists("g:tex_no_math") && !s:tex_no_error
syn match texBadMath "\\end\s*{\s*\(array\|[bBpvV]matrix\|split\|smallmatrix\)\s*}"
syn match texBadMath "\\end\s*{\s*\(displaymath\|equation\|eqnarray\|math\)\*\=\s*}"
syn match texBadMath "\\[\])]"
+ syn match texBadPar contained "\%(\\par\>\|^\s*\n.\)"
endif
" Math Zones: {{{1
@@ -475,15 +486,15 @@ if !exists("g:tex_no_math")
" Inline Math Zones: {{{2
if s:tex_fast =~# 'M'
if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'd'
- syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
- syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
- syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
- syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend concealends contains=@texMathZoneGroup
+ syn region texMathZoneV matchgroup=texDelimiter start="\\(" matchgroup=texDelimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
+ syn region texMathZoneW matchgroup=texDelimiter start="\\\[" matchgroup=texDelimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
+ syn region texMathZoneX matchgroup=texDelimiter start="\$" skip="\\\\\|\\\$" matchgroup=texDelimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
+ syn region texMathZoneY matchgroup=texDelimiter start="\$\$" matchgroup=texDelimiter end="\$\$" end="%stopzone\>" keepend concealends contains=@texMathZoneGroup
else
- syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
- syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
- syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\%(\\\\\)*\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
- syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
+ syn region texMathZoneV matchgroup=texDelimiter start="\\(" matchgroup=texDelimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
+ syn region texMathZoneW matchgroup=texDelimiter start="\\\[" matchgroup=texDelimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
+ syn region texMathZoneX matchgroup=texDelimiter start="\$" skip="\%(\\\\\)*\\\$" matchgroup=texDelimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
+ syn region texMathZoneY matchgroup=texDelimiter start="\$\$" matchgroup=texDelimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
endif
syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
endif
@@ -650,23 +661,23 @@ if s:tex_fast =~# 'r'
syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup
syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
- syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite
- syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite
+ syn region texRefOption contained matchgroup=texDelimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite
+ syn region texCite contained matchgroup=texDelimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite
endif
syn match texRefZone '\\cite\%([tp]\*\=\)\=\>' nextgroup=texRefOption,texCite
-" Handle newcommand, newenvironment : {{{1
-syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
+" Handle (re)newcommand, (re)newenvironment : {{{1
+syn match texNewCmd "\\\%(re\)\=newcommand\>" nextgroup=texCmdName skipwhite skipnl
if s:tex_fast =~# 'V'
- syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
- syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
- syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
+ syn region texCmdName contained matchgroup=texDelimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
+ syn region texCmdArgs contained matchgroup=texDelimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
+ syn region texCmdBody contained matchgroup=texDelimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=texDelimiter end="}" contains=@texCmdGroup
endif
-syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
+syn match texNewEnv "\\\%(re\)\=newenvironment\>" nextgroup=texEnvName skipwhite skipnl
if s:tex_fast =~# 'V'
- syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
- syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
- syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
+ syn region texEnvName contained matchgroup=texDelimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
+ syn region texEnvBgn contained matchgroup=texDelimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
+ syn region texEnvEnd contained matchgroup=texDelimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
endif
" Definitions/Commands: {{{1
@@ -694,8 +705,8 @@ if !s:tex_no_error
endif
syn match texStyleStatement "\\[a-zA-Z@]\+" contained
if s:tex_fast =~# 'S'
- syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
- syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained
+ syn region texStyleMatcher matchgroup=texDelimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
+ syn region texStyleMatcher matchgroup=texDelimiter start="\[" end="]" contains=@texStyleGroup,texError contained
endif
endif
@@ -1017,8 +1028,8 @@ if has("conceal") && &enc == 'utf-8'
" Superscripts/Subscripts {{{2
if s:tex_conceal =~# 's'
if s:tex_fast =~# 's'
- syn region texSuperscript matchgroup=Delimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
- syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
+ syn region texSuperscript matchgroup=texDelimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
+ syn region texSubscript matchgroup=texDelimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
endif
" s:SuperSub:
fun! s:SuperSub(group,leader,pat,cchar)
@@ -1255,6 +1266,7 @@ if !exists("skip_tex_syntax_inits")
if !exists("g:tex_no_error")
if !exists("g:tex_no_math")
hi def link texBadMath texError
+ hi def link texBadPar texBadMath
hi def link texMathDelimBad texError
hi def link texMathError texError
if !b:tex_stylish
diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim
index 867c033cb5..042b96e872 100644
--- a/runtime/syntax/tmux.vim
+++ b/runtime/syntax/tmux.vim
@@ -1,5 +1,5 @@
" Language: tmux(1) configuration file
-" Version: 3.2a (git-44ada9cd)
+" Version: 3.3-rc (git-964deae4)
" 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)
@@ -18,40 +18,49 @@ syntax iskeyword @,48-57,_,192-255,-
syntax case match
syn keyword tmuxAction none any current other
-syn keyword tmuxBoolean off on
+syn keyword tmuxBoolean off on yes no
syn keyword tmuxTodo FIXME NOTE TODO XXX contained
-syn match tmuxColour /\<colour[0-9]\+/ display
+syn match tmuxColour /\<colou\?r[0-9]\+\>/ display
syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display
syn match tmuxNumber /\<\d\+\>/ display
syn match tmuxFlags /\s-\a\+/ display
-syn match tmuxVariable /\w\+=/ display
-syn match tmuxVariableExpansion /\${\=\w\+}\=/ display
-syn match tmuxControl /%\(if\|elif\|else\|endif\)/
+syn match tmuxVariableExpansion /\$\({[A-Za-z_]\w*}\|[A-Za-z_]\w*\)/ display
+syn match tmuxControl /^\s*%\(if\|elif\|else\|endif\)\>/
+syn match tmuxEscape /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display
syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
-syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,@Spell
-syn region tmuxString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell
+syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,tmuxEscape,tmuxVariableExpansion,@Spell
+syn region tmuxUninterpolatedString start=+'+ skip=+\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell
" TODO: Figure out how escaping works inside of #(...) and #{...} blocks.
syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend
syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ keepend
syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend
+" At the time of this writing, the latest tmux release will parse a line
+" reading "abc=xyz set-option ..." as an assignment followed by a command
+" hence the presence of "\s" in the "end" argument.
+syn region tmuxAssignment matchgroup=tmuxVariable start=/^\s*[A-Za-z_]\w*=\@=/ skip=/\\$\|\\\s/ end=/\s\|$/ contains=tmuxString,tmuxUninterpolatedString,tmuxVariableExpansion,tmuxControl,tmuxEscape
+
hi def link tmuxFormatString Identifier
hi def link tmuxAction Boolean
hi def link tmuxBoolean Boolean
hi def link tmuxCommands Keyword
-hi def link tmuxControl Keyword
+hi def link tmuxControl PreCondit
hi def link tmuxComment Comment
+hi def link tmuxEscape Special
+hi def link tmuxEscapeUnquoted Special
hi def link tmuxKey Special
hi def link tmuxNumber Number
hi def link tmuxFlags Identifier
hi def link tmuxOptions Function
hi def link tmuxString String
hi def link tmuxTodo Todo
+hi def link tmuxUninterpolatedString
+\ String
hi def link tmuxVariable Identifier
hi def link tmuxVariableExpansion Identifier
@@ -61,63 +70,85 @@ hi def link tmuxVariableExpansion Identifier
if get(g:, "tmux_syntax_colors", 1)
for s:i in range(0, 255)
let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none"
- exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display"
+ exec "syn match tmuxColour" . s:i . " /\\<colou\\?r" . s:i . "\\>/ display"
\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
endfor
endif
syn keyword tmuxOptions
-\ backspace buffer-limit command-alias copy-command default-terminal editor
-\ escape-time exit-empty activity-action assume-paste-time base-index
-\ bell-action default-command default-shell default-size destroy-unattached
+\ activity-action after-bind-key after-capture-pane after-copy-mode
+\ after-display-message after-display-panes after-kill-pane
+\ after-list-buffers after-list-clients after-list-keys after-list-panes
+\ after-list-sessions after-list-windows after-load-buffer after-lock-server
+\ after-new-session after-new-window after-paste-buffer after-pipe-pane
+\ after-queue after-refresh-client after-rename-session after-rename-window
+\ after-resize-pane after-resize-window after-save-buffer
+\ after-select-layout after-select-pane after-select-window after-send-keys
+\ after-set-buffer after-set-environment after-set-hook after-set-option
+\ after-show-environment after-show-messages after-show-options
+\ after-split-window after-unbind-key aggressive-resize alert-activity
+\ alert-bell alert-silence allow-passthrough allow-rename alternate-screen
+\ assume-paste-time automatic-rename automatic-rename-format backspace
+\ base-index bell-action buffer-limit client-active client-attached
+\ client-detached client-focus-in client-focus-out client-resized
+\ client-session-changed clock-mode-colour clock-mode-style command-alias
+\ copy-command copy-mode-current-match-style copy-mode-mark-style
+\ copy-mode-match-style cursor-colour cursor-style default-command
+\ default-shell default-size default-terminal destroy-unattached
\ detach-on-destroy display-panes-active-colour display-panes-colour
-\ display-panes-time display-time exit-unattached extended-keys focus-events
-\ history-file history-limit key-table lock-after-time lock-command
-\ message-command-style message-limit message-style aggressive-resize
-\ allow-rename alternate-screen automatic-rename automatic-rename-format
-\ clock-mode-colour clock-mode-style copy-mode-current-match-style
-\ copy-mode-mark-style copy-mode-match-style main-pane-height
-\ main-pane-width mode-keys mode-style monitor-activity monitor-bell
-\ monitor-silence mouse other-pane-height other-pane-width
-\ pane-active-border-style pane-base-index pane-border-format
-\ pane-border-lines pane-border-status pane-border-style pane-colours prefix
-\ prefix2 prompt-history-limit remain-on-exit renumber-windows repeat-time
-\ set-clipboard set-titles set-titles-string silence-action status status-bg
-\ status-fg status-format status-interval status-justify status-keys
-\ status-left status-left-length status-left-style status-position
-\ status-right status-right-length status-right-style status-style
-\ synchronize-panes terminal-features terminal-overrides update-environment
-\ user-keys visual-activity visual-bell visual-silence window-active-style
+\ display-panes-time display-time editor escape-time exit-empty
+\ exit-unattached extended-keys fill-character focus-events history-file
+\ history-limit key-table lock-after-time lock-command main-pane-height
+\ main-pane-width message-command-style message-limit message-style
+\ mode-keys mode-style monitor-activity monitor-bell monitor-silence mouse
+\ other-pane-height other-pane-width pane-active-border-style
+\ pane-base-index pane-border-format pane-border-indicators
+\ pane-border-lines pane-border-status pane-border-style pane-colours
+\ pane-died pane-exited pane-focus-in pane-focus-out pane-mode-changed
+\ pane-set-clipboard pane-title-changed popup-border-lines
+\ popup-border-style popup-style prefix prefix2 prompt-history-limit
+\ remain-on-exit remain-on-exit-format renumber-windows repeat-time
+\ scroll-on-clear session-closed session-created session-renamed
+\ session-window-changed set-clipboard set-titles set-titles-string
+\ silence-action status status-bg status-fg status-format status-interval
+\ status-justify status-keys status-left status-left-length
+\ status-left-style status-position status-right status-right-length
+\ status-right-style status-style synchronize-panes terminal-features
+\ terminal-overrides update-environment user-keys visual-activity
+\ visual-bell visual-silence window-active-style window-layout-changed
+\ window-linked window-pane-changed window-renamed window-resized
\ window-size window-status-activity-style window-status-bell-style
\ window-status-current-format window-status-current-style
\ window-status-format window-status-last-style window-status-separator
-\ window-status-style window-style word-separators wrap-search
+\ window-status-style window-style window-unlinked word-separators
+\ wrap-search xterm-keys
syn keyword tmuxCommands
\ attach attach-session bind bind-key break-pane breakp capture-pane
-\ capturep choose-buffer choose-client choose-tree clear-history clearhist
+\ capturep choose-buffer choose-client choose-session choose-tree
+\ choose-window clear-history clear-prompt-history clearhist clearphist
\ clock-mode command-prompt confirm confirm-before copy-mode customize-mode
-\ detach detach-client display display-menu display-message display-panes
-\ display-popup displayp find-window findw if if-shell join-pane joinp
-\ kill-pane kill-server kill-session kill-window killp has has-session killw
+\ delete-buffer deleteb detach detach-client display display-menu
+\ display-message display-panes display-popup displayp find-window findw has
+\ has-session if if-shell info join-pane joinp kill-pane kill-server
+\ kill-session kill-window killp killw last last-pane last-window lastp
\ link-window linkw list-buffers list-clients list-commands list-keys
\ list-panes list-sessions list-windows load-buffer loadb lock lock-client
-\ lock-server lock-session lockc last-pane lastp locks ls last last-window
-\ lsb delete-buffer deleteb lsc lscm lsk lsp lsw menu move-pane move-window
-\ clear-prompt-history clearphist movep movew new new-session new-window
-\ neww next next-layout next-window nextl paste-buffer pasteb pipe-pane
-\ pipep popup prev previous-layout previous-window prevl refresh
-\ refresh-client rename rename-session rename-window renamew resize-pane
-\ resize-window resizep resizew respawn-pane respawn-window respawnp
-\ respawnw rotate-window rotatew run run-shell save-buffer saveb
-\ select-layout select-pane select-window selectl selectp selectw send
-\ send-keys send-prefix set set-buffer set-environment set-hook set-option
+\ lock-server lock-session lockc locks ls lsb lsc lscm lsk lsp lsw menu
+\ move-pane move-window movep movew new new-session new-window neww next
+\ next-layout next-window nextl paste-buffer pasteb pipe-pane pipep popup
+\ prev previous-layout previous-window prevl refresh refresh-client rename
+\ rename-session rename-window renamew resize-pane resize-window resizep
+\ resizew respawn-pane respawn-window respawnp respawnw rotate-window
+\ rotatew run run-shell save-buffer saveb select-layout select-pane
+\ select-window selectl selectp selectw send send-keys send-prefix
+\ server-info set set-buffer set-environment set-hook set-option
\ set-window-option setb setenv setw show show-buffer show-environment
\ show-hooks show-messages show-options show-prompt-history
\ show-window-options showb showenv showmsgs showphist showw source
-\ source-file split-window splitw start start-server suspend-client suspendc
-\ swap-pane swap-window swapp swapw switch-client switchc unbind unbind-key
-\ unlink-window unlinkw wait wait-for
+\ source-file split-pane split-window splitp splitw start start-server
+\ suspend-client suspendc swap-pane swap-window swapp swapw switch-client
+\ switchc unbind unbind-key unlink-window unlinkw wait wait-for
let &cpo = s:original_cpo
unlet! s:original_cpo s:bg s:i
diff --git a/runtime/syntax/trustees.vim b/runtime/syntax/trustees.vim
index 6c58d3983d..3a7d26e896 100644
--- a/runtime/syntax/trustees.vim
+++ b/runtime/syntax/trustees.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: trustees
" Maintainer: Nima Talebi <nima@it.net.au>
-" Last Change: 2005-10-12
+" Last Change: 2022 Jun 14
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -40,3 +40,5 @@ syntax match tfsRuleWho ~\(\*\|[+]\{0,1\}[a-zA-Z0-9/]\+\)~ contained contains=tf
highlight link tfsRuleWho Identifier
syntax match tfsRuleWhat ~[RWEBXODCU!]\+~ contained contains=tfsSpecialChar
highlight link tfsRuleWhat Structure
+
+let b:current_syntax = 'trustees'
diff --git a/runtime/syntax/tt2.vim b/runtime/syntax/tt2.vim
index 6432b85a05..6826fb1581 100644
--- a/runtime/syntax/tt2.vim
+++ b/runtime/syntax/tt2.vim
@@ -1,9 +1,11 @@
+" Vim syntax file
" Language: TT2 (Perl Template Toolkit)
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Author: Moriki, Atsushi <4woods+vim@gmail.com>
-" Homepage: http://github.com/vim-perl/vim-perl
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2015-04-25
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2018 Mar 28
"
" Installation:
" put tt2.vim and tt2html.vim in to your syntax directory.
@@ -42,9 +44,6 @@
" Release
" 0.1.0
" Internal
-"
-" License: follow Vim :help uganda
-"
if !exists("b:tt2_syn_tags")
let b:tt2_syn_tags = '\[% %]'
@@ -95,7 +94,7 @@ if exists("b:tt2_syn_tags")
"Include Perl syntax when 'PERL' 'RAWPERL' block
if b:tt2_syn_inc_perl
- syn include @Perl $VIMRUNTIME/syntax/perl.vim
+ syn include @Perl syntax/perl.vim
exec 'syn region tt2_perlcode '.
\ 'start=+\(\(RAW\)\=PERL\s*[-]\=' . s:ed . '\(\n\)\=\)\@<=+ ' .
\ 'end=+' . s:st . '[-]\=\s*END+me=s-1 contains=@Perl keepend'
@@ -122,7 +121,7 @@ else
"Include Perl syntax when 'PERL' 'RAWPERL' block
if b:tt2_syn_inc_perl
- syn include @Perl $VIMRUNTIME/syntax/perl.vim
+ syn include @Perl syntax/perl.vim
syn region tt2_perlcode
\ start=+\(\(RAW\)\=PERL\s*[-]\=%]\(\n\)\=\)\@<=+
\ end=+\[%[-]\=\s*END+me=s-1
@@ -155,7 +154,7 @@ syn match tt2_operator "[!=<>]=\=\|&&\|||" contained
syn match tt2_operator "\(\s\)\@<=_\(\s\)\@=" contained
syn match tt2_operator "=>\|," contained
syn match tt2_deref "\([[:alnum:]_)\]}]\s*\)\@<=\." contained
-syn match tt2_comment +#.*$+ contained extend
+syn match tt2_comment +#.*$+ contained
syn match tt2_func +\<\I\w*\(\s*(\)\@=+ contained nextgroup=tt2_bracket_r skipempty skipwhite
"
syn region tt2_bracket_r start=+(+ end=+)+ contained contains=@tt2_statement_cluster keepend extend
diff --git a/runtime/syntax/tt2html.vim b/runtime/syntax/tt2html.vim
index ac5744f39d..8c223be707 100644
--- a/runtime/syntax/tt2html.vim
+++ b/runtime/syntax/tt2html.vim
@@ -1,9 +1,11 @@
+" Vim syntax file
" Language: TT2 embedded with HTML
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Author: Moriki, Atsushi <4woods+vim@gmail.com>
-" Homepage: http://github.com/vim-perl/vim-perl
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2013-07-21
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2018 Mar 28
if exists("b:current_syntax")
finish
diff --git a/runtime/syntax/tt2js.vim b/runtime/syntax/tt2js.vim
index 350df57d4c..52e5a3c54a 100644
--- a/runtime/syntax/tt2js.vim
+++ b/runtime/syntax/tt2js.vim
@@ -1,9 +1,11 @@
+" Vim syntax file
" Language: TT2 embedded with Javascript
" Maintainer: Andy Lester <andy@petdance.com>
" Author: Yates, Peter <pd.yates@gmail.com>
-" Homepage: http://github.com/vim-perl/vim-perl
-" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
-" Last Change: 2013-07-21
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2018 Mar 28
if exists("b:current_syntax")
finish
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 41993b65b0..2b1c58c449 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -23,7 +23,7 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell
" Special and plugin vim commands {{{2
syn match vimCommand contained "\<z[-+^.=]\=\>"
syn keyword vimOnlyCommand contained fix[del] op[en] sh[ell] P[rint]
-syn keyword vimStdPlugin contained DiffOrig Man N[ext] S TOhtml XMLent XMLns
+syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man N[ext] Over P[rint] Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns
" Vim-specific options {{{2
syn keyword vimOnlyOption contained biosk bioskey cp compatible consk conskey cm cryptmethod edcompatible guipty key macatsui mzq mzquantum osfiletype oft renderoptions rop st shelltype sn shortname tenc termencoding ta textauto tx textmode tf ttyfast ttym ttymouse tbi ttybuiltin wiv weirdinvert
@@ -34,8 +34,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
-syn keyword vimTermOption contained t_8b t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RB t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_SR t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xn t_xs t_ZH t_ZR
-syn keyword vimTermOption contained t_8f t_AF t_AL t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EI
+syn keyword vimTermOption contained t_8b t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_Ds t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_KH t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RB t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_SR t_te t_ti t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xn t_xs t_ZH t_ZR
+syn keyword vimTermOption contained t_8f t_AF t_AL t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_ds t_EI t_kh t_kI
syn match vimTermOption contained "t_%1"
syn match vimTermOption contained "t_#2"
syn match vimTermOption contained "t_#4"
@@ -46,14 +46,14 @@ syn match vimTermOption contained "t_%i"
syn match vimTermOption contained "t_k;"
" unsupported settings: these are supported by vi but don't do anything in vim {{{2
-syn keyword vimErrSetting contained hardtabs ht w1200 w300 w9600
+syn keyword vimErrSetting contained hardtabs ht w1200 w300 w9600
"}}}2
syn case ignore
" Highlight commonly used Groupnames {{{2
-syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
+syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
" Default highlighting groups {{{2
-syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
+syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
syn match vimHLGroup contained "Conceal"
syn keyword vimOnlyHLGroup contained LineNrAbove LineNrBelow StatusLineTerm Terminal VisualNOS
syn keyword nvimHLGroup contained Substitute TermCursor TermCursorNC
@@ -88,10 +88,10 @@ if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhlmpPrt]'
else
com! -nargs=* VimFoldm <args>
endif
- if g:vimsyn_folding =~# 'p'
- com! -nargs=* VimFoldp <args> fold
- else
- com! -nargs=* VimFoldp <args>
+ if g:vimsyn_folding =~# 'p'
+ com! -nargs=* VimFoldp <args> fold
+ else
+ com! -nargs=* VimFoldp <args>
endif
if g:vimsyn_folding =~# 'P'
com! -nargs=* VimFoldP <args> fold
@@ -120,9 +120,6 @@ else
com! -nargs=* VimFoldt <args>
endif
-" commands not picked up by the generator (due to non-standard format) {{{2
-syn keyword vimCommand contained py3
-
" Deprecated variable options {{{2
if exists("g:vim_minlines")
let g:vimsyn_minlines= g:vim_minlines
@@ -148,8 +145,8 @@ syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgro
syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
+syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
+syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
" All vimCommands are contained by vimIsCommand. {{{2
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimEcho,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd
@@ -202,7 +199,7 @@ syn keyword vimAugroupKey contained aug[roup]
" Operators: {{{2
" =========
-syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment
+syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment,vimVar
syn match vimOper "||\|&&\|[-+.!]" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile
@@ -299,7 +296,7 @@ syn match vimPatSep contained "\\|"
syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\=\ze(" skip="\\\\" end="\\)\|[^\\]['"]" contains=@vimStringGroup
syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline
syn match vimNotPatSep contained "\\\\"
-syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell
+syn cluster vimStringGroup contains=vimEscape,vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell
syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup
syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+
syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup
@@ -307,6 +304,7 @@ syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@v
"syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup " see tst45.vim
syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont
syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+
+syn match vimEscape contained "\\."
" Substitutions: {{{2
" =============
@@ -370,7 +368,7 @@ syn match vimSetMod contained "&vim\=\|[!&?<]\|all&"
" Let: {{{2
" ===
syn keyword vimLet let unl[et] skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc
-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s\+\%(trim\>\)\=\s*\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s\+\%(trim\|eval\>\)\=\s*\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
" Abbreviations: {{{2
" =============
@@ -413,7 +411,7 @@ syn case match
" Menus: {{{2
" =====
syn cluster vimMenuList contains=vimMenuBang,vimMenuPriority,vimMenuName,vimMenuMod
-syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] skipwhite nextgroup=@vimMenuList
+syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] skipwhite nextgroup=@vimMenuList
syn match vimMenuName "[^ \t\\<]\+" contained nextgroup=vimMenuNameMore,vimMenuMap
syn match vimMenuPriority "\d\+\(\.\d\+\)*" contained skipwhite nextgroup=vimMenuName
syn match vimMenuNameMore "\c\\\s\|<tab>\|\\\." contained nextgroup=vimMenuName,vimMenuNameMore contains=vimNotation
@@ -437,11 +435,11 @@ syn case match
" User Function Highlighting: {{{2
" (following Gautam Iyer's suggestion)
" ==========================
-syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute
+syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute
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
" User Command Highlighting: {{{2
-"syn match vimUsrCmd '^\s*\zs\u\w*.*$'
syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
" Errors And Warnings: {{{2
@@ -574,7 +572,7 @@ syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster
syn match vimHiGroup contained "\i\+"
syn case ignore
-syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl
+syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdouble underdotted underdashed
syn keyword vimFgBgAttrib contained none bg background fg foreground
syn case match
syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib
@@ -873,8 +871,10 @@ if !exists("skip_vim_syntax_inits")
hi def link vimElseif vimCondHL
hi def link vimEnvvar PreProc
hi def link vimError Error
+ hi def link vimEscape Special
hi def link vimFBVar vimVar
hi def link vimFgBgAttrib vimHiAttrib
+ hi def link vimFuncEcho vimCommand
hi def link vimHiCtermul vimHiTerm
hi def link vimFold Folded
hi def link vimFTCmd vimCommand
diff --git a/runtime/syntax/webmacro.vim b/runtime/syntax/webmacro.vim
index fb1fff6d3d..95975251af 100644
--- a/runtime/syntax/webmacro.vim
+++ b/runtime/syntax/webmacro.vim
@@ -34,9 +34,9 @@ syn region webmacroList contained matchgroup=Structure start="\[" matchgroup=Str
syn region webmacroIf start="#if" start="#else" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces
syn region webmacroForeach start="#foreach" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces
-syn match webmacroSet "#set .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
-syn match webmacroInclude "#include .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
-syn match webmacroParse "#parse .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
+syn match webmacroSet "#set .*$" contains=webmacroVariable,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
+syn match webmacroInclude "#include .*$" contains=webmacroVariable,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
+syn match webmacroParse "#parse .*$" contains=webmacroVariable,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
syn region webmacroUse matchgroup=PreProc start="#use .*" matchgroup=PreProc end="^-.*" contains=webmacroHash,@HtmlTop
syn region webmacroBraces matchgroup=Structure start="{" matchgroup=Structure end="}" contained transparent
syn match webmacroBracesError "[{}]"
diff --git a/runtime/syntax/wget.vim b/runtime/syntax/wget.vim
index 2587022f2e..8178d02bad 100644
--- a/runtime/syntax/wget.vim
+++ b/runtime/syntax/wget.vim
@@ -1,7 +1,9 @@
" Vim syntax file
" Language: Wget configuration file (/etc/wgetrc ~/.wgetrc)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2013 Jun 1
+" Last Change: 2022 Apr 28
+
+" GNU Wget 1.21 built on linux-gnu.
if exists("b:current_syntax")
finish
@@ -18,155 +20,206 @@ syn region wgetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained oneline
syn region wgetString start=+'+ skip=+\\\\\|\\'+ end=+'+ contained oneline
syn case ignore
-syn keyword wgetBoolean on off contained
-syn keyword wgetNumber inf contained
-syn case match
-syn match wgetNumber "\<\%(\d\+\|inf\)\>" contained
-syn match wgetQuota "\<\d\+[kKmM]\>" contained
-syn match wgetTime "\<\d\+[smhdw]\>" contained
+syn keyword wgetBoolean on off yes no contained
+syn keyword wgetNumber inf contained
+
+syn match wgetNumber "\<\d\+>" contained
+syn match wgetQuota "\<\d\+[kmgt]\>" contained
+syn match wgetTime "\<\d\+[smhdw]\>" contained
"{{{ Commands
-let s:commands = map([
- \ "accept",
- \ "add_hostdir",
- \ "adjust_extension",
- \ "always_rest",
- \ "ask_password",
- \ "auth_no_challenge",
- \ "background",
- \ "backup_converted",
- \ "backups",
- \ "base",
- \ "bind_address",
- \ "ca_certificate",
- \ "ca_directory",
- \ "cache",
- \ "certificate",
- \ "certificate_type",
- \ "check_certificate",
- \ "connect_timeout",
- \ "content_disposition",
- \ "continue",
- \ "convert_links",
- \ "cookies",
- \ "cut_dirs",
- \ "debug",
- \ "default_page",
- \ "delete_after",
- \ "dns_cache",
- \ "dns_timeout",
- \ "dir_prefix",
- \ "dir_struct",
- \ "domains",
- \ "dot_bytes",
- \ "dots_in_line",
- \ "dot_spacing",
- \ "dot_style",
- \ "egd_file",
- \ "exclude_directories",
- \ "exclude_domains",
- \ "follow_ftp",
- \ "follow_tags",
- \ "force_html",
- \ "ftp_passwd",
- \ "ftp_password",
- \ "ftp_user",
- \ "ftp_proxy",
- \ "glob",
- \ "header",
- \ "html_extension",
- \ "htmlify",
- \ "http_keep_alive",
- \ "http_passwd",
- \ "http_password",
- \ "http_proxy",
- \ "https_proxy",
- \ "http_user",
- \ "ignore_case",
- \ "ignore_length",
- \ "ignore_tags",
- \ "include_directories",
- \ "inet4_only",
- \ "inet6_only",
- \ "input",
- \ "iri",
- \ "keep_session_cookies",
- \ "kill_longer",
- \ "limit_rate",
- \ "load_cookies",
- \ "locale",
- \ "local_encoding",
- \ "logfile",
- \ "login",
- \ "max_redirect",
- \ "mirror",
- \ "netrc",
- \ "no_clobber",
- \ "no_parent",
- \ "no_proxy",
- \ "numtries",
- \ "output_document",
- \ "page_requisites",
- \ "passive_ftp",
- \ "passwd",
- \ "password",
- \ "post_data",
- \ "post_file",
- \ "prefer_family",
- \ "preserve_permissions",
- \ "private_key",
- \ "private_key_type",
- \ "progress",
- \ "protocol_directories",
- \ "proxy_passwd",
- \ "proxy_password",
- \ "proxy_user",
- \ "quiet",
- \ "quota",
- \ "random_file",
- \ "random_wait",
- \ "read_timeout",
- \ "reclevel",
- \ "recursive",
- \ "referer",
- \ "reject",
- \ "relative_only",
- \ "remote_encoding",
- \ "remove_listing",
- \ "restrict_file_names",
- \ "retr_symlinks",
- \ "retry_connrefused",
- \ "robots",
- \ "save_cookies",
- \ "save_headers",
- \ "secure_protocol",
- \ "server_response",
- \ "show_all_dns_entries",
- \ "simple_host_check",
- \ "span_hosts",
- \ "spider",
- \ "strict_comments",
- \ "sslcertfile",
- \ "sslcertkey",
- \ "timeout",
- \ "time_stamping",
- \ "use_server_timestamps",
- \ "tries",
- \ "trust_server_names",
- \ "user",
- \ "use_proxy",
- \ "user_agent",
- \ "verbose",
- \ "wait",
- \ "wait_retry"],
- \ "substitute(v:val, '_', '[-_]\\\\=', 'g')")
+let s:commands =<< trim EOL
+ accept
+ accept_regex
+ add_host_dir
+ adjust_extension
+ always_rest
+ ask_password
+ auth_no_challenge
+ background
+ backup_converted
+ backups
+ base
+ bind_address
+ bind_dns_address
+ body_data
+ body_file
+ ca_certificate
+ ca_directory
+ cache
+ certificate
+ certificate_type
+ check_certificate
+ choose_config
+ ciphers
+ compression
+ connect_timeout
+ content_disposition
+ content_on_error
+ continue
+ convert_file_only
+ convert_links
+ cookies
+ crl_file
+ cut_dirs
+ debug
+ default_page
+ delete_after
+ dns_cache
+ dns_servers
+ dns_timeout
+ dir_prefix
+ dir_struct
+ domains
+ dot_bytes
+ dots_in_line
+ dot_spacing
+ dot_style
+ egd_file
+ exclude_directories
+ exclude_domains
+ follow_ftp
+ follow_tags
+ force_html
+ ftp_passwd
+ ftp_password
+ ftp_user
+ ftp_proxy
+ ftps_clear_data_connection
+ ftps_fallback_to_ftp
+ ftps_implicit
+ ftps_resume_ssl
+ hsts
+ hsts_file
+ ftp_stmlf
+ glob
+ header
+ html_extension
+ htmlify
+ http_keep_alive
+ http_passwd
+ http_password
+ http_proxy
+ https_proxy
+ https_only
+ http_user
+ if_modified_since
+ ignore_case
+ ignore_length
+ ignore_tags
+ include_directories
+ inet4_only
+ inet6_only
+ input
+ input_meta_link
+ iri
+ keep_bad_hash
+ keep_session_cookies
+ kill_longer
+ limit_rate
+ load_cookies
+ locale
+ local_encoding
+ logfile
+ login
+ max_redirect
+ metalink_index
+ metalink_over_http
+ method
+ mirror
+ netrc
+ no_clobber
+ no_config
+ no_parent
+ no_proxy
+ numtries
+ output_document
+ page_requisites
+ passive_ftp
+ passwd
+ password
+ pinned_pubkey
+ post_data
+ post_file
+ prefer_family
+ preferred_location
+ preserve_permissions
+ private_key
+ private_key_type
+ progress
+ protocol_directories
+ proxy_passwd
+ proxy_password
+ proxy_user
+ quiet
+ quota
+ random_file
+ random_wait
+ read_timeout
+ rec_level
+ recursive
+ referer
+ regex_type
+ reject
+ rejected_log
+ reject_regex
+ relative_only
+ remote_encoding
+ remove_listing
+ report_speed
+ restrict_file_names
+ retr_symlinks
+ retry_connrefused
+ retry_on_host_error
+ retry_on_http_error
+ robots
+ save_cookies
+ save_headers
+ secure_protocol
+ server_response
+ show_all_dns_entries
+ show_progress
+ simple_host_check
+ span_hosts
+ spider
+ start_pos
+ strict_comments
+ sslcertfile
+ sslcertkey
+ timeout
+ timestamping
+ use_server_timestamps
+ tries
+ trust_server_names
+ unlink
+ use_askpass
+ user
+ use_proxy
+ user_agent
+ verbose
+ wait
+ wait_retry
+ warc_cdx
+ warc_cdx_dedup
+ warc_compression
+ warc_digests
+ warc_file
+ warc_header
+ warc_keep_log
+ warc_max_size
+ warc_temp_dir
+ wdebug
+ xattr
+EOL
"}}}
-syn case ignore
+call map(s:commands, "substitute(v:val, '_', '[-_]\\\\=', 'g')")
+
for cmd in s:commands
- exe 'syn match wgetCommand "' . cmd . '" nextgroup=wgetAssignmentOperator skipwhite contained'
+ exe 'syn match wgetCommand "\<' . cmd . '\>" nextgroup=wgetAssignmentOperator skipwhite contained'
endfor
+
syn case match
syn match wgetStart "^" nextgroup=wgetCommand,wgetComment skipwhite
@@ -179,6 +232,7 @@ hi def link wgetComment Comment
hi def link wgetNumber Number
hi def link wgetQuota Number
hi def link wgetString String
+hi def link wgetTime Number
hi def link wgetTodo Todo
let b:current_syntax = "wget"
diff --git a/runtime/syntax/wget2.vim b/runtime/syntax/wget2.vim
new file mode 100644
index 0000000000..a63c336f06
--- /dev/null
+++ b/runtime/syntax/wget2.vim
@@ -0,0 +1,250 @@
+" Vim syntax file
+" Language: Wget2 configuration file (/etc/wget2rc ~/.wget2rc)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Apr 28
+
+" GNU Wget2 2.0.0 - multithreaded metalink/file/website downloader
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syn match wgetComment "#.*$" contains=wgetTodo contained
+
+syn keyword wgetTodo TODO NOTE FIXME XXX contained
+
+syn region wgetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained oneline
+syn region wgetString start=+'+ skip=+\\\\\|\\'+ end=+'+ contained oneline
+
+syn case ignore
+
+syn keyword wgetBoolean on off yes no y n contained
+syn keyword wgetNumber infinity inf contained
+
+syn match wgetNumber "\<\d\+>" contained
+syn match wgetQuota "\<\d\+[kmgt]\>" contained
+syn match wgetTime "\<\d\+[smhd]\>" contained
+
+"{{{ Commands
+let s:commands =<< trim EOL
+ accept
+ accept-regex
+ adjust-extension
+ append-output
+ ask-password
+ auth-no-challenge
+ background
+ backup-converted
+ backups
+ base
+ bind-address
+ bind-interface
+ body-data
+ body-file
+ ca-certificate
+ ca-directory
+ cache
+ certificate
+ certificate-type
+ check-certificate
+ check-hostname
+ chunk-size
+ clobber
+ compression
+ config
+ connect-timeout
+ content-disposition
+ content-on-error
+ continue
+ convert-file-only
+ convert-links
+ cookie-suffixes
+ cookies
+ crl-file
+ cut-dirs
+ cut-file-get-vars
+ cut-url-get-vars
+ debug
+ default-http-port
+ default-https-port
+ default-page
+ delete-after
+ directories
+ directory-prefix
+ dns-cache
+ dns-cache-preload
+ dns-timeout
+ domains
+ download-attr
+ egd-file
+ exclude-directories
+ exclude-domains
+ execute
+ filter-mime-type
+ filter-urls
+ follow-tags
+ force-atom
+ force-css
+ force-directories
+ force-html
+ force-metalink
+ force-progress
+ force-rss
+ force-sitemap
+ fsync-policy
+ gnupg-homedir
+ header
+ help
+ host-directories
+ hpkp
+ hpkp-file
+ hsts
+ hsts-file
+ hsts-preload
+ hsts-preload-file
+ html-extension
+ http-keep-alive
+ http-password
+ http-proxy
+ http-proxy-password
+ http-proxy-user
+ http-user
+ http2
+ http2-only
+ http2-request-window
+ https-enforce
+ https-only
+ https-proxy
+ hyperlink
+ if-modified-since
+ ignore-case
+ ignore-length
+ ignore-tags
+ include-directories
+ inet4-only
+ inet6-only
+ input-encoding
+ input-file
+ keep-extension
+ keep-session-cookies
+ level
+ limit-rate
+ list-plugins
+ load-cookies
+ local-db
+ local-encoding
+ local-plugin
+ max-redirect
+ max-threads
+ metalink
+ method
+ mirror
+ netrc
+ netrc-file
+ ocsp
+ ocsp-date
+ ocsp-file
+ ocsp-nonce
+ ocsp-server
+ ocsp-stapling
+ output-document
+ output-file
+ page-requisites
+ parent
+ password
+ plugin
+ plugin-dirs
+ plugin-help
+ plugin-opt
+ post-data
+ post-file
+ prefer-family
+ private-key
+ private-key-type
+ progress
+ protocol-directories
+ proxy
+ quiet
+ quota
+ random-file
+ random-wait
+ read-timeout
+ recursive
+ referer
+ regex-type
+ reject
+ reject-regex
+ remote-encoding
+ report-speed
+ restrict-file-names
+ retry-connrefused
+ retry-on-http-error
+ robots
+ save-content-on
+ save-cookies
+ save-headers
+ secure-protocol
+ server-response
+ signature-extensions
+ span-hosts
+ spider
+ start-pos
+ stats-dns
+ stats-ocsp
+ stats-server
+ stats-site
+ stats-tls
+ strict-comments
+ tcp-fastopen
+ timeout
+ timestamping
+ tls-false-start
+ tls-resume
+ tls-session-file
+ tries
+ trust-server-names
+ unlink
+ use-askpass
+ use-server-timestamps
+ user
+ user-agent
+ verbose
+ verify-save-failed
+ verify-sig
+ version
+ wait
+ waitretry
+ xattr
+EOL
+"}}}
+
+call map(s:commands, "substitute(v:val, '_', '[-_]\\\\=', 'g')")
+
+for cmd in s:commands
+ exe 'syn match wgetCommand "\<' . cmd . '\>" nextgroup=wgetAssignmentOperator skipwhite contained'
+endfor
+
+syn case match
+
+syn match wgetStart "^" nextgroup=wgetCommand,wgetComment skipwhite
+syn match wgetAssignmentOperator "=" nextgroup=wgetString,wgetBoolean,wgetNumber,wgetQuota,wgetTime skipwhite contained
+
+hi def link wgetAssignmentOperator Special
+hi def link wgetBoolean Boolean
+hi def link wgetCommand Identifier
+hi def link wgetComment Comment
+hi def link wgetNumber Number
+hi def link wgetQuota Number
+hi def link wgetString String
+hi def link wgetTime Number
+hi def link wgetTodo Todo
+
+let b:current_syntax = "wget"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ts=8 fdm=marker:
diff --git a/runtime/syntax/xs.vim b/runtime/syntax/xs.vim
index 3e658b4a83..2145ede2dd 100644
--- a/runtime/syntax/xs.vim
+++ b/runtime/syntax/xs.vim
@@ -1,9 +1,12 @@
" Vim syntax file
-" Language: XS (Perl extension interface language)
-" Author: Autogenerated from perl headers, on an original basis of Michael W. Dodge <sarge@pobox.com>
-" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Previous: Vincent Pit <perl@profvince.com>
-" Last Change: 2017-09-12
+" Language: XS (Perl extension interface language)
+" Author: Autogenerated from perl headers, on an original basis of Michael W. Dodge <sarge@pobox.com>
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Previous: Vincent Pit <perl@profvince.com>
+" Homepage: https://github.com/vim-perl/vim-perl
+" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
+" License: Vim License (see :help license)
+" Last Change: 2018 Mar 28
if exists("b:current_syntax")
finish
diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor
index 7c0c357e80..e256711e70 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor
+++ b/runtime/tutor/en/vim-01-beginner.tutor
@@ -1,15 +1,14 @@
-# Welcome to the VIM Tutor
+# Welcome to the Neovim Tutorial
-Vim is a very powerful editor that has many commands, too many to explain in
-a tutor such as this. This tutor is designed to describe enough of the
-commands that you will be able to easily use Vim as an all-purpose editor.
-It is IMPORTANT to remember that this tutor is set up to teach by use. That
+Neovim is a very powerful editor that has many commands, too many to explain in
+a tutorial such as this. This tutorial is designed to describe enough of the
+commands that you will be able to easily use Neovim as an all-purpose editor.
+It is IMPORTANT to remember that this tutorial is set up to teach by use. That
means that you need to do the exercises to learn them properly. If you only
read the text, you will soon forget what is most important!
-For now, make sure that your Shift-Lock key is NOT depressed and press the
-`j`{normal} key enough times to move the cursor so that Lesson 0 completely
-fills the screen.
+For now, make sure that your Caps-Lock is off and press the `j`{normal} key enough
+times to move the cursor so that Lesson 0 completely fills the screen.
# Lesson 0
@@ -20,12 +19,13 @@ pressing [<Esc>](<Esc>) and then [u](u) will undo the latest change.
This tutorial is interactive, and there are a few things you should know.
- Type [<Enter>](<Enter>) on links [like this](holy-grail ) to open the linked help section.
- Or simply type [K](K) on any word to find its documentation!
+- You can close this help window with `:q`{vim}
- Sometimes you will be required to modify text like
this here
Once you have done the changes correctly, the ✗ sign at the left will change
-to ✓. I imagine you can already see how neat Vim can be. ;)
+to ✓. I imagine you can already see how neat Neovim can be.
Other times, you'll be prompted to run a command (I'll explain this later):
~~~ cmd
:help <Enter>
@@ -43,9 +43,9 @@ Now, move to the next lesson (use the `j`{normal} key to scroll down).
** To move the cursor, press the `h`, `j`, `k`, `l` keys as indicated. **
- ↑
- k Hint: The `h`{normal} key is at the left and moves left.
- ← h l → The `l`{normal} key is at the right and moves right.
+ ↑
+ k Hint: The `h`{normal} key is at the left and moves left.
+ ← h l → The `l`{normal} key is at the right and moves right.
j The `j`{normal} key looks like a down arrow.
@@ -60,11 +60,11 @@ NOTE: If you are ever unsure about something you typed, press <Esc> to place
you in Normal mode. Then retype the command you wanted.
NOTE: The cursor keys should also work. But using hjkl you will be able to
- move around much faster, once you get used to it. Really!
+ move around much faster, once you get used to it.
-# Lesson 1.2: EXITING VIM
+# Lesson 1.2: EXITING NEOVIM
-!! NOTE: Before executing any of the steps below, read this entire lesson !!
+!! NOTE: Before executing any of the steps below, read the entire lesson !!
1. Press the <Esc> key (to make sure you are in Normal mode).
@@ -72,10 +72,10 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to
`:q!`{vim} `<Enter>`{normal}.
- This exits the editor, DISCARDING any changes you have made.
+ This quits the editor, DISCARDING any changes you have made.
- 3. Open vim and get back here by executing the command that got you into
- this tutor. That might be:
+ 3. Open Neovim and get back here by executing the command that got you into
+ this tutorial. That might be:
:Tutor <Enter>
@@ -104,9 +104,9 @@ The ccow jumpedd ovverr thhe mooon.
5. Now that the line is correct, go on to Lesson 1.4.
-NOTE: As you go through this tutor, do not try to memorize everything,
- your Vim vocabulary will expand with usage. Consider returning to
- this tutor periodically for a refresher.
+NOTE: As you go through this tutorial, do not try to memorize everything,
+ your Neovim vocabulary will expand with usage. Consider returning to
+ this tutorial periodically for a refresher.
# Lesson 1.4: TEXT EDITING: INSERTION
@@ -151,11 +151,11 @@ There is also some text missing here.
# Lesson 1.6: EDITING A FILE
-** Use `:wq`{vim} to save a file and exit. **
+** Use `:wq`{vim} to write a file and quit. **
-!! NOTE: Before executing any of the steps below, read this entire lesson !!
+!! NOTE: Before executing any of the steps below, read the entire lesson !!
- 1. Exit this tutor as you did in Lesson 1.2: `:q!`{vim}
+ 1. Exit this tutorial as you did in Lesson 1.2: `:q!`{vim}
Or, if you have access to another terminal, do the following there.
2. At the shell prompt type this command:
@@ -167,28 +167,28 @@ There is also some text missing here.
3. Insert and delete text as you learned in the previous lessons.
- 4. Save the file with changes and exit Vim with:
+ 4. Save the file with changes and exit Neovim with:
~~~ cmd
:wq
~~~
Note you'll need to press `<Enter>` to execute the command.
- 5. If you have quit vimtutor in step 1 restart the vimtutor and move down
+ 5. If you have quit this tutorial in step 1, restart and move down
to the following summary.
- 6. After reading the above steps and understanding them: do it.
+ 6. After reading and understanding the above steps: do them.
# Lesson 1 SUMMARY
1. The cursor is moved using either the arrow keys or the hjkl keys.
h (left) j (down) k (up) l (right)
- 2. To start Vim from the shell prompt type:
+ 2. To start Neovim from the shell prompt type:
~~~ sh
$ nvim FILENAME
~~~
- 3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes.
- OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the changes.
+ 3. To exit Neovim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes.
+ OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the changes.
4. To delete the character at the cursor type: `x`{normal}
@@ -297,8 +297,11 @@ Due to the frequency of whole line deletion, the designers of Vi decided
it would be easier to simply type two d's to delete a line.
1. Move the cursor to the second line in the phrase below.
+
2. Type [dd](dd) to delete the line.
+
3. Now move to the fourth line.
+
4. Type `2dd`{normal} to delete two lines.
1) Roses are red,
@@ -314,11 +317,17 @@ it would be easier to simply type two d's to delete a line.
** Press `u`{normal} to undo the last commands, `U`{normal} to fix a whole line. **
1. Move the cursor to the line below marked ✗ and place it on the first error.
+
2. Type `x`{normal} to delete the first unwanted character.
+
3. Now type `u`{normal} to undo the last command executed.
+
4. This time fix all the errors on the line using the `x`{normal} command.
+
5. Now type a capital `U`{normal} to return the line to its original state.
+
6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding commands.
+
7. Now type `<C-r>`{normal} (Control + R) a few times to redo the commands.
Fiix the errors oon thhis line and reeplace them witth undo.
@@ -328,8 +337,11 @@ Fiix the errors oon thhis line and reeplace them witth undo.
# Lesson 2 SUMMARY
1. To delete from the cursor up to the next word type: `dw`{normal}
+
2. To delete from the cursor to the end of a line type: `d$`{normal}
+
3. To delete a whole line type: `dd`{normal}
+
4. To repeat a motion prepend it with a number: `2w`{normal}
5. The format for a change command is:
@@ -356,7 +368,7 @@ Fiix the errors oon thhis line and reeplace them witth undo.
1. Move the cursor to the first ✓ line below.
- 2. Type `dd`{normal} to delete the line and store it in a Vim register.
+ 2. Type `dd`{normal} to delete the line and store it in a Neovim register.
3. Move the cursor to the c) line, ABOVE where the deleted line should go.
@@ -369,6 +381,8 @@ b) Violets are blue,
c) Intelligence is learned,
a) Roses are red,
+NOTE: You can also put the text before the cursor with `P`{normal} (capital P)
+
# Lesson 3.2: THE REPLACE COMMAND
** Type `rx`{normal} to replace the character at the cursor with x. **
@@ -386,7 +400,7 @@ When this line was typed in, someone pressed some wrong keys!
5. Now move on to Lesson 3.3.
-NOTE: Remember that you should be learning by doing, not memorization.
+NOTE: Remember that you should be learning by doing, not memorizing.
# Lesson 3.3: THE CHANGE OPERATOR
@@ -439,7 +453,7 @@ NOTE: You can use the Backspace key to correct mistakes while typing.
3. The [change operator](c) allows you to change from the cursor to where
the motion takes you. Type `ce`{normal} to change from the cursor to the
- end of the word, `c$`{normal} to change to the end of a line.
+ end of the word, `c$`{normal} to change to the end of a line, etc.
4. The format for change is:
@@ -452,7 +466,7 @@ Now go on to the next lesson.
** Type `<C-g>`{normal} to show your location in a file and the file status.
Type `G`{normal} to move to a line in the file. **
-NOTE: Read this entire lesson before executing any of the steps!!
+NOTE: Read the entire lesson before executing any of these steps!!
1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this `<C-g>`{normal}.
A message will appear at the bottom of the page with the filename and
@@ -535,8 +549,8 @@ Usually thee best time to see thee flowers is in thee spring.
~~~ cmd
:#,#s/old/new/g
~~~
- where #,# are the line numbers of the range of lines where the
- substitution is to be done.
+ where # are the line numbers of the range of lines where the
+ substitution is to be done (i.e., `1,3` means from line 1 to line 3, inclusive).
Type
~~~ cmd
@@ -551,6 +565,9 @@ Usually thee best time to see thee flowers is in thee spring.
to find every occurrence in the whole file, with a prompt whether to
substitute or not.
+NOTE: You can also select the lines you want to substitute first using visual-mode.
+ This will be explained more in a future lesson.
+
# Lesson 4 SUMMARY
1. `<C-g>`{normal} displays your location and the file status.
@@ -603,11 +620,10 @@ Usually thee best time to see thee flowers is in thee spring.
This will show you a listing of your directory, just as if you were
at the shell prompt.
-NOTE: It is possible to execute any external command this way, also with
- arguments.
+NOTE: It is possible to execute any external command this way, and you
+ can include arguments.
-NOTE: All `:`{vim} commands must be finished by hitting `<Enter>`{normal}.
- From here on we will not always mention it.
+NOTE: All `:`{vim} commands are executed when you press `<Enter>`{normal}.
# Lesson 5.2: MORE ON WRITING FILES
@@ -624,11 +640,11 @@ NOTE: All `:`{vim} commands must be finished by hitting `<Enter>`{normal}.
~~~
(where TEST is the filename you chose.)
- 4. This saves the whole file (the Vim Tutor) under the name TEST.
+ 4. This saves the current file under the name TEST.
To verify this, type `:!ls`{vim} again to see your directory.
-NOTE: If you were to exit Vim and start it again with `nvim TEST`, the file
- would be an exact copy of the tutor when you saved it.
+NOTE: If you were to exit Neovim and start it again with `nvim TEST`, the file
+ would be an exact copy of the tutorial when you saved it.
5. Now remove the file by typing:
~~~ cmd
@@ -659,7 +675,7 @@ NOTE: If you were to exit Vim and start it again with `nvim TEST`, the file
before you press `<Enter>`{normal}.
- 5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it.
+ 5. Neovim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it.
Do not remove it yet! We will use it in the next lesson.
NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move the cursor around to
@@ -668,7 +684,7 @@ NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move the c
# Lesson 5.4: RETRIEVING AND MERGING FILES
-** To insert the contents of a file, type `:r FILENAME`{vim}. **
+** To retrieve the contents of a file, type `:r FILENAME`{vim}. **
1. Place the cursor just above this line.
@@ -683,7 +699,7 @@ NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move
The file you retrieve is placed below the cursor line.
3. To verify that a file was retrieved, cursor back and notice that there
- are now two copies of Lesson 5.3, the original and the file version.
+ are now two copies of Lesson 5.3, the original and the retrieved version.
NOTE: You can also read the output of an external command. For example,
@@ -699,7 +715,7 @@ NOTE: You can also read the output of an external command. For example,
`:!ls`{vim} - shows a directory listing
`:!rm FILENAME`{vim} - removes file FILENAME
- 2. [:w](:w) FILENAME writes the current Vim file to disk with
+ 2. [:w](:w) FILENAME writes the current Neovim file to disk with
name FILENAME.
3. [v](v) motion :w FILENAME saves the Visually selected lines in file
@@ -768,11 +784,11 @@ Adding 123 to xxx gives you xxx.
Adding 123 to 456 gives you 579.
NOTE: Replace mode is like Insert mode, but every typed character
- deletes an existing character.
+ replaces an existing character.
# Lesson 6.4: COPY AND PASTE TEXT
-** Use the `y`{normal} operator to copy text and `p`{normal} to paste it. **
+** Use the `y`{normal} operator to copy text and `p`{normal} to put it. **
1. Go to the line marked with ✓ below and place the cursor after "a)".
@@ -796,9 +812,13 @@ b)
NOTE: you can use `y`{normal} as an operator: `yw`{normal} yanks one word.
+NOTE: you can use `P`{normal} to put before the cursor, rather than after.
+
# Lesson 6.5: SET OPTION
-** Set an option so a search or substitute ignores case. **
+** Set an option so search and substitute commands ignore case. **
+
+There are many settings in Neovim that you can configure to suit your needs.
1. Search for 'ignore' by entering: `/ignore`
Repeat several times by pressing `n`{normal}.
@@ -820,7 +840,7 @@ NOTE: you can use `y`{normal} as an operator: `yw`{normal} yanks one word.
~~~ cmd
:set noic
~~~
- 7. To toggle the value of a setting, prepend it with "inv":
+ 7. To invert the value of a setting, prepend it with "inv":
~~~ cmd
:set invic
~~~
@@ -858,19 +878,18 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
~~~ cmd
:set noic
~~~
- 8. Prepend "inv" to toggle an option:
+ 8. Prepend "inv" to invert an option:
~~~ cmd
:set invic
~~~
# Lesson 7.1: GETTING HELP
-** Use the on-line help system. **
+** Use the online help system. **
-Vim has a comprehensive on-line help system.
+Neovim has a comprehensive online help system.
To get started, try one of these three:
- - press the `<HELP>`{normal} key (if you have one)
- press the `<F1>`{normal} key (if you have one)
- type `:help`{vim}
@@ -879,7 +898,7 @@ Type `<C-w><C-w>`{normal} to jump from one window to another.
Type `:q`{vim} to close the help window.
You can find help on just about any subject, by giving an argument to the
-":help" command. Try these (don't forget pressing <Enter>):
+":help" command. Try these (don't forget to press <Enter>):
~~~ cmd
:help w
:help c_CTRL-D
@@ -888,12 +907,12 @@ You can find help on just about any subject, by giving an argument to the
~~~
# Lesson 7.2: CREATE A STARTUP SCRIPT
-** Enable Vim features. **
+** Enable Neovim features. **
-Vim has many more features than Vi, but most of them are disabled by
-default. To start using more features you have to create a "vimrc" file.
+Neovim is a very configurable editor. You can customise it any way you like.
+To start using more features create an "init.vim" file.
- 1. Start editing the "vimrc" file.
+ 1. Start editing the "init.vim" file.
`:call mkdir(stdpath('config'),'p')`{vim}
`:exe 'edit' stdpath('config').'/init.vim'`{vim}
@@ -902,24 +921,24 @@ default. To start using more features you have to create a "vimrc" file.
`:w`{vim}
- You can add all your preferred settings to this "vimrc" file.
- For more information type `:help vimrc-intro`{vim}.
+ You can add all your preferred settings to this "init.vim" file.
+ For more information type `:help init.vim`{vim}.
# Lesson 7.3: COMPLETION
** Command line completion with `<C-d>`{normal} and `<Tab>`{normal}. **
- 1. Look what files exist in the directory: `:!ls`{vim}
+ 1. List the contents of the current directory: `:!ls`{vim}
2. Type the start of a command: `:e`{vim}
- 3. Press `<C-d>`{normal} and Vim will show a list of commands beginning with "e".
+ 3. Press `<C-d>`{normal} and Neovim will show a list of commands beginning with "e".
- 4. Press `<Tab>`{normal} and Vim will complete the command name to ":edit".
+ 4. Press `<Tab>`{normal} and Neovim will complete the command name to ":edit".
5. Now add a space and the start of an existing file name: `:edit FIL`{vim}
- 6. Press `<Tab>`{normal}. Vim will complete the name ("FIL" -> "FILE", if it is unique).
+ 6. Press `<Tab>`{normal}. Neovim will complete the name ("FIL" -> "FILE", if it is unique).
NOTE: Completion works for many commands. It is especially useful for `:help`{vim}.
@@ -934,19 +953,18 @@ NOTE: Completion works for many commands. It is especially useful for `:help`{vi
4. Type `:q`{vim} to close the help window
- 5. Create a vimrc startup script to keep your preferred settings.
+ 5. Create an init.vim startup script to keep your preferred settings.
6. While in command mode, press `<C-d>`{normal} to see possible completions.
Press `<Tab>`{normal} to use one completion.
# CONCLUSION
-This was intended to give a brief overview of the Vim editor, just enough to
-allow you to use the editor fairly easily. It is far from complete as Vim has
+This was intended to give a brief overview of the Neovim editor, just enough to
+allow you to use it fairly easily. It is far from complete as Neovim has
many many more commands. Consult the help often.
-
-There are many resources online to learn more about vim. Here's a bunch of
-them:
+There are also countless great tutorials and videos to be found online.
+Here's a bunch of them:
- *Learn Vim Progressively*:
http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
@@ -964,7 +982,7 @@ them:
https://github.com/mhinz/vim-galore
If you prefer a book, *Practical Vim* by Drew Neil is recommended often
-(the sequel, *Modern Vim*, includes material specific to nvim).
+(the sequel, *Modern Vim*, includes material specific to Neovim).
This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado
School of Mines using ideas supplied by Charles Smith, Colorado State
@@ -972,5 +990,6 @@ University. E-mail: bware@mines.colorado.edu.
Modified for Vim by Bram Moolenaar.
Modified for vim-tutor-mode by Felipe Morales.
+Modified for Neovim by Rory Nesbitt.
// vim: nowrap
diff --git a/runtime/tutor/en/vim-01-beginner.tutor.json b/runtime/tutor/en/vim-01-beginner.tutor.json
index e71ead976d..5dccb824e0 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor.json
+++ b/runtime/tutor/en/vim-01-beginner.tutor.json
@@ -12,34 +12,34 @@
"232": "Somebody typed the end of this line twice.",
"271": -1,
"290": "This line of words is cleaned up.",
- "304": -1,
- "305": -1,
- "306": -1,
"307": -1,
"308": -1,
"309": -1,
"310": -1,
- "324": "Fix the errors on this line and replace them with undo.",
- "367": -1,
- "368": -1,
- "369": -1,
- "370": -1,
- "384": "When this line was typed in, someone pressed some wrong keys!",
- "385": "When this line was typed in, someone pressed some wrong keys!",
- "405": "This line has a few words that need changing using the change operator.",
- "406": "This line has a few words that need changing using the change operator.",
- "426": "The end of this line needs to be corrected using the `c$` command.",
- "427": "The end of this line needs to be corrected using the `c$` command.",
- "490": -1,
- "509": -1,
- "532": "Usually the best time to see the flowers is in the spring.",
- "725": -1,
- "730": -1,
- "746": "This line will allow you to practice appending text to a line.",
- "747": "This line will allow you to practice appending text to a line.",
- "767": "Adding 123 to 456 gives you 579.",
- "768": "Adding 123 to 456 gives you 579.",
- "794": "a) This is the first item.",
- "795": "b) This is the second item."
+ "311": -1,
+ "312": -1,
+ "313": -1,
+ "333": "Fix the errors on this line and replace them with undo.",
+ "379": -1,
+ "380": -1,
+ "381": -1,
+ "382": -1,
+ "398": "When this line was typed in, someone pressed some wrong keys!",
+ "399": "When this line was typed in, someone pressed some wrong keys!",
+ "419": "This line has a few words that need changing using the change operator.",
+ "420": "This line has a few words that need changing using the change operator.",
+ "440": "The end of this line needs to be corrected using the `c$` command.",
+ "441": "The end of this line needs to be corrected using the `c$` command.",
+ "504": -1,
+ "523": -1,
+ "546": "Usually the best time to see the flowers is in the spring.",
+ "741": -1,
+ "746": -1,
+ "762": "This line will allow you to practice appending text to a line.",
+ "763": "This line will allow you to practice appending text to a line.",
+ "783": "Adding 123 to 456 gives you 579.",
+ "784": "Adding 123 to 456 gives you 579.",
+ "810": "a) This is the first item.",
+ "811": "b) This is the second item."
}
}