aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt2
-rw-r--r--runtime/autoload/dist/ft.vim19
-rw-r--r--runtime/autoload/man.vim529
-rw-r--r--runtime/autoload/python.vim40
-rw-r--r--runtime/colors/blue.vim18
-rw-r--r--runtime/colors/darkblue.vim8
-rw-r--r--runtime/colors/delek.vim12
-rw-r--r--runtime/colors/desert.vim8
-rw-r--r--runtime/colors/elflord.vim6
-rw-r--r--runtime/colors/evening.vim41
-rw-r--r--runtime/colors/habamax.vim8
-rw-r--r--runtime/colors/industry.vim16
-rw-r--r--runtime/colors/koehler.vim6
-rw-r--r--runtime/colors/lunaperche.vim97
-rw-r--r--runtime/colors/morning.vim8
-rw-r--r--runtime/colors/murphy.vim8
-rw-r--r--runtime/colors/pablo.vim24
-rw-r--r--runtime/colors/peachpuff.vim8
-rw-r--r--runtime/colors/quiet.vim6
-rw-r--r--runtime/colors/ron.vim6
-rw-r--r--runtime/colors/shine.vim8
-rw-r--r--runtime/colors/slate.vim8
-rw-r--r--runtime/colors/torte.vim8
-rw-r--r--runtime/colors/zellner.vim8
-rw-r--r--runtime/compiler/raco.vim14
-rw-r--r--runtime/compiler/racomake.vim14
-rw-r--r--runtime/compiler/racosetup.vim14
-rw-r--r--runtime/compiler/racotest.vim14
-rw-r--r--runtime/doc/api.txt17
-rw-r--r--runtime/doc/autocmd.txt2
-rw-r--r--runtime/doc/builtin.txt161
-rw-r--r--runtime/doc/cmdline.txt8
-rw-r--r--runtime/doc/eval.txt396
-rw-r--r--runtime/doc/filetype.txt4
-rw-r--r--runtime/doc/help.txt1
-rw-r--r--runtime/doc/indent.txt27
-rw-r--r--runtime/doc/lsp.txt57
-rw-r--r--runtime/doc/lua.txt287
-rw-r--r--runtime/doc/map.txt10
-rw-r--r--runtime/doc/options.txt98
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/syntax.txt10
-rw-r--r--runtime/doc/tagsrch.txt8
-rw-r--r--runtime/doc/treesitter.txt241
-rw-r--r--runtime/doc/ui.txt1
-rw-r--r--runtime/doc/userfunc.txt429
-rw-r--r--runtime/doc/usr_41.txt2
-rw-r--r--runtime/doc/vim_diff.txt5
-rw-r--r--runtime/doc/windows.txt15
-rw-r--r--runtime/filetype.lua2
-rw-r--r--runtime/filetype.vim49
-rw-r--r--runtime/ftplugin/gitattributes.vim13
-rw-r--r--runtime/ftplugin/gitignore.vim13
-rw-r--r--runtime/ftplugin/jsonnet.vim17
-rw-r--r--runtime/ftplugin/lua.lua3
-rw-r--r--runtime/ftplugin/lua.vim38
-rw-r--r--runtime/ftplugin/lynx.vim29
-rw-r--r--runtime/ftplugin/man.vim4
-rw-r--r--runtime/ftplugin/racket.vim82
-rw-r--r--runtime/ftplugin/sh.vim53
-rw-r--r--runtime/ftplugin/vim.vim2
-rw-r--r--runtime/ftplugin/zimbu.vim4
-rw-r--r--runtime/ftplugin/zsh.vim2
-rw-r--r--runtime/indent/json.vim3
-rw-r--r--runtime/indent/racket.vim60
-rw-r--r--runtime/indent/testdir/python.in18
-rw-r--r--runtime/indent/testdir/python.ok18
-rw-r--r--runtime/indent/testdir/runtest.vim15
-rw-r--r--runtime/indent/testdir/vim.in7
-rw-r--r--runtime/indent/testdir/vim.ok7
-rw-r--r--runtime/indent/vim.vim44
-rw-r--r--runtime/indent/yaml.vim10
-rw-r--r--runtime/lua/man.lua601
-rw-r--r--runtime/lua/vim/_meta.lua3
-rw-r--r--runtime/lua/vim/diagnostic.lua30
-rw-r--r--runtime/lua/vim/filetype.lua36
-rw-r--r--runtime/lua/vim/filetype/detect.lua13
-rw-r--r--runtime/lua/vim/inspect.lua32
-rw-r--r--runtime/lua/vim/lsp.lua93
-rw-r--r--runtime/lua/vim/lsp/buf.lua82
-rw-r--r--runtime/lua/vim/lsp/rpc.lua781
-rw-r--r--runtime/lua/vim/shared.lua25
-rw-r--r--runtime/lua/vim/treesitter.lua251
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua141
-rw-r--r--runtime/lua/vim/treesitter/language.lua14
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua44
-rw-r--r--runtime/lua/vim/treesitter/query.lua79
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim9
-rw-r--r--runtime/plugin/man.lua34
-rw-r--r--runtime/plugin/man.vim15
-rw-r--r--runtime/plugin/matchparen.vim5
-rw-r--r--runtime/queries/c/highlights.scm2
-rw-r--r--runtime/queries/c/injections.scm3
-rw-r--r--runtime/queries/lua/highlights.scm194
-rw-r--r--runtime/queries/lua/injections.scm22
-rw-r--r--runtime/queries/vim/highlights.scm259
-rw-r--r--runtime/queries/vim/injections.scm26
-rw-r--r--runtime/syntax/gdresource.vim65
-rw-r--r--runtime/syntax/gdscript.vim105
-rw-r--r--runtime/syntax/gdshader.vim57
-rw-r--r--runtime/syntax/gitattributes.vim63
-rw-r--r--runtime/syntax/gitignore.vim29
-rw-r--r--runtime/syntax/lua.vim70
-rw-r--r--runtime/syntax/plsql.vim87
-rw-r--r--runtime/syntax/racket.vim656
-rw-r--r--runtime/syntax/sh.vim6
-rw-r--r--runtime/syntax/synload.vim2
-rw-r--r--runtime/syntax/syntax.vim7
-rw-r--r--runtime/syntax/vim.vim2
-rw-r--r--runtime/syntax/zsh.vim163
110 files changed, 5302 insertions, 2035 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index e0a0b34d28..b42b1de54b 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -123,7 +123,7 @@ foreach(PROG ${RUNTIME_PROGRAMS})
endforeach()
globrecurse_wrapper(RUNTIME_FILES ${CMAKE_CURRENT_SOURCE_DIR}
- *.vim *.lua *.dict *.py *.rb *.ps *.spl *.tutor *.tutor.json)
+ *.vim *.lua *.scm *.dict *.py *.rb *.ps *.spl *.tutor *.tutor.json)
foreach(F ${RUNTIME_FILES})
get_filename_component(BASEDIR ${F} DIRECTORY)
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 77140d62b1..7333e5a7e7 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -468,7 +468,7 @@ endfunc
" Returns true if file content looks like LambdaProlog module
func IsLProlog()
- " skip apparent comments and blank lines, what looks like
+ " 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
@@ -877,6 +877,23 @@ func dist#ft#FTsig()
endif
endfunc
+" This function checks the first 100 lines of files matching "*.sil" to
+" resolve detection between Swift Intermediate Language and SILE.
+func dist#ft#FTsil()
+ for lnum in range(1, [line('$'), 100]->min())
+ let line = getline(lnum)
+ if line =~ '^\s*[\\%]'
+ setf sile
+ return
+ elseif line =~ '^\s*\S'
+ setf sil
+ return
+ endif
+ endfor
+ " no clue, default to "sil"
+ setf sil
+endfunc
+
func dist#ft#FTsys()
if exists("g:filetype_sys")
exe "setf " .. g:filetype_sys
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
deleted file mode 100644
index b8a73a64c9..0000000000
--- a/runtime/autoload/man.vim
+++ /dev/null
@@ -1,529 +0,0 @@
-" Maintainer: Anmol Sethi <hi@nhooyr.io>
-
-if exists('s:loaded_man')
- finish
-endif
-let s:loaded_man = 1
-
-let s:find_arg = '-w'
-let s:localfile_arg = v:true " Always use -l if possible. #6683
-
-function! man#init() abort
- try
- " Check for -l support.
- call s:get_page(s:get_path('', 'man'))
- catch /command error .*/
- let s:localfile_arg = v:false
- endtry
-endfunction
-
-function! man#open_page(count, mods, ...) abort
- if a:0 > 2
- call s:error('too many arguments')
- return
- elseif a:0 == 0
- let ref = &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>')
- if empty(ref)
- call s:error('no identifier under cursor')
- return
- endif
- elseif a:0 ==# 1
- let ref = a:1
- else
- " Combine the name and sect into a manpage reference so that all
- " verification/extraction can be kept in a single function.
- " If a:2 is a reference as well, that is fine because it is the only
- " reference that will match.
- let ref = a:2.'('.a:1.')'
- endif
- try
- let [sect, name] = s:extract_sect_and_name_ref(ref)
- if a:count >= 0
- let sect = string(a:count)
- endif
- let path = s:verify_exists(sect, name)
- let [sect, name] = s:extract_sect_and_name_path(path)
- catch
- call s:error(v:exception)
- return
- endtry
-
- let [l:buf, l:save_tfu] = [bufnr(), &tagfunc]
- try
- setlocal tagfunc=man#goto_tag
- let l:target = l:name . '(' . l:sect . ')'
- if a:mods !~# 'tab' && s:find_man()
- execute 'silent keepalt tag' l:target
- else
- execute 'silent keepalt' a:mods 'stag' l:target
- endif
- call s:set_options(v:false)
- finally
- call setbufvar(l:buf, '&tagfunc', l:save_tfu)
- endtry
-
- let b:man_sect = sect
-endfunction
-
-" Called when a man:// buffer is opened.
-function! man#read_page(ref) abort
- try
- let [sect, name] = s:extract_sect_and_name_ref(a:ref)
- let path = s:verify_exists(sect, name)
- let [sect, name] = s:extract_sect_and_name_path(path)
- let page = s:get_page(path)
- catch
- call s:error(v:exception)
- return
- endtry
- let b:man_sect = sect
- call s:put_page(page)
-endfunction
-
-" Handler for s:system() function.
-function! s:system_handler(jobid, data, event) dict abort
- if a:event is# 'stdout' || a:event is# 'stderr'
- let self[a:event] .= join(a:data, "\n")
- else
- let self.exit_code = a:data
- endif
-endfunction
-
-" Run a system command and timeout after 30 seconds.
-function! s:system(cmd, ...) abort
- let opts = {
- \ 'stdout': '',
- \ 'stderr': '',
- \ 'exit_code': 0,
- \ 'on_stdout': function('s:system_handler'),
- \ 'on_stderr': function('s:system_handler'),
- \ 'on_exit': function('s:system_handler'),
- \ }
- let jobid = jobstart(a:cmd, opts)
-
- if jobid < 1
- throw printf('command error %d: %s', jobid, join(a:cmd))
- endif
-
- let res = jobwait([jobid], 30000)
- if res[0] == -1
- try
- call jobstop(jobid)
- throw printf('command timed out: %s', join(a:cmd))
- catch /^Vim(call):E900:/
- endtry
- elseif res[0] == -2
- throw printf('command interrupted: %s', join(a:cmd))
- endif
- if opts.exit_code != 0
- throw printf("command error (%d) %s: %s", jobid, join(a:cmd), substitute(opts.stderr, '\_s\+$', '', &gdefault ? '' : 'g'))
- endif
-
- return opts.stdout
-endfunction
-
-function! s:set_options(pager) abort
- setlocal noswapfile buftype=nofile bufhidden=hide
- setlocal nomodified readonly nomodifiable
- let b:pager = a:pager
- setlocal filetype=man
-endfunction
-
-function! s:get_page(path) abort
- " Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
- " Soft-wrap: ftplugin/man.vim sets wrap/breakindent/….
- " Hard-wrap: driven by `man`.
- let manwidth = !get(g:, 'man_hardwrap', 1) ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
- " Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
- " http://comments.gmane.org/gmane.editors.vim.devel/29085
- " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
- let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'MAN_KEEP_FORMATTING=1', 'man']
- return s:system(cmd + (s:localfile_arg ? ['-l', a:path] : [a:path]))
-endfunction
-
-function! s:put_page(page) abort
- setlocal modifiable noreadonly noswapfile
- silent keepjumps %delete _
- silent put =a:page
- while getline(1) =~# '^\s*$'
- silent keepjumps 1delete _
- endwhile
- " XXX: nroff justifies text by filling it with whitespace. That interacts
- " badly with our use of $MANWIDTH=999. Hack around this by using a fixed
- " size for those whitespace regions.
- silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g
- 1
- lua require("man").highlight_man_page()
- call s:set_options(v:false)
-endfunction
-
-function! man#show_toc() abort
- let bufname = bufname('%')
- let info = getloclist(0, {'winid': 1})
- if !empty(info) && getwinvar(info.winid, 'qf_toc') ==# bufname
- lopen
- return
- endif
-
- let toc = []
- let lnum = 2
- let last_line = line('$') - 1
- 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)
- endwhile
-
- call setloclist(0, toc, ' ')
- call setloclist(0, [], 'a', {'title': 'Man TOC'})
- lopen
- let w:qf_toc = bufname
-endfunction
-
-" attempt to extract the name and sect out of 'name(sect)'
-" otherwise just return the largest string of valid characters in ref
-function! s:extract_sect_and_name_ref(ref) abort
- if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled.
- throw 'manpage name cannot start with ''-'''
- endif
- let ref = matchstr(a:ref, '[^()]\+([^()]\+)')
- if empty(ref)
- let name = matchstr(a:ref, '[^()]\+')
- if empty(name)
- throw 'manpage reference cannot contain only parentheses'
- endif
- return ['', s:spaces_to_underscores(name)]
- endif
- let left = split(ref, '(')
- " see ':Man 3X curses' on why tolower.
- " TODO(nhooyr) Not sure if this is portable across OSs
- " but I have not seen a single uppercase section.
- return [tolower(split(left[1], ')')[0]), s:spaces_to_underscores(left[0])]
-endfunction
-
-" replace spaces in a man page name with underscores
-" intended for PostgreSQL, which has man pages like 'CREATE_TABLE(7)';
-" while editing SQL source code, it's nice to visually select 'CREATE TABLE'
-" and hit 'K', which requires this transformation
-function! s:spaces_to_underscores(str)
- return substitute(a:str, ' ', '_', 'g')
-endfunction
-
-function! s:get_path(sect, name) abort
- " Some man implementations (OpenBSD) return all available paths from the
- " search command. Previously, this function would simply select the first one.
- "
- " However, some searches will report matches that are incorrect:
- " man -w strlen may return string.3 followed by strlen.3, and therefore
- " selecting the first would get us the wrong page. Thus, we must find the
- " first matching one.
- "
- " There's yet another special case here. Consider the following:
- " If you run man -w strlen and string.3 comes up first, this is a problem. We
- " should search for a matching named one in the results list.
- " However, if you search for man -w clock_gettime, you will *only* get
- " clock_getres.2, which is the right page. Searching the resuls for
- " clock_gettime will no longer work. In this case, we should just use the
- " first one that was found in the correct section.
- "
- " 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.
- 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 ''
- endif
-
- " find any that match the specified name
- let namematches = filter(copy(results), 'fnamemodify(v:val, ":t") =~ a:name')
- let sectmatches = []
-
- if !empty(namematches) && !empty(a:sect)
- let sectmatches = filter(copy(namematches), 'fnamemodify(v:val, ":e") == a:sect')
- endif
-
- return substitute(get(sectmatches, 0, get(namematches, 0, results[0])), '\n\+$', '', '')
-endfunction
-
-" s:verify_exists attempts to find the path to a manpage
-" based on the passed section and name.
-"
-" 1. If the passed section is empty, b:man_default_sects is used.
-" 2. If manpage could not be found with the given sect and name,
-" then another attempt is made with b:man_default_sects.
-" 3. If it still could not be found, then we try again without a section.
-" 4. If still not found but $MANSECT is set, then we try again with $MANSECT
-" unset.
-"
-" This function is careful to avoid duplicating a search if a previous
-" step has already done it. i.e if we use b:man_default_sects in step 1,
-" then we don't do it again in step 2.
-function! s:verify_exists(sect, name) abort
- let sect = a:sect
-
- if empty(sect)
- " no section specified, so search with b:man_default_sects
- if exists('b:man_default_sects')
- let sects = split(b:man_default_sects, ',')
- for sec in sects
- try
- let res = s:get_path(sec, a:name)
- if !empty(res)
- return res
- endif
- catch /^command error (/
- endtry
- endfor
- endif
- else
- " try with specified section
- try
- let res = s:get_path(sect, a:name)
- if !empty(res)
- return res
- endif
- catch /^command error (/
- endtry
-
- " try again with b:man_default_sects
- if exists('b:man_default_sects')
- let sects = split(b:man_default_sects, ',')
- for sec in sects
- try
- let res = s:get_path(sec, a:name)
- if !empty(res)
- return res
- endif
- catch /^command error (/
- endtry
- endfor
- endif
- endif
-
- " if none of the above worked, we will try with no section
- try
- let res = s:get_path('', a:name)
- if !empty(res)
- return res
- endif
- catch /^command error (/
- endtry
-
- " if that still didn't work, we will check for $MANSECT and try again with it
- " unset
- if !empty($MANSECT)
- try
- let MANSECT = $MANSECT
- call setenv('MANSECT', v:null)
- let res = s:get_path('', a:name)
- if !empty(res)
- return res
- endif
- catch /^command error (/
- finally
- call setenv('MANSECT', MANSECT)
- endtry
- endif
-
- " finally, if that didn't work, there is no hope
- throw 'no manual entry for ' . a:name
-endfunction
-
-" Extracts the name/section from the 'path/name.sect', because sometimes the actual section is
-" more specific than what we provided to `man` (try `:Man 3 App::CLI`).
-" Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
-" still want the name of the buffer to be 'printf'.
-function! s:extract_sect_and_name_path(path) abort
- let tail = fnamemodify(a:path, ':t')
- if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions
- let tail = fnamemodify(tail, ':r')
- endif
- let sect = matchstr(tail, '\.\zs[^.]\+$')
- let name = matchstr(tail, '^.\+\ze\.')
- return [sect, name]
-endfunction
-
-function! s:find_man() abort
- let l:win = 1
- while l:win <= winnr('$')
- let l:buf = winbufnr(l:win)
- if getbufvar(l:buf, '&filetype', '') ==# 'man'
- execute l:win.'wincmd w'
- return 1
- endif
- let l:win += 1
- endwhile
- return 0
-endfunction
-
-function! s:error(msg) abort
- redraw
- echohl ErrorMsg
- echon 'man.vim: ' a:msg
- echohl None
-endfunction
-
-" see s:extract_sect_and_name_ref on why tolower(sect)
-function! man#complete(arg_lead, cmd_line, cursor_pos) abort
- let args = split(a:cmd_line)
- let cmd_offset = index(args, 'Man')
- if cmd_offset > 0
- " Prune all arguments up to :Man itself. Otherwise modifier commands like
- " :tab, :vertical, etc. would lead to a wrong length.
- let args = args[cmd_offset:]
- endif
- let l = len(args)
- if l > 3
- return
- elseif l ==# 1
- let name = ''
- let sect = ''
- elseif a:arg_lead =~# '^[^()]\+([^()]*$'
- " cursor (|) is at ':Man printf(|' or ':Man 1 printf(|'
- " The later is is allowed because of ':Man pri<TAB>'.
- " It will offer 'priclass.d(1m)' even though section is specified as 1.
- let tmp = split(a:arg_lead, '(')
- let name = tmp[0]
- let sect = tolower(get(tmp, 1, ''))
- return s:complete(sect, '', name)
- elseif args[1] !~# '^[^()]\+$'
- " cursor (|) is at ':Man 3() |' or ':Man (3|' or ':Man 3() pri|'
- " or ':Man 3() pri |'
- return
- elseif l ==# 2
- if empty(a:arg_lead)
- " cursor (|) is at ':Man 1 |'
- let name = ''
- let sect = tolower(args[1])
- else
- " cursor (|) is at ':Man pri|'
- if a:arg_lead =~# '\/'
- " if the name is a path, complete files
- " TODO(nhooyr) why does this complete the last one automatically
- return glob(a:arg_lead.'*', 0, 1)
- endif
- let name = a:arg_lead
- let sect = ''
- endif
- elseif a:arg_lead !~# '^[^()]\+$'
- " cursor (|) is at ':Man 3 printf |' or ':Man 3 (pr)i|'
- return
- else
- " cursor (|) is at ':Man 3 pri|'
- let name = a:arg_lead
- let sect = tolower(args[1])
- endif
- return s:complete(sect, sect, name)
-endfunction
-
-function! s:get_paths(sect, name, do_fallback) abort
- " callers must try-catch this, as some `man` implementations don't support `s:find_arg`
- try
- let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',')
- let paths = globpath(mandirs, 'man?/'.a:name.'*.'.a:sect.'*', 0, 1)
- try
- " Prioritize the result from verify_exists as it obeys b:man_default_sects.
- let first = s:verify_exists(a:sect, a:name)
- let paths = filter(paths, 'v:val !=# first')
- let paths = [first] + paths
- catch
- endtry
- return paths
- catch
- if !a:do_fallback
- throw v:exception
- endif
-
- " Fallback to a single path, with the page we're trying to find.
- try
- return [s:verify_exists(a:sect, a:name)]
- catch
- return []
- endtry
- endtry
-endfunction
-
-function! s:complete(sect, psect, name) abort
- let pages = s:get_paths(a:sect, a:name, v:false)
- " We remove duplicates in case the same manpage in different languages was found.
- return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i'))
-endfunction
-
-function! s:format_candidate(path, psect) abort
- if a:path =~# '\.\%(pdf\|in\)$' " invalid extensions
- return
- endif
- let [sect, name] = s:extract_sect_and_name_path(a:path)
- if sect ==# a:psect
- return name
- elseif sect =~# a:psect.'.\+$'
- " We include the section if the user provided section is a prefix
- " of the actual section.
- return name.'('.sect.')'
- endif
-endfunction
-
-" Called when Nvim is invoked as $MANPAGER.
-function! man#init_pager() abort
- if getline(1) =~# '^\s*$'
- silent keepjumps 1delete _
- else
- keepjumps 1
- endif
- lua require("man").highlight_man_page()
- " Guess the ref from the heading (which is usually uppercase, so we cannot
- " know the correct casing, cf. `man glDrawArraysInstanced`).
- let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')
- try
- let b:man_sect = s:extract_sect_and_name_ref(ref)[0]
- catch
- let b:man_sect = ''
- endtry
- if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95.
- execute 'silent file man://'.tolower(fnameescape(ref))
- endif
-
- call s:set_options(v:true)
-endfunction
-
-function! man#goto_tag(pattern, flags, info) abort
- let [l:sect, l:name] = s:extract_sect_and_name_ref(a:pattern)
-
- let l:paths = s:get_paths(l:sect, l:name, v:true)
- let l:structured = []
-
- for l:path in l:paths
- let [l:sect, l:name] = s:extract_sect_and_name_path(l:path)
- let l:structured += [{
- \ 'name': l:name,
- \ 'title': l:name . '(' . l:sect . ')'
- \ }]
- endfor
-
- if &cscopetag
- " return only a single entry so we work well with :cstag (#11675)
- let l:structured = l:structured[:0]
- endif
-
- return map(l:structured, {
- \ _, entry -> {
- \ 'name': entry.name,
- \ 'filename': 'man://' . entry.title,
- \ 'cmd': '1'
- \ }
- \ })
-endfunction
-
-call man#init()
diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim
index e45dbd9db8..1eaad09ef5 100644
--- a/runtime/autoload/python.vim
+++ b/runtime/autoload/python.vim
@@ -3,13 +3,19 @@
let s:keepcpo= &cpo
set cpo&vim
-" searchpair() can be slow, limit the time to 150 msec or what is put in
-" g:pyindent_searchpair_timeout
-let s:searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150)
-
-" Identing inside parentheses can be very slow, regardless of the searchpair()
-" timeout, so let the user disable this feature if he doesn't need it
-let s:disable_parentheses_indenting = get(g:, 'pyindent_disable_parentheses_indenting', v:false)
+" need to inspect some old g:pyindent_* variables to be backward compatible
+let g:python_indent = extend(get(g:, 'python_indent', {}), #{
+ \ closed_paren_align_last_line: v:true,
+ \ open_paren: get(g:, 'pyindent_open_paren', 'shiftwidth() * 2'),
+ \ nested_paren: get(g:, 'pyindent_nested_paren', 'shiftwidth()'),
+ \ continue: get(g:, 'pyindent_continue', 'shiftwidth() * 2'),
+ "\ searchpair() can be slow, limit the time to 150 msec or what is put in
+ "\ g:python_indent.searchpair_timeout
+ \ searchpair_timeout: get(g:, 'pyindent_searchpair_timeout', 150),
+ "\ Identing inside parentheses can be very slow, regardless of the searchpair()
+ "\ timeout, so let the user disable this feature if he doesn't need it
+ \ disable_parentheses_indenting: get(g:, 'pyindent_disable_parentheses_indenting', v:false),
+ \ }, 'keep')
let s:maxoff = 50 " maximum number of lines to look backwards for ()
@@ -18,7 +24,7 @@ function s:SearchBracket(fromlnum, flags)
\ {-> synstack('.', col('.'))
\ ->map({_, id -> id->synIDattr('name')})
\ ->match('\%(Comment\|Todo\|String\)$') >= 0},
- \ [0, a:fromlnum - s:maxoff]->max(), s:searchpair_timeout)
+ \ [0, a:fromlnum - s:maxoff]->max(), g:python_indent.searchpair_timeout)
endfunction
" See if the specified line is already user-dedented from the expected value.
@@ -38,7 +44,7 @@ function python#GetIndent(lnum, ...)
if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$'
return indent(a:lnum - 1)
endif
- return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2))
+ return indent(a:lnum - 1) + get(g:, 'pyindent_continue', g:python_indent.continue)->eval()
endif
" If the start of the line is in a string don't change the indent.
@@ -55,7 +61,7 @@ function python#GetIndent(lnum, ...)
return 0
endif
- if s:disable_parentheses_indenting == 1
+ if g:python_indent.disable_parentheses_indenting == 1
let plindent = indent(plnum)
let plnumstart = plnum
else
@@ -70,8 +76,12 @@ function python#GetIndent(lnum, ...)
" 100, 200, 300, 400)
call cursor(a:lnum, 1)
let [parlnum, parcol] = s:SearchBracket(a:lnum, 'nbW')
- if parlnum > 0 && parcol != col([parlnum, '$']) - 1
- return parcol
+ if parlnum > 0
+ if parcol != col([parlnum, '$']) - 1
+ return parcol
+ elseif getline(a:lnum) =~ '^\s*[])}]' && !g:python_indent.closed_paren_align_last_line
+ return indent(parlnum)
+ endif
endif
call cursor(plnum, 1)
@@ -123,9 +133,11 @@ function python#GetIndent(lnum, ...)
" When the start is inside parenthesis, only indent one 'shiftwidth'.
let [pp, _] = s:SearchBracket(a:lnum, 'bW')
if pp > 0
- return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
+ return indent(plnum)
+ \ + get(g:, 'pyindent_nested_paren', g:python_indent.nested_paren)->eval()
endif
- return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
+ return indent(plnum)
+ \ + get(g:, 'pyindent_open_paren', g:python_indent.open_paren)->eval()
endif
if plnumstart == p
return indent(plnum)
diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim
index 0d2f07c654..652046b561 100644
--- a/runtime/colors/blue.vim
+++ b/runtime/colors/blue.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri Aug 5 12:25:12 2022
+" Last Updated: Fri 02 Sep 2022 09:41:44 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'blue'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -57,7 +57,7 @@ hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NO
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 WarningMsg guifg=#d787d7 guibg=NONE gui=NONE cterm=NONE
hi WildMenu guifg=#000087 guibg=#ffd700 gui=NONE cterm=NONE
hi debugBreakpoint guifg=#00ff00 guibg=#000087 gui=reverse cterm=reverse
hi debugPC guifg=#5fffff guibg=#000087 gui=reverse cterm=reverse
@@ -120,6 +120,8 @@ hi! link Structure Type
hi! link Tag Special
hi! link Typedef Type
hi! link Terminal Normal
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -165,7 +167,7 @@ if s:t_Co >= 256
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 WarningMsg ctermfg=176 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
@@ -228,6 +230,8 @@ if s:t_Co >= 256
hi! link Tag Special
hi! link Typedef Type
hi! link Terminal Normal
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
@@ -276,7 +280,7 @@ if s:t_Co >= 16
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 WarningMsg ctermfg=magenta 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
@@ -339,6 +343,8 @@ if s:t_Co >= 16
hi! link Tag Special
hi! link Typedef Type
hi! link Terminal Normal
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
hi DiffText ctermfg=black ctermbg=grey cterm=NONE
@@ -449,6 +455,8 @@ if s:t_Co >= 8
hi! link Tag Special
hi! link Typedef Type
hi! link Terminal Normal
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
hi DiffText ctermfg=black ctermbg=grey cterm=NONE
diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim
index b4c286af37..4ce8687415 100644
--- a/runtime/colors/darkblue.vim
+++ b/runtime/colors/darkblue.vim
@@ -4,7 +4,7 @@
" Maintainer: Original author Bohdan Vlasyuk <bohdan@vstu.edu.ua>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:06 2022
+" Last Updated: Fri 02 Sep 2022 09:40:36 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'darkblue'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
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']
@@ -65,6 +65,8 @@ hi! link diffCommon WarningMsg
hi! link diffBDiffer WarningMsg
hi! link lCursor Cursor
hi! link CurSearch Search
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
hi Normal guifg=#c0c0c0 guibg=#000040 gui=NONE cterm=NONE
hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi ColorColumn guifg=#c0c0c0 guibg=#8b0000 gui=NONE cterm=NONE
@@ -171,6 +173,8 @@ if s:t_Co >= 256
hi! link diffBDiffer WarningMsg
hi! link lCursor Cursor
hi! link CurSearch Search
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=252 ctermbg=17 cterm=NONE
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi ColorColumn ctermfg=252 ctermbg=88 cterm=NONE
diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim
index bd9c5cf52d..38f21d7156 100644
--- a/runtime/colors/delek.vim
+++ b/runtime/colors/delek.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer David Schweikert <david@schweikert.ch>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:07 2022
+" Last Updated: Sun 04 Sep 2022 09:31:26 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=light
hi clear
let g:colors_name = 'delek'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -25,6 +25,8 @@ hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link ErrorMsg Error
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -57,7 +59,7 @@ 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 Question guifg=#008700 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
@@ -97,6 +99,8 @@ if s:t_Co >= 256
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link ErrorMsg Error
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=16 ctermbg=231 cterm=NONE
hi EndOfBuffer ctermfg=250 ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=226 ctermbg=18 cterm=bold
@@ -129,7 +133,7 @@ if s:t_Co >= 256
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 Question ctermfg=28 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
diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim
index e9b8108d19..4bfdf7eabd 100644
--- a/runtime/colors/desert.vim
+++ b/runtime/colors/desert.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Hans Fugal <hans@fugal.net>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:08 2022
+" Last Updated: Fri 02 Sep 2022 09:39:21 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'desert'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -25,6 +25,8 @@ hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link EndOfBuffer NonText
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -97,6 +99,8 @@ if s:t_Co >= 256
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link EndOfBuffer NonText
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=231 ctermbg=236 cterm=NONE
hi StatusLine ctermfg=236 ctermbg=144 cterm=NONE
hi StatusLineNC ctermfg=242 ctermbg=144 cterm=NONE
diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim
index 4bfda2a083..a9bdac7a1d 100644
--- a/runtime/colors/elflord.vim
+++ b/runtime/colors/elflord.vim
@@ -3,7 +3,7 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:08 2022
+" Last Updated: Fri 02 Sep 2022 09:44:22 MSK
" Generated by Colortemplate v2.2.0
@@ -12,7 +12,7 @@ set background=dark
hi clear
let g:colors_name = 'elflord'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
hi! link Terminal Normal
hi! link Boolean Constant
@@ -43,6 +43,8 @@ hi! link lCursor Cursor
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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']
diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim
index 7e0609e9c4..23ff8421e8 100644
--- a/runtime/colors/evening.vim
+++ b/runtime/colors/evening.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:09 2022
+" Last Updated: Sun 04 Sep 2022 09:48:34 MSK
" Generated by Colortemplate v2.2.0
@@ -13,10 +13,10 @@ set background=dark
hi clear
let g:colors_name = 'evening'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
+ let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0087ff', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff']
endif
hi! link VertSplit StatusLineNC
hi! link StatusLineTerm StatusLine
@@ -64,6 +64,8 @@ hi! link String Constant
hi! link Structure Type
hi! link Tag Special
hi! link Typedef Type
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -98,7 +100,7 @@ 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 WarningMsg guifg=#ff0000 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
@@ -170,6 +172,8 @@ if s:t_Co >= 256
hi! link Structure Type
hi! link Tag Special
hi! link Typedef Type
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=231 ctermbg=236 cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=88 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=241 cterm=NONE
@@ -204,7 +208,7 @@ if s:t_Co >= 256
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 WarningMsg ctermfg=196 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
@@ -279,6 +283,8 @@ if s:t_Co >= 16
hi! link Structure Type
hi! link Tag Special
hi! link Typedef Type
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=white ctermbg=black cterm=NONE
hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
@@ -313,7 +319,7 @@ if s:t_Co >= 16
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 WarningMsg ctermfg=red 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
@@ -494,13 +500,26 @@ endif
" 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: x_black #000000 16 black
+" Color: x_darkred #cd0000 160 darkred
+" Color: x_darkgreen #00cd00 40 darkgreen
+" Color: x_darkyellow #cdcd00 184 darkyellow
+" Color: x_darkblue_m #0087ff 33 darkblue
+" Color: x_darkmagenta #cd00cd 164 darkmagenta
+" Color: x_darkcyan #00cdcd 44 darkcyan
+" Color: x_gray #e5e5e5 254 gray
+" Color: x_darkgray #7f7f7f 244 darkgray
+" Color: x_red #ff0000 196 red
+" Color: x_green #00ff00 46 green
+" Color: x_yellow #ffff00 226 yellow
+" Color: x_blue #5c5cff 63 blue
+" Color: x_magenta #ff00ff 201 magenta
+" Color: x_cyan #00ffff 51 cyan
+" Color: x_white #ffffff 231 white
+" Term colors: x_black x_darkred x_darkgreen x_darkyellow x_darkblue_m x_darkmagenta x_darkcyan x_gray
+" Term colors: x_darkgray x_red x_green x_yellow x_blue x_magenta x_cyan x_white
" Color: bgDiffA #5F875F 65 darkgreen
" Color: bgDiffC #5F87AF 67 blue
" Color: bgDiffD #AF5FAF 133 magenta
diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim
index 169fc28021..049413beef 100644
--- a/runtime/colors/habamax.vim
+++ b/runtime/colors/habamax.vim
@@ -4,7 +4,7 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:10 2022
+" Last Updated: Fri 02 Sep 2022 09:45:11 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'habamax'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
if (has('termguicolors') && &termguicolors) || has('gui_running')
let g:terminal_ansi_colors = ['#1c1c1c', '#d75f5f', '#87af87', '#afaf87', '#5f87af', '#af87af', '#5f8787', '#9e9e9e', '#767676', '#d7875f', '#afd7af', '#d7d787', '#87afd7', '#d7afd7', '#87afaf', '#bcbcbc']
@@ -21,6 +21,8 @@ endif
hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
hi! link javaScriptFunction Statement
hi! link javaScriptIdentifier Statement
hi! link sqlKeyword Statement
@@ -142,6 +144,8 @@ if s:t_Co >= 256
hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi! link javaScriptFunction Statement
hi! link javaScriptIdentifier Statement
hi! link sqlKeyword Statement
diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim
index 359600fa4a..3f6726038e 100644
--- a/runtime/colors/industry.vim
+++ b/runtime/colors/industry.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Shian Lee.
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:11 2022
+" Last Updated: Sun 04 Sep 2022 09:50:04 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'industry'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -51,7 +51,7 @@ 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 WarningMsg guifg=#ff0000 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
@@ -84,6 +84,8 @@ hi! link LineNrBelow LineNr
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -123,7 +125,7 @@ if s:t_Co >= 256
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 WarningMsg ctermfg=196 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
@@ -156,6 +158,8 @@ if s:t_Co >= 256
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
hi DiffText ctermfg=16 ctermbg=251 cterm=NONE
@@ -198,7 +202,7 @@ if s:t_Co >= 16
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 WarningMsg ctermfg=red 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
@@ -231,6 +235,8 @@ if s:t_Co >= 16
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
hi DiffText ctermfg=black ctermbg=grey cterm=NONE
diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim
index 04476d1ee9..f414eeb3e6 100644
--- a/runtime/colors/koehler.vim
+++ b/runtime/colors/koehler.vim
@@ -3,7 +3,7 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:12 2022
+" Last Updated: Fri 02 Sep 2022 09:23:56 MSK
" Generated by Colortemplate v2.2.0
@@ -12,7 +12,7 @@ set background=dark
hi clear
let g:colors_name = 'koehler'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
hi! link Terminal Normal
hi! link Boolean Constant
@@ -49,6 +49,8 @@ hi! link lCursor Cursor
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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']
diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim
index d6c73eb28c..b717ca7855 100644
--- a/runtime/colors/lunaperche.vim
+++ b/runtime/colors/lunaperche.vim
@@ -4,14 +4,14 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://www.github.com/vim/colorschemes
" License: Vim License (see `:help license`)
-" Last Updated: Thu Aug 18 14:36:32 2022
+" Last Updated: Sat 03 Sep 2022 14:31:51 MSK
" Generated by Colortemplate v2.2.0
hi clear
let g:colors_name = 'lunaperche'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
hi! link helpVim Title
hi! link helpHeader Title
@@ -81,18 +81,31 @@ hi! link shOption Normal
hi! link shCommandSub Normal
hi! link shDerefPattern shQuote
hi! link shDerefOp Special
+hi! link phpStorageClass Statement
+hi! link phpStructure Statement
+hi! link phpInclude Statement
+hi! link phpDefine Statement
+hi! link phpSpecialFunction Normal
+hi! link phpParent Normal
+hi! link phpComparison Normal
+hi! link phpOperator Normal
+hi! link phpVarSelector Special
+hi! link phpMemberSelector Special
+hi! link phpDocCustomTags phpDocTags
hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
+hi! link MessageWindow PMenu
+hi! link PopupNotification Todo
if &background ==# 'dark'
if (has('termguicolors') && &termguicolors) || has('gui_running')
let g:terminal_ansi_colors = ['#000000', '#af5f5f', '#5faf5f', '#af875f', '#5f87af', '#d787af', '#5fafaf', '#c6c6c6', '#767676', '#ff5f5f', '#5fd75f', '#ffd787', '#87afd7', '#ffafd7', '#5fd7d7', '#ffffff']
endif
hi Normal guifg=#c6c6c6 guibg=#000000 gui=NONE cterm=NONE
- hi Statusline guifg=#000000 guibg=#c6c6c6 gui=bold cterm=bold
- hi StatuslineNC guifg=#000000 guibg=#767676 gui=NONE cterm=NONE
+ hi Statusline guifg=#c6c6c6 guibg=#000000 gui=bold,reverse cterm=bold,reverse
+ hi StatuslineNC guifg=#767676 guibg=#000000 gui=reverse cterm=reverse
hi VertSplit guifg=#767676 guibg=#767676 gui=NONE cterm=NONE
hi TabLine guifg=#000000 guibg=#c6c6c6 gui=NONE cterm=NONE
hi TabLineFill guifg=NONE guibg=#767676 gui=NONE cterm=NONE
@@ -107,7 +120,7 @@ if &background ==# 'dark'
hi EndOfBuffer guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi SpecialKey guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=NONE guibg=#1c1c1c gui=NONE cterm=NONE
- hi PmenuSel guifg=NONE guibg=#005f00 gui=NONE cterm=NONE
+ hi PmenuSel guifg=NONE guibg=#444444 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#c6c6c6 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -169,7 +182,6 @@ if &background ==# 'dark'
hi dirFilterMenuBookmarkPath guifg=#878787 guibg=NONE gui=NONE cterm=NONE
hi dirFilterMenuHistoryPath guifg=#878787 guibg=NONE gui=NONE cterm=NONE
hi FilterMenuLineNr guifg=#878787 guibg=NONE gui=NONE cterm=NONE
- hi CocMenuSel guifg=NONE guibg=#005f00 gui=NONE cterm=NONE
hi CocSearch guifg=#ffd787 guibg=NONE gui=NONE cterm=NONE
else
" Light background
@@ -193,7 +205,7 @@ else
hi EndOfBuffer guifg=#9e9e9e guibg=NONE gui=NONE cterm=NONE
hi SpecialKey guifg=#9e9e9e guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
- hi PmenuSel guifg=NONE guibg=#afd7af gui=NONE cterm=NONE
+ hi PmenuSel guifg=NONE guibg=#c6c6c6 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#767676 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -256,7 +268,6 @@ else
hi dirFilterMenuHistoryPath guifg=#626262 guibg=NONE gui=NONE cterm=NONE
hi FilterMenuDirectorySubtle guifg=#626262 guibg=NONE gui=NONE cterm=NONE
hi FilterMenuLineNr guifg=#626262 guibg=NONE gui=NONE cterm=NONE
- hi CocMenuSel guifg=NONE guibg=#afd7af gui=NONE cterm=NONE
hi CocSearch guifg=#870000 guibg=NONE gui=NONE cterm=NONE
endif
@@ -329,15 +340,28 @@ if s:t_Co >= 256
hi! link shCommandSub Normal
hi! link shDerefPattern shQuote
hi! link shDerefOp Special
+ hi! link phpStorageClass Statement
+ hi! link phpStructure Statement
+ hi! link phpInclude Statement
+ hi! link phpDefine Statement
+ hi! link phpSpecialFunction Normal
+ hi! link phpParent Normal
+ hi! link phpComparison Normal
+ hi! link phpOperator Normal
+ hi! link phpVarSelector Special
+ hi! link phpMemberSelector Special
+ hi! link phpDocCustomTags phpDocTags
hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
+ hi! link MessageWindow PMenu
+ hi! link PopupNotification Todo
if &background ==# 'dark'
hi Normal ctermfg=251 ctermbg=16 cterm=NONE
- hi Statusline ctermfg=16 ctermbg=251 cterm=bold
- hi StatuslineNC ctermfg=16 ctermbg=243 cterm=NONE
+ hi Statusline ctermfg=251 ctermbg=16 cterm=bold,reverse
+ hi StatuslineNC ctermfg=243 ctermbg=16 cterm=reverse
hi VertSplit ctermfg=243 ctermbg=243 cterm=NONE
hi TabLine ctermfg=16 ctermbg=251 cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=243 cterm=NONE
@@ -352,7 +376,7 @@ if s:t_Co >= 256
hi EndOfBuffer ctermfg=240 ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=240 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=234 cterm=NONE
- hi PmenuSel ctermfg=NONE ctermbg=22 cterm=NONE
+ hi PmenuSel ctermfg=NONE ctermbg=238 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=251 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -412,7 +436,6 @@ if s:t_Co >= 256
hi dirFilterMenuBookmarkPath ctermfg=102 ctermbg=NONE cterm=NONE
hi dirFilterMenuHistoryPath ctermfg=102 ctermbg=NONE cterm=NONE
hi FilterMenuLineNr ctermfg=102 ctermbg=NONE cterm=NONE
- hi CocMenuSel ctermfg=NONE ctermbg=22 cterm=NONE
hi CocSearch ctermfg=222 ctermbg=NONE cterm=NONE
else
" Light background
@@ -433,7 +456,7 @@ if s:t_Co >= 256
hi EndOfBuffer ctermfg=247 ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=247 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=255 cterm=NONE
- hi PmenuSel ctermfg=NONE ctermbg=151 cterm=NONE
+ hi PmenuSel ctermfg=NONE ctermbg=251 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=243 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -494,7 +517,6 @@ if s:t_Co >= 256
hi dirFilterMenuHistoryPath ctermfg=241 ctermbg=NONE cterm=NONE
hi FilterMenuDirectorySubtle ctermfg=241 ctermbg=NONE cterm=NONE
hi FilterMenuLineNr ctermfg=241 ctermbg=NONE cterm=NONE
- hi CocMenuSel ctermfg=NONE ctermbg=151 cterm=NONE
hi CocSearch ctermfg=88 ctermbg=NONE cterm=NONE
endif
unlet s:t_Co
@@ -504,8 +526,8 @@ endif
if s:t_Co >= 16
if &background ==# 'dark'
hi Normal ctermfg=grey ctermbg=black cterm=NONE
- hi Statusline ctermfg=black ctermbg=grey cterm=bold
- hi StatuslineNC ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi Statusline ctermfg=grey ctermbg=black cterm=bold,reverse
+ hi StatuslineNC ctermfg=darkgrey ctermbg=black cterm=reverse
hi VertSplit ctermfg=darkgrey ctermbg=darkgrey cterm=NONE
hi TabLine ctermfg=black ctermbg=grey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE
@@ -520,7 +542,7 @@ if s:t_Co >= 16
hi EndOfBuffer ctermfg=grey ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=grey ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=black ctermbg=darkgrey cterm=NONE
- hi PmenuSel ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -567,6 +589,20 @@ if s:t_Co >= 16
hi diffAdded ctermfg=green ctermbg=NONE cterm=NONE
hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=magenta ctermbg=NONE cterm=NONE
+ hi dirType ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi dirPermissionUser ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi dirPermissionGroup ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi dirPermissionOther ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi dirOwner ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi dirGroup ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi dirTime ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi dirSize ctermfg=yellow ctermbg=NONE cterm=NONE
+ hi dirSizeMod ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi FilterMenuDirectorySubtle ctermfg=grey ctermbg=NONE cterm=NONE
+ hi dirFilterMenuBookmarkPath ctermfg=grey ctermbg=NONE cterm=NONE
+ hi dirFilterMenuHistoryPath ctermfg=grey ctermbg=NONE cterm=NONE
+ hi FilterMenuLineNr ctermfg=grey ctermbg=NONE cterm=NONE
+ hi CocSearch ctermfg=yellow ctermbg=NONE cterm=NONE
else
" Light background
hi Normal ctermfg=black ctermbg=white cterm=NONE
@@ -586,7 +622,7 @@ if s:t_Co >= 16
hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
- hi PmenuSel ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgrey cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -633,6 +669,21 @@ if s:t_Co >= 16
hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi diffRemoved ctermfg=red ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi dirType ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi dirPermissionUser ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi dirPermissionGroup ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi dirPermissionOther ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi dirOwner ctermfg=grey ctermbg=NONE cterm=NONE
+ hi dirGroup ctermfg=grey ctermbg=NONE cterm=NONE
+ hi dirTime ctermfg=grey ctermbg=NONE cterm=NONE
+ hi dirSize ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi dirSizeMod ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi dirLink ctermfg=darkgreen ctermbg=NONE cterm=bold
+ hi dirFilterMenuBookmarkPath ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi dirFilterMenuHistoryPath ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi FilterMenuDirectorySubtle ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi FilterMenuLineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi CocSearch ctermfg=darkred ctermbg=NONE cterm=NONE
endif
unlet s:t_Co
finish
@@ -659,7 +710,7 @@ if s:t_Co >= 8
hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
- hi PmenuSel ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=grey ctermbg=darkred cterm=NONE
hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
@@ -688,7 +739,7 @@ if s:t_Co >= 8
hi Comment ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Statement ctermfg=black ctermbg=NONE cterm=bold
+ hi Statement ctermfg=grey ctermbg=NONE cterm=bold
hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE
hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE
@@ -722,7 +773,7 @@ if s:t_Co >= 8
hi Pmenu ctermfg=grey ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
- hi PmenuSel ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=grey ctermbg=darkred cterm=NONE
hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
@@ -864,7 +915,7 @@ endif
" Color: colorlC #FF5FFF 207 magenta
" Color: colorV #005F87 24 darkblue
" Color: colorMP #C5E7C5 30 darkcyan
-" Color: colorPMenuSel #005F00 22 darkgreen
+" Color: colorPMenuSel #444444 238 darkcyan
" Color: colorDim #878787 102 grey
" Color: diffAdd #AF87AF 139 darkmagenta
" Color: diffDelete #D78787 174 darkred
@@ -898,7 +949,7 @@ endif
" Color: colorlC #FF00FF 201 magenta
" Color: colorV #5F87AF 67 darkblue
" Color: colorMP #C5E7C5 30 darkcyan
-" Color: colorPMenuSel #AFD7AF 151 darkgreen
+" Color: colorPMenuSel #C6C6C6 251 darkcyan
" Color: colorDim #626262 241 darkgrey
" Color: diffAdd #D7AFD7 182 darkmagenta
" Color: diffDelete #870000 88 darkred
diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim
index 5764d0df78..a7aec49808 100644
--- a/runtime/colors/morning.vim
+++ b/runtime/colors/morning.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Bram Moolenaar <Bram@vim.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:13 2022
+" Last Updated: Fri 02 Sep 2022 09:46:24 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=light
hi clear
let g:colors_name = 'morning'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -26,6 +26,8 @@ hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -96,6 +98,8 @@ if s:t_Co >= 256
hi! link CursorLineSign CursorLine
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=16 ctermbg=254 cterm=NONE
hi EndOfBuffer ctermfg=21 ctermbg=252 cterm=bold
hi Folded ctermfg=18 ctermbg=252 cterm=NONE
diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim
index b7cf6ce985..60a6aed428 100644
--- a/runtime/colors/murphy.vim
+++ b/runtime/colors/murphy.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>.
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:14 2022
+" Last Updated: Fri 02 Sep 2022 09:47:20 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'murphy'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -26,6 +26,8 @@ hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -96,6 +98,8 @@ if s:t_Co >= 256
hi! link CursorLineSign CursorLine
hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=120 ctermbg=16 cterm=NONE
hi EndOfBuffer ctermfg=21 ctermbg=16 cterm=NONE
hi StatusLine ctermfg=231 ctermbg=18 cterm=NONE
diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim
index 521ea44aaf..f404951b2a 100644
--- a/runtime/colors/pablo.vim
+++ b/runtime/colors/pablo.vim
@@ -3,7 +3,7 @@
" Maintainer: Original maintainerRon Aaron <ron@ronware.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:15 2022
+" Last Updated: Sun 04 Sep 2022 09:53:40 MSK
" Generated by Colortemplate v2.2.0
@@ -12,18 +12,20 @@ set background=dark
hi clear
let g:colors_name = 'pablo'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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! link MessageWindow Pmenu
+hi! link PopupNotification Todo
+hi Normal guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
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
@@ -88,13 +90,15 @@ 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! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
+ hi Normal ctermfg=231 ctermbg=16 cterm=NONE
hi Comment ctermfg=244 ctermbg=NONE cterm=NONE
hi Constant ctermfg=51 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=37 ctermbg=NONE cterm=NONE
@@ -117,7 +121,7 @@ if s:t_Co >= 256
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 WarningMsg ctermfg=196 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
@@ -163,12 +167,6 @@ endif
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
@@ -191,7 +189,7 @@ if s:t_Co >= 16
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 WarningMsg ctermfg=red 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
@@ -405,7 +403,7 @@ endif
" Color: SpecialKey #00ffff 81 cyan
" Color: StatusLineTerm #90ee90 121 darkgreen
" Color: Title #ff00ff 225 magenta
-" Color: WarningMsg #ff0000 224 darkred
+" Color: WarningMsg #ff0000 196 red
" Color: ToolbarLine #7f7f7f 242 darkgrey
" Color: ToolbarButton #d3d3d3 254 grey
" Color: Underlined #80a0ff 111 darkgreen
diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim
index 3e896ffdeb..130eceeb18 100644
--- a/runtime/colors/peachpuff.vim
+++ b/runtime/colors/peachpuff.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:16 2022
+" Last Updated: Fri 02 Sep 2022 09:50:02 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=light
hi clear
let g:colors_name = 'peachpuff'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -24,6 +24,8 @@ hi! link LineNrBelow LineNr
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -94,6 +96,8 @@ if s:t_Co >= 256
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=16 ctermbg=223 cterm=NONE
hi Folded ctermfg=16 ctermbg=252 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=180 cterm=NONE
diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim
index 4c4baa994c..9e81ba3857 100644
--- a/runtime/colors/quiet.vim
+++ b/runtime/colors/quiet.vim
@@ -4,18 +4,20 @@
" Maintainer: neutaaaaan <neutaaaaan-gh@protonmail.com>
" Website: https://github.com/vim/colorschemes
" License: Vim License (see `:help license`)`
-" Last Updated: 2022-08-14 15:17:11
+" Last Updated: Fri 02 Sep 2022 09:55:30 MSK
" Generated by Colortemplate v2.2.0
hi clear
let g:colors_name = 'quiet'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
hi! link Terminal Normal
hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
hi! link Boolean Constant
hi! link Character Constant
hi! link Conditional Statement
diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim
index a529d6c199..ea37b646a6 100644
--- a/runtime/colors/ron.vim
+++ b/runtime/colors/ron.vim
@@ -3,7 +3,7 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:18 2022
+" Last Updated: Fri 02 Sep 2022 09:50:56 MSK
" Generated by Colortemplate v2.2.0
@@ -12,7 +12,7 @@ set background=dark
hi clear
let g:colors_name = 'ron'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -1
hi! link Terminal Normal
hi! link Boolean Constant
@@ -46,6 +46,8 @@ hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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']
diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim
index b84be280e1..f9b1e39324 100644
--- a/runtime/colors/shine.vim
+++ b/runtime/colors/shine.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer is Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:19 2022
+" Last Updated: Fri 02 Sep 2022 09:51:42 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=light
hi clear
let g:colors_name = 'shine'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -28,6 +28,8 @@ hi! link EndOfBuffer NonText
hi! link ErrorMsg Error
hi! link Tag Special
hi! link Operator Statement
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -104,6 +106,8 @@ if s:t_Co >= 256
hi! link ErrorMsg Error
hi! link Tag Special
hi! link Operator Statement
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=16 ctermbg=231 cterm=NONE
hi Folded ctermfg=18 ctermbg=253 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=253 cterm=NONE
diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim
index 49dbc6387c..04fbc6d6c8 100644
--- a/runtime/colors/slate.vim
+++ b/runtime/colors/slate.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Ralph Amissah <ralph@amissah.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Tue Aug 16 08:11:08 2022
+" Last Updated: Fri 02 Sep 2022 09:52:25 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'slate'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -24,6 +24,8 @@ hi! link LineNrBelow LineNr
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -99,6 +101,8 @@ if s:t_Co >= 256
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=231 ctermbg=235 cterm=NONE
hi EndOfBuffer ctermfg=68 ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=16 ctermbg=144 cterm=NONE
diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim
index ce36507ae8..01d5f0b4e0 100644
--- a/runtime/colors/torte.vim
+++ b/runtime/colors/torte.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Thorsten Maerz <info@netztorte.de>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:22 2022
+" Last Updated: Fri 02 Sep 2022 09:53:21 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=dark
hi clear
let g:colors_name = 'torte'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -26,6 +26,8 @@ hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -97,6 +99,8 @@ if s:t_Co >= 256
hi! link CursorLineSign CursorLine
hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=251 ctermbg=16 cterm=NONE
hi Comment ctermfg=111 ctermbg=NONE cterm=NONE
hi Constant ctermfg=217 ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim
index 135591052c..ab794c0193 100644
--- a/runtime/colors/zellner.vim
+++ b/runtime/colors/zellner.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon Aug 8 15:21:23 2022
+" Last Updated: Fri 02 Sep 2022 09:54:15 MSK
" Generated by Colortemplate v2.2.0
@@ -13,7 +13,7 @@ set background=light
hi clear
let g:colors_name = 'zellner'
-let s:t_Co = exists('&t_Co') ? (&t_Co ? &t_Co : 0) : -1
+let s:t_Co = exists('&t_Co') && !has('gui_running') ? (&t_Co ? &t_Co : 0) : -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']
@@ -24,6 +24,8 @@ hi! link LineNrBelow LineNr
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+hi! link MessageWindow Pmenu
+hi! link PopupNotification Todo
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
@@ -95,6 +97,8 @@ if s:t_Co >= 256
hi! link CurSearch Search
hi! link CursorLineFold CursorLine
hi! link CursorLineSign CursorLine
+ hi! link MessageWindow Pmenu
+ hi! link PopupNotification Todo
hi Normal ctermfg=16 ctermbg=231 cterm=NONE
hi Folded ctermfg=18 ctermbg=252 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE
diff --git a/runtime/compiler/raco.vim b/runtime/compiler/raco.vim
new file mode 100644
index 0000000000..bd10859aa9
--- /dev/null
+++ b/runtime/compiler/raco.vim
@@ -0,0 +1,14 @@
+" Vim compiler file
+" Compiler: raco (Racket command-line tools)
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" URL: https://github.com/benknoble/vim-racket
+" Last Change: 2022 Aug 12
+
+let current_compiler = 'raco'
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=raco
+CompilerSet errorformat=%f:%l:%c:%m
diff --git a/runtime/compiler/racomake.vim b/runtime/compiler/racomake.vim
new file mode 100644
index 0000000000..dae95fec42
--- /dev/null
+++ b/runtime/compiler/racomake.vim
@@ -0,0 +1,14 @@
+" Vim compiler file
+" Compiler: raco make (Racket command-line tools)
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" URL: https://github.com/benknoble/vim-racket
+" Last Change: 2022 Aug 12
+
+let current_compiler = 'racomake'
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=raco\ make\ --\ %
+CompilerSet errorformat=%f:%l:%c:%m
diff --git a/runtime/compiler/racosetup.vim b/runtime/compiler/racosetup.vim
new file mode 100644
index 0000000000..1efe8a15a2
--- /dev/null
+++ b/runtime/compiler/racosetup.vim
@@ -0,0 +1,14 @@
+" Vim compiler file
+" Compiler: raco setup (Racket command-line tools)
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" URL: https://github.com/benknoble/vim-racket
+" Last Change: 2022 Aug 12
+
+let current_compiler = 'racosetup'
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=raco\ setup
+CompilerSet errorformat=%f:%l:%c:%m
diff --git a/runtime/compiler/racotest.vim b/runtime/compiler/racotest.vim
new file mode 100644
index 0000000000..d2a1a3c0f3
--- /dev/null
+++ b/runtime/compiler/racotest.vim
@@ -0,0 +1,14 @@
+" Vim compiler file
+" Compiler: raco test (Racket command-line tools)
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" URL: https://github.com/benknoble/vim-racket
+" Last Change: 2022 Aug 12
+
+let current_compiler = 'racotest'
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=raco\ test\ %
+CompilerSet errorformat=location:%f:%l:%c
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index a388592981..00a3759936 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -750,7 +750,7 @@ nvim_eval_statusline({str}, {*opts}) *nvim_eval_statusline()*
• 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
+ statusline. When true, {winid} is ignored. Mutually
exclusive with {use_winbar}.
Return: ~
@@ -759,7 +759,7 @@ nvim_eval_statusline({str}, {*opts}) *nvim_eval_statusline()*
• width: (number) Display width of the statusline.
• highlights: Array containing highlight information of the
statusline. Only included when the "highlights" key in {opts} is
- |TRUE|. Each element of the array is a |Dictionary| with these keys:
+ true. Each element of the array is a |Dictionary| with these keys:
• start: (number) Byte index (0-based) of first character that uses
the highlight.
• group: (string) Name of highlight group.
@@ -1067,9 +1067,11 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
|api-fast|
Parameters: ~
- {button} Mouse button: one of "left", "right", "middle", "wheel".
+ {button} Mouse button: one of "left", "right", "middle", "wheel",
+ "move".
{action} For ordinary buttons, one of "press", "drag", "release".
For the wheel, one of "up", "down", "left", "right".
+ Ignored for "move".
{modifier} String of modifiers each represented by a single char. The
same specifiers are used as for a key press, except that
the "-" separator is optional, so "C-A-", "c-a" and "CA"
@@ -1839,13 +1841,14 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
• browse: (boolean) |:browse|.
• confirm: (boolean) |:confirm|.
• hide: (boolean) |:hide|.
+ • horizontal: (boolean) |:horizontal|.
• keepalt: (boolean) |:keepalt|.
• keepjumps: (boolean) |:keepjumps|.
• keepmarks: (boolean) |:keepmarks|.
• keeppatterns: (boolean) |:keeppatterns|.
• lockmarks: (boolean) |:lockmarks|.
• noswapfile: (boolean) |:noswapfile|.
- • tab: (integer) |:tab|.
+ • tab: (integer) |:tab|. -1 when omitted.
• verbose: (integer) |:verbose|. -1 when omitted.
• vertical: (boolean) |:vertical|.
• split: (string) Split modifier string, is an empty string when
@@ -2643,6 +2646,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
When a character is supplied it is used as |:syn-cchar|.
"hl_group" is used as highlight for the cchar if provided,
otherwise it defaults to |hl-Conceal|.
+ • spell: boolean indicating that spell checking should be
+ performed within this extmark
• ui_watched: boolean that indicates the mark should be
drawn by a UI. When set, the UI will receive win_extmark
events. Note: the mark is positioned by virt_text
@@ -2674,7 +2679,7 @@ nvim_get_namespaces() *nvim_get_namespaces()*
dict that maps from names to namespace ids.
*nvim_set_decoration_provider()*
-nvim_set_decoration_provider({ns_id}, {opts})
+nvim_set_decoration_provider({ns_id}, {*opts})
Set or change decoration provider for a namespace
This is a very general purpose interface for having lua callbacks being
@@ -2706,7 +2711,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
Parameters: ~
{ns_id} Namespace id from |nvim_create_namespace()|
- {opts} Callbacks invoked during redraw:
+ {opts} Table of callbacks:
• on_start: called first on each screen redraw ["start",
tick]
• on_buf: called for each buffer being redrawn (before window
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 63226fe701..7a2c540ea2 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -412,6 +412,8 @@ CmdwinLeave Before leaving the command-line window.
|cmdwin-char|
*ColorScheme*
ColorScheme After loading a color scheme. |:colorscheme|
+ Not triggered if the color scheme is not
+ found.
The pattern is matched against the
colorscheme name. <afile> can be used for the
name of the actual file where this option was
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 0be9e9b9d1..c70643d12c 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -6,9 +6,7 @@
Builtin functions *builtin-functions*
-1. Overview |builtin-function-list|
-2. Details |builtin-function-details|
-3. Matching a pattern in a String |string-match|
+ Type |gO| to see the table of contents.
==============================================================================
1. Overview *builtin-function-list*
@@ -400,6 +398,7 @@ setbufvar({buf}, {varname}, {val}) set {varname} in buffer {buf} to {val}
setcellwidths({list}) none set character cell width overrides
setcharpos({expr}, {list}) Number set the {expr} position to {list}
setcharsearch({dict}) Dict set character search from {dict}
+setcmdline({str} [, {pos}]) Number set command-line
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
@@ -527,6 +526,8 @@ 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
+virtcol2col({winid}, {lnum}, {col})
+ Number byte index of a character on screen
visualmode([expr]) String last visual mode used
wait({timeout}, {condition} [, {interval}])
Number Wait until {condition} is satisfied
@@ -784,7 +785,8 @@ browsedir({title}, {initdir})
browsing is not possible, an empty string is returned.
bufadd({name}) *bufadd()*
- Add a buffer to the buffer list with String {name}.
+ Add a buffer to the buffer list with name {name} (must be a
+ String).
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
@@ -835,7 +837,8 @@ 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.
+ then there is no change. If the buffer is not related to a
+ file the no file is read (e.g., when 'buftype' is "nofile").
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()|.
@@ -1027,7 +1030,7 @@ chanclose({id} [, {stream}]) *chanclose()*
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.
+ omitted.
chansend({id}, {data}) *chansend()*
Send data to channel {id}. For a job, it writes it to the
@@ -1136,6 +1139,9 @@ chdir({dir}) *chdir()*
" ... do some work
call chdir(save_dir)
endif
+
+< Can also be used as a |method|: >
+ GetDir()->chdir()
<
cindent({lnum}) *cindent()*
Get the amount of indent for line {lnum} according the C
@@ -1270,7 +1276,7 @@ complete_info([{what}]) *complete_info()*
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]
+ inserted Inserted string. [NOT IMPLEMENTED YET]
*complete_info_mode*
mode values are:
@@ -1526,6 +1532,18 @@ cursor({list})
Can also be used as a |method|: >
GetCursorPos()->cursor()
+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()
+
deepcopy({expr} [, {noref}]) *deepcopy()* *E698*
Make a copy of {expr}. For Numbers and Strings this isn't
different from using {expr} directly.
@@ -1967,18 +1985,6 @@ exp({expr}) *exp()*
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.
@@ -2010,6 +2016,8 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
a function
<SID> "<SNR>123_" where "123" is the
current script ID |<SID>|
+ <script> sourced script file, or script file
+ where the current function was defined
<stack> call stack
<cword> word under the cursor
<cWORD> WORD under the cursor
@@ -2043,6 +2051,9 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
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 'verbose' is set then expanding '%', '#' and <> items
+ will result in an error message if the argument cannot be
+ expanded.
When {string} does not start with '%', '#' or '<', it is
expanded like a file name is expanded on the command line.
@@ -2496,10 +2507,11 @@ funcref({name} [, {arglist}] [, {dict}])
Can also be used as a |method|: >
GetFuncname()->funcref([arg])
<
- *function()* *E700* *E922* *E923*
+ *function()* *partial* *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 be the name of 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}
@@ -2518,30 +2530,56 @@ function({name} [, {arglist}] [, {dict}])
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')
+< With a |method|: >
+ func Callback(one, two, three)
+ "...
+ let Partial = function('Callback', ['two'])
+ "...
+ eval 'one'->Partial('three')
+< Invokes the function as with: >
+ call Callback('one', 'two', 'three')
+
+< The function() call can be nested to add more arguments to the
+ Funcref. The extra arguments are appended to the list of
+ arguments. Example: >
+ func Callback(arg1, arg2, name)
+ "...
+ let Func = function('Callback', ['one'])
+ let Func2 = function(Func, ['two'])
+ "...
+ call Func2('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 use of function() is not needed when there are no extra
+ arguments, these two are equivalent, if Callback() is defined
+ as context.Callback(): >
+ let Func = function('Callback', context)
+ let Func = context.Callback
< 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)
@@ -2870,7 +2908,8 @@ getcmdcompltype() *getcmdcompltype()*
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()|.
+ Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
+ |setcmdline()|.
Returns an empty string when completion is not defined.
getcmdline() *getcmdline()*
@@ -2879,7 +2918,8 @@ getcmdline() *getcmdline()*
|c_CTRL-R_=|.
Example: >
:cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
-< Also see |getcmdtype()|, |getcmdpos()| and |setcmdpos()|.
+< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()| and
+ |setcmdline()|.
Returns an empty string when entering a password or using
|inputsecret()|.
@@ -2889,7 +2929,8 @@ getcmdpos() *getcmdpos()*
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()|.
+ Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
+ |setcmdline()|.
getcmdscreenpos() *getcmdscreenpos()*
Return the screen position of the cursor in the command line
@@ -2898,7 +2939,8 @@ getcmdscreenpos() *getcmdscreenpos()*
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()|.
+ Also see |getcmdpos()|, |setcmdpos()|, |getcmdline()| and
+ |setcmdline()|.
getcmdtype() *getcmdtype()*
Return the current command-line type. Possible return values
@@ -4963,7 +5005,7 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
highlighted matches. The dict can have the following members:
conceal Special character to show instead of the
- match (only for |hl-Conceal| highlighed
+ match (only for |hl-Conceal| highlighted
matches, see |:syn-cchar|)
window Instead of the current window use the
window with this number or window ID.
@@ -5580,12 +5622,19 @@ nvim_...({...}) *E5555* *nvim_...()* *eval-api*
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.
+ Also see `and()` and `xor()`.
Example: >
:let bits = or(bits, 0x80)
< Can also be used as a |method|: >
:let bits = bits->or(0x80)
-pathshorten({expr} [, {len}]) *pathshorten()*
+< Rationale: The reason this is a function and not using the "|"
+ character like many languages, is that Vi has always used "|"
+ to separate commands. In many places it would not be clear if
+ "|" is an operator or a command separator.
+
+
+pathshorten({path} [, {len}]) *pathshorten()*
Shorten directory names in the path {path} and return the
result. The tail, the file name, is kept as-is. The other
components in the path are reduced to {len} letters in length.
@@ -6417,8 +6466,10 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
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.
+ search starts one column after the start of the match. This
+ matters for overlapping matches. See |cpo-c|. You can also
+ insert "\ze" to change where the match ends, see |/\ze|.
+
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
@@ -6900,6 +6951,16 @@ setcharsearch({dict}) *setcharsearch()*
Can also be used as a |method|: >
SavedSearch()->setcharsearch()
+setcmdline({str} [, {pos}]) *setcmdline()*
+ Set the command line to {str} and set the cursor position to
+ {pos}.
+ If {pos} is omitted, the cursor is positioned after the text.
+ Returns 0 when successful, 1 when not editing the command
+ line.
+
+ Can also be used as a |method|: >
+ GetText()->setcmdline()
+
setcmdpos({pos}) *setcmdpos()*
Set the cursor position in the command line to byte position
{pos}. The first position is 1.
@@ -6912,8 +6973,8 @@ setcmdpos({pos}) *setcmdpos()*
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.
+ Returns 0 when successful, 1 when not editing the command
+ line.
Can also be used as a |method|: >
GetPos()->setcmdpos()
@@ -7697,14 +7758,13 @@ stdpath({what}) *stdpath()* *E6100*
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 String User data directory.
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.
+ drafts, undo, |shada|, etc.
Example: >
:echo stdpath("config")
@@ -8780,6 +8840,26 @@ virtcol({expr}) *virtcol()*
< Can also be used as a |method|: >
GetPos()->virtcol()
+virtcol2col({winid}, {lnum}, {col}) *virtcol2col()*
+ The result is a Number, which is the byte index of the
+ character in window {winid} at buffer line {lnum} and virtual
+ column {col}.
+
+ If {col} is greater than the last virtual column in line
+ {lnum}, then the byte index of the character at the last
+ virtual column is returned.
+
+ The {winid} argument can be the window number or the
+ |window-ID|. If this is zero, then the current window is used.
+
+ Returns -1 if the window {winid} doesn't exist or the buffer
+ line {lnum} or virtual column {col} is invalid.
+
+ See also |screenpos()|, |virtcol()| and |col()|.
+
+ Can also be used as a |method|: >
+ GetWinid()->virtcol2col(lnum, col)
+
visualmode([{expr}]) *visualmode()*
The result is a String, which describes the last Visual mode
used in the current buffer. Initially it returns an empty
@@ -9211,6 +9291,7 @@ writefile({object}, {fname} [, {flags}])
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.
+ Also see `and()` and `or()`.
Example: >
:let bits = xor(bits, 0x80)
<
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 29eff75bfa..f19671e713 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -881,7 +881,7 @@ Note: these are typed literally, they are not special keys!
file name of the sourced file. *E498*
When executing a function, is replaced with the call stack,
as with <stack> (this is for backwards compatibility, using
- <stack> is preferred).
+ <stack> or <script> is preferred).
Note that filename-modifiers are useless when <sfile> is
not used inside a script.
*:<stack>* *<stack>*
@@ -891,6 +891,12 @@ Note: these are typed literally, they are not special keys!
".." in between items. E.g.:
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
If there is no call stack you get error *E489* .
+ *:<script>* *<script>*
+ <script> When executing a `:source` command, is replaced with the file
+ name of the sourced file. When executing a function, is
+ replaced with the file name of the script where it is
+ defined.
+ If the file name cannot be determined you get error *E1274* .
*:<slnum>* *<slnum>*
<slnum> When executing a `:source` command, is replaced with the
line number. *E842*
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 376adfec7f..3e068e3b4e 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2309,397 +2309,10 @@ help file: |builtin-functions|.
5. Defining functions *user-function*
New functions can be defined. These can be called just like builtin
-functions. The function executes a sequence of Ex commands. Normal mode
-commands can be executed with the |:normal| command.
-
-The function name must start with an uppercase letter, to avoid confusion with
-builtin functions. To prevent from using the same name in different scripts
-avoid obvious, short names. A good habit is to start the function name with
-the name of the script, e.g., "HTMLcolor()".
-
-It's also possible to use curly braces, see |curly-braces-names|. And the
-|autoload| facility is useful to define a function only when it's called.
-
- *local-function*
-A function local to a script must start with "s:". A local script function
-can only be called from within the script and from functions, user commands
-and autocommands defined in the script. It is also possible to call the
-function from a mapping defined in the script, but then |<SID>| must be used
-instead of "s:" when the mapping is expanded outside of the script.
-There are only script-local functions, no buffer-local or window-local
-functions.
-
- *:fu* *:function* *E128* *E129* *E123*
-:fu[nction] List all functions and their arguments.
-
-:fu[nction][!] {name} List function {name}, annotated with line numbers
- unless "!" is given.
- {name} may be a |Dictionary| |Funcref| entry: >
- :function dict.init
-
-:fu[nction] /{pattern} List functions with a name matching {pattern}.
- Example that lists all functions ending with "File": >
- :function /File$
-<
- *:function-verbose*
-When 'verbose' is non-zero, listing a function will also display where it was
-last defined. Example: >
-
- :verbose function SetFileTypeSH
- function SetFileTypeSH(name)
- Last set from /usr/share/vim/vim-7.0/filetype.vim
-<
-See |:verbose-cmd| for more information.
-
- *E124* *E125* *E853* *E884*
-:fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure]
- Define a new function by the name {name}. The body of
- the function follows in the next lines, until the
- matching |:endfunction|.
-
- The name must be made of alphanumeric characters and
- '_', and must start with a capital or "s:" (see
- above). Note that using "b:" or "g:" is not allowed.
- (since patch 7.4.260 E884 is given if the function
- name has a colon in the name, e.g. for "foo:bar()".
- Before that patch no error was given).
-
- {name} can also be a |Dictionary| entry that is a
- |Funcref|: >
- :function dict.init(arg)
-< "dict" must be an existing dictionary. The entry
- "init" is added if it didn't exist yet. Otherwise [!]
- is required to overwrite an existing function. The
- result is a |Funcref| to a numbered function. The
- function can only be used with a |Funcref| and will be
- deleted if there are no more references to it.
- *E127* *E122*
- When a function by this name already exists and [!] is
- not used an error message is given. There is one
- exception: When sourcing a script again, a function
- that was previously defined in that script will be
- silently replaced.
- When [!] is used, an existing function is silently
- replaced. Unless it is currently being executed, that
- is an error.
- NOTE: Use ! wisely. If used without care it can cause
- an existing function to be replaced unexpectedly,
- which is hard to debug.
-
- For the {arguments} see |function-argument|.
-
- *:func-range* *a:firstline* *a:lastline*
- When the [range] argument is added, the function is
- expected to take care of a range itself. The range is
- passed as "a:firstline" and "a:lastline". If [range]
- is excluded, ":{range}call" will call the function for
- each line in the range, with the cursor on the start
- of each line. See |function-range-example|.
- The cursor is still moved to the first line of the
- range, as is the case with all Ex commands.
- *:func-abort*
- When the [abort] argument is added, the function will
- abort as soon as an error is detected.
- *:func-dict*
- When the [dict] argument is added, the function must
- be invoked through an entry in a |Dictionary|. The
- local variable "self" will then be set to the
- dictionary. See |Dictionary-function|.
- *:func-closure* *E932*
- When the [closure] argument is added, the function
- can access variables and arguments from the outer
- scope. This is usually called a closure. In this
- example Bar() uses "x" from the scope of Foo(). It
- remains referenced even after Foo() returns: >
- :function! Foo()
- : let x = 0
- : function! Bar() closure
- : let x += 1
- : return x
- : endfunction
- : return funcref('Bar')
- :endfunction
-
- :let F = Foo()
- :echo F()
-< 1 >
- :echo F()
-< 2 >
- :echo F()
-< 3
-
- *function-search-undo*
- The last used search pattern and the redo command "."
- will not be changed by the function. This also
- implies that the effect of |:nohlsearch| is undone
- when the function returns.
-
- *:endf* *:endfunction* *E126* *E193* *W22*
-:endf[unction] [argument]
- The end of a function definition. Best is to put it
- on a line by its own, without [argument].
-
- [argument] can be:
- | command command to execute next
- \n command command to execute next
- " comment always ignored
- anything else ignored, warning given when
- 'verbose' is non-zero
- The support for a following command was added in Vim
- 8.0.0654, before that any argument was silently
- ignored.
-
- To be able to define a function inside an `:execute`
- command, use line breaks instead of |:bar|: >
- :exe "func Foo()\necho 'foo'\nendfunc"
-<
- *:delf* *:delfunction* *E131* *E933*
-:delf[unction][!] {name}
- Delete function {name}.
- {name} can also be a |Dictionary| entry that is a
- |Funcref|: >
- :delfunc dict.init
-< This will remove the "init" entry from "dict". The
- function is deleted if there are no more references to
- it.
- With the ! there is no error if the function does not
- exist.
- *:retu* *:return* *E133*
-:retu[rn] [expr] Return from a function. When "[expr]" is given, it is
- evaluated and returned as the result of the function.
- If "[expr]" is not given, the number 0 is returned.
- When a function ends without an explicit ":return",
- the number 0 is returned.
- Note that there is no check for unreachable lines,
- thus there is no warning if commands follow ":return".
-
- If the ":return" is used after a |:try| 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 function. The function
- returns at the outermost ":endtry".
-
- *function-argument* *a:var*
-An argument can be defined by giving its name. In the function this can then
-be used as "a:name" ("a:" for argument).
- *a:0* *a:1* *a:000* *E740* *...*
-Up to 20 arguments can be given, separated by commas. After the named
-arguments an argument "..." can be specified, which means that more arguments
-may optionally be following. In the function the extra arguments can be used
-as "a:1", "a:2", etc. "a:0" is set to the number of extra arguments (which
-can be 0). "a:000" is set to a |List| that contains these arguments. Note
-that "a:1" is the same as "a:000[0]".
- *E742*
-The a: scope and the variables in it cannot be changed, they are fixed.
-However, if a composite type is used, such as |List| or |Dictionary| , you can
-change their contents. Thus you can pass a |List| to a function and have the
-function add an item to it. If you want to make sure the function cannot
-change a |List| or |Dictionary| use |:lockvar|.
-
-It is also possible to define a function without any arguments. You must
-still supply the () then.
-
-It is allowed to define another function inside a function body.
-
- *optional-function-argument*
-You can provide default values for positional named arguments. This makes
-them optional for function calls. When a positional argument is not
-specified at a call, the default expression is used to initialize it.
-This only works for functions declared with |function|, not for
-lambda expressions |expr-lambda|.
-
-Example: >
- function Something(key, value = 10)
- echo a:key .. ": " .. a:value
- endfunction
- call Something('empty') "empty: 10"
- call Something('key', 20) "key: 20"
-
-The argument default expressions are evaluated at the time of the function
-call, not definition. Thus it is possible to use an expression which is
-invalid the moment the function is defined. The expressions are also only
-evaluated when arguments are not specified during a call.
-
- *E989*
-Optional arguments with default expressions must occur after any mandatory
-arguments. You can use "..." after all optional named arguments.
-
-It is possible for later argument defaults to refer to prior arguments,
-but not the other way around. They must be prefixed with "a:", as with all
-arguments.
-
-Example that works: >
- :function Okay(mandatory, optional = a:mandatory)
- :endfunction
-Example that does NOT work: >
- :function NoGood(first = a:second, second = 10)
- :endfunction
-<
-When not using "...", the number of arguments in a function call must be at
-least equal to the number of mandatory named arguments. When using "...", the
-number of arguments may be larger than the total of mandatory and optional
-arguments.
-
- *local-variables*
-Inside a function local variables can be used. These will disappear when the
-function returns. Global variables need to be accessed with "g:".
-
-Example: >
- :function Table(title, ...)
- : echohl Title
- : echo a:title
- : echohl None
- : echo a:0 .. " items:"
- : for s in a:000
- : echon ' ' .. s
- : endfor
- :endfunction
-
-This function can then be called with: >
- call Table("Table", "line1", "line2")
- call Table("Empty Table")
-
-To return more than one value, return a |List|: >
- :function Compute(n1, n2)
- : if a:n2 == 0
- : return ["fail", 0]
- : endif
- : return ["ok", a:n1 / a:n2]
- :endfunction
-
-This function can then be called with: >
- :let [success, div] = Compute(102, 6)
- :if success == "ok"
- : echo div
- :endif
-<
- *:cal* *:call* *E107* *E117*
-:[range]cal[l] {name}([arguments])
- Call a function. The name of the function and its arguments
- are as specified with `:function`. Up to 20 arguments can be
- used. The returned value is discarded.
- Without a range and for functions that accept a range, the
- function is called once. When a range is given the cursor is
- positioned at the start of the first line before executing the
- function.
- When a range is given and the function doesn't handle it
- itself, the function is executed for each line in the range,
- with the cursor in the first column of that line. The cursor
- is left at the last line (possibly moved by the last function
- call). The arguments are re-evaluated for each line. Thus
- this works:
- *function-range-example* >
- :function Mynumber(arg)
- : echo line(".") .. " " .. a:arg
- :endfunction
- :1,5call Mynumber(getline("."))
-<
- The "a:firstline" and "a:lastline" are defined anyway, they
- can be used to do something different at the start or end of
- the range.
-
- Example of a function that handles the range itself: >
-
- :function Cont() range
- : execute (a:firstline + 1) .. "," .. a:lastline .. 's/^/\t\\ '
- :endfunction
- :4,8call Cont()
-<
- This function inserts the continuation character "\" in front
- of all the lines in the range, except the first one.
-
- When the function returns a composite value it can be further
- dereferenced, but the range will not be used then. Example: >
- :4,8call GetDict().method()
-< Here GetDict() gets the range but method() does not.
-
- *E132*
-The recursiveness of user functions is restricted with the |'maxfuncdepth'|
-option.
-
-It is also possible to use `:eval`. It does not support a range, but does
-allow for method chaining, e.g.: >
- eval GetList()->Filter()->append('$')
+functions. The function takes arguments, executes a sequence of Ex commands
+and can return a value.
-
-AUTOMATICALLY LOADING FUNCTIONS ~
- *autoload-functions*
-When using many or large functions, it's possible to automatically define them
-only when they are used. There are two methods: with an autocommand and with
-the "autoload" directory in 'runtimepath'.
-
-
-Using an autocommand ~
-
-This is introduced in the user manual, section |41.14|.
-
-The autocommand is useful if you have a plugin that is a long Vim script file.
-You can define the autocommand and quickly quit the script with `:finish`.
-That makes Vim startup faster. The autocommand should then load the same file
-again, setting a variable to skip the `:finish` command.
-
-Use the FuncUndefined autocommand event with a pattern that matches the
-function(s) to be defined. Example: >
-
- :au FuncUndefined BufNet* source ~/vim/bufnetfuncs.vim
-
-The file "~/vim/bufnetfuncs.vim" should then define functions that start with
-"BufNet". Also see |FuncUndefined|.
-
-
-Using an autoload script ~
- *autoload* *E746*
-This is introduced in the user manual, section |41.15|.
-
-Using a script in the "autoload" directory is simpler, but requires using
-exactly the right file name. A function that can be autoloaded has a name
-like this: >
-
- :call filename#funcname()
-
-When such a function is called, and it is not defined yet, Vim will search the
-"autoload" directories in 'runtimepath' for a script file called
-"filename.vim". For example "~/.config/nvim/autoload/filename.vim". That
-file should then define the function like this: >
-
- function filename#funcname()
- echo "Done!"
- endfunction
-
-The file name and the name used before the # in the function must match
-exactly, and the defined function must have the name exactly as it will be
-called.
-
-It is possible to use subdirectories. Every # in the function name works like
-a path separator. Thus when calling a function: >
-
- :call foo#bar#func()
-
-Vim will look for the file "autoload/foo/bar.vim" in 'runtimepath'.
-
-This also works when reading a variable that has not been set yet: >
-
- :let l = foo#bar#lvar
-
-However, when the autoload script was already loaded it won't be loaded again
-for an unknown variable.
-
-When assigning a value to such a variable nothing special happens. This can
-be used to pass settings to the autoload script before it's loaded: >
-
- :let foo#bar#toggle = 1
- :call foo#bar#func()
-
-Note that when you make a mistake and call a function that is supposed to be
-defined in an autoload script, but the script doesn't actually define the
-function, you will get an error message for the missing function. If you fix
-the autoload script it won't be automatically loaded again. Either restart
-Vim or manually source the script.
-
-Also note that if you have two script files, and one calls a function in the
-other and vice versa, before the used function is defined, it won't work.
-Avoid using the autoload functionality at the toplevel.
+You can find most information about defining functions in |userfunc.txt|.
==============================================================================
6. Curly braces names *curly-braces-names*
@@ -3167,6 +2780,9 @@ text...
iterate over. Unlike with |List|, modifying the
|Blob| does not affect the iteration.
+ When {object} is a |String| each item is a string with
+ one character, plus any combining characters.
+
:for [{var1}, {var2}, ...] in {listlist}
:endfo[r]
Like `:for` above, but each item in {listlist} must be
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 7fff74a963..9f8ef248f8 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -586,12 +586,12 @@ Local mappings:
to the end of the file in Normal mode. This means "> " is inserted in
each line.
-MAN *ft-man-plugin* *:Man* *man.vim*
+MAN *ft-man-plugin* *:Man* *man.lua*
View manpages in Nvim. Supports highlighting, completion, locales, and
navigation. Also see |find-manpage|.
-man.vim will always attempt to reuse the closest man window (above/left) but
+man.lua will always attempt to reuse the closest man window (above/left) but
otherwise create a split.
The case sensitivity of completion is controlled by 'fileignorecase'.
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 04e31e0680..34213f7512 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -131,6 +131,7 @@ Advanced editing ~
|autocmd.txt| automatically executing commands on an event
|eval.txt| expression evaluation, conditional commands
|builtin.txt| builtin functions
+|userfunc.txt| defining user 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/indent.txt b/runtime/doc/indent.txt
index 1a1d8e30b0..c5411b5f16 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -979,25 +979,38 @@ indentation: >
PYTHON *ft-python-indent*
The amount of indent can be set for the following situations. The examples
-given are the defaults. Note that the variables are set to an expression, so
-that you can change the value of 'shiftwidth' later.
+given are the defaults. Note that the dictionary values are set to an
+expression, so that you can change the value of 'shiftwidth' later.
Indent after an open paren: >
- let g:pyindent_open_paren = 'shiftwidth() * 2'
+ let g:python_indent.open_paren = 'shiftwidth() * 2'
Indent after a nested paren: >
- let g:pyindent_nested_paren = 'shiftwidth()'
+ let g:python_indent.nested_paren = 'shiftwidth()'
Indent for a continuation line: >
- let g:pyindent_continue = 'shiftwidth() * 2'
+ let g:python_indent.continue = 'shiftwidth() * 2'
+
+By default, the closing paren on a multiline construct lines up under the first
+non-whitespace character of the previous line.
+If you prefer that it's lined up under the first character of the line that
+starts the multiline construct, reset this key: >
+ let g:python_indent.closed_paren_align_last_line = v:false
The method uses |searchpair()| to look back for unclosed parentheses. This
can sometimes be slow, thus it timeouts after 150 msec. If you notice the
indenting isn't correct, you can set a larger timeout in msec: >
- let g:pyindent_searchpair_timeout = 500
+ let g:python_indent.searchpair_timeout = 500
If looking back for unclosed parenthesis is still too slow, especially during
a copy-paste operation, or if you don't need indenting inside multi-line
parentheses, you can completely disable this feature: >
- let g:pyindent_disable_parentheses_indenting = 1
+ let g:python_indent.disable_parentheses_indenting = 1
+
+For backward compatibility, these variables are also supported: >
+ g:pyindent_open_paren
+ g:pyindent_nested_paren
+ g:pyindent_continue
+ g:pyindent_searchpair_timeout
+ g:pyindent_disable_parentheses_indenting
R *ft-r-indent*
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 7fc0daa0ca..00aaf759e2 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -126,13 +126,14 @@ FAQ *lsp-faq*
"after/ftplugin/python.vim".
- Q: How do I run a request synchronously (e.g. for formatting on file save)?
- A: Use the `_sync` variant of the function provided by |lsp-buf|, if it
- exists.
+ A: Check if the function has an `async` parameter and set the value to
+ false.
E.g. code formatting: >
" Auto-format *.rs (rust) files prior to saving them
- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
+ " (async = false is the default for format)
+ autocmd BufWritePre *.rs lua vim.lsp.buf.format({ async = false })
<
*lsp-vs-treesitter*
@@ -468,7 +469,7 @@ LspCodeLens
|nvim_buf_set_extmark()|.
LspCodeLensSeparator *hl-LspCodeLensSeparator*
- Used to color the separator between two or more code lens.
+ Used to color the separator between two or more code lenses.
*lsp-highlight-signature*
@@ -825,7 +826,7 @@ start({config}, {opts}) *vim.lsp.start()*
re-uses a client if name and root_dir matches.
Return: ~
- (number) client_id
+ (number|nil) client_id
start_client({config}) *vim.lsp.start_client()*
Starts and initializes a client with the given configuration.
@@ -835,9 +836,16 @@ start_client({config}) *vim.lsp.start_client()*
The following parameters describe fields in the {config} table.
Parameters: ~
- {cmd} (required, string or list treated like
- |jobstart()|) Base command that initiates the LSP
- client.
+ {cmd} (table|string|fun(dispatchers: table):table)
+ command string or list treated like |jobstart|.
+ The command must launch the language server
+ process. `cmd` can also be a function that
+ creates an RPC client. The function receives a
+ dispatchers table and must return a table with
+ the functions `request`, `notify`, `is_closing`
+ and `terminate` See |vim.lsp.rpc.request| and
+ |vim.lsp.rpc.notify| For TCP there is a built-in
+ rpc client factory: |vim.lsp.rpc.connect|
{cmd_cwd} (string, default=|getcwd()|) Directory to launch
the `cmd` process. Not related to `root_dir`.
{cmd_env} (table) Environment flags to pass to the LSP on
@@ -1128,6 +1136,11 @@ format({options}) *vim.lsp.buf.format()*
ID (client.id) matching this field.
• name (string|nil): Restrict formatting to the client with
name (client.name) matching this field.
+ • range (table|nil) Range to format. Table must contain
+ `start` and `end` keys with {row, col} tuples using (1,0)
+ indexing. Defaults to current selection in visual mode
+ Defaults to `nil` in other modes, formatting the full
+ buffer
formatting({options}) *vim.lsp.buf.formatting()*
Formats the current buffer.
@@ -1890,6 +1903,17 @@ should_log({level}) *vim.lsp.log.should_log()*
==============================================================================
Lua module: vim.lsp.rpc *lsp-rpc*
+connect({host}, {port}) *vim.lsp.rpc.connect()*
+ Create a LSP RPC client factory that connects via TCP to the given host
+ and port
+
+ Parameters: ~
+ {host} (string)
+ {port} (number)
+
+ Return: ~
+ (function)
+
format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()*
Constructs an error message from an LSP error object.
@@ -1904,7 +1928,7 @@ notify({method}, {params}) *vim.lsp.rpc.notify()*
Parameters: ~
{method} (string) The invoked LSP method
- {params} (table): Parameters for the invoked LSP method
+ {params} (table|nil): Parameters for the invoked LSP method
Return: ~
(bool) `true` if notification could be sent, `false` if not
@@ -1915,7 +1939,8 @@ request({method}, {params}, {callback}, {notify_reply_callback})
Parameters: ~
{method} (string) The invoked LSP method
- {params} (table) Parameters for the invoked LSP method
+ {params} (table|nil) Parameters for the invoked LSP
+ method
{callback} (function) Callback to invoke
{notify_reply_callback} (function|nil) Callback to invoke as soon as
a request is no longer pending
@@ -1937,8 +1962,9 @@ rpc_response_error({code}, {message}, {data})
*vim.lsp.rpc.start()*
start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
Starts an LSP server process and create an LSP RPC client object to
- interact with it. Communication with the server is currently limited to
- stdio.
+ interact with it. Communication with the spawned process happens via
+ stdio. For communication via TCP, spawn a process manually and use
+ |vim.lsp.rpc.connect|
Parameters: ~
{cmd} (string) Command to start the LSP server.
@@ -1962,11 +1988,8 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
Methods:
• `notify()` |vim.lsp.rpc.notify()|
• `request()` |vim.lsp.rpc.request()|
-
- Members:
- • {pid} (number) The LSP server's PID.
- • {handle} A handle for low-level interaction with the LSP server
- process |vim.loop|.
+ • `is_closing()` returns a boolean indicating if the RPC is closing.
+ • `terminate()` terminates the RPC client.
==============================================================================
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 42f3a5e432..35badb13b1 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -881,6 +881,22 @@ vim.str_byteindex({str}, {index} [, {use_utf16}]) *vim.str_byteindex()*
An {index} in the middle of a UTF-16 sequence is rounded upwards to
the end of that sequence.
+vim.iconv({str}, {from}, {to}[, {opts}]) *vim.iconv()*
+ The result is a String, which is the text {str} converted from
+ encoding {from} to encoding {to}. When the conversion fails `nil` is
+ returned. When 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".
+
+ Parameters: ~
+ {str} (string) Text to convert
+ {from} (string) Encoding of {str}
+ {to} (string) Target encoding
+
+ Returns: ~
+ Converted string if conversion succeeds, `nil` otherwise.
+
vim.schedule({callback}) *vim.schedule()*
Schedules {callback} to be invoked soon by the main event-loop. Useful
to avoid |textlock| or other temporary restrictions.
@@ -951,6 +967,37 @@ vim.wait({time} [, {callback}, {interval}, {fast_only}]) *vim.wait()*
end
<
+vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()*
+ Attach to ui events, similar to |nvim_ui_attach()| but receive events
+ as lua callback. Can be used to implement screen elements like
+ popupmenu or message handling in lua.
+
+ {options} should be a dictionary-like table, where `ext_...` options should
+ be set to true to receive events for the respective external element.
+
+ {callback} receives event name plus additional parameters. See |ui-popupmenu|
+ and the sections below for event format for respective events.
+
+ Example (stub for a |ui-popupmenu| implementation): >
+
+ ns = vim.api.nvim_create_namespace('my_fancy_pum')
+
+ vim.ui_attach(ns, {ext_popupmenu=true}, function(event, ...)
+ if event == "popupmenu_show" then
+ local items, selected, row, col, grid = ...
+ print("display pum ", #items)
+ elseif event == "popupmenu_select" then
+ local selected = ...
+ print("selected", selected)
+ elseif event == "popupmenu_hide" then
+ print("FIN")
+ end
+ end)
+
+vim.ui_detach({ns}) *vim.ui_detach()*
+ Detach a callback previously attached with |vim.ui_attach()| for the
+ given namespace {ns}.
+
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
@@ -1075,17 +1122,13 @@ vim.env *vim.env*
print(vim.env.TERM)
<
+ *lua-options*
*lua-vim-options*
- *lua-vim-opt*
*lua-vim-set*
- *lua-vim-optlocal*
*lua-vim-setlocal*
-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
-from within Lua.
+Vim options can be accessed through |vim.o|, which behaves like Vimscript
+|:set|.
Examples: ~
@@ -1094,62 +1137,145 @@ from within Lua.
`set number`
In Lua:
- `vim.opt.number = true`
+ `vim.o.number = true`
- To set an array of values:
+ To set a string value:
In Vimscript:
`set wildignore=*.o,*.a,__pycache__`
- In Lua, there are two ways you can do this now. One is very similar to
- the Vimscript form:
- `vim.opt.wildignore = '*.o,*.a,__pycache__'`
+ In Lua:
+ `vim.o.wildignore = '*.o,*.a,__pycache__'`
+
+Similarly, there exist |vim.bo| and |vim.wo| for setting buffer-local and
+window-local options, respectively, similarly to |:setlocal|. There is also
+|vim.go| that only sets the global value of a |global-local| option, see
+|:setglobal|. The following table summarizes this relation.
+
+ lua command global_value local_value ~
+vim.o :set set set
+vim.bo/vim.wo :setlocal - set
+vim.go :setglobal set -
+
+
+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)
+ print(vim.o.foo) -- error: invalid key
+<
+vim.go *vim.go*
+ Get or set an |option|. Invalid key is an error.
- However, vim.opt also supports a more elegent way of setting
- list-style options by using lua tables:
+ This is a wrapper around |nvim_set_option_value()| and
+ |nvim_get_option_value()|.
+
+ NOTE: This is different from |vim.o| because this ONLY sets the global
+ option, which generally produces confusing behavior for options with
+ |global-local| values.
+
+ Example: >
+ vim.go.cmdheight = 4
+ print(vim.go.columns)
+ print(vim.go.bar) -- error: invalid key
+<
+vim.bo[{bufnr}] *vim.bo*
+ Get or set buffer-scoped |local-options| for the buffer with number {bufnr}.
+ If [{bufnr}] is omitted, use the current buffer. Invalid {bufnr} or key is
+ an error.
+
+ This is a wrapper around |nvim_set_option_value()| and
+ |nvim_get_option_value()| with `opts = {scope = local, buf = bufnr}` .
+
+ Example: >
+ local bufnr = vim.api.nvim_get_current_buf()
+ vim.bo[bufnr].buflisted = true -- same as vim.bo.buflisted = true
+ print(vim.bo.comments)
+ print(vim.bo.baz) -- error: invalid key
+<
+vim.wo[{winid}] *vim.wo*
+ Get or set window-scoped |local-options| for the window with handle {winid}.
+ If [{winid}] is omitted, use the current window. Invalid {winid} or key
+ is an error.
+
+ This is a wrapper around |nvim_set_option_value()| and
+ |nvim_get_option_value()| with `opts = {scope = local, win = winid}` .
+
+ Example: >
+ local winid = vim.api.nvim_get_current_win()
+ vim.wo[winid].number = true -- same as vim.wo.number = true
+ print(vim.wo.foldmarker)
+ print(vim.wo.quux) -- error: invalid key
+<
+
+
+
+ *lua-vim-opt*
+ *lua-vim-optlocal*
+ *lua-vim-optglobal*
+ *vim.opt*
+
+
+A special interface |vim.opt| exists for conveniently interacting with list-
+and map-style option from Lua: It allows accessing them as Lua tables and
+offers object-oriented method for adding and removing entries.
+
+ Examples: ~
+
+ The following methods of setting a list-style option are equivalent:
+ In Vimscript:
+ `set wildignore=*.o,*.a,__pycache__`
+
+ In Lua using `vim.o`:
+ `vim.o.wildignore = '*.o,*.a,__pycache__'`
+
+ In Lua using `vim.opt`:
`vim.opt.wildignore = { '*.o', '*.a', '__pycache__' }`
To replicate the behavior of |:set+=|, use: >
- -- vim.opt supports appending options via the "+" operator
- vim.opt.wildignore = vim.opt.wildignore + { "*.pyc", "node_modules" }
-
- -- 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
- vim.opt.wildignore = vim.opt.wildignore ^ { "new_first_value" }
-
- -- or using the `:prepend(...)` method
vim.opt.wildignore:prepend { "new_first_value" }
<
To replicate the behavior of |:set-=|, use: >
- -- vim.opt supports removing options via the "-" operator
- vim.opt.wildignore = vim.opt.wildignore - { "node_modules" }
-
- -- or using the `:remove(...)` method
vim.opt.wildignore:remove { "node_modules" }
<
- To set a map of values:
+ The following methods of setting a map-style option are equivalent:
In Vimscript:
`set listchars=space:_,tab:>~`
- In Lua:
+ In Lua using `vim.o`:
+ `vim.o.listchars = 'space:_,tab:>~'`
+
+ In Lua using `vim.opt`:
`vim.opt.listchars = { space = '_', tab = '>~' }`
+Note that |vim.opt| returns an `Option` object, not the value of the option,
+which is accessed through |Option:get()|:
+
+ Examples: ~
+
+ The following methods of getting a list-style option are equivalent:
+ In Vimscript:
+ `echo wildignore`
+
+ In Lua using `vim.o`:
+ `print(vim.o.wildignore)`
+
+ In Lua using `vim.opt`:
+ `vim.pretty_print(vim.opt.wildignore:get())`
+
+
In any of the above examples, to replicate the behavior |setlocal|, use
`vim.opt_local`. Additionally, to replicate the behavior of |setglobal|, use
`vim.opt_global`.
- *vim.opt*
-
-|vim.opt| returns an Option object.
-
-For example: `local listchar_object = vim.opt.listchars`
-An `Option` has the following methods:
*vim.opt:get()*
@@ -1162,7 +1288,7 @@ Option:get()
the values as entries in the array: >
vim.cmd [[set wildignore=*.pyc,*.o]]
- print(vim.inspect(vim.opt.wildignore:get()))
+ vim.pretty_print(vim.opt.wildignore:get())
-- { "*.pyc", "*.o", }
for _, ignore_pattern in ipairs(vim.opt.wildignore:get()) do
@@ -1175,7 +1301,7 @@ Option:get()
the names as keys and the values as entries: >
vim.cmd [[set listchars=space:_,tab:>~]]
- print(vim.inspect(vim.opt.listchars:get()))
+ vim.pretty_print(vim.opt.listchars:get())
-- { space = "_", tab = ">~", }
for char, representation in pairs(vim.opt.listchars:get()) do
@@ -1186,7 +1312,7 @@ Option:get()
as keys and `true` as entries. >
vim.cmd [[set formatoptions=njtcroql]]
- print(vim.inspect(vim.opt.formatoptions:get()))
+ vim.pretty_print(vim.opt.formatoptions:get())
-- { n = true, j = true, c = true, ... }
local format_opts = vim.opt.formatoptions:get()
@@ -1222,71 +1348,6 @@ Option:remove(value)
`vim.opt.wildignore = vim.opt.wildignore - '*.pyc'`
-In general, using `vim.opt` will provide the expected result when the user is
-used to interacting with editor |options| via `set`. There are still times
-where the user may want to set particular options via a shorthand in Lua,
-which is where |vim.o|, |vim.bo|, |vim.wo|, and |vim.go| come into play.
-
-The behavior of |vim.o|, |vim.bo|, |vim.wo|, and |vim.go| is designed to
-follow that of |:set|, |:setlocal|, and |:setglobal| which can be seen in the
-table below:
-
- lua command global_value local_value ~
-vim.o :set set set
-vim.bo/vim.wo :setlocal - set
-vim.go :setglobal set -
-
-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)
- print(vim.o.foo) -- error: invalid key
-<
-vim.go *vim.go*
- Get or set an |option|. Invalid key is an error.
-
- This is a wrapper around |nvim_set_option_value()| and
- |nvim_get_option_value()|.
-
- NOTE: This is different from |vim.o| because this ONLY sets the global
- option, which generally produces confusing behavior for options with
- |global-local| values.
-
- Example: >
- vim.go.cmdheight = 4
- print(vim.go.columns)
- print(vim.go.bar) -- error: invalid key
-<
-vim.bo[{bufnr}] *vim.bo*
- Get or set buffer-scoped |local-options| for the buffer with number {bufnr}.
- If [{bufnr}] is omitted, use the current buffer. Invalid {bufnr} or key is
- an error.
-
- This is a wrapper around |nvim_set_option_value()| and
- |nvim_get_option_value()| with `opts = {scope = local, buf = bufnr}` .
-
- Example: >
- local bufnr = vim.api.nvim_get_current_buf()
- vim.bo[bufnr].buflisted = true -- same as vim.bo.buflisted = true
- print(vim.bo.comments)
- print(vim.bo.baz) -- error: invalid key
-<
-vim.wo[{winid}] *vim.wo*
- Get or set window-scoped |local-options| for the window with handle {winid}.
- If [{winid}] is omitted, use the current window. Invalid {winid} or key
- is an error.
-
- This is a wrapper around |nvim_set_option_value()| and
- |nvim_get_option_value()| with `opts = {scope = local, win = winid}` .
-
- Example: >
- local winid = vim.api.nvim_get_current_win()
- vim.wo[winid].number = true -- same as vim.wo.number = true
- print(vim.wo.foldmarker)
- print(vim.wo.quux) -- error: invalid key
-<
==============================================================================
Lua module: vim *lua-vim*
@@ -1520,6 +1581,28 @@ deepcopy({orig}) *vim.deepcopy()*
Return: ~
(table) Table of copied keys and (nested) values.
+defaulttable({create}) *vim.defaulttable()*
+ Creates a table whose members are automatically created when accessed, if
+ they don't already exist.
+
+ They mimic defaultdict in python.
+
+ If `create` is `nil`, this will create a defaulttable whose constructor
+ function is this function, effectively allowing to create nested tables on
+ the fly:
+>
+
+ local a = vim.defaulttable()
+ a.b.c = 1
+<
+
+ Parameters: ~
+ {create} (function|nil) The function called to create a missing
+ value.
+
+ Return: ~
+ (table) Empty table with metamethod
+
endswith({s}, {suffix}) *vim.endswith()*
Tests if `s` ends with `suffix`.
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index ca1ddaabd4..da6a305e89 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1623,11 +1623,11 @@ The valid escape sequences are
*<mods>* *<q-mods>* *:command-modifiers*
<mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
- |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
- |:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
- |:lockmarks|, |:noautocmd|, |:noswapfile| |:rightbelow|,
- |:sandbox|, |:silent|, |:tab|, |:topleft|, |:unsilent|,
- |:verbose|, and |:vertical|.
+ |:botright|, |:browse|, |:confirm|, |:hide|, |:horizontal|,
+ |:keepalt|, |:keepjumps|, |:keepmarks|, |:keeppatterns|,
+ |:leftabove|, |:lockmarks|, |:noautocmd|, |:noswapfile|
+ |:rightbelow|, |:sandbox|, |:silent|, |:tab|, |:topleft|,
+ |:unsilent|, |:verbose|, and |:vertical|.
Note that |:filter| is not supported.
Examples: >
command! -nargs=+ -complete=file MyEdit
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2e0c1f8cc4..110f7400e6 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2454,28 +2454,30 @@ A jump table for the options with a short description can be found at |Q_op|.
*'fillchars'* *'fcs'*
'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:
+ Characters to fill the statuslines, vertical separators and special
+ lines in the window.
+ It is a comma-separated list of items. Each item has a name, a colon
+ and the value of that item:
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
+ stl ' ' or '^' statusline of the current window
+ stlnc ' ' or '=' statusline of the non-current windows
+ wbr ' ' window bar
+ horiz '─' or '-' horizontal separators |:split|
+ horizup '┴' or '-' upwards facing horizontal separator
+ horizdown '┬' or '-' downwards facing horizontal separator
+ vert '│' or '|' vertical separators |:vsplit|
+ vertleft '┤' or '|' left facing vertical separator
+ vertright '├' or '|' right facing vertical separator
+ verthoriz '┼' 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
- foldsep:c '│' or '|' open fold middle marker
- diff:c '-' deleted lines of the 'diff' option
- msgsep:c ' ' message separator 'display'
- eob:c '~' empty lines at the end of a buffer
+ fold '·' or '-' filling 'foldtext'
+ foldopen '-' mark the beginning of a fold
+ foldclose '+' show a closed fold
+ foldsep '│' or '|' open fold middle marker
+ diff '-' deleted lines of the 'diff' option
+ msgsep ' ' message separator 'display'
+ eob '~' empty lines at the end of a buffer
Any one that is omitted will fall back to the default. For "stl" and
"stlnc" the space will be used when there is highlighting, '^' or '='
@@ -2500,19 +2502,19 @@ A jump table for the options with a short description can be found at |Q_op|.
The highlighting used for these items:
item highlight group ~
- stl:c StatusLine |hl-StatusLine|
- stlnc:c StatusLineNC |hl-StatusLineNC|
- 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|
+ stl StatusLine |hl-StatusLine|
+ stlnc StatusLineNC |hl-StatusLineNC|
+ wbr WinBar |hl-WinBar| or |hl-WinBarNC|
+ horiz WinSeparator |hl-WinSeparator|
+ horizup WinSeparator |hl-WinSeparator|
+ horizdown WinSeparator |hl-WinSeparator|
+ vert WinSeparator |hl-WinSeparator|
+ vertleft WinSeparator |hl-WinSeparator|
+ vertright WinSeparator |hl-WinSeparator|
+ verthoriz WinSeparator |hl-WinSeparator|
+ fold Folded |hl-Folded|
+ diff DiffDelete |hl-DiffDelete|
+ eob EndOfBuffer |hl-EndOfBuffer|
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
'fixendofline' 'fixeol' boolean (default on)
@@ -4229,6 +4231,15 @@ 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.
+ *'mousemoveevent'* *'mousemev'*
+'mousemoveevent' 'mousemev' boolean (default off)
+ global
+ When on, mouse move events are delivered to the input queue and are
+ available for mapping. The default, off, avoids the mouse movement
+ overhead except when needed.
+ Warning: Setting this option can make pending mappings to be aborted
+ when the mouse is moved.
+
*'mousescroll'*
'mousescroll' string (default "ver:3,hor:6")
global
@@ -5860,10 +5871,14 @@ A jump table for the options with a short description can be found at |Q_op|.
'spelloptions' 'spo' string (default "")
local to buffer
A comma-separated list of options for spell checking:
- camel When a word is CamelCased, assume "Cased" is a
+ 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
start of a new word.
+ noplainbuffer Only spellcheck a buffer when 'syntax' is enabled,
+ or when extmarks are set within the buffer. Only
+ designated regions of the buffer are spellchecked in
+ this case.
*'spellsuggest'* *'sps'*
'spellsuggest' 'sps' string (default "best")
@@ -6938,15 +6953,18 @@ A jump table for the options with a short description can be found at |Q_op|.
*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
'wildmenu' 'wmnu' boolean (default on)
global
- Enables "enhanced mode" of command-line completion. When user hits
- <Tab> (or 'wildchar') to invoke completion, the possible matches are
- shown in a menu just above the command-line (see 'wildoptions'), with
- the first match highlighted (overwriting the statusline). Keys that
- show the previous/next match (<Tab>/CTRL-P/CTRL-N) highlight the
- match.
+ When 'wildmenu' is on, command-line completion operates in an enhanced
+ mode. On pressing 'wildchar' (usually <Tab>) to invoke completion,
+ the possible matches are shown.
+ When 'wildoptions' contains "pum", then the completion matches are
+ shown in a popup menu. Otherwise they are displayed just above the
+ command line, with the first match highlighted (overwriting the status
+ line, if there is one).
+ Keys that show the previous/next match, such as <Tab> or
+ CTRL-P/CTRL-N, cause the highlight to move to the appropriate match.
'wildmode' must specify "full": "longest" and "list" do not start
'wildmenu' mode. You can check the current mode with |wildmenumode()|.
- The menu is canceled when a key is hit that is not used for selecting
+ The menu is cancelled when a key is hit that is not used for selecting
a completion.
While the menu is active these keys have special meanings:
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 6f16db5cc2..9f3993506a 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -649,6 +649,7 @@ Short explanation of each option: *option-list*
'complete' 'cpt' specify how Insert mode completion works
'completefunc' 'cfu' function to be used for Insert mode completion
'completeopt' 'cot' options for Insert mode completion
+'completeslash' 'csl' like 'shellslash' for completion
'concealcursor' 'cocu' whether concealable text is hidden in cursor line
'conceallevel' 'cole' whether concealable text is shown or hidden
'confirm' 'cf' ask what to do about unsaved/read-only files
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index b74611633f..6fcf292513 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -181,16 +181,16 @@ Vim will only load the first syntax file found, assuming that it sets
b:current_syntax.
-NAMING CONVENTIONS *group-name* *{group-name}* *E669* *W18*
+NAMING CONVENTIONS *group-name* *{group-name}* *E669* *E5248*
A syntax group name is to be used for syntax items that match the same kind of
thing. These are then linked to a highlight group that specifies the color.
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. The maximum length of a group name is
-about 200 bytes. *E1249*
+The name for a highlight or syntax group must consist of ASCII letters,
+digits, underscores, periods and `@` characters. As a regexp it is
+`[a-zA-Z0-9_.@]*`. 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.
diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt
index 2485290667..82deb0fa0c 100644
--- a/runtime/doc/tagsrch.txt
+++ b/runtime/doc/tagsrch.txt
@@ -870,13 +870,15 @@ like |CTRL-]|.
The function used for generating the taglist is specified by setting the
'tagfunc' option. The function will be called with three arguments:
- a:pattern The tag identifier or pattern used during the tag search.
- a:flags String containing flags to control the function behavior.
- a:info Dict containing the following entries:
+ pattern The tag identifier or pattern used during the tag search.
+ flags String containing flags to control the function behavior.
+ info Dict containing the following entries:
buf_ffname Full filename which can be used for priority.
user_data Custom data String, if stored in the tag
stack previously by tagfunc.
+Note that "a:" needs to be prepended to the argument name when using it.
+
Currently up to three flags may be passed to the tag function:
'c' The function was invoked by a normal command being processed
(mnemonic: the tag function may use the context around the
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 52531a1525..491aea793c 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -187,6 +187,11 @@ Note: The predicates listed in the web page above differ from those Neovim
supports. See |lua-treesitter-predicates| for a complete list of predicates
supported by Neovim.
+By default, the first query on `runtimepath` is used (which usually implies
+that user config takes precedence over plugins, which take precedence over
+queries bundled with Neovim). If a query should extend other queries instead
+of replacing them, use |ts-modeline-extends|.
+
A `query` consists of one or more patterns. A `pattern` is defined over node
types in the syntax tree. A `match` corresponds to specific elements of the
syntax tree which match a pattern. Patterns may optionally define captures
@@ -194,6 +199,36 @@ 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.
+ *ts-query-modeline*
+Neovim supports to customize the behavior of the queries using a set of
+"modelines", that is comments in the queries starting with `;`. Here are the
+currently supported modeline alternatives:
+
+ `inherits: {lang}...` *ts-modeline-inherits*
+ Specifies that this query should inherit the queries from {lang}.
+ This will recursively descend in the queries of {lang} unless wrapped
+ in parentheses: `({lang})`.
+ Note: this is meant to be used to include queries from another
+ language. If you want your query to extend the queries of the same
+ language, use `extends`.
+
+ `extends` *ts-modeline-extends*
+ Specifies that this query should be used as an extension for the
+ query, i.e. that it should be merged with the others.
+ Note: the order of the extensions, and the query that will be used as
+ a base depends on your 'runtimepath' value.
+
+Note: these modeline comments must be at the top of the query, but can be
+repeated, for example, the following modeline blocks are all valid:
+>
+ ;; inherits: foo,bar
+ ;; extends
+
+ ;; extends
+ ;;
+ ;; inherits: baz
+<
+
Treesitter Query Predicates *lua-treesitter-predicates*
When writing queries for treesitter, one might use `predicates`, that is,
@@ -323,16 +358,34 @@ for a buffer with this code: >
local query2 = [[ ... ]]
highlighter:set_query(query2)
-As mentioned above the supported predicate is currently only `eq?`. `match?`
-predicates behave like matching always fails. As an addition a capture which
-begin with an upper-case letter like `@WarningMsg` will map directly to this
-highlight group, if defined. Also if the predicate begins with upper-case and
-contains a dot only the part before the first will be interpreted as the
-highlight group. As an example, this warns of a binary expression with two
+
+ *lua-treesitter-highlight-groups*
+The capture names, with `@` included, are directly usable as highlight groups.
+A fallback system is implemented, so that more specific groups fallback to
+more generic ones. For instance, in a language that has separate doc
+comments, `@comment.doc` could be used. If this group is not defined, the
+highlighting for an ordinary `@comment` is used. This way, existing color
+schemes already work out of the box, but it is possible to add
+more specific variants for queries that make them available.
+
+As an additional rule, captures highlights can always be specialized by
+language, by appending the language name after an additional dot. For
+instance, to highlight comments differently per language: >
+
+ hi @comment.c guifg=Blue
+ hi @comment.lua @guifg=DarkBlue
+ hi link @comment.doc.java String
+<
+It is possible to use custom highlight groups. As an example, if we
+define the `@warning` group: >
+
+ hi link @warning WarningMsg
+<
+the following query warns of a binary expression with two
identical identifiers, highlighting both as |hl-WarningMsg|: >
- ((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right)
- (eq? @WarningMsg.left @WarningMsg.right))
+ ((binary_expression left: (identifier) @warning.left right: (identifier) @warning.right)
+ (eq? @warning.left @warning.right))
<
Treesitter Highlighting Priority *lua-treesitter-highlight-priority*
@@ -352,6 +405,60 @@ attribute: >
==============================================================================
Lua module: vim.treesitter *lua-treesitter-core*
+get_captures_at_cursor({winnr}) *get_captures_at_cursor()*
+ Gets a list of captures under the cursor
+
+ Parameters: ~
+ {winnr} (number|nil) Window handle or 0 for current window (default)
+
+ Return: ~
+ (table) Named node under the cursor
+
+ *get_captures_at_position()*
+get_captures_at_position({bufnr}, {row}, {col})
+ Gets a list of captures for a given cursor position
+
+ Parameters: ~
+ {bufnr} (number) Buffer number (0 for current buffer)
+ {row} (number) Position row
+ {col} (number) Position column
+
+ Return: ~
+ (table) Table of captures
+
+get_node_at_cursor({winnr}) *get_node_at_cursor()*
+ Gets the smallest named node under the cursor
+
+ Parameters: ~
+ {winnr} (number|nil) Window handle or 0 for current window (default)
+
+ Return: ~
+ (string) Named node under the cursor
+
+ *get_node_at_position()*
+get_node_at_position({bufnr}, {row}, {col}, {opts})
+ Gets the smallest named node at position
+
+ Parameters: ~
+ {bufnr} (number) Buffer number (0 for current buffer)
+ {row} (number) Position row
+ {col} (number) Position column
+ {opts} (table) Optional keyword arguments:
+ • ignore_injections boolean Ignore injected languages
+ (default true)
+
+ Return: ~
+ (table) Named node under the cursor
+
+get_node_range({node_or_range}) *get_node_range()*
+ Get the node's range or unpack a range table
+
+ Parameters: ~
+ {node_or_range} (table)
+
+ Return: ~
+ (table) start_row, start_col, end_row, end_col
+
get_parser({bufnr}, {lang}, {opts}) *get_parser()*
Gets the parser for this bufnr / ft combination.
@@ -359,12 +466,14 @@ get_parser({bufnr}, {lang}, {opts}) *get_parser()*
callback
Parameters: ~
- {bufnr} The buffer the parser should be tied to
- {lang} The filetype of this parser
- {opts} Options object to pass to the created language tree
+ {bufnr} (number|nil) Buffer the parser should be tied to (default:
+ current buffer)
+ {lang} (string) |nil Filetype of this parser (default: buffer
+ filetype)
+ {opts} (table|nil) Options to pass to the created language tree
Return: ~
- The parser
+ (table) Parser object
get_string_parser({str}, {lang}, {opts}) *get_string_parser()*
Gets a string parser
@@ -374,6 +483,70 @@ get_string_parser({str}, {lang}, {opts}) *get_string_parser()*
{lang} The language of this string
{opts} Options to pass to the created language tree
+is_ancestor({dest}, {source}) *is_ancestor()*
+ Determines whether a node is the ancestor of another
+
+ Parameters: ~
+ {dest} (table) Possible ancestor
+ {source} (table) Possible descendant node
+
+ Return: ~
+ (boolean) True if dest is an ancestor of source
+
+is_in_node_range({node}, {line}, {col}) *is_in_node_range()*
+ Determines whether (line, col) position is in node range
+
+ Parameters: ~
+ {node} (table) Node defining the range
+ {line} (number) Line (0-based)
+ {col} (number) Column (0-based)
+
+ Return: ~
+ (boolean) True if the position is in node range
+
+node_contains({node}, {range}) *node_contains()*
+ Determines if a node contains a range
+
+ Parameters: ~
+ {node} (table)
+ {range} (table)
+
+ Return: ~
+ (boolean) True if the node contains the range
+
+start({bufnr}, {lang}) *start()*
+ Start treesitter highlighting for a buffer
+
+ Can be used in an ftplugin or FileType autocommand
+
+ Note: By default, disables regex syntax highlighting, which may be
+ required for some plugins. In this case, add `vim.bo.syntax = 'on'` after
+ the call to `start`.
+
+ Example:
+>
+
+ vim.api.nvim_create_autocmd( 'FileType', { pattern = 'tex',
+ callback = function(args)
+ vim.treesitter.start(args.buf, 'latex')
+ vim.bo[args.buf].syntax = 'on' -- only if additional legacy syntax is needed
+ end
+ })
+<
+
+ Parameters: ~
+ {bufnr} (number|nil) Buffer to be highlighted (default: current
+ buffer)
+ {lang} (string|nil) Language of the parser (default: buffer
+ filetype)
+
+stop({bufnr}) *stop()*
+ Stop treesitter highlighting for a buffer
+
+ Parameters: ~
+ {bufnr} (number|nil) Buffer to stop highlighting (default: current
+ buffer)
+
==============================================================================
Lua module: vim.treesitter.language *treesitter-language*
@@ -387,16 +560,20 @@ inspect_language({lang}) *inspect_language()*
Parameters: ~
{lang} The language.
-require_language({lang}, {path}, {silent}) *require_language()*
+ *require_language()*
+require_language({lang}, {path}, {silent}, {symbol_name})
Asserts that the provided language is installed, and optionally provide a
path for the parser
Parsers are searched in the `parser` runtime directory.
Parameters: ~
- {lang} The language the parser should parse
- {path} Optional path the parser is located at
- {silent} Don't throw an error if language not found
+ {lang} (string) The language the parser should parse
+ {path} (string|nil) Optional path the parser is located at
+ {silent} (boolean|nil) Don't throw an error if language not
+ found
+ {symbol_name} (string|nil) Internal symbol name for the language to
+ load
==============================================================================
@@ -423,12 +600,16 @@ add_predicate({name}, {handler}, {force}) *add_predicate()*
{handler} the handler function to be used signature will be (match,
pattern, bufnr, predicate)
-get_node_text({node}, {source}) *get_node_text()*
+get_node_text({node}, {source}, {opts}) *get_node_text()*
Gets the text corresponding to a given node
Parameters: ~
- {node} the node
- {source} The buffer or string from which the node is extracted
+ {node} (table) The node
+ {source} (table) The buffer or string from which the node is
+ extracted
+ {opts} (table) Optional parameters.
+ • concat: (boolean default true) Concatenate result in a
+ string
get_query({lang}, {query_name}) *get_query()*
Returns the runtime query {query_name} for {lang}.
@@ -676,6 +857,17 @@ LanguageTree:language_for_range({self}, {range})
{range} A text range, see |LanguageTree:contains|
{self}
+ *LanguageTree:named_node_for_range()*
+LanguageTree:named_node_for_range({self}, {range}, {opts})
+ Gets the smallest named node that contains {range}
+
+ Parameters: ~
+ {range} (table) A text range
+ {opts} (table) Options table
+ {opts.ignore_injections} (boolean) (default true) Ignore injected
+ languages.
+ {self}
+
LanguageTree:parse({self}) *LanguageTree:parse()*
Parses all defined regions using a treesitter parser for the language this
tree represents. This will run the injection query for this language to
@@ -736,6 +928,17 @@ LanguageTree:source({self}) *LanguageTree:source()*
Parameters: ~
{self}
+ *LanguageTree:tree_for_range()*
+LanguageTree:tree_for_range({self}, {range}, {opts})
+ Gets the tree that contains {range}
+
+ Parameters: ~
+ {range} (table) A text range
+ {opts} (table) Options table
+ {opts.ignore_injections} (boolean) (default true) Ignore injected
+ languages.
+ {self}
+
LanguageTree:trees({self}) *LanguageTree:trees()*
Returns all trees this language tree contains. Does not include child
languages.
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 3fb9ed1125..955af84679 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -207,6 +207,7 @@ the editor.
'guifontwide'
'linespace'
'mousefocus'
+ 'mousemoveevent'
'pumblend'
'showtabline'
'termguicolors'
diff --git a/runtime/doc/userfunc.txt b/runtime/doc/userfunc.txt
new file mode 100644
index 0000000000..c701834383
--- /dev/null
+++ b/runtime/doc/userfunc.txt
@@ -0,0 +1,429 @@
+*userfunc.txt* Nvim
+
+
+ VIM REFERENCE MANUAL by Bram Moolenaar
+
+
+Defining and using functions.
+
+This is introduced in section |41.7| of the user manual.
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+
+1. Defining a fuction ~
+ *define-function*
+New functions can be defined. These can be called just like builtin
+functions. The function executes a sequence of Ex commands. Normal mode
+commands can be executed with the |:normal| command.
+
+The function name must start with an uppercase letter, to avoid confusion with
+builtin functions. To prevent from using the same name in different scripts
+make them script-local. If you do use a global function then avoid obvious,
+short names. A good habit is to start the function name with the name of the
+script, e.g., "HTMLcolor()".
+
+It is also possible to use curly braces, see |curly-braces-names|.
+
+The |autoload| facility is useful to define a function only when it's called.
+
+ *local-function*
+A function local to a script must start with "s:". A local script function
+can only be called from within the script and from functions, user commands
+and autocommands defined in the script. It is also possible to call the
+function from a mapping defined in the script, but then |<SID>| must be used
+instead of "s:" when the mapping is expanded outside of the script.
+There are only script-local functions, no buffer-local or window-local
+functions.
+
+ *:fu* *:function* *E128* *E129* *E123*
+:fu[nction] List all functions and their arguments.
+
+:fu[nction][!] {name} List function {name}, annotated with line numbers
+ unless "!" is given.
+ {name} may be a |Dictionary| |Funcref| entry: >
+ :function dict.init
+
+:fu[nction] /{pattern} List functions with a name matching {pattern}.
+ Example that lists all functions ending with "File": >
+ :function /File$
+<
+ *:function-verbose*
+When 'verbose' is non-zero, listing a function will also display where it was
+last defined. Example: >
+
+ :verbose function SetFileTypeSH
+ function SetFileTypeSH(name)
+ Last set from /usr/share/vim/vim-7.0/filetype.vim
+<
+See |:verbose-cmd| for more information.
+
+ *E124* *E125* *E853* *E884*
+:fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure]
+ Define a new function by the name {name}. The body of
+ the function follows in the next lines, until the
+ matching |:endfunction|.
+
+ The name must be made of alphanumeric characters and
+ '_', and must start with a capital or "s:" (see
+ above). Note that using "b:" or "g:" is not allowed.
+ (since patch 7.4.260 E884 is given if the function
+ name has a colon in the name, e.g. for "foo:bar()".
+ Before that patch no error was given).
+
+ {name} can also be a |Dictionary| entry that is a
+ |Funcref|: >
+ :function dict.init(arg)
+< "dict" must be an existing dictionary. The entry
+ "init" is added if it didn't exist yet. Otherwise [!]
+ is required to overwrite an existing function. The
+ result is a |Funcref| to a numbered function. The
+ function can only be used with a |Funcref| and will be
+ deleted if there are no more references to it.
+ *E127* *E122*
+ When a function by this name already exists and [!] is
+ not used an error message is given. There is one
+ exception: When sourcing a script again, a function
+ that was previously defined in that script will be
+ silently replaced.
+ When [!] is used, an existing function is silently
+ replaced. Unless it is currently being executed, that
+ is an error.
+ NOTE: Use ! wisely. If used without care it can cause
+ an existing function to be replaced unexpectedly,
+ which is hard to debug.
+
+ For the {arguments} see |function-argument|.
+
+ *:func-range* *a:firstline* *a:lastline*
+ When the [range] argument is added, the function is
+ expected to take care of a range itself. The range is
+ passed as "a:firstline" and "a:lastline". If [range]
+ is excluded, ":{range}call" will call the function for
+ each line in the range, with the cursor on the start
+ of each line. See |function-range-example|.
+ The cursor is still moved to the first line of the
+ range, as is the case with all Ex commands.
+ *:func-abort*
+ When the [abort] argument is added, the function will
+ abort as soon as an error is detected.
+ *:func-dict*
+ When the [dict] argument is added, the function must
+ be invoked through an entry in a |Dictionary|. The
+ local variable "self" will then be set to the
+ dictionary. See |Dictionary-function|.
+ *:func-closure* *E932*
+ When the [closure] argument is added, the function
+ can access variables and arguments from the outer
+ scope. This is usually called a closure. In this
+ example Bar() uses "x" from the scope of Foo(). It
+ remains referenced even after Foo() returns: >
+ :function! Foo()
+ : let x = 0
+ : function! Bar() closure
+ : let x += 1
+ : return x
+ : endfunction
+ : return funcref('Bar')
+ :endfunction
+
+ :let F = Foo()
+ :echo F()
+< 1 >
+ :echo F()
+< 2 >
+ :echo F()
+< 3
+
+ *function-search-undo*
+ The last used search pattern and the redo command "."
+ will not be changed by the function. This also
+ implies that the effect of |:nohlsearch| is undone
+ when the function returns.
+
+ *:endf* *:endfunction* *E126* *E193* *W22*
+:endf[unction] [argument]
+ The end of a function definition. Best is to put it
+ on a line by its own, without [argument].
+
+ [argument] can be:
+ | command command to execute next
+ \n command command to execute next
+ " comment always ignored
+ anything else ignored, warning given when
+ 'verbose' is non-zero
+ The support for a following command was added in Vim
+ 8.0.0654, before that any argument was silently
+ ignored.
+
+ To be able to define a function inside an `:execute`
+ command, use line breaks instead of |:bar|: >
+ :exe "func Foo()\necho 'foo'\nendfunc"
+<
+ *:delf* *:delfunction* *E131* *E933*
+:delf[unction][!] {name}
+ Delete function {name}.
+ {name} can also be a |Dictionary| entry that is a
+ |Funcref|: >
+ :delfunc dict.init
+< This will remove the "init" entry from "dict". The
+ function is deleted if there are no more references to
+ it.
+ With the ! there is no error if the function does not
+ exist.
+ *:retu* *:return* *E133*
+:retu[rn] [expr] Return from a function. When "[expr]" is given, it is
+ evaluated and returned as the result of the function.
+ If "[expr]" is not given, the number 0 is returned.
+ When a function ends without an explicit ":return",
+ the number 0 is returned.
+ Note that there is no check for unreachable lines,
+ thus there is no warning if commands follow ":return".
+
+ If the ":return" is used after a |:try| 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 function. The function
+ returns at the outermost ":endtry".
+
+ *function-argument* *a:var*
+An argument can be defined by giving its name. In the function this can then
+be used as "a:name" ("a:" for argument).
+ *a:0* *a:1* *a:000* *E740* *...*
+Up to 20 arguments can be given, separated by commas. After the named
+arguments an argument "..." can be specified, which means that more arguments
+may optionally be following. In the function the extra arguments can be used
+as "a:1", "a:2", etc. "a:0" is set to the number of extra arguments (which
+can be 0). "a:000" is set to a |List| that contains these arguments. Note
+that "a:1" is the same as "a:000[0]".
+ *E742*
+The a: scope and the variables in it cannot be changed, they are fixed.
+However, if a composite type is used, such as |List| or |Dictionary| , you can
+change their contents. Thus you can pass a |List| to a function and have the
+function add an item to it. If you want to make sure the function cannot
+change a |List| or |Dictionary| use |:lockvar|.
+
+It is also possible to define a function without any arguments. You must
+still supply the () then.
+
+It is allowed to define another function inside a function body.
+
+ *optional-function-argument*
+You can provide default values for positional named arguments. This makes
+them optional for function calls. When a positional argument is not
+specified at a call, the default expression is used to initialize it.
+This only works for functions declared with |function|, not for
+lambda expressions |expr-lambda|.
+
+Example: >
+ function Something(key, value = 10)
+ echo a:key .. ": " .. a:value
+ endfunction
+ call Something('empty') "empty: 10"
+ call Something('key', 20) "key: 20"
+
+The argument default expressions are evaluated at the time of the function
+call, not definition. Thus it is possible to use an expression which is
+invalid the moment the function is defined. The expressions are also only
+evaluated when arguments are not specified during a call.
+
+ *E989*
+Optional arguments with default expressions must occur after any mandatory
+arguments. You can use "..." after all optional named arguments.
+
+It is possible for later argument defaults to refer to prior arguments,
+but not the other way around. They must be prefixed with "a:", as with all
+arguments.
+
+Example that works: >
+ :function Okay(mandatory, optional = a:mandatory)
+ :endfunction
+Example that does NOT work: >
+ :function NoGood(first = a:second, second = 10)
+ :endfunction
+<
+When not using "...", the number of arguments in a function call must be at
+least equal to the number of mandatory named arguments. When using "...", the
+number of arguments may be larger than the total of mandatory and optional
+arguments.
+
+ *local-variables*
+Inside a function local variables can be used. These will disappear when the
+function returns. Global variables need to be accessed with "g:". Inside
+functions local variables are accessed without prepending anything. But you
+can also prepend "l:" if you like. This is required for some reserved names,
+such as "version".
+
+Example: >
+ :function Table(title, ...)
+ : echohl Title
+ : echo a:title
+ : echohl None
+ : echo a:0 .. " items:"
+ : for s in a:000
+ : echon ' ' .. s
+ : endfor
+ :endfunction
+
+This function can then be called with: >
+ call Table("Table", "line1", "line2")
+ call Table("Empty Table")
+
+To return more than one value, return a |List|: >
+ :function Compute(n1, n2)
+ : if a:n2 == 0
+ : return ["fail", 0]
+ : endif
+ : return ["ok", a:n1 / a:n2]
+ :endfunction
+
+This function can then be called with: >
+ :let [success, div] = Compute(102, 6)
+ :if success == "ok"
+ : echo div
+ :endif
+<
+==============================================================================
+
+2. Calling a fuction ~
+ *:cal* *:call* *E107* *E117*
+:[range]cal[l] {name}([arguments])
+ Call a function. The name of the function and its arguments
+ are as specified with `:function`. Up to 20 arguments can be
+ used. The returned value is discarded.
+ Without a range and for functions that accept a range, the
+ function is called once. When a range is given the cursor is
+ positioned at the start of the first line before executing the
+ function.
+ When a range is given and the function doesn't handle it
+ itself, the function is executed for each line in the range,
+ with the cursor in the first column of that line. The cursor
+ is left at the last line (possibly moved by the last function
+ call). The arguments are re-evaluated for each line. Thus
+ this works:
+ *function-range-example* >
+ :function Mynumber(arg)
+ : echo line(".") .. " " .. a:arg
+ :endfunction
+ :1,5call Mynumber(getline("."))
+<
+ The "a:firstline" and "a:lastline" are defined anyway, they
+ can be used to do something different at the start or end of
+ the range.
+
+ Example of a function that handles the range itself: >
+
+ :function Cont() range
+ : execute (a:firstline + 1) .. "," .. a:lastline .. 's/^/\t\\ '
+ :endfunction
+ :4,8call Cont()
+<
+ This function inserts the continuation character "\" in front
+ of all the lines in the range, except the first one.
+
+ When the function returns a composite value it can be further
+ dereferenced, but the range will not be used then. Example: >
+ :4,8call GetDict().method()
+< Here GetDict() gets the range but method() does not.
+
+ *E132*
+The recursiveness of user functions is restricted with the |'maxfuncdepth'|
+option.
+
+It is also possible to use `:eval`. It does not support a range, but does
+allow for method chaining, e.g.: >
+ eval GetList()->Filter()->append('$')
+
+A function can also be called as part of evaluating an expression or when it
+is used as a method: >
+ let x = GetList()
+ let y = GetList()->Filter()
+
+
+==============================================================================
+
+3. Automatically loading functions ~
+ *autoload-functions*
+When using many or large functions, it's possible to automatically define them
+only when they are used. There are two methods: with an autocommand and with
+the "autoload" directory in 'runtimepath'.
+
+
+Using an autocommand ~
+
+This is introduced in the user manual, section |41.14|.
+
+The autocommand is useful if you have a plugin that is a long Vim script file.
+You can define the autocommand and quickly quit the script with `:finish`.
+That makes Vim startup faster. The autocommand should then load the same file
+again, setting a variable to skip the `:finish` command.
+
+Use the FuncUndefined autocommand event with a pattern that matches the
+function(s) to be defined. Example: >
+
+ :au FuncUndefined BufNet* source ~/vim/bufnetfuncs.vim
+
+The file "~/vim/bufnetfuncs.vim" should then define functions that start with
+"BufNet". Also see |FuncUndefined|.
+
+
+Using an autoload script ~
+ *autoload* *E746*
+This is introduced in the user manual, section |41.15|.
+
+Using a script in the "autoload" directory is simpler, but requires using
+exactly the right file name. A function that can be autoloaded has a name
+like this: >
+
+ :call filename#funcname()
+
+When such a function is called, and it is not defined yet, Vim will search the
+"autoload" directories in 'runtimepath' for a script file called
+"filename.vim". For example "~/.config/nvim/autoload/filename.vim". That
+file should then define the function like this: >
+
+ function filename#funcname()
+ echo "Done!"
+ endfunction
+
+The file name and the name used before the # in the function must match
+exactly, and the defined function must have the name exactly as it will be
+called.
+
+It is possible to use subdirectories. Every # in the function name works like
+a path separator. Thus when calling a function: >
+
+ :call foo#bar#func()
+
+Vim will look for the file "autoload/foo/bar.vim" in 'runtimepath'.
+
+This also works when reading a variable that has not been set yet: >
+
+ :let l = foo#bar#lvar
+
+However, when the autoload script was already loaded it won't be loaded again
+for an unknown variable.
+
+When assigning a value to such a variable nothing special happens. This can
+be used to pass settings to the autoload script before it's loaded: >
+
+ :let foo#bar#toggle = 1
+ :call foo#bar#func()
+
+Note that when you make a mistake and call a function that is supposed to be
+defined in an autoload script, but the script doesn't actually define the
+function, you will get an error message for the missing function. If you fix
+the autoload script it won't be automatically loaded again. Either restart
+Vim or manually source the script.
+
+Also note that if you have two script files, and one calls a function in the
+other and vice versa, before the used function is defined, it won't work.
+Avoid using the autoload functionality at the toplevel.
+
+Hint: If you distribute a bunch of scripts you can pack them together with the
+|vimball| utility. Also read the user manual |distribute-script|.
+
+
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 0c907bfb68..ee644be366 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -745,6 +745,7 @@ Cursor and mark position: *cursor-functions* *mark-functions*
screencol() get screen column of the cursor
screenrow() get screen row of the cursor
screenpos() screen row and col of a text character
+ virtcol2col() byte index of a text character on screen
getcurpos() get position of the cursor
getpos() get position of cursor, mark, etc.
setpos() set position of cursor, mark, etc.
@@ -872,6 +873,7 @@ Command line: *command-line-functions*
getcmdpos() get position of the cursor in the command line
getcmdscreenpos() get screen position of the cursor in the
command line
+ setcmdline() set the current 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
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 53effa1443..b013e00fe8 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -73,7 +73,7 @@ centralized reference of the differences.
- 'wildmenu' is enabled
- 'wildoptions' defaults to "pum,tagfile"
-- |man.vim| plugin is enabled, so |:Man| is available by default.
+- |man.lua| plugin is enabled, so |:Man| is available by default.
- |matchit| plugin is enabled. To disable it in your config: >
:let loaded_matchit = 1
@@ -390,6 +390,9 @@ Highlight groups:
using |n| or |N|
|hl-CursorLine| is low-priority unless foreground color is set
|hl-VertSplit| superseded by |hl-WinSeparator|
+ Highlight groups names are allowed to contain the characters `.` and `@`.
+ It is an error to define a highlight group with a name that doesn't match
+ the regexp `[a-zA-Z0-9_.@]*` (see |group-name|).
Macro/|recording| behavior
Replay of a macro recorded during :lmap produces the same actions as when it
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 7355cec522..6386e4ace1 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -163,6 +163,8 @@ CTRL-W v *CTRL-W_v*
3. 'eadirection' isn't "ver", and
4. one of the other windows is wider than the current or new
window.
+ If N was given make the new window N columns wide, if
+ possible.
Note: In other places CTRL-Q does the same as CTRL-V, but here
it doesn't!
@@ -233,9 +235,16 @@ and 'winminwidth' are relevant.
*:vert* *:vertical*
:vert[ical] {cmd}
Execute {cmd}. If it contains a command that splits a window,
- it will be split vertically.
+ it will be split vertically. For `vertical wincmd =` windows
+ will be equalized only vertically.
Doesn't work for |:execute| and |:normal|.
+ *:hor* *:horizontal*
+:hor[izontal] {cmd}
+ Execute {cmd}. Currently only makes a difference for
+ `horizontal wincmd =`, which will equalize windows only
+ horizontally.
+
:lefta[bove] {cmd} *:lefta* *:leftabove*
:abo[veleft] {cmd} *:abo* *:aboveleft*
Execute {cmd}. If it contains a command that splits a window,
@@ -528,6 +537,10 @@ CTRL-W = Make all windows (almost) equally high and wide, but use
'winheight' and 'winwidth' for the current window.
Windows with 'winfixheight' set keep their height and windows
with 'winfixwidth' set keep their width.
+ To equalize only vertically (make window equally high) use
+ `vertical wincmd =`
+ To equalize only horizontally (make window equally wide) use
+ `horizontal wincmd =`
:res[ize] -N *:res* *:resize* *CTRL-W_-*
CTRL-W - Decrease current window height by N (default 1).
diff --git a/runtime/filetype.lua b/runtime/filetype.lua
index 9f5b5fd0dc..c50ba6453d 100644
--- a/runtime/filetype.lua
+++ b/runtime/filetype.lua
@@ -6,7 +6,7 @@ vim.g.did_load_filetypes = 1
vim.api.nvim_create_augroup('filetypedetect', { clear = false })
-vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
+vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, {
group = 'filetypedetect',
callback = function(args)
local ft, on_detect = vim.filetype.match({ filename = args.match, buf = args.buf })
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 52a20d5c10..eda2cd555a 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Jul 5
+" Last Change: 2022 Sep 09
" Only run this if enabled
if !exists("do_legacy_filetype")
@@ -697,7 +697,10 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
au BufNewFile,BufRead *.gd setf gdscript
" Godot resource
-au BufRead,BufNewFile *.tscn,*.tres setf gdresource
+au BufRead,BufNewFile *.tscn,*.tres setf gdresource
+
+" Godot shader
+au BufRead,BufNewFile *.gdshader,*.shader setf gdshader
" Gedcom
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
@@ -718,9 +721,16 @@ 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
+ au BufNewFile,BufRead $XDG_CONFIG_HOME/git/attributes setf gitattributes
+ au BufNewFile,BufRead $XDG_CONFIG_HOME/git/ignore setf gitignore
endif
-au BufNewFile,BufRead git-rebase-todo setf gitrebase
-au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail
+au BufNewFile,BufRead .gitattributes,*.git/info/attributes setf gitattributes
+au BufNewFile,BufRead */.config/git/attributes setf gitattributes
+au BufNewFile,BufRead */etc/gitattributes setf gitattributes
+au BufNewFile,BufRead .gitignore,*.git/info/exclude setf gitignore
+au BufNewFile,BufRead */.config/git/ignore setf gitignore
+au BufNewFile,BufRead git-rebase-todo setf gitrebase
+au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail
au BufNewFile,BufRead *.git/*
\ if getline(1) =~# '^\x\{40,\}\>\|^ref: ' |
\ setf git |
@@ -865,11 +875,11 @@ au BufNewFile,BufRead *.htt,*.htb setf httest
" i3
au BufNewFile,BufRead */i3/config setf i3config
-au BufNewFile,BufRead */.i3/config setf i3config
+au BufNewFile,BufRead */.i3/config setf i3config
" sway
au BufNewFile,BufRead */sway/config setf swayconfig
-au BufNewFile,BufRead */.sway/config setf swayconfig
+au BufNewFile,BufRead */.sway/config setf swayconfig
" Icon
au BufNewFile,BufRead *.icn setf icon
@@ -938,7 +948,7 @@ au BufNewFile,BufRead *.java,*.jav setf java
au BufNewFile,BufRead *.jj,*.jjt setf javacc
" JavaScript, ECMAScript, ES module script, CommonJS script
-au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs,*.cjs setf javascript
+au BufNewFile,BufRead *.js,*.jsm,*.javascript,*.es,*.mjs,*.cjs setf javascript
" JavaScript with React
au BufNewFile,BufRead *.jsx setf javascriptreact
@@ -976,6 +986,9 @@ au BufNewFile,BufRead .babelrc,.eslintrc,.prettierrc,.firebaserc setf json
" JSONC
au BufNewFile,BufRead *.jsonc setf jsonc
+" Jsonnet
+au BufNewFile,BufRead *.jsonnet,*.libjsonnet setf jsonnet
+
" Julia
au BufNewFile,BufRead *.jl setf julia
@@ -1314,7 +1327,7 @@ au BufNewFile,BufRead *.or setf openroad
au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
" OpenSCAD
-au BufNewFile,BufRead *.scad setf openscad
+au BufNewFile,BufRead *.scad setf openscad
" Oracle config file
au BufNewFile,BufRead *.ora setf ora
@@ -1389,7 +1402,8 @@ au BufNewFile,BufRead *.pod setf pod
" 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
+" Also .theme for Drupal theme files.
+au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp,*.phpt,*.theme setf php
" PHP config
au BufNewFile,BufRead php.ini-* setf dosini
@@ -1710,6 +1724,9 @@ au BufNewFile,BufRead *.sdl,*.pr setf sdl
" sed
au BufNewFile,BufRead *.sed setf sed
+" SubRip
+au BufNewFile,BufRead *.srt setf srt
+
" svelte
au BufNewFile,BufRead *.svelte setf svelte
@@ -1820,7 +1837,7 @@ au BufNewFile,BufRead *.score setf slrnsc
au BufNewFile,BufRead *.st setf st
" Smalltalk (and Rexx, TeX, and Visual Basic)
-au BufNewFile,BufRead *.cls call dist#ft#FTcls()
+au BufNewFile,BufRead *.cls call dist#ft#FTcls()
" Smarty templates
au BufNewFile,BufRead *.tpl setf smarty
@@ -1927,8 +1944,8 @@ au BufNewFile,BufRead *.cm setf voscm
au BufNewFile,BufRead *.swift setf swift
au BufNewFile,BufRead *.swift.gyb setf swiftgyb
-" Swift Intermediate Language
-au BufNewFile,BufRead *.sil setf sil
+" Swift Intermediate Language or SILE
+au BufNewFile,BufRead *.sil call dist#ft#FTsil()
" Sysctl
au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl
@@ -2095,6 +2112,11 @@ au BufNewFile,BufRead */.config/upstart/*.override setf upstart
" Vala
au BufNewFile,BufRead *.vala setf vala
+" VDM
+au BufRead,BufNewFile *.vdmpp,*.vpp setf vdmpp
+au BufRead,BufNewFile *.vdmrt setf vdmrt
+au BufRead,BufNewFile *.vdmsl,*.vdm setf vdmsl
+
" Vera
au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera
@@ -2564,6 +2586,9 @@ au BufNewFile,BufRead *.txt
\| setf text
\| endif
+" Blueprint markup files
+au BufNewFile,BufRead *.blp setf blueprint
+
if !exists('g:did_load_ftdetect')
" Use the filetype detect plugins. They may overrule any of the previously
" detected filetypes.
diff --git a/runtime/ftplugin/gitattributes.vim b/runtime/ftplugin/gitattributes.vim
new file mode 100644
index 0000000000..2025d009d2
--- /dev/null
+++ b/runtime/ftplugin/gitattributes.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: git attributes
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Sep 08
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/gitignore.vim b/runtime/ftplugin/gitignore.vim
new file mode 100644
index 0000000000..3502dd2717
--- /dev/null
+++ b/runtime/ftplugin/gitignore.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: git ignore
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Sep 10
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/jsonnet.vim b/runtime/ftplugin/jsonnet.vim
new file mode 100644
index 0000000000..1e621e1867
--- /dev/null
+++ b/runtime/ftplugin/jsonnet.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin
+" Language: Jsonnet
+" Maintainer: Cezary Drożak <cezary@drozak.net>
+" URL: https://github.com/google/vim-jsonnet
+" Last Change: 2022-09-08
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = "setlocal commentstring<"
diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua
new file mode 100644
index 0000000000..415cf28f9a
--- /dev/null
+++ b/runtime/ftplugin/lua.lua
@@ -0,0 +1,3 @@
+if vim.g.ts_highlight_lua then
+ vim.treesitter.start()
+end
diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim
index 2604257594..aaa61f71d9 100644
--- a/runtime/ftplugin/lua.vim
+++ b/runtime/ftplugin/lua.vim
@@ -1,46 +1,46 @@
" Vim filetype plugin file.
-" Language: Lua
+" Language: Lua
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Max Ischenko <mfi@ukr.net>
-" Last Change: 2021 Nov 15
+" Contributor: Dorai Sitaram <ds26@gte.com>
+" Last Change: 2022 Sep 05
-" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
-
-" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-" Set 'formatoptions' to break comment lines but not other lines, and insert
-" the comment leader when hitting <CR> or using "o".
+setlocal comments=:--
+setlocal commentstring=--\ %s
setlocal formatoptions-=t formatoptions+=croql
-setlocal comments=:--
-setlocal commentstring=--%s
+let &l:define = '\<function\|\<local\%(\s\+function\)\='
+
setlocal suffixesadd=.lua
-let b:undo_ftplugin = "setlocal fo< com< cms< sua<"
+let b:undo_ftplugin = "setlocal cms< com< def< fo< sua<"
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0
let b:match_words =
- \ '\<\%(do\|function\|if\)\>:' .
- \ '\<\%(return\|else\|elseif\)\>:' .
- \ '\<end\>,' .
- \ '\<repeat\>:\<until\>,' .
- \ '\%(--\)\=\[\(=*\)\[:]\1]'
- let b:undo_ftplugin .= " | unlet! b:match_words b:match_ignorecase"
+ \ '\<\%(do\|function\|if\)\>:' ..
+ \ '\<\%(return\|else\|elseif\)\>:' ..
+ \ '\<end\>,' ..
+ \ '\<repeat\>:\<until\>,' ..
+ \ '\%(--\)\=\[\(=*\)\[:]\1]'
+ let b:undo_ftplugin ..= " | unlet! b:match_words b:match_ignorecase"
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n" .
- \ "All Files (*.*)\t*.*\n"
- let b:undo_ftplugin .= " | unlet! b:browsefilter"
+ let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\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 noet:
diff --git a/runtime/ftplugin/lynx.vim b/runtime/ftplugin/lynx.vim
new file mode 100644
index 0000000000..b76c69f0ae
--- /dev/null
+++ b/runtime/ftplugin/lynx.vim
@@ -0,0 +1,29 @@
+" Vim filetype plugin file
+" Language: Lynx Web Browser Configuration
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Sep 09
+
+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 cms< com< fo<"
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Lynx Configuration Files (lynx.cfg .lynxrc)\tlynx.cfg;.lynxrc\n" ..
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index d7a08a9941..277ce3c0b3 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -17,12 +17,12 @@ setlocal iskeyword=@-@,:,a-z,A-Z,48-57,_,.,-,(,)
setlocal nonumber norelativenumber
setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable
-setlocal tagfunc=man#goto_tag
+setlocal tagfunc=v:lua.require'man'.goto_tag
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nnoremap <silent> <buffer> j gj
nnoremap <silent> <buffer> k gk
- nnoremap <silent> <buffer> gO :call man#show_toc()<CR>
+ nnoremap <silent> <buffer> gO :lua require'man'.show_toc()<CR>
nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
if get(b:, 'pager')
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
diff --git a/runtime/ftplugin/racket.vim b/runtime/ftplugin/racket.vim
new file mode 100644
index 0000000000..3aa413397e
--- /dev/null
+++ b/runtime/ftplugin/racket.vim
@@ -0,0 +1,82 @@
+" Vim filetype plugin
+" Language: Racket
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" Previous Maintainer: Will Langstroth <will@langstroth.com>
+" URL: https://github.com/benknoble/vim-racket
+" Last Change: 2022 Aug 29
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" quick hack to allow adding values
+setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94
+
+" Enable auto begin new comment line when continuing from an old comment line
+setlocal comments=:;;;;,:;;;,:;;,:;
+setlocal formatoptions+=r
+
+"setlocal commentstring=;;%s
+setlocal commentstring=#\|\ %s\ \|#
+
+setlocal formatprg=raco\ fmt
+
+" Undo our settings when the filetype changes away from Racket
+" (this should be amended if settings/mappings are added above!)
+let b:undo_ftplugin =
+ \ "setlocal iskeyword< lispwords< lisp< comments< formatoptions< formatprg<"
+ \. " | setlocal commentstring<"
+
+if !exists("no_plugin_maps") && !exists("no_racket_maps")
+ " Simply setting keywordprg like this works:
+ " setlocal keywordprg=raco\ docs
+ " but then vim says:
+ " "press ENTER or type a command to continue"
+ " We avoid the annoyance of having to hit enter by remapping K directly.
+ function s:RacketDoc(word) abort
+ execute 'silent !raco docs --' shellescape(a:word)
+ redraw!
+ endfunction
+ nnoremap <buffer> <Plug>RacketDoc :call <SID>RacketDoc(expand('<cword>'))<CR>
+ nmap <buffer> K <Plug>RacketDoc
+
+ " For the visual mode K mapping, it's slightly more convoluted to get the
+ " selected text:
+ function! s:Racket_visual_doc()
+ try
+ let l:old_a = @a
+ normal! gv"ay
+ call system("raco docs '". @a . "'")
+ redraw!
+ return @a
+ finally
+ let @a = l:old_a
+ endtry
+ endfunction
+
+ xnoremap <buffer> <Plug>RacketDoc :call <SID>Racket_visual_doc()<cr>
+ xmap <buffer> K <Plug>RacketDoc
+
+ let b:undo_ftplugin .=
+ \ " | silent! execute 'nunmap <buffer> K'"
+ \. " | silent! execute 'xunmap <buffer> K'"
+endif
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter =
+ \ "Racket Source Files (*.rkt *.rktl)\t*.rkt;*.rktl\n"
+ \. "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
+endif
+
+if exists("loaded_matchit") && !exists("b:match_words")
+ let b:match_words = '#|:|#'
+ let b:undo_ftplugin .= " | unlet! b:match_words"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim
index 93a46f63e2..b6fdb8f3e2 100644
--- a/runtime/ftplugin/sh.vim
+++ b/runtime/ftplugin/sh.vim
@@ -1,12 +1,12 @@
" Vim filetype plugin file
-" Language: sh
-"
-" This runtime file is looking for a new maintainer.
-"
-" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
-
-if exists("b:did_ftplugin") | finish | endif
+" Language: sh
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Dan Sharp
+" Last Change: 2022 Sep 07
+
+if exists("b:did_ftplugin")
+ finish
+endif
let b:did_ftplugin = 1
" Make sure the continuation lines below do not cause problems in
@@ -14,28 +14,35 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo-=C
-setlocal commentstring=#%s
+setlocal comments=:#
+setlocal commentstring=#\ %s
+setlocal formatoptions-=t formatoptions+=croql
+
+let b:undo_ftplugin = "setl com< cms< fo<"
" Shell: thanks to Johannes Zellner
-if exists("loaded_matchit")
- let s:sol = '\%(;\s*\|^\s*\)\@<=' " start of line
- let b:match_words =
- \ s:sol.'if\>:' . s:sol.'elif\>:' . s:sol.'else\>:' . s:sol. 'fi\>,' .
- \ s:sol.'\%(for\|while\)\>:' . s:sol. 'done\>,' .
- \ s:sol.'case\>:' . s:sol. 'esac\>'
+if exists("loaded_matchit") && !exists("b:match_words")
+ let b:match_ignorecase = 0
+ let s:sol = '\%(;\s*\|^\s*\)\@<=' " start of line
+ let b:match_words =
+ \ s:sol .. 'if\>:' .. s:sol.'elif\>:' .. s:sol.'else\>:' .. s:sol .. 'fi\>,' ..
+ \ s:sol .. '\%(for\|while\)\>:' .. s:sol .. 'done\>,' ..
+ \ s:sol .. 'case\>:' .. s:sol .. 'esac\>'
+ unlet s:sol
+ let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words"
endif
" Change the :browse e filter to primarily show shell-related files.
-if has("gui_win32")
- let b:browsefilter="Bourne Shell Scripts (*.sh)\t*.sh\n" .
- \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" .
- \ "Bash Shell Scripts (*.bash)\t*.bash\n" .
- \ "All Files (*.*)\t*.*\n"
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" ..
+ \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" ..
+ \ "Bash Shell Scripts (*.bash)\t*.bash\n" ..
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-" Undo the stuff we changed.
-let b:undo_ftplugin = "setlocal cms< | unlet! b:browsefilter b:match_words"
-
" Restore the saved compatibility options.
let &cpo = s:save_cpo
unlet s:save_cpo
+
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 772899cb42..82a4b13f9f 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Aug 4
+" Last Change: 2022 Sep 09
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
diff --git a/runtime/ftplugin/zimbu.vim b/runtime/ftplugin/zimbu.vim
index e365ccf07e..cbe2f55572 100644
--- a/runtime/ftplugin/zimbu.vim
+++ b/runtime/ftplugin/zimbu.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Zimbu
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Nov 12
+" Last Change: 2022 Sep 07
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -28,7 +28,7 @@ endif
" Set 'comments' to format dashed lists in comments.
" And to keep Zudocu comment characters.
-setlocal comments=sO:#\ -,mO:#\ \ ,:#=,:#-,:#%,:#
+setlocal comments=sO:#\ -,mO:#\ \ ,exO:#/,s:/*,m:\ ,ex:*/,:#=,:#-,:#%,:#
setlocal errorformat^=%f\ line\ %l\ col\ %c:\ %m,ERROR:\ %m
diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim
index 34410f1c62..0ca8077305 100644
--- a/runtime/ftplugin/zsh.vim
+++ b/runtime/ftplugin/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2020-09-01
+" Latest Revision: 2021-04-03
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
diff --git a/runtime/indent/json.vim b/runtime/indent/json.vim
index 09c7d7a85a..510f7e8f42 100644
--- a/runtime/indent/json.vim
+++ b/runtime/indent/json.vim
@@ -3,6 +3,7 @@
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
" Last Change: 2020 Aug 30
" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
+" 2022 Sep 07: b:undo_indent added by Doug Kearns
" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
" http://www.vim.org/scripts/script.php?script_id=2765
@@ -22,6 +23,8 @@ setlocal nosmartindent
setlocal indentexpr=GetJSONIndent(v:lnum)
setlocal indentkeys=0{,0},0),0[,0],!^F,o,O,e
+let b:undo_indent = "setl inde< indk< si<"
+
" Only define the function once.
if exists("*GetJSONIndent")
finish
diff --git a/runtime/indent/racket.vim b/runtime/indent/racket.vim
new file mode 100644
index 0000000000..93bd38fbff
--- /dev/null
+++ b/runtime/indent/racket.vim
@@ -0,0 +1,60 @@
+" Vim indent file
+" Language: Racket
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" Previous Maintainer: Will Langstroth <will@langstroth.com>
+" URL: https://github.com/benknoble/vim-racket
+" Last Change: 2022 Aug 12
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal lisp autoindent nosmartindent
+
+setlocal lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local
+setlocal lispwords+=define/contract
+setlocal lispwords+=λ
+setlocal lispwords+=with-handlers
+setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
+setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class
+setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig
+setlocal lispwords+=define-opt/c,define-syntax-rule
+setlocal lispwords+=define-test-suite
+setlocal lispwords+=struct
+setlocal lispwords+=with-input-from-file,with-output-to-file
+
+" Racket OOP
+" TODO missing a lot of define-like forms here (e.g., define/augment, etc.)
+setlocal lispwords+=class,class*,mixin,interface,class/derived
+setlocal lispwords+=define/public,define/pubment,define/public-final
+setlocal lispwords+=define/override,define/overment,define/override-final
+setlocal lispwords+=define/augment,define/augride,define/augment-final
+setlocal lispwords+=define/private
+
+" kanren
+setlocal lispwords+=fresh,run,run*,project,conde,condu
+
+" loops
+setlocal lispwords+=for,for/list,for/fold,for*,for*/list,for*/fold,for/or,for/and,for*/or,for*/and
+setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/flvector,for/vector,for*/vector,for*/sum,for*/hash,for*/hasheq,for*/hasheqv
+setlocal lispwords+=for/async
+setlocal lispwords+=for/set,for*/set
+setlocal lispwords+=for/first,for*/first
+
+setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda**
+setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values
+setlocal lispwords+=match-letrec,match-define,match-define-values
+
+setlocal lispwords+=let/cc,let/ec
+
+" qi
+setlocal lispwords+=define-flow,define-switch,flow-lambda,switch-lambda,on,switch,π,λ01
+setlocal lispwords+=define-qi-syntax,define-qi-syntax-parser,define-qi-syntax-rule
+
+" gui-easy
+setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view
+setlocal lispwords+=case/dep
+setlocal lispwords+=define/obs
+
+let b:undo_indent = "setlocal lisp< ai< si< lw<"
diff --git a/runtime/indent/testdir/python.in b/runtime/indent/testdir/python.in
index e6f05f22bc..57719ee430 100644
--- a/runtime/indent/testdir/python.in
+++ b/runtime/indent/testdir/python.in
@@ -1,6 +1,24 @@
# vim: set ft=python sw=4 et:
# START_INDENT
+dict = {
+'a': 1,
+'b': 2,
+'c': 3,
+}
+# END_INDENT
+
+# START_INDENT
+# INDENT_EXE let [g:python_indent.open_paren, g:python_indent.closed_paren_align_last_line] = ['shiftwidth()', v:false]
+dict = {
+'a': 1,
+'b': 2,
+'c': 3,
+}
+# END_INDENT
+
+# START_INDENT
+# INDENT_EXE let g:python_indent.open_paren = 'shiftwidth() * 2'
# INDENT_EXE syntax match pythonFoldMarkers /{{{\d*/ contained containedin=pythonComment
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {{{1
diff --git a/runtime/indent/testdir/python.ok b/runtime/indent/testdir/python.ok
index df3de8f186..f5ebbc2285 100644
--- a/runtime/indent/testdir/python.ok
+++ b/runtime/indent/testdir/python.ok
@@ -1,6 +1,24 @@
# vim: set ft=python sw=4 et:
# START_INDENT
+dict = {
+ 'a': 1,
+ 'b': 2,
+ 'c': 3,
+ }
+# END_INDENT
+
+# START_INDENT
+# INDENT_EXE let [g:python_indent.open_paren, g:python_indent.closed_paren_align_last_line] = ['shiftwidth()', v:false]
+dict = {
+ 'a': 1,
+ 'b': 2,
+ 'c': 3,
+}
+# END_INDENT
+
+# START_INDENT
+# INDENT_EXE let g:python_indent.open_paren = 'shiftwidth() * 2'
# INDENT_EXE syntax match pythonFoldMarkers /{{{\d*/ contained containedin=pythonComment
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {{{1
diff --git a/runtime/indent/testdir/runtest.vim b/runtime/indent/testdir/runtest.vim
index 6bbd33cacd..fa4e16e381 100644
--- a/runtime/indent/testdir/runtest.vim
+++ b/runtime/indent/testdir/runtest.vim
@@ -11,6 +11,7 @@ syn on
set nowrapscan
set report=9999
set modeline
+set debug=throw
au! SwapExists * call HandleSwapExists()
func HandleSwapExists()
@@ -84,7 +85,12 @@ for fname in glob('testdir/*.in', 1, 1)
exe start + 1
if pattern == ''
- exe 'normal =' . (end - 1) . 'G'
+ try
+ exe 'normal =' . (end - 1) . 'G'
+ catch
+ call append(indent_at, 'ERROR: ' . v:exception)
+ let failed = 1
+ endtry
else
let lnum = search(pattern)
if lnum <= 0
@@ -99,7 +105,12 @@ for fname in glob('testdir/*.in', 1, 1)
else
exe lnum - 1
endif
- normal ==
+ try
+ normal ==
+ catch
+ call append(indent_at, 'ERROR: ' . v:exception)
+ let failed = 1
+ endtry
endif
endif
endwhile
diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in
index 873045bc2c..5eb262f50a 100644
--- a/runtime/indent/testdir/vim.in
+++ b/runtime/indent/testdir/vim.in
@@ -36,6 +36,13 @@ let t = [
\ },
\ ]
+def Func()
+ var d = dd
+ ->extend({
+ })
+ eval 0
+enddef
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok
index 8e70abe619..932eebef43 100644
--- a/runtime/indent/testdir/vim.ok
+++ b/runtime/indent/testdir/vim.ok
@@ -36,6 +36,13 @@ let t = [
\ },
\ ]
+def Func()
+ var d = dd
+ ->extend({
+ })
+ eval 0
+enddef
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index 8076b2df07..3beb70d255 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -33,7 +33,9 @@ function GetVimIndent()
endtry
endfunc
-let s:lineContPat = '^\s*\(\\\|"\\ \)'
+" Legacy script line continuation and Vim9 script operators that must mean an
+" expression that continues from the previous line.
+let s:lineContPat = '^\s*\(\\\|"\\ \|->\)'
function GetVimIndentIntern()
" If the current line has line continuation and the previous one too, use
@@ -133,15 +135,15 @@ function GetVimIndentIntern()
endif
endif
- " For a line starting with "}" find the matching "{". If it is at the start
- " of the line align with it, probably end of a block.
+ " For a line starting with "}" find the matching "{". Align with that line,
+ " it is either the matching block start or dictionary start.
" Use the mapped "%" from matchit to find the match, otherwise we may match
" a { inside a comment or string.
if cur_text =~ '^\s*}'
if maparg('%') != ''
exe v:lnum
silent! normal %
- if line('.') < v:lnum && getline('.') =~ '^\s*{'
+ if line('.') < v:lnum
let ind = indent('.')
endif
else
@@ -149,19 +151,33 @@ function GetVimIndentIntern()
endif
endif
- " Below a line starting with "}" find the matching "{". If it is at the
- " end of the line we must be below the end of a dictionary.
- if prev_text =~ '^\s*}'
- if maparg('%') != ''
- exe lnum
- silent! normal %
- if line('.') == lnum || getline('.') !~ '^\s*{'
- let ind = ind - shiftwidth()
+ " Look back for a line to align with
+ while lnum > 1
+ " Below a line starting with "}" find the matching "{".
+ if prev_text =~ '^\s*}'
+ if maparg('%') != ''
+ exe lnum
+ silent! normal %
+ if line('.') < lnum
+ let lnum = line('.')
+ let ind = indent(lnum)
+ let prev_text = getline(lnum)
+ else
+ break
+ endif
+ else
+ " todo: use searchpair() to find a match
+ break
endif
+ elseif prev_text =~ s:lineContPat
+ " looks like a continuation like, go back one line
+ let lnum = lnum - 1
+ let ind = indent(lnum)
+ let prev_text = getline(lnum)
else
- " todo: use searchpair() to find a match
+ break
endif
- endif
+ endwhile
" Below a line starting with "]" we must be below the end of a list.
" Include a "}" and "},} in case a dictionary ends too.
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index d732c37c05..93fd8ea6f6 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: YAML
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
-" Last Update: Lukas Reineke
+" Last Updates: Lukas Reineke, "lacygoill"
" Last Change: 2022 Jun 17
" Only load this indent file when no other was loaded.
@@ -29,8 +29,8 @@ function s:FindPrevLessIndentedLine(lnum, ...)
let prevlnum = prevnonblank(a:lnum-1)
let curindent = a:0 ? a:1 : indent(a:lnum)
while prevlnum
- \&& indent(prevlnum) >= curindent
- \&& getline(prevlnum) !~# '^\s*#'
+ \ && indent(prevlnum) >= curindent
+ \ && getline(prevlnum) !~# '^\s*#'
let prevlnum = prevnonblank(prevlnum-1)
endwhile
return prevlnum
@@ -54,7 +54,7 @@ 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%(%\x\x|' .. 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\!'
@@ -63,7 +63,7 @@ let s:c_tag_handle = '\v%(' .. s:c_named_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%(%\x\x|' .. s:ns_word_char .. '\v|[#/;?:@&=+$,.!~*''()[\]])'
+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.
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index 5da3d2a92f..82ed0305f7 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -1,7 +1,75 @@
require('vim.compat')
+local api, fn = vim.api, vim.fn
+
+local find_arg = '-w'
+local localfile_arg = true -- Always use -l if possible. #6683
local buf_hls = {}
+local M = {}
+
+local function man_error(msg)
+ M.errormsg = 'man.lua: ' .. vim.inspect(msg)
+ error(M.errormsg)
+end
+
+-- Run a system command and timeout after 30 seconds.
+local function man_system(cmd, silent)
+ local stdout_data = {}
+ local stderr_data = {}
+ local stdout = vim.loop.new_pipe(false)
+ local stderr = vim.loop.new_pipe(false)
+
+ local done = false
+ local exit_code
+
+ local handle = vim.loop.spawn(cmd[1], {
+ args = vim.list_slice(cmd, 2),
+ stdio = { nil, stdout, stderr },
+ }, function(code)
+ exit_code = code
+ stdout:close()
+ stderr:close()
+ done = true
+ end)
+
+ if handle then
+ stdout:read_start(function(_, data)
+ stdout_data[#stdout_data + 1] = data
+ end)
+ stderr:read_start(function(_, data)
+ stderr_data[#stderr_data + 1] = data
+ end)
+ else
+ stdout:close()
+ stderr:close()
+ if not silent then
+ man_error(string.format('command error: %s', table.concat(cmd)))
+ end
+ end
+
+ vim.wait(30000, function()
+ return done
+ end)
+
+ if not done then
+ if handle then
+ vim.loop.shutdown(handle)
+ stdout:close()
+ stderr:close()
+ end
+ man_error(string.format('command timed out: %s', table.concat(cmd, ' ')))
+ end
+
+ if exit_code ~= 0 and not silent then
+ man_error(
+ string.format("command error '%s': %s", table.concat(cmd, ' '), table.concat(stderr_data))
+ )
+ end
+
+ return table.concat(stdout_data)
+end
+
local function highlight_line(line, linenr)
local chars = {}
local prev_char = ''
@@ -152,21 +220,540 @@ 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.bo.modifiable
+ vim.bo.modifiable = true
- local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
+ local lines = api.nvim_buf_get_lines(0, 0, -1, false)
for i, line in ipairs(lines) do
lines[i] = highlight_line(line, i)
end
- vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
+ api.nvim_buf_set_lines(0, 0, -1, false, lines)
for _, args in ipairs(buf_hls) do
- vim.api.nvim_buf_add_highlight(unpack(args))
+ api.nvim_buf_add_highlight(unpack(args))
end
buf_hls = {}
- vim.api.nvim_buf_set_option(0, 'modifiable', mod)
+ vim.bo.modifiable = mod
+end
+
+-- replace spaces in a man page name with underscores
+-- intended for PostgreSQL, which has man pages like 'CREATE_TABLE(7)';
+-- while editing SQL source code, it's nice to visually select 'CREATE TABLE'
+-- and hit 'K', which requires this transformation
+local function spaces_to_underscores(str)
+ local res = str:gsub('%s', '_')
+ return res
+end
+
+local function get_path(sect, name, silent)
+ name = name or ''
+ sect = sect or ''
+ -- Some man implementations (OpenBSD) return all available paths from the
+ -- search command. Previously, this function would simply select the first one.
+ --
+ -- However, some searches will report matches that are incorrect:
+ -- man -w strlen may return string.3 followed by strlen.3, and therefore
+ -- selecting the first would get us the wrong page. Thus, we must find the
+ -- first matching one.
+ --
+ -- There's yet another special case here. Consider the following:
+ -- If you run man -w strlen and string.3 comes up first, this is a problem. We
+ -- should search for a matching named one in the results list.
+ -- However, if you search for man -w clock_gettime, you will *only* get
+ -- clock_getres.2, which is the right page. Searching the resuls for
+ -- clock_gettime will no longer work. In this case, we should just use the
+ -- first one that was found in the correct section.
+ --
+ -- 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.
+ local cmd
+ if sect == '' then
+ cmd = { 'man', find_arg, name }
+ else
+ cmd = { 'man', find_arg, sect, name }
+ end
+
+ local lines = man_system(cmd, silent)
+ if lines == nil then
+ return nil
+ end
+
+ local results = vim.split(lines, '\n', { trimempty = true })
+
+ if #results == 0 then
+ return
+ end
+
+ -- find any that match the specified name
+ local namematches = vim.tbl_filter(function(v)
+ return fn.fnamemodify(v, ':t'):match(name)
+ end, results) or {}
+ local sectmatches = {}
+
+ if #namematches > 0 and sect ~= '' then
+ sectmatches = vim.tbl_filter(function(v)
+ return fn.fnamemodify(v, ':e') == sect
+ end, namematches)
+ end
+
+ return fn.substitute(sectmatches[1] or namematches[1] or results[1], [[\n\+$]], '', '')
+end
+
+local function matchstr(text, pat_or_re)
+ local re = type(pat_or_re) == 'string' and vim.regex(pat_or_re) or pat_or_re
+
+ local s, e = re:match_str(text)
+
+ if s == nil then
+ return
+ end
+
+ return text:sub(vim.str_utfindex(text, s) + 1, vim.str_utfindex(text, e))
+end
+
+-- attempt to extract the name and sect out of 'name(sect)'
+-- otherwise just return the largest string of valid characters in ref
+local function extract_sect_and_name_ref(ref)
+ ref = ref or ''
+ if ref:sub(1, 1) == '-' then -- try ':Man -pandoc' with this disabled.
+ man_error("manpage name cannot start with '-'")
+ end
+ local ref1 = ref:match('[^()]+%([^()]+%)')
+ if not ref1 then
+ local name = ref:match('[^()]+')
+ if not name then
+ man_error('manpage reference cannot contain only parentheses: ' .. ref)
+ end
+ return '', spaces_to_underscores(name)
+ end
+ local parts = vim.split(ref1, '(', { plain = true })
+ -- see ':Man 3X curses' on why tolower.
+ -- TODO(nhooyr) Not sure if this is portable across OSs
+ -- but I have not seen a single uppercase section.
+ local sect = vim.split(parts[2] or '', ')', { plain = true })[1]:lower()
+ local name = spaces_to_underscores(parts[1])
+ return sect, name
+end
+
+-- verify_exists attempts to find the path to a manpage
+-- based on the passed section and name.
+--
+-- 1. If manpage could not be found with the given sect and name,
+-- then try all the sections in b:man_default_sects.
+-- 2. If it still could not be found, then we try again without a section.
+-- 3. If still not found but $MANSECT is set, then we try again with $MANSECT
+-- unset.
+local function verify_exists(sect, name)
+ if sect and sect ~= '' then
+ local ret = get_path(sect, name, true)
+ if ret then
+ return ret
+ end
+ end
+
+ if vim.b.man_default_sects ~= nil then
+ local sects = vim.split(vim.b.man_default_sects, ',', { plain = true, trimempty = true })
+ for _, sec in ipairs(sects) do
+ local ret = get_path(sec, name, true)
+ if ret then
+ return ret
+ end
+ end
+ end
+
+ -- if none of the above worked, we will try with no section
+ local res_empty_sect = get_path('', name, true)
+ if res_empty_sect then
+ return res_empty_sect
+ end
+
+ -- if that still didn't work, we will check for $MANSECT and try again with it
+ -- unset
+ if vim.env.MANSECT then
+ local mansect = vim.env.MANSECT
+ vim.env.MANSECT = nil
+ local res = get_path('', name, true)
+ vim.env.MANSECT = mansect
+ if res then
+ return res
+ end
+ end
+
+ -- finally, if that didn't work, there is no hope
+ man_error('no manual entry for ' .. name)
+end
+
+local EXT_RE = vim.regex([[\.\%([glx]z\|bz2\|lzma\|Z\)$]])
+
+-- Extracts the name/section from the 'path/name.sect', because sometimes the actual section is
+-- more specific than what we provided to `man` (try `:Man 3 App::CLI`).
+-- Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
+-- still want the name of the buffer to be 'printf'.
+local function extract_sect_and_name_path(path)
+ local tail = fn.fnamemodify(path, ':t')
+ if EXT_RE:match_str(path) then -- valid extensions
+ tail = fn.fnamemodify(tail, ':r')
+ end
+ local name, sect = tail:match('^(.+)%.([^.]+)$')
+ return sect, name
+end
+
+local function find_man()
+ local win = 1
+ while win <= fn.winnr('$') do
+ local buf = fn.winbufnr(win)
+ if vim.bo[buf].filetype == 'man' then
+ vim.cmd(win .. 'wincmd w')
+ return true
+ end
+ win = win + 1
+ end
+ return false
+end
+
+local function set_options(pager)
+ vim.bo.swapfile = false
+ vim.bo.buftype = 'nofile'
+ vim.bo.bufhidden = 'hide'
+ vim.bo.modified = false
+ vim.bo.readonly = true
+ vim.bo.modifiable = false
+ vim.b.pager = pager
+ vim.bo.filetype = 'man'
+end
+
+local function get_page(path, silent)
+ -- Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
+ -- Soft-wrap: ftplugin/man.lua sets wrap/breakindent/….
+ -- Hard-wrap: driven by `man`.
+ local manwidth
+ if (vim.g.man_hardwrap or 1) ~= 1 then
+ manwidth = 999
+ elseif vim.env.MANWIDTH then
+ manwidth = vim.env.MANWIDTH
+ else
+ manwidth = api.nvim_win_get_width(0)
+ end
+ -- Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
+ -- http://comments.gmane.org/gmane.editors.vim.devel/29085
+ -- Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
+ local cmd = { 'env', 'MANPAGER=cat', 'MANWIDTH=' .. manwidth, 'MAN_KEEP_FORMATTING=1', 'man' }
+ if localfile_arg then
+ cmd[#cmd + 1] = '-l'
+ end
+ cmd[#cmd + 1] = path
+ return man_system(cmd, silent)
+end
+
+local function put_page(page)
+ vim.bo.modified = true
+ vim.bo.readonly = false
+ vim.bo.swapfile = false
+
+ api.nvim_buf_set_lines(0, 0, -1, false, vim.split(page, '\n'))
+
+ while fn.getline(1):match('^%s*$') do
+ api.nvim_buf_set_lines(0, 0, 1, false, {})
+ end
+ -- XXX: nroff justifies text by filling it with whitespace. That interacts
+ -- badly with our use of $MANWIDTH=999. Hack around this by using a fixed
+ -- size for those whitespace regions.
+ vim.cmd([[silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g]])
+ vim.cmd('1') -- Move cursor to first line
+ highlight_man_page()
+ set_options(false)
+end
+
+local function format_candidate(path, psect)
+ if matchstr(path, [[\.\%(pdf\|in\)$]]) then -- invalid extensions
+ return ''
+ end
+ local sect, name = extract_sect_and_name_path(path)
+ if sect == psect then
+ return name
+ elseif sect and name and matchstr(sect, psect .. '.\\+$') then -- invalid extensions
+ -- We include the section if the user provided section is a prefix
+ -- of the actual section.
+ return ('%s(%s)'):format(name, sect)
+ end
+ return ''
end
-return { highlight_man_page = highlight_man_page }
+local function get_paths(sect, name, do_fallback)
+ -- callers must try-catch this, as some `man` implementations don't support `s:find_arg`
+ local ok, ret = pcall(function()
+ local mandirs =
+ table.concat(vim.split(man_system({ 'man', find_arg }), '[:\n]', { trimempty = true }), ',')
+ local paths = fn.globpath(mandirs, 'man?/' .. name .. '*.' .. sect .. '*', false, true)
+ pcall(function()
+ -- Prioritize the result from verify_exists as it obeys b:man_default_sects.
+ local first = verify_exists(sect, name)
+ paths = vim.tbl_filter(function(v)
+ return v ~= first
+ end, paths)
+ paths = { first, unpack(paths) }
+ end)
+ return paths
+ end)
+
+ if not ok then
+ if not do_fallback then
+ error(ret)
+ end
+
+ -- Fallback to a single path, with the page we're trying to find.
+ ok, ret = pcall(verify_exists, sect, name)
+
+ return { ok and ret or nil }
+ end
+ return ret or {}
+end
+
+local function complete(sect, psect, name)
+ local pages = get_paths(sect, name, false)
+ -- We remove duplicates in case the same manpage in different languages was found.
+ return fn.uniq(fn.sort(vim.tbl_map(function(v)
+ return format_candidate(v, psect)
+ end, pages) or {}, 'i'))
+end
+
+-- see extract_sect_and_name_ref on why tolower(sect)
+function M.man_complete(arg_lead, cmd_line, _)
+ local args = vim.split(cmd_line, '%s+', { trimempty = true })
+ local cmd_offset = fn.index(args, 'Man')
+ if cmd_offset > 0 then
+ -- Prune all arguments up to :Man itself. Otherwise modifier commands like
+ -- :tab, :vertical, etc. would lead to a wrong length.
+ args = vim.list_slice(args, cmd_offset + 1)
+ end
+
+ if #args > 3 then
+ return {}
+ end
+
+ if #args == 1 then
+ -- returning full completion is laggy. Require some arg_lead to complete
+ -- return complete('', '', '')
+ return {}
+ end
+
+ if arg_lead:match('^[^()]+%([^()]*$') then
+ -- cursor (|) is at ':Man printf(|' or ':Man 1 printf(|'
+ -- The later is is allowed because of ':Man pri<TAB>'.
+ -- It will offer 'priclass.d(1m)' even though section is specified as 1.
+ local tmp = vim.split(arg_lead, '(', { plain = true })
+ local name = tmp[1]
+ local sect = (tmp[2] or ''):lower()
+ return complete(sect, '', name)
+ end
+
+ if not args[2]:match('^[^()]+$') then
+ -- cursor (|) is at ':Man 3() |' or ':Man (3|' or ':Man 3() pri|'
+ -- or ':Man 3() pri |'
+ return {}
+ end
+
+ if #args == 2 then
+ local name, sect
+ if arg_lead == '' then
+ -- cursor (|) is at ':Man 1 |'
+ name = ''
+ sect = args[1]:lower()
+ else
+ -- cursor (|) is at ':Man pri|'
+ if arg_lead:match('/') then
+ -- if the name is a path, complete files
+ -- TODO(nhooyr) why does this complete the last one automatically
+ return fn.glob(arg_lead .. '*', false, true)
+ end
+ name = arg_lead
+ sect = ''
+ end
+ return complete(sect, sect, name)
+ end
+
+ if not arg_lead:match('[^()]+$') then
+ -- cursor (|) is at ':Man 3 printf |' or ':Man 3 (pr)i|'
+ return {}
+ end
+
+ -- cursor (|) is at ':Man 3 pri|'
+ local name = arg_lead
+ local sect = args[2]:lower()
+ return complete(sect, sect, name)
+end
+
+function M.goto_tag(pattern, _, _)
+ local sect, name = extract_sect_and_name_ref(pattern)
+
+ local paths = get_paths(sect, name, true)
+ local structured = {}
+
+ for _, path in ipairs(paths) do
+ sect, name = extract_sect_and_name_path(path)
+ if sect and name then
+ structured[#structured + 1] = {
+ name = name,
+ title = name .. '(' .. sect .. ')',
+ }
+ end
+ end
+
+ if vim.o.cscopetag then
+ -- return only a single entry so we work well with :cstag (#11675)
+ structured = { structured[1] }
+ end
+
+ return vim.tbl_map(function(entry)
+ return {
+ name = entry.name,
+ filename = 'man://' .. entry.title,
+ cmd = '1',
+ }
+ end, structured)
+end
+
+-- Called when Nvim is invoked as $MANPAGER.
+function M.init_pager()
+ if fn.getline(1):match('^%s*$') then
+ api.nvim_buf_set_lines(0, 0, 1, false, {})
+ else
+ vim.cmd('keepjumps 1')
+ end
+ highlight_man_page()
+ -- Guess the ref from the heading (which is usually uppercase, so we cannot
+ -- know the correct casing, cf. `man glDrawArraysInstanced`).
+ local ref = fn.substitute(matchstr(fn.getline(1), [[^[^)]\+)]]) or '', ' ', '_', 'g')
+ local ok, res = pcall(extract_sect_and_name_ref, ref)
+ vim.b.man_sect = ok and res or ''
+
+ if not fn.bufname('%'):match('man://') then -- Avoid duplicate buffers, E95.
+ vim.cmd.file({ 'man://' .. fn.fnameescape(ref):lower(), mods = { silent = true } })
+ end
+
+ set_options(true)
+end
+
+function M.open_page(count, smods, args)
+ if #args > 2 then
+ man_error('too many arguments')
+ end
+
+ local ref
+ if #args == 0 then
+ ref = vim.bo.filetype == 'man' and fn.expand('<cWORD>') or fn.expand('<cword>')
+ if ref == '' then
+ man_error('no identifier under cursor')
+ end
+ elseif #args == 1 then
+ ref = args[1]
+ else
+ -- Combine the name and sect into a manpage reference so that all
+ -- verification/extraction can be kept in a single function.
+ -- If args[2] is a reference as well, that is fine because it is the only
+ -- reference that will match.
+ ref = ('%s(%s)'):format(args[2], args[1])
+ end
+
+ local sect, name = extract_sect_and_name_ref(ref)
+ if count >= 0 then
+ sect = tostring(count)
+ end
+
+ local path = verify_exists(sect, name)
+ sect, name = extract_sect_and_name_path(path)
+
+ local buf = fn.bufnr()
+ local save_tfu = vim.bo[buf].tagfunc
+ vim.bo[buf].tagfunc = "v:lua.require'man'.goto_tag"
+
+ local target = ('%s(%s)'):format(name, sect)
+
+ local ok, ret = pcall(function()
+ if smods.tab == -1 and find_man() then
+ vim.cmd.tag({ target, mods = { silent = true, keepalt = true } })
+ else
+ smods.silent = true
+ smods.keepalt = true
+ vim.cmd.stag({ target, mods = smods })
+ end
+ end)
+
+ vim.bo[buf].tagfunc = save_tfu
+
+ if not ok then
+ error(ret)
+ else
+ set_options(false)
+ end
+
+ vim.b.man_sect = sect
+end
+
+-- Called when a man:// buffer is opened.
+function M.read_page(ref)
+ local sect, name = extract_sect_and_name_ref(ref)
+ local path = verify_exists(sect, name)
+ sect = extract_sect_and_name_path(path)
+ local page = get_page(path)
+ vim.b.man_sect = sect
+ put_page(page)
+end
+
+function M.show_toc()
+ local bufname = fn.bufname('%')
+ local info = fn.getloclist(0, { winid = 1 })
+ if info ~= '' and vim.w[info.winid].qf_toc == bufname then
+ vim.cmd.lopen()
+ return
+ end
+
+ local toc = {}
+ local lnum = 2
+ local last_line = fn.line('$') - 1
+ local section_title_re = vim.regex([[^\%( \{3\}\)\=\S.*$]])
+ local flag_title_re = vim.regex([[^\s\+\%(+\|-\)\S\+]])
+ while lnum and lnum < last_line do
+ local text = fn.getline(lnum)
+ if section_title_re:match_str(text) then
+ -- if text is a section title
+ toc[#toc + 1] = {
+ bufnr = fn.bufnr('%'),
+ lnum = lnum,
+ text = text,
+ }
+ elseif flag_title_re:match_str(text) then
+ -- if text is a flag title. we strip whitespaces and prepend two
+ -- spaces to have a consistent format in the loclist.
+ toc[#toc + 1] = {
+ bufnr = fn.bufnr('%'),
+ lnum = lnum,
+ text = ' ' .. fn.substitute(text, [[^\s*\(.\{-}\)\s*$]], [[\1]], ''),
+ }
+ end
+ lnum = fn.nextnonblank(lnum + 1)
+ end
+
+ fn.setloclist(0, toc, ' ')
+ fn.setloclist(0, {}, 'a', { title = 'Man TOC' })
+ vim.cmd.lopen()
+ vim.w.qf_toc = bufname
+end
+
+local function init()
+ local path = get_path('', 'man', true)
+ local page
+ if path ~= nil then
+ -- Check for -l support.
+ page = get_page(path, true)
+ end
+
+ if page == '' or page == nil then
+ localfile_arg = false
+ end
+end
+
+init()
+
+return M
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index f1652718ee..0f45c916dc 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -198,7 +198,10 @@ end
-- Can be done in a separate PR.
local key_value_options = {
fillchars = true,
+ fcs = true,
listchars = true,
+ lcs = true,
+ winhighlight = true,
winhl = true,
}
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 3f71d4f70d..4f7d8cccd5 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -45,18 +45,24 @@ local bufnr_and_namespace_cacher_mt = {
end,
}
-local diagnostic_cache = setmetatable({}, {
- __index = function(t, bufnr)
- assert(bufnr > 0, 'Invalid buffer number')
- vim.api.nvim_buf_attach(bufnr, false, {
- on_detach = function()
- rawset(t, bufnr, nil) -- clear cache
- end,
- })
- t[bufnr] = {}
- return t[bufnr]
- end,
-})
+local diagnostic_cache
+do
+ local group = vim.api.nvim_create_augroup('DiagnosticBufWipeout', {})
+ diagnostic_cache = setmetatable({}, {
+ __index = function(t, bufnr)
+ assert(bufnr > 0, 'Invalid buffer number')
+ vim.api.nvim_create_autocmd('BufWipeout', {
+ group = group,
+ buffer = bufnr,
+ callback = function()
+ rawset(t, bufnr, nil)
+ end,
+ })
+ t[bufnr] = {}
+ return t[bufnr]
+ end,
+ })
+end
local diagnostic_cache_extmarks = setmetatable({}, bufnr_and_namespace_cacher_mt)
local diagnostic_attached_buffers = {}
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 99c98764dd..39985c948e 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -177,6 +177,7 @@ local extension = {
bbappend = 'bitbake',
bbclass = 'bitbake',
bl = 'blank',
+ blp = 'blueprint',
bsd = 'bsdl',
bsdl = 'bsdl',
bst = 'bst',
@@ -422,9 +423,11 @@ local extension = {
gdb = 'gdb',
gdmo = 'gdmo',
mo = 'gdmo',
- tres = 'gdresource',
tscn = 'gdresource',
+ tres = 'gdresource',
gd = 'gdscript',
+ gdshader = 'gdshader',
+ shader = 'gdshader',
ged = 'gedcom',
gmi = 'gemtext',
gemini = 'gemtext',
@@ -538,6 +541,7 @@ local extension = {
mjs = 'javascript',
javascript = 'javascript',
js = 'javascript',
+ jsm = 'javascript',
cjs = 'javascript',
jsx = 'javascriptreact',
clp = 'jess',
@@ -554,6 +558,8 @@ local extension = {
['json-patch'] = 'json',
json5 = 'json5',
jsonc = 'jsonc',
+ jsonnet = 'jsonnet',
+ libjsonnet = 'jsonnet',
jsp = 'jsp',
jl = 'julia',
kv = 'kivy',
@@ -741,6 +747,7 @@ local extension = {
php = 'php',
phpt = 'php',
phtml = 'php',
+ theme = 'php',
pike = 'pike',
pmod = 'pike',
rcp = 'pilrc',
@@ -900,7 +907,9 @@ local extension = {
sig = function(path, bufnr)
return require('vim.filetype.detect').sig(bufnr)
end,
- sil = 'sil',
+ sil = function(path, bufnr)
+ return require('vim.filetype.detect').sil(bufnr)
+ end,
sim = 'simula',
['s85'] = 'sinda',
sin = 'sinda',
@@ -950,6 +959,7 @@ local extension = {
srec = 'srec',
mot = 'srec',
['s19'] = 'srec',
+ srt = 'srt',
st = 'st',
imata = 'stata',
['do'] = 'stata',
@@ -1011,6 +1021,11 @@ local extension = {
dsm = 'vb',
ctl = 'vb',
vbs = 'vb',
+ vdmpp = 'vdmpp',
+ vpp = 'vdmpp',
+ vdmrt = 'vdmrt',
+ vdmsl = 'vdmsl',
+ vdm = 'vdmsl',
vr = 'vera',
vri = 'vera',
vrh = 'vera',
@@ -1371,6 +1386,8 @@ local filename = {
['EDIT_DESCRIPTION'] = 'gitcommit',
['.gitconfig'] = 'gitconfig',
['.gitmodules'] = 'gitconfig',
+ ['.gitattributes'] = 'gitattributes',
+ ['.gitignore'] = 'gitignore',
['gitolite.conf'] = 'gitolite',
['git-rebase-todo'] = 'gitrebase',
gkrellmrc = 'gkrellmrc',
@@ -1813,6 +1830,21 @@ local pattern = {
return 'gitconfig'
end
end,
+ ['.*%.git/info/attributes'] = 'gitattributes',
+ ['.*/etc/gitattributes'] = 'gitattributes',
+ ['.*/%.config/git/attributes'] = 'gitattributes',
+ ['.*/git/attributes'] = function(path, bufnr)
+ if vim.env.XDG_CONFIG_HOME and path:find(vim.env.XDG_CONFIG_HOME .. '/git/attributes') then
+ return 'gitattributes'
+ end
+ end,
+ ['.*%.git/info/exclude'] = 'gitignore',
+ ['.*/%.config/git/ignore'] = 'gitignore',
+ ['.*/git/ignore'] = function(path, bufnr)
+ if vim.env.XDG_CONFIG_HOME and path:find(vim.env.XDG_CONFIG_HOME .. '/git/ignore') then
+ return 'gitignore'
+ end
+ end,
['%.gitsendemail%.msg%.......'] = 'gitsendemail',
['gkrellmrc_.'] = 'gkrellmrc',
['.*/usr/.*/gnupg/options%.skel'] = 'gpg',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 2be9dcff88..7fc7f1b7ca 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -1194,6 +1194,19 @@ function M.shell(path, contents, name)
return name
end
+-- Swift Intermediate Language or SILE
+function M.sil(bufnr)
+ for _, line in ipairs(getlines(bufnr, 1, 100)) do
+ if line:find('^%s*[\\%%]') then
+ return 'sile'
+ elseif line:find('^%s*%S') then
+ return 'sil'
+ end
+ end
+ -- No clue, default to "sil"
+ return 'sil'
+end
+
-- SMIL or SNMP MIB file
function M.smi(bufnr)
local line = getlines(bufnr, 1)
diff --git a/runtime/lua/vim/inspect.lua b/runtime/lua/vim/inspect.lua
index 0a53fb203b..c232f69590 100644
--- a/runtime/lua/vim/inspect.lua
+++ b/runtime/lua/vim/inspect.lua
@@ -89,8 +89,38 @@ local function escape(str)
)
end
+-- List of lua keywords
+local luaKeywords = {
+ ['and'] = true,
+ ['break'] = true,
+ ['do'] = true,
+ ['else'] = true,
+ ['elseif'] = true,
+ ['end'] = true,
+ ['false'] = true,
+ ['for'] = true,
+ ['function'] = true,
+ ['goto'] = true,
+ ['if'] = true,
+ ['in'] = true,
+ ['local'] = true,
+ ['nil'] = true,
+ ['not'] = true,
+ ['or'] = true,
+ ['repeat'] = true,
+ ['return'] = true,
+ ['then'] = true,
+ ['true'] = true,
+ ['until'] = true,
+ ['while'] = true,
+}
+
local function isIdentifier(str)
- return type(str) == 'string' and not not str:match('^[_%a][_%a%d]*$')
+ return type(str) == 'string'
+ -- identifier must start with a letter and underscore, and be followed by letters, numbers, and underscores
+ and not not str:match('^[_%a][_%a%d]*$')
+ -- lua keywords are not valid identifiers
+ and not luaKeywords[str]
end
local flr = math.floor
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index fd64c1a495..22933d8143 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -289,7 +289,12 @@ local function validate_client_config(config)
'flags.debounce_text_changes must be a number with the debounce time in milliseconds'
)
- local cmd, cmd_args = lsp._cmd_parts(config.cmd)
+ local cmd, cmd_args
+ if type(config.cmd) == 'function' then
+ cmd = config.cmd
+ else
+ cmd, cmd_args = lsp._cmd_parts(config.cmd)
+ end
local offset_encoding = valid_encodings.UTF16
if config.offset_encoding then
offset_encoding = validate_encoding(config.offset_encoding)
@@ -855,14 +860,17 @@ end
--- Used on all running clients.
--- The default implementation re-uses a client if name
--- and root_dir matches.
----@return number client_id
+---@return number|nil 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
+ config.name = config.name
+ if not config.name and type(config.cmd) == 'table' then
+ config.name = config.cmd[1] and vim.fs.basename(config.cmd[1]) or nil
+ end
local bufnr = api.nvim_get_current_buf()
for _, clients in ipairs({ uninitialized_clients, lsp.get_active_clients() }) do
for _, client in pairs(clients) do
@@ -893,8 +901,13 @@ end
--- The following parameters describe fields in the {config} table.
---
---
----@param cmd: (required, string or list treated like |jobstart()|) Base command
---- that initiates the LSP client.
+---@param cmd: (table|string|fun(dispatchers: table):table) command string or
+--- list treated like |jobstart|. The command must launch the language server
+--- process. `cmd` can also be a function that creates an RPC client.
+--- The function receives a dispatchers table and must return a table with the
+--- functions `request`, `notify`, `is_closing` and `terminate`
+--- See |vim.lsp.rpc.request| and |vim.lsp.rpc.notify|
+--- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect|
---
---@param cmd_cwd: (string, default=|getcwd()|) Directory to launch
--- the `cmd` process. Not related to `root_dir`.
@@ -1134,41 +1147,47 @@ function lsp.start_client(config)
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)
+ client_ids[client_id] = nil
+ if vim.tbl_isempty(client_ids) then
+ unset_defaults(bufnr)
+ end
end)
end
end
- local client = active_clients[client_id] and active_clients[client_id]
- or uninitialized_clients[client_id]
- active_clients[client_id] = nil
- uninitialized_clients[client_id] = nil
- -- Client can be absent if executable starts, but initialize fails
- -- init/attach won't have happened
- if client then
- changetracking.reset(client)
- end
- if code ~= 0 or (signal ~= 0 and signal ~= 15) then
- local msg =
- string.format('Client %s quit with exit code %s and signal %s', client_id, code, signal)
- vim.schedule(function()
+ -- Schedule the deletion of the client object so that it exists in the execution of LspDetach
+ -- autocommands
+ vim.schedule(function()
+ local client = active_clients[client_id] and active_clients[client_id]
+ or uninitialized_clients[client_id]
+ active_clients[client_id] = nil
+ uninitialized_clients[client_id] = nil
+
+ -- Client can be absent if executable starts, but initialize fails
+ -- init/attach won't have happened
+ if client then
+ changetracking.reset(client)
+ end
+ if code ~= 0 or (signal ~= 0 and signal ~= 15) then
+ local msg =
+ string.format('Client %s quit with exit code %s and signal %s', client_id, code, signal)
vim.notify(msg, vim.log.levels.WARN)
- end)
- end
+ end
+ end)
end
-- Start the RPC client.
- local rpc = lsp_rpc.start(cmd, cmd_args, dispatch, {
- cwd = config.cmd_cwd,
- env = config.cmd_env,
- detached = config.detached,
- })
+ local rpc
+ if type(cmd) == 'function' then
+ rpc = cmd(dispatch)
+ else
+ rpc = lsp_rpc.start(cmd, cmd_args, dispatch, {
+ cwd = config.cmd_cwd,
+ env = config.cmd_env,
+ detached = config.detached,
+ })
+ end
-- Return nil if client fails to start
if not rpc then
@@ -1464,14 +1483,13 @@ function lsp.start_client(config)
--- you request to stop a client which has previously been requested to
--- shutdown, it will automatically escalate and force shutdown.
---
- ---@param force (bool, optional)
+ ---@param force boolean|nil
function client.stop(force)
- local handle = rpc.handle
- if handle:is_closing() then
+ if rpc.is_closing() then
return
end
if force or not client.initialized or graceful_shutdown_failed then
- handle:kill(15)
+ rpc.terminate()
return
end
-- Sending a signal after a process has exited is acceptable.
@@ -1480,7 +1498,7 @@ function lsp.start_client(config)
rpc.notify('exit')
else
-- If there was an error in the shutdown request, then term to be safe.
- handle:kill(15)
+ rpc.terminate()
graceful_shutdown_failed = true
end
end)
@@ -1492,7 +1510,7 @@ function lsp.start_client(config)
---@returns (bool) true if client is stopped or in the process of being
---stopped; false otherwise
function client.is_stopped()
- return rpc.handle:is_closing()
+ return rpc.is_closing()
end
---@private
@@ -1627,6 +1645,7 @@ function lsp.buf_attach_client(bufnr, client_id)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify('textDocument/didClose', params)
end
+ client.attached_buffers[bufnr] = nil
end)
util.buf_versions[bufnr] = nil
all_buffer_active_clients[bufnr] = nil
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 6a070928d9..2ce565e1d9 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -150,6 +150,33 @@ local function select_client(method, on_choice)
end
end
+---@private
+---@return table {start={row, col}, end={row, col}} using (1, 0) indexing
+local function range_from_selection()
+ -- TODO: Use `vim.region()` instead https://github.com/neovim/neovim/pull/13896
+
+ -- [bufnum, lnum, col, off]; both row and column 1-indexed
+ local start = vim.fn.getpos('v')
+ local end_ = vim.fn.getpos('.')
+ local start_row = start[2]
+ local start_col = start[3]
+ local end_row = end_[2]
+ local end_col = end_[3]
+
+ -- A user can start visual selection at the end and move backwards
+ -- Normalize the range to start < end
+ if start_row == end_row and end_col < start_col then
+ end_col, start_col = start_col, end_col
+ elseif end_row < start_row then
+ start_row, end_row = end_row, start_row
+ start_col, end_col = end_col, start_col
+ end
+ return {
+ ['start'] = { start_row, start_col - 1 },
+ ['end'] = { end_row, end_col - 1 },
+ }
+end
+
--- Formats a buffer using the attached (and optionally filtered) language
--- server clients.
---
@@ -184,7 +211,12 @@ end
--- Restrict formatting to the client with ID (client.id) matching this field.
--- - name (string|nil):
--- Restrict formatting to the client with name (client.name) matching this field.
-
+---
+--- - range (table|nil) Range to format.
+--- Table must contain `start` and `end` keys with {row, col} tuples using
+--- (1,0) indexing.
+--- Defaults to current selection in visual mode
+--- Defaults to `nil` in other modes, formatting the full buffer
function M.format(options)
options = options or {}
local bufnr = options.bufnr or api.nvim_get_current_buf()
@@ -206,16 +238,32 @@ function M.format(options)
vim.notify('[LSP] Format request failed, no matching language servers.')
end
+ local mode = api.nvim_get_mode().mode
+ local range = options.range
+ if not range and mode == 'v' or mode == 'V' then
+ range = range_from_selection()
+ end
+
+ ---@private
+ local function set_range(client, params)
+ if range then
+ local range_params =
+ util.make_given_range_params(range.start, range['end'], bufnr, client.offset_encoding)
+ params.range = range_params.range
+ end
+ return params
+ end
+
+ local method = range and 'textDocument/rangeFormatting' or 'textDocument/formatting'
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']
+ local params = set_range(client, util.make_formatting_params(options.formatting_options))
+ client.request(method, params, function(...)
+ local handler = client.handlers[method] or vim.lsp.handlers[method]
handler(...)
do_format(next(clients, idx))
end, bufnr)
@@ -224,8 +272,8 @@ function M.format(options)
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)
+ local params = set_range(client, util.make_formatting_params(options.formatting_options))
+ local result, err = client.request_sync(method, params, timeout_ms, bufnr)
if result and result.result then
util.apply_text_edits(result.result, bufnr, client.offset_encoding)
elseif err then
@@ -356,6 +404,7 @@ end
---@param end_pos ({number, number}, optional) mark-indexed position.
---Defaults to the end of the last visual selection.
function M.range_formatting(options, start_pos, end_pos)
+ vim.deprecate('vim.lsp.buf.range_formatting', 'vim.lsp.formatexpr or vim.lsp.format', '0.9.0')
local params = util.make_given_range_params(start_pos, end_pos)
params.options = util.make_formatting_params(options).options
select_client('textDocument/rangeFormatting', function(client)
@@ -885,23 +934,8 @@ function M.code_action(options)
local end_ = assert(options.range['end'], 'range must have a `end` property')
params = util.make_given_range_params(start, end_)
elseif mode == 'v' or mode == 'V' then
- -- [bufnum, lnum, col, off]; both row and column 1-indexed
- local start = vim.fn.getpos('v')
- local end_ = vim.fn.getpos('.')
- local start_row = start[2]
- local start_col = start[3]
- local end_row = end_[2]
- local end_col = end_[3]
-
- -- A user can start visual selection at the end and move backwards
- -- Normalize the range to start < end
- if start_row == end_row and end_col < start_col then
- end_col, start_col = start_col, end_col
- elseif end_row < start_row then
- start_row, end_row = end_row, start_row
- start_col, end_col = end_col, start_col
- end
- params = util.make_given_range_params({ start_row, start_col - 1 }, { end_row, end_col - 1 })
+ local range = range_from_selection()
+ params = util.make_given_range_params(range.start, range['end'])
else
params = util.make_range_params()
end
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 0926912066..7d047f8958 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -241,8 +241,402 @@ function default_dispatchers.on_error(code, err)
local _ = log.error() and log.error('client_error:', client_errors[code], err)
end
+---@private
+local function create_read_loop(handle_body, on_no_chunk, on_error)
+ local parse_chunk = coroutine.wrap(request_parser_loop)
+ parse_chunk()
+ return function(err, chunk)
+ if err then
+ on_error(err)
+ return
+ end
+
+ if not chunk then
+ if on_no_chunk then
+ on_no_chunk()
+ end
+ return
+ end
+
+ while true do
+ local headers, body = parse_chunk(chunk)
+ if headers then
+ handle_body(body)
+ chunk = ''
+ else
+ break
+ end
+ end
+ end
+end
+
+---@class RpcClient
+---@field message_index number
+---@field message_callbacks table
+---@field notify_reply_callbacks table
+---@field transport table
+---@field dispatchers table
+
+---@class RpcClient
+local Client = {}
+
+---@private
+function Client:encode_and_send(payload)
+ local _ = log.debug() and log.debug('rpc.send', payload)
+ if self.transport.is_closing() then
+ return false
+ end
+ local encoded = vim.json.encode(payload)
+ self.transport.write(format_message_with_content_length(encoded))
+ return true
+end
+
+---@private
+--- Sends a notification to the LSP server.
+---@param method (string) The invoked LSP method
+---@param params (table|nil): Parameters for the invoked LSP method
+---@returns (bool) `true` if notification could be sent, `false` if not
+function Client:notify(method, params)
+ return self:encode_and_send({
+ jsonrpc = '2.0',
+ method = method,
+ params = params,
+ })
+end
+
+---@private
+--- sends an error object to the remote LSP process.
+function Client:send_response(request_id, err, result)
+ return self:encode_and_send({
+ id = request_id,
+ jsonrpc = '2.0',
+ error = err,
+ result = result,
+ })
+end
+
+---@private
+--- Sends a request to the LSP server and runs {callback} upon response.
+---
+---@param method (string) The invoked LSP method
+---@param params (table|nil) Parameters for the invoked LSP method
+---@param callback (function) Callback to invoke
+---@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
+function Client:request(method, params, callback, notify_reply_callback)
+ validate({
+ callback = { callback, 'f' },
+ notify_reply_callback = { notify_reply_callback, 'f', true },
+ })
+ self.message_index = self.message_index + 1
+ local message_id = self.message_index
+ local result = self:encode_and_send({
+ id = message_id,
+ jsonrpc = '2.0',
+ method = method,
+ params = params,
+ })
+ local message_callbacks = self.message_callbacks
+ local notify_reply_callbacks = self.notify_reply_callbacks
+ if result then
+ if message_callbacks then
+ message_callbacks[message_id] = schedule_wrap(callback)
+ else
+ return false
+ end
+ if notify_reply_callback and notify_reply_callbacks then
+ notify_reply_callbacks[message_id] = schedule_wrap(notify_reply_callback)
+ end
+ return result, message_id
+ else
+ return false
+ end
+end
+
+---@private
+function Client:on_error(errkind, ...)
+ assert(client_errors[errkind])
+ -- TODO what to do if this fails?
+ pcall(self.dispatchers.on_error, errkind, ...)
+end
+
+---@private
+function Client:pcall_handler(errkind, status, head, ...)
+ if not status then
+ self:on_error(errkind, head, ...)
+ return status, head
+ end
+ return status, head, ...
+end
+
+---@private
+function Client:try_call(errkind, fn, ...)
+ return self:pcall_handler(errkind, pcall(fn, ...))
+end
+
+-- TODO periodically check message_callbacks for old requests past a certain
+-- time and log them. This would require storing the timestamp. I could call
+-- them with an error then, perhaps.
+
+---@private
+function Client:handle_body(body)
+ local ok, decoded = pcall(vim.json.decode, body, { luanil = { object = true } })
+ if not ok then
+ self:on_error(client_errors.INVALID_SERVER_JSON, decoded)
+ return
+ end
+ local _ = log.debug() and log.debug('rpc.receive', decoded)
+
+ if type(decoded.method) == 'string' and decoded.id then
+ local err
+ -- Schedule here so that the users functions don't trigger an error and
+ -- we can still use the result.
+ schedule(function()
+ local status, result
+ status, result, err = self:try_call(
+ client_errors.SERVER_REQUEST_HANDLER_ERROR,
+ self.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
+ )
+ )
+ 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.'
+ )
+ err.message = err.message or code_name
+ end
+ else
+ -- On an exception, result will contain the error message.
+ err = rpc_response_error(protocol.ErrorCodes.InternalError, result)
+ result = nil
+ end
+ self:send_response(decoded.id, err, result)
+ end)
+ -- 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 = assert(tonumber(decoded.id), 'response id must be a number')
+
+ -- Notify the user that a response was received for the request
+ local notify_reply_callbacks = self.notify_reply_callbacks
+ 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' },
+ })
+ notify_reply_callback(result_id)
+ notify_reply_callbacks[result_id] = nil
+ end
+
+ local message_callbacks = self.message_callbacks
+
+ -- Do not surface RequestCancelled to users, it is RPC-internal.
+ 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)
+ mute_error = true
+ end
+
+ if mute_error then
+ -- Clear any callback since this is cancelled now.
+ -- This is safe to do assuming that these conditions hold:
+ -- - The server will not send a result callback after this cancellation.
+ -- - If the server sent this cancellation ACK after sending the result, the user of this RPC
+ -- client will ignore the result themselves.
+ if result_id and message_callbacks then
+ message_callbacks[result_id] = nil
+ end
+ return
+ end
+ end
+
+ local callback = message_callbacks and message_callbacks[result_id]
+ if callback then
+ message_callbacks[result_id] = nil
+ validate({
+ callback = { callback, 'f' },
+ })
+ if decoded.error then
+ decoded.error = setmetatable(decoded.error, {
+ __tostring = format_rpc_error,
+ })
+ end
+ self:try_call(
+ client_errors.SERVER_RESULT_CALLBACK_ERROR,
+ callback,
+ decoded.error,
+ decoded.result
+ )
+ else
+ self:on_error(client_errors.NO_RESULT_CALLBACK_FOUND, decoded)
+ local _ = log.error() and log.error('No callback found for server response id ' .. result_id)
+ end
+ elseif type(decoded.method) == 'string' then
+ -- Notification
+ self:try_call(
+ client_errors.NOTIFICATION_HANDLER_ERROR,
+ self.dispatchers.notification,
+ decoded.method,
+ decoded.params
+ )
+ else
+ -- Invalid server message
+ self:on_error(client_errors.INVALID_SERVER_MESSAGE, decoded)
+ end
+end
+
+---@private
+---@return RpcClient
+local function new_client(dispatchers, transport)
+ local state = {
+ message_index = 0,
+ message_callbacks = {},
+ notify_reply_callbacks = {},
+ transport = transport,
+ dispatchers = dispatchers,
+ }
+ return setmetatable(state, { __index = Client })
+end
+
+---@private
+---@param client RpcClient
+local function public_client(client)
+ local result = {}
+
+ ---@private
+ function result.is_closing()
+ return client.transport.is_closing()
+ end
+
+ ---@private
+ function result.terminate()
+ client.transport.terminate()
+ end
+
+ --- Sends a request to the LSP server and runs {callback} upon response.
+ ---
+ ---@param method (string) The invoked LSP method
+ ---@param params (table|nil) Parameters for the invoked LSP method
+ ---@param callback (function) Callback to invoke
+ ---@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
+ function result.request(method, params, callback, notify_reply_callback)
+ return client:request(method, params, callback, notify_reply_callback)
+ end
+
+ --- Sends a notification to the LSP server.
+ ---@param method (string) The invoked LSP method
+ ---@param params (table|nil): Parameters for the invoked LSP method
+ ---@returns (bool) `true` if notification could be sent, `false` if not
+ function result.notify(method, params)
+ return client:notify(method, params)
+ end
+
+ return result
+end
+
+---@private
+local function merge_dispatchers(dispatchers)
+ if dispatchers then
+ local user_dispatchers = dispatchers
+ dispatchers = {}
+ for dispatch_name, default_dispatch in pairs(default_dispatchers) do
+ local user_dispatcher = user_dispatchers[dispatch_name]
+ if user_dispatcher then
+ if type(user_dispatcher) ~= 'function' then
+ error(string.format('dispatcher.%s must be a function', dispatch_name))
+ end
+ -- server_request is wrapped elsewhere.
+ if
+ not (dispatch_name == 'server_request' or dispatch_name == 'on_exit') -- TODO this blocks the loop exiting for some reason.
+ then
+ user_dispatcher = schedule_wrap(user_dispatcher)
+ end
+ dispatchers[dispatch_name] = user_dispatcher
+ else
+ dispatchers[dispatch_name] = default_dispatch
+ end
+ end
+ else
+ dispatchers = default_dispatchers
+ end
+ return dispatchers
+end
+
+--- Create a LSP RPC client factory that connects via TCP to the given host
+--- and port
+---
+---@param host string
+---@param port number
+---@return function
+local function connect(host, port)
+ return function(dispatchers)
+ dispatchers = merge_dispatchers(dispatchers)
+ local tcp = uv.new_tcp()
+ local closing = false
+ local transport = {
+ write = function(msg)
+ tcp:write(msg)
+ end,
+ is_closing = function()
+ return closing
+ end,
+ terminate = function()
+ if not closing then
+ closing = true
+ tcp:shutdown()
+ tcp:close()
+ dispatchers.on_exit(0, 0)
+ end
+ end,
+ }
+ local client = new_client(dispatchers, transport)
+ tcp:connect(host, port, function(err)
+ if err then
+ vim.schedule(function()
+ vim.notify(
+ string.format('Could not connect to %s:%s, reason: %s', host, port, vim.inspect(err)),
+ vim.log.levels.WARN
+ )
+ end)
+ return
+ end
+ local handle_body = function(body)
+ client:handle_body(body)
+ end
+ tcp:read_start(create_read_loop(handle_body, transport.terminate, function(read_err)
+ client:on_error(client_errors.READ_ERROR, read_err)
+ end))
+ end)
+
+ return public_client(client)
+ end
+end
+
--- Starts an LSP server process and create an LSP RPC client object to
---- interact with it. Communication with the server is currently limited to stdio.
+--- interact with it. Communication with the spawned process happens via stdio. For
+--- communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect|
---
---@param cmd (string) Command to start the LSP server.
---@param cmd_args (table) List of additional string arguments to pass to {cmd}.
@@ -261,11 +655,8 @@ end
---@returns Methods:
--- - `notify()` |vim.lsp.rpc.notify()|
--- - `request()` |vim.lsp.rpc.request()|
----
----@returns Members:
---- - {pid} (number) The LSP server's PID.
---- - {handle} A handle for low-level interaction with the LSP server process
---- |vim.loop|.
+--- - `is_closing()` returns a boolean indicating if the RPC is closing.
+--- - `terminate()` terminates the RPC client.
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 })
@@ -278,161 +669,64 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
if extra_spawn_params and extra_spawn_params.cwd then
assert(is_dir(extra_spawn_params.cwd), 'cwd must be a directory')
end
- if dispatchers then
- local user_dispatchers = dispatchers
- dispatchers = {}
- for dispatch_name, default_dispatch in pairs(default_dispatchers) do
- local user_dispatcher = user_dispatchers[dispatch_name]
- if user_dispatcher then
- if type(user_dispatcher) ~= 'function' then
- error(string.format('dispatcher.%s must be a function', dispatch_name))
- end
- -- server_request is wrapped elsewhere.
- if
- not (dispatch_name == 'server_request' or dispatch_name == 'on_exit') -- TODO this blocks the loop exiting for some reason.
- then
- user_dispatcher = schedule_wrap(user_dispatcher)
- end
- dispatchers[dispatch_name] = user_dispatcher
- else
- dispatchers[dispatch_name] = default_dispatch
- end
- end
- else
- dispatchers = default_dispatchers
- end
+ dispatchers = merge_dispatchers(dispatchers)
local stdin = uv.new_pipe(false)
local stdout = uv.new_pipe(false)
local stderr = uv.new_pipe(false)
-
- local message_index = 0
- local message_callbacks = {}
- local notify_reply_callbacks = {}
-
local handle, pid
- do
- ---@private
- --- Callback for |vim.loop.spawn()| Closes all streams and runs the `on_exit` dispatcher.
- ---@param code (number) Exit code
- ---@param signal (number) Signal that was used to terminate (if any)
- local function onexit(code, signal)
- stdin:close()
- stdout:close()
- stderr:close()
- handle:close()
- -- Make sure that message_callbacks/notify_reply_callbacks can be gc'd.
- message_callbacks = nil
- notify_reply_callbacks = nil
- dispatchers.on_exit(code, signal)
- end
- local spawn_params = {
- 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
- stdin:close()
- stdout:close()
- stderr:close()
- 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)
+
+ local client = new_client(dispatchers, {
+ write = function(msg)
+ stdin:write(msg)
+ end,
+ is_closing = function()
+ return handle == nil or handle:is_closing()
+ end,
+ terminate = function()
+ if handle then
+ handle:kill(15)
end
- vim.notify(msg, vim.log.levels.WARN)
- return
- end
- end
+ end,
+ })
---@private
- --- Encodes {payload} into a JSON-RPC message and sends it to the remote
- --- process.
- ---
- ---@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 encoded = vim.json.encode(payload)
- stdin:write(format_message_with_content_length(encoded))
- return true
- end
-
- -- FIXME: DOC: Should be placed on the RPC client object returned by
- -- `start()`
- --
- --- Sends a notification to the LSP server.
- ---@param method (string) The invoked LSP method
- ---@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,
- })
+ --- Callback for |vim.loop.spawn()| Closes all streams and runs the `on_exit` dispatcher.
+ ---@param code (number) Exit code
+ ---@param signal (number) Signal that was used to terminate (if any)
+ local function onexit(code, signal)
+ stdin:close()
+ stdout:close()
+ stderr:close()
+ handle:close()
+ dispatchers.on_exit(code, signal)
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,
- })
+ local spawn_params = {
+ 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
-
- -- FIXME: DOC: Should be placed on the RPC client object returned by
- -- `start()`
- --
- --- Sends a request to the LSP server and runs {callback} upon response.
- ---
- ---@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|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 },
- })
- 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,
- })
- if result then
- if message_callbacks then
- message_callbacks[message_id] = schedule_wrap(callback)
- else
- return false
- end
- if notify_reply_callback and notify_reply_callbacks then
- notify_reply_callbacks[message_id] = schedule_wrap(notify_reply_callback)
- end
- return result, message_id
+ handle, pid = uv.spawn(cmd, spawn_params, onexit)
+ if handle == nil then
+ stdin:close()
+ stdout:close()
+ stderr:close()
+ 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
- return false
+ msg = msg .. string.format(' with error message: %s', pid)
end
+ vim.notify(msg, vim.log.levels.WARN)
+ return
end
stderr:read_start(function(_, chunk)
@@ -441,195 +735,22 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
end
end)
- ---@private
- local function on_error(errkind, ...)
- assert(client_errors[errkind])
- -- TODO what to do if this fails?
- pcall(dispatchers.on_error, errkind, ...)
- end
- ---@private
- local function pcall_handler(errkind, status, head, ...)
- if not status then
- on_error(errkind, head, ...)
- return status, head
- end
- return status, head, ...
+ local handle_body = function(body)
+ client:handle_body(body)
end
- ---@private
- local function try_call(errkind, fn, ...)
- return pcall_handler(errkind, pcall(fn, ...))
- end
-
- -- TODO periodically check message_callbacks for old requests past a certain
- -- time and log them. This would require storing the timestamp. I could call
- -- them with an error then, perhaps.
+ stdout:read_start(create_read_loop(handle_body, nil, function(err)
+ client:on_error(client_errors.READ_ERROR, err)
+ end))
- ---@private
- local function handle_body(body)
- local ok, decoded = pcall(vim.json.decode, body, { luanil = { object = true } })
- if not ok then
- on_error(client_errors.INVALID_SERVER_JSON, decoded)
- return
- end
- local _ = log.debug() and log.debug('rpc.receive', decoded)
-
- if type(decoded.method) == 'string' and decoded.id then
- local err
- -- Schedule here so that the users functions don't trigger an error and
- -- 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 }
- )
- 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
- )
- )
- 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.'
- )
- err.message = err.message or code_name
- end
- else
- -- On an exception, result will contain the error message.
- err = rpc_response_error(protocol.ErrorCodes.InternalError, result)
- result = nil
- end
- send_response(decoded.id, err, result)
- end)
- -- 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 = assert(tonumber(decoded.id), 'response id must be a number')
-
- -- 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' },
- })
- notify_reply_callback(result_id)
- notify_reply_callbacks[result_id] = nil
- end
-
- -- Do not surface RequestCancelled to users, it is RPC-internal.
- 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)
- mute_error = true
- end
-
- if mute_error then
- -- Clear any callback since this is cancelled now.
- -- This is safe to do assuming that these conditions hold:
- -- - The server will not send a result callback after this cancellation.
- -- - If the server sent this cancellation ACK after sending the result, the user of this RPC
- -- client will ignore the result themselves.
- if result_id and message_callbacks then
- message_callbacks[result_id] = nil
- end
- return
- end
- end
-
- local callback = message_callbacks and message_callbacks[result_id]
- if callback then
- message_callbacks[result_id] = nil
- validate({
- callback = { callback, 'f' },
- })
- if decoded.error then
- decoded.error = setmetatable(decoded.error, {
- __tostring = format_rpc_error,
- })
- end
- 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)
- end
- elseif type(decoded.method) == 'string' then
- -- Notification
- 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)
- end
- end
-
- local request_parser = coroutine.wrap(request_parser_loop)
- request_parser()
- stdout:read_start(function(err, chunk)
- if err then
- -- TODO better handling. Can these be intermittent errors?
- on_error(client_errors.READ_ERROR, err)
- return
- end
- -- This should signal that we are done reading from the client.
- if not chunk then
- return
- end
- -- Flush anything in the parser by looping until we don't get a result
- -- anymore.
- while true do
- local headers, body = request_parser(chunk)
- -- If we successfully parsed, then handle the response.
- if headers then
- handle_body(body)
- -- Set chunk to empty so that we can call request_parser to get
- -- anything existing in the parser to flush.
- chunk = ''
- else
- break
- end
- end
- end)
-
- return {
- pid = pid,
- handle = handle,
- request = request,
- notify = notify,
- }
+ return public_client(client)
end
return {
start = start,
+ connect = connect,
rpc_response_error = rpc_response_error,
format_rpc_error = format_rpc_error,
client_errors = client_errors,
+ create_read_loop = create_read_loop,
}
-- vim:sw=2 ts=2 et
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index e1b4ed4ea9..59cb669609 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -715,5 +715,30 @@ function vim.is_callable(f)
return type(m.__call) == 'function'
end
+--- Creates a table whose members are automatically created when accessed, if they don't already
+--- exist.
+---
+--- They mimic defaultdict in python.
+---
+--- If @p create is @c nil, this will create a defaulttable whose constructor function is
+--- this function, effectively allowing to create nested tables on the fly:
+---
+--- <pre>
+--- local a = vim.defaulttable()
+--- a.b.c = 1
+--- </pre>
+---
+---@param create function|nil The function called to create a missing value.
+---@return table Empty table with metamethod
+function vim.defaulttable(create)
+ create = create or vim.defaulttable
+ return setmetatable({}, {
+ __index = function(tbl, key)
+ rawset(tbl, key, create())
+ return rawget(tbl, key)
+ end,
+ })
+end
+
return vim
-- vim:sw=2 ts=2 et
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 70f2c425ed..d93c485dfe 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -3,10 +3,7 @@ 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 parsers = setmetatable({}, { __mode = 'v' })
local M = vim.tbl_extend('error', query, language)
@@ -32,9 +29,11 @@ setmetatable(M, {
---
--- It is not recommended to use this, use vim.treesitter.get_parser() instead.
---
----@param bufnr The buffer the parser will be tied to
----@param lang The language of the parser
----@param opts Options to pass to the created language tree
+---@param bufnr string Buffer the parser will be tied to (0 for current buffer)
+---@param lang string Language of the parser
+---@param opts table|nil Options to pass to the created language tree
+---
+---@returns table Created parser object
function M._create_parser(bufnr, lang, opts)
language.require_language(lang)
if bufnr == 0 then
@@ -79,11 +78,11 @@ end
--- If needed this will create the parser.
--- Unconditionally attach the provided callback
---
----@param bufnr The buffer the parser should be tied to
----@param lang The filetype of this parser
----@param opts Options object to pass to the created language tree
+---@param bufnr number|nil Buffer the parser should be tied to (default: current buffer)
+---@param lang string |nil Filetype of this parser (default: buffer filetype)
+---@param opts table|nil Options to pass to the created language tree
---
----@returns The parser
+---@returns table Parser object
function M.get_parser(bufnr, lang, opts)
opts = opts or {}
@@ -118,4 +117,234 @@ function M.get_string_parser(str, lang, opts)
return LanguageTree.new(str, lang, opts)
end
+--- Determines whether a node is the ancestor of another
+---
+---@param dest table Possible ancestor
+---@param source table Possible descendant node
+---
+---@returns (boolean) True if dest is an ancestor of source
+function M.is_ancestor(dest, source)
+ if not (dest and source) then
+ return false
+ end
+
+ local current = source
+ while current ~= nil do
+ if current == dest then
+ return true
+ end
+
+ current = current:parent()
+ end
+
+ return false
+end
+
+--- Get the node's range or unpack a range table
+---
+---@param node_or_range table
+---
+---@returns table start_row, start_col, end_row, end_col
+function M.get_node_range(node_or_range)
+ if type(node_or_range) == 'table' then
+ return unpack(node_or_range)
+ else
+ return node_or_range:range()
+ end
+end
+
+---Determines whether (line, col) position is in node range
+---
+---@param node table Node defining the range
+---@param line number Line (0-based)
+---@param col number Column (0-based)
+---
+---@returns (boolean) True if the position is in node range
+function M.is_in_node_range(node, line, col)
+ local start_line, start_col, end_line, end_col = M.get_node_range(node)
+ if line >= start_line and line <= end_line then
+ if line == start_line and line == end_line then
+ return col >= start_col and col < end_col
+ elseif line == start_line then
+ return col >= start_col
+ elseif line == end_line then
+ return col < end_col
+ else
+ return true
+ end
+ else
+ return false
+ end
+end
+
+---Determines if a node contains a range
+---@param node table
+---@param range table
+---
+---@returns (boolean) True if the node contains the range
+function M.node_contains(node, range)
+ local start_row, start_col, end_row, end_col = node: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])
+
+ return start_fits and end_fits
+end
+
+---Gets a list of captures for a given cursor position
+---@param bufnr number Buffer number (0 for current buffer)
+---@param row number Position row
+---@param col number Position column
+---
+---@param bufnr number Buffer number (0 for current buffer)
+---@param row number Position row
+---@param col number Position column
+---
+---@returns (table) Table of captures
+function M.get_captures_at_position(bufnr, row, col)
+ if bufnr == 0 then
+ bufnr = a.nvim_get_current_buf()
+ end
+ local buf_highlighter = M.highlighter.active[bufnr]
+
+ if not buf_highlighter then
+ return {}
+ end
+
+ local matches = {}
+
+ buf_highlighter.tree:for_each_tree(function(tstree, tree)
+ if not tstree then
+ return
+ end
+
+ local root = tstree:root()
+ local root_start_row, _, root_end_row, _ = root:range()
+
+ -- Only worry about trees within the line range
+ if root_start_row > row or root_end_row < row then
+ return
+ end
+
+ local q = buf_highlighter:get_query(tree:lang())
+
+ -- Some injected languages may not have highlight queries.
+ if not q:query() then
+ return
+ end
+
+ local iter = q:query():iter_captures(root, buf_highlighter.bufnr, row, row + 1)
+
+ for capture, node, metadata in iter do
+ if M.is_in_node_range(node, row, col) then
+ local c = q._query.captures[capture] -- name of the capture in the query
+ if c ~= nil then
+ table.insert(matches, { capture = c, priority = metadata.priority })
+ end
+ end
+ end
+ end, true)
+ return matches
+end
+
+---Gets a list of captures under the cursor
+---
+---@param winnr number|nil Window handle or 0 for current window (default)
+---
+---@returns (table) Named node under the cursor
+function M.get_captures_at_cursor(winnr)
+ winnr = winnr or 0
+ local bufnr = a.nvim_win_get_buf(winnr)
+ local cursor = a.nvim_win_get_cursor(winnr)
+
+ local data = M.get_captures_at_position(bufnr, cursor[1] - 1, cursor[2])
+
+ local captures = {}
+
+ for _, capture in ipairs(data) do
+ table.insert(captures, capture.capture)
+ end
+
+ return captures
+end
+
+--- Gets the smallest named node at position
+---
+---@param bufnr number Buffer number (0 for current buffer)
+---@param row number Position row
+---@param col number Position column
+---@param opts table Optional keyword arguments:
+--- - ignore_injections boolean Ignore injected languages (default true)
+---
+---@returns (table) Named node under the cursor
+function M.get_node_at_position(bufnr, row, col, opts)
+ if bufnr == 0 then
+ bufnr = a.nvim_get_current_buf()
+ end
+ local ts_range = { row, col, row, col }
+
+ local root_lang_tree = M.get_parser(bufnr)
+ if not root_lang_tree then
+ return
+ end
+
+ return root_lang_tree:named_node_for_range(ts_range, opts)
+end
+
+--- Gets the smallest named node under the cursor
+---
+---@param winnr number|nil Window handle or 0 for current window (default)
+---
+---@returns (string) Named node under the cursor
+function M.get_node_at_cursor(winnr)
+ winnr = winnr or 0
+ local bufnr = a.nvim_win_get_buf(winnr)
+ local cursor = a.nvim_win_get_cursor(winnr)
+
+ return M.get_node_at_position(bufnr, cursor[1] - 1, cursor[2], { ignore_injections = false })
+ :type()
+end
+
+--- Start treesitter highlighting for a buffer
+---
+--- Can be used in an ftplugin or FileType autocommand
+---
+--- Note: By default, disables regex syntax highlighting, which may be required for some plugins.
+--- In this case, add ``vim.bo.syntax = 'on'`` after the call to `start`.
+---
+--- Example:
+---
+--- <pre>
+--- vim.api.nvim_create_autocmd( 'FileType', { pattern = 'tex',
+--- callback = function(args)
+--- vim.treesitter.start(args.buf, 'latex')
+--- vim.bo[args.buf].syntax = 'on' -- only if additional legacy syntax is needed
+--- end
+--- })
+--- </pre>
+---
+---@param bufnr number|nil Buffer to be highlighted (default: current buffer)
+---@param lang string|nil Language of the parser (default: buffer filetype)
+function M.start(bufnr, lang)
+ bufnr = bufnr or a.nvim_get_current_buf()
+
+ local parser = M.get_parser(bufnr, lang)
+
+ M.highlighter.new(parser)
+
+ vim.b[bufnr].ts_highlight = true
+end
+
+---Stop treesitter highlighting for a buffer
+---
+---@param bufnr number|nil Buffer to stop highlighting (default: current buffer)
+function M.stop(bufnr)
+ bufnr = bufnr or a.nvim_get_current_buf()
+
+ if M.highlighter.active[bufnr] then
+ M.highlighter.active[bufnr]:destroy()
+ end
+
+ vim.bo[bufnr].syntax = 'on'
+end
+
return M
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index e27a5fa9c3..1e625eddb8 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -12,105 +12,18 @@ TSHighlighterQuery.__index = TSHighlighterQuery
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
- a.nvim_set_hl(0, from, { link = to, default = true })
- end
-
- return from
-end
-
--- 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)
- return firstc ~= string.lower(firstc)
-end
-
---@private
function TSHighlighterQuery.new(lang, query_string)
local self = setmetatable({}, { __index = TSHighlighterQuery })
self.hl_cache = setmetatable({}, {
__index = function(table, capture)
- local hl, is_vim_highlight = self:_get_hl_from_capture(capture)
- if not is_vim_highlight then
- hl = _link_default_highlight_once(lang .. hl, hl)
+ local name = self._query.captures[capture]
+ local id = 0
+ if not vim.startswith(name, '_') then
+ id = a.nvim_get_hl_id_by_name('@' .. name .. '.' .. lang)
end
- local id = a.nvim_get_hl_id_by_name(hl)
-
rawset(table, capture, id)
return id
end,
@@ -130,20 +43,6 @@ function TSHighlighterQuery:query()
return self._query
end
----@private
---- Get the hl from capture.
---- Returns a tuple { highlight_name: string, is_builtin: bool }
-function TSHighlighterQuery:_get_hl_from_capture(capture)
- local name = self._query.captures[capture]
-
- if is_highlight_name(name) then
- -- From "Normal.left" only keep "Normal"
- return vim.split(name, '.', true)[1], true
- else
- return TSHighlighter.hl_map[name] or 0, false
- end
-end
-
--- Creates a new highlighter using @param tree
---
---@param tree The language tree to use for highlighting
@@ -187,7 +86,7 @@ function TSHighlighter.new(tree, opts)
end
end
- a.nvim_buf_set_option(self.bufnr, 'syntax', '')
+ vim.bo[self.bufnr].syntax = ''
TSHighlighter.active[self.bufnr] = self
@@ -196,9 +95,13 @@ 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.cmd.runtime({ 'syntax/synload.vim', bang = true })
end
+ a.nvim_buf_call(self.bufnr, function()
+ vim.opt_local.spelloptions:append('noplainbuffer')
+ end)
+
self.tree:parse()
return self
@@ -257,7 +160,7 @@ function TSHighlighter:get_query(lang)
end
---@private
-local function on_line_impl(self, buf, line)
+local function on_line_impl(self, buf, line, spell)
self.tree:for_each_tree(function(tstree, tree)
if not tstree then
return
@@ -294,7 +197,9 @@ local function on_line_impl(self, buf, line)
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
+ local is_spell = highlighter_query:query().captures[capture] == 'spell'
+
+ if hl and end_row >= line and (not spell or is_spell) then
a.nvim_buf_set_extmark(buf, ns, start_row, start_col, {
end_line = end_row,
end_col = end_col,
@@ -302,6 +207,7 @@ local function on_line_impl(self, buf, line)
ephemeral = true,
priority = tonumber(metadata.priority) or 100, -- Low but leaves room below
conceal = metadata.conceal,
+ spell = is_spell,
})
end
if start_row > line then
@@ -318,7 +224,21 @@ function TSHighlighter._on_line(_, _win, buf, line, _)
return
end
- on_line_impl(self, buf, line)
+ on_line_impl(self, buf, line, false)
+end
+
+---@private
+function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _)
+ local self = TSHighlighter.active[buf]
+ if not self then
+ return
+ end
+
+ self:reset_highlight_state()
+
+ for row = srow, erow do
+ on_line_impl(self, buf, row, true)
+ end
end
---@private
@@ -345,6 +265,7 @@ a.nvim_set_decoration_provider(ns, {
on_buf = TSHighlighter._on_buf,
on_win = TSHighlighter._on_win,
on_line = TSHighlighter._on_line,
+ _on_spell_nav = TSHighlighter._on_spell_nav,
})
return TSHighlighter
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index dfb6f5be84..d14b825603 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -6,10 +6,11 @@ local M = {}
---
--- Parsers are searched in the `parser` runtime directory.
---
----@param lang The language the parser should parse
----@param path Optional path the parser is located at
----@param silent Don't throw an error if language not found
-function M.require_language(lang, path, silent)
+---@param lang string The language the parser should parse
+---@param path string|nil Optional path the parser is located at
+---@param silent boolean|nil Don't throw an error if language not found
+---@param symbol_name string|nil Internal symbol name for the language to load
+function M.require_language(lang, path, silent, symbol_name)
if vim._ts_has_language(lang) then
return true
end
@@ -21,7 +22,6 @@ function M.require_language(lang, path, silent)
return false
end
- -- TODO(bfredl): help tag?
error("no parser for '" .. lang .. "' language, see :help treesitter-parsers")
end
path = paths[1]
@@ -29,10 +29,10 @@ function M.require_language(lang, path, silent)
if silent then
return pcall(function()
- vim._ts_add_language(path, lang)
+ vim._ts_add_language(path, lang, symbol_name)
end)
else
- vim._ts_add_language(path, lang)
+ vim._ts_add_language(path, lang, symbol_name)
end
return true
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 4d3b0631a2..70317a9f94 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -299,7 +299,7 @@ function LanguageTree:included_regions()
end
---@private
-local function get_node_range(node, id, metadata)
+local function get_range_from_metadata(node, id, metadata)
if metadata[id] and metadata[id].range then
return metadata[id].range
end
@@ -362,7 +362,7 @@ function LanguageTree:_get_injections()
elseif name == 'combined' then
combined = true
elseif name == 'content' and #ranges == 0 then
- table.insert(ranges, get_node_range(node, id, metadata))
+ table.insert(ranges, get_range_from_metadata(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
@@ -371,7 +371,7 @@ function LanguageTree:_get_injections()
end
if #ranges == 0 then
- table.insert(ranges, get_node_range(node, id, metadata))
+ table.insert(ranges, get_range_from_metadata(node, id, metadata))
end
end
end
@@ -549,6 +549,44 @@ function LanguageTree:contains(range)
return false
end
+--- Gets the tree that contains {range}
+---
+---@param range table A text range
+---@param opts table Options table
+---@param opts.ignore_injections boolean (default true) Ignore injected languages.
+function LanguageTree:tree_for_range(range, opts)
+ opts = opts or {}
+ local ignore = vim.F.if_nil(opts.ignore_injections, true)
+
+ if not ignore then
+ for _, child in pairs(self._children) do
+ for _, tree in pairs(child:trees()) do
+ if tree_contains(tree, range) then
+ return tree
+ end
+ end
+ end
+ end
+
+ for _, tree in pairs(self._trees) do
+ if tree_contains(tree, range) then
+ return tree
+ end
+ end
+
+ return nil
+end
+
+--- Gets the smallest named node that contains {range}
+---
+---@param range table A text range
+---@param opts table Options table
+---@param opts.ignore_injections boolean (default true) Ignore injected languages.
+function LanguageTree:named_node_for_range(range, opts)
+ local tree = self:tree_for_range(range, opts)
+ return tree:root():named_descendant_for_range(unpack(range))
+end
+
--- Gets the appropriate language that contains {range}
---
---@param range A text range, see |LanguageTree:contains|
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 103e85abfd..90ed2a357c 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -34,6 +34,18 @@ local function safe_read(filename, read_quantifier)
return content
end
+---@private
+--- Adds @p ilang to @p base_langs, only if @p ilang is different than @lang
+---
+---@return boolean true it lang == ilang
+local function add_included_lang(base_langs, lang, ilang)
+ if lang == ilang then
+ return true
+ end
+ table.insert(base_langs, ilang)
+ return false
+end
+
--- Gets the list of files used to make up a query
---
---@param lang The language
@@ -47,6 +59,9 @@ function M.get_query_files(lang, query_name, is_included)
return {}
end
+ local base_query = nil
+ local extensions = {}
+
local base_langs = {}
-- Now get the base languages by looking at the first line of every file
@@ -55,35 +70,61 @@ function M.get_query_files(lang, query_name, is_included)
--
-- {language} ::= {lang} | ({lang})
local MODELINE_FORMAT = '^;+%s*inherits%s*:?%s*([a-z_,()]+)%s*$'
+ local EXTENDS_FORMAT = '^;+%s*extends%s*$'
- for _, file in ipairs(lang_files) do
- local modeline = safe_read(file, '*l')
+ for _, filename in ipairs(lang_files) do
+ local file, err = io.open(filename, 'r')
+ if not file then
+ error(err)
+ end
- if modeline then
- local langlist = modeline:match(MODELINE_FORMAT)
+ local extension = false
+ for modeline in
+ function()
+ return file:read('*l')
+ end
+ do
+ if not vim.startswith(modeline, ';') then
+ break
+ end
+
+ local langlist = modeline:match(MODELINE_FORMAT)
if langlist then
for _, incllang in ipairs(vim.split(langlist, ',', true)) do
local is_optional = incllang:match('%(.*%)')
if is_optional then
if not is_included then
- table.insert(base_langs, incllang:sub(2, #incllang - 1))
+ if add_included_lang(base_langs, lang, incllang:sub(2, #incllang - 1)) then
+ extension = true
+ end
end
else
- table.insert(base_langs, incllang)
+ if add_included_lang(base_langs, lang, incllang) then
+ extension = true
+ end
end
end
+ elseif modeline:match(EXTENDS_FORMAT) then
+ extension = true
end
end
+
+ if extension then
+ table.insert(extensions, filename)
+ elseif base_query == nil then
+ base_query = filename
+ end
+ io.close(file)
end
- local query_files = {}
+ local query_files = { base_query }
for _, base_lang in ipairs(base_langs) do
local base_files = M.get_query_files(base_lang, query_name, true)
vim.list_extend(query_files, base_files)
end
- vim.list_extend(query_files, lang_files)
+ vim.list_extend(query_files, extensions)
return query_files
end
@@ -140,12 +181,9 @@ 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,
-})
+local query_cache = vim.defaulttable(function()
+ return setmetatable({}, { __mode = 'v' })
+end)
--- Parse {query} as a string. (If the query is in a file, the caller
--- should read the contents into a string before calling).
@@ -181,9 +219,14 @@ end
--- Gets the text corresponding to a given node
---
----@param node the node
----@param source The buffer or string from which the node is extracted
-function M.get_node_text(node, source)
+---@param node table The node
+---@param source table The buffer or string from which the node is extracted
+---@param opts table Optional parameters.
+--- - concat: (boolean default true) Concatenate result in a string
+function M.get_node_text(node, source, opts)
+ opts = opts or {}
+ local concat = vim.F.if_nil(opts.concat, true)
+
local start_row, start_col, start_byte = node:start()
local end_row, end_col, end_byte = node:end_()
@@ -210,7 +253,7 @@ function M.get_node_text(node, source)
end
end
- return table.concat(lines, '\n')
+ return concat and table.concat(lines, '\n') or lines
elseif type(source) == 'string' then
return source:sub(start_byte + 1, end_byte)
end
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 802ebd42b5..bfece6aa72 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -964,14 +964,7 @@ func s:DeleteCommands()
nunmap K
else
" 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,
- \ 'noremap': s:k_map_saved.noremap ? v:true : v:false,
- \ 'nowait': s:k_map_saved.nowait ? v:true : v:false,
- \ 'script': s:k_map_saved.script ? v:true : v:false,
- \ 'silent': s:k_map_saved.silent ? v:true : v:false,
- \ })
+ call mapset('n', 0, s:k_map_saved)
endif
unlet s:k_map_saved
endif
diff --git a/runtime/plugin/man.lua b/runtime/plugin/man.lua
new file mode 100644
index 0000000000..4b1528b0cb
--- /dev/null
+++ b/runtime/plugin/man.lua
@@ -0,0 +1,34 @@
+if vim.g.loaded_man ~= nil then
+ return
+end
+vim.g.loaded_man = true
+
+vim.api.nvim_create_user_command('Man', function(params)
+ local man = require('man')
+ if params.bang then
+ man.init_pager()
+ else
+ local ok, err = pcall(man.open_page, params.count, params.smods, params.fargs)
+ if not ok then
+ vim.notify(man.errormsg or err, vim.log.levels.ERROR)
+ end
+ end
+end, {
+ bang = true,
+ bar = true,
+ addr = 'other',
+ nargs = '*',
+ complete = function(...)
+ return require('man').man_complete(...)
+ end,
+})
+
+local augroup = vim.api.nvim_create_augroup('man', {})
+
+vim.api.nvim_create_autocmd('BufReadCmd', {
+ group = augroup,
+ pattern = 'man://*',
+ callback = function(params)
+ require('man').read_page(vim.fn.matchstr(params.match, 'man://\\zs.*'))
+ end,
+})
diff --git a/runtime/plugin/man.vim b/runtime/plugin/man.vim
deleted file mode 100644
index b10677593f..0000000000
--- a/runtime/plugin/man.vim
+++ /dev/null
@@ -1,15 +0,0 @@
-" Maintainer: Anmol Sethi <hi@nhooyr.io>
-
-if exists('g:loaded_man')
- finish
-endif
-let g:loaded_man = 1
-
-command! -bang -bar -addr=other -complete=customlist,man#complete -nargs=* Man
- \ if <bang>0 | call man#init_pager() |
- \ else | call man#open_page(<count>, <q-mods>, <f-args>) | endif
-
-augroup man
- autocmd!
- autocmd BufReadCmd man://* call man#read_page(matchstr(expand('<amatch>'), 'man://\zs.*'))
-augroup END
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index cc4f38f669..ce2225c5f8 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -5,8 +5,7 @@
" Exit quickly when:
" - this plugin was already loaded (or disabled)
" - when 'compatible' is set
-" - the "CursorMoved" autocmd event is not available.
-if exists("g:loaded_matchparen") || &cp || !exists("##CursorMoved")
+if exists("g:loaded_matchparen") || &cp
finish
endif
let g:loaded_matchparen = 1
@@ -20,7 +19,7 @@ endif
augroup matchparen
" Replace all matchparen autocommands
- autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair()
+ autocmd! CursorMoved,CursorMovedI,WinEnter,WinScrolled * call s:Highlight_Matching_Pair()
autocmd! WinLeave * call s:Remove_Matches()
if exists('##TextChanged')
autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair()
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 260750a85b..33e6df74ab 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -101,6 +101,7 @@
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
(string_literal) @string
+(string_literal) @spell
(system_lib_string) @string
(null) @constant.builtin
@@ -148,6 +149,7 @@
(comment) @comment
+(comment) @spell
;; Parameters
(parameter_declaration
diff --git a/runtime/queries/c/injections.scm b/runtime/queries/c/injections.scm
new file mode 100644
index 0000000000..7e9e73449d
--- /dev/null
+++ b/runtime/queries/c/injections.scm
@@ -0,0 +1,3 @@
+(preproc_arg) @c
+
+; (comment) @comment
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
new file mode 100644
index 0000000000..054d787932
--- /dev/null
+++ b/runtime/queries/lua/highlights.scm
@@ -0,0 +1,194 @@
+;; Keywords
+
+"return" @keyword.return
+
+[
+ "goto"
+ "in"
+ "local"
+] @keyword
+
+(label_statement) @label
+
+(break_statement) @keyword
+
+(do_statement
+[
+ "do"
+ "end"
+] @keyword)
+
+(while_statement
+[
+ "while"
+ "do"
+ "end"
+] @repeat)
+
+(repeat_statement
+[
+ "repeat"
+ "until"
+] @repeat)
+
+(if_statement
+[
+ "if"
+ "elseif"
+ "else"
+ "then"
+ "end"
+] @conditional)
+
+(elseif_statement
+[
+ "elseif"
+ "then"
+ "end"
+] @conditional)
+
+(else_statement
+[
+ "else"
+ "end"
+] @conditional)
+
+(for_statement
+[
+ "for"
+ "do"
+ "end"
+] @repeat)
+
+(function_declaration
+[
+ "function"
+ "end"
+] @keyword.function)
+
+(function_definition
+[
+ "function"
+ "end"
+] @keyword.function)
+
+;; Operators
+
+[
+ "and"
+ "not"
+ "or"
+] @keyword.operator
+
+[
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "^"
+ "#"
+ "=="
+ "~="
+ "<="
+ ">="
+ "<"
+ ">"
+ "="
+ "&"
+ "~"
+ "|"
+ "<<"
+ ">>"
+ "//"
+ ".."
+] @operator
+
+;; Punctuations
+
+[
+ ";"
+ ":"
+ ","
+ "."
+] @punctuation.delimiter
+
+;; Brackets
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+;; Variables
+
+(identifier) @variable
+
+((identifier) @variable.builtin
+ (#eq? @variable.builtin "self"))
+
+;; Constants
+
+((identifier) @constant
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+
+(vararg_expression) @constant
+
+(nil) @constant.builtin
+
+[
+ (false)
+ (true)
+] @boolean
+
+;; Tables
+
+(field name: (identifier) @field)
+
+(dot_index_expression field: (identifier) @field)
+
+(table_constructor
+[
+ "{"
+ "}"
+] @constructor)
+
+;; Functions
+
+(parameters (identifier) @parameter)
+
+(function_call name: (identifier) @function.call)
+(function_declaration name: (identifier) @function)
+
+(function_call name: (dot_index_expression field: (identifier) @function.call))
+(function_declaration name: (dot_index_expression field: (identifier) @function))
+
+(method_index_expression method: (identifier) @method)
+
+(function_call
+ (identifier) @function.builtin
+ (#any-of? @function.builtin
+ ;; built-in functions in Lua 5.1
+ "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
+ "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
+ "rawequal" "rawget" "rawset" "require" "select" "setfenv" "setmetatable"
+ "tonumber" "tostring" "type" "unpack" "xpcall"))
+
+;; Others
+
+(comment) @comment
+(comment) @spell
+
+(hash_bang_line) @comment
+
+(number) @number
+
+(string) @string
+(string) @spell
+
+;; Error
+(ERROR) @error
diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm
new file mode 100644
index 0000000000..0e67329139
--- /dev/null
+++ b/runtime/queries/lua/injections.scm
@@ -0,0 +1,22 @@
+((function_call
+ name: [
+ (identifier) @_cdef_identifier
+ (_ _ (identifier) @_cdef_identifier)
+ ]
+ arguments: (arguments (string content: _ @c)))
+ (#eq? @_cdef_identifier "cdef"))
+
+((function_call
+ name: (_) @_vimcmd_identifier
+ arguments: (arguments (string content: _ @vim)))
+ (#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec" "vim.api.nvim_cmd"))
+
+; ((function_call
+; name: (_) @_vimcmd_identifier
+; arguments: (arguments (string content: _ @query) .))
+; (#eq? @_vimcmd_identifier "vim.treesitter.query.set_query"))
+
+; ;; highlight string as query if starts with `;; query`
+; ((string ("string_content") @query) (#lua-match? @query "^%s*;+%s?query"))
+
+; (comment) @comment
diff --git a/runtime/queries/vim/highlights.scm b/runtime/queries/vim/highlights.scm
new file mode 100644
index 0000000000..3d1729b2cd
--- /dev/null
+++ b/runtime/queries/vim/highlights.scm
@@ -0,0 +1,259 @@
+(identifier) @variable
+((identifier) @constant
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+
+;; Keywords
+
+[
+ "if"
+ "else"
+ "elseif"
+ "endif"
+] @conditional
+
+[
+ "try"
+ "catch"
+ "finally"
+ "endtry"
+ "throw"
+] @exception
+
+[
+ "for"
+ "endfor"
+ "in"
+ "while"
+ "endwhile"
+ "break"
+ "continue"
+] @repeat
+
+[
+ "function"
+ "endfunction"
+] @keyword.function
+
+;; Function related
+(function_declaration name: (_) @function)
+(call_expression function: (identifier) @function)
+(parameters (identifier) @parameter)
+(default_parameter (identifier) @parameter)
+
+[ (bang) (spread) ] @punctuation.special
+
+[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
+[
+ (scope)
+ "a:"
+ "$"
+] @namespace
+
+;; Commands and user defined commands
+
+[
+ "let"
+ "unlet"
+ "const"
+ "call"
+ "execute"
+ "normal"
+ "set"
+ "setlocal"
+ "silent"
+ "echo"
+ "echomsg"
+ "autocmd"
+ "augroup"
+ "return"
+ "syntax"
+ "lua"
+ "ruby"
+ "perl"
+ "python"
+ "highlight"
+ "command"
+ "delcommand"
+ "comclear"
+ "colorscheme"
+ "startinsert"
+ "stopinsert"
+ "global"
+ "runtime"
+ "wincmd"
+ "cnext"
+ "cprevious"
+ "cNext"
+ "vertical"
+ "leftabove"
+ "aboveleft"
+ "rightbelow"
+ "belowright"
+ "topleft"
+ "botright"
+ (unknown_command_name)
+ "edit"
+ "enew"
+ "find"
+ "ex"
+ "visual"
+ "view"
+] @keyword
+(map_statement cmd: _ @keyword)
+(command_name) @function.macro
+
+;; Syntax command
+
+(syntax_statement (keyword) @string)
+(syntax_statement [
+ "enable"
+ "on"
+ "off"
+ "reset"
+ "case"
+ "spell"
+ "foldlevel"
+ "iskeyword"
+ "keyword"
+ "match"
+ "cluster"
+ "region"
+] @keyword)
+
+(syntax_argument name: _ @keyword)
+
+[
+ "<buffer>"
+ "<nowait>"
+ "<silent>"
+ "<script>"
+ "<expr>"
+ "<unique>"
+] @constant.builtin
+
+(augroup_name) @namespace
+
+(au_event) @constant
+(normal_statement (commands) @constant)
+
+;; Highlight command
+
+(hl_attribute
+ key: _ @property
+ val: _ @constant)
+
+(hl_group) @type
+
+(highlight_statement [
+ "default"
+ "link"
+ "clear"
+] @keyword)
+
+;; Command command
+
+(command) @string
+
+(command_attribute
+ name: _ @property
+ val: (behavior
+ name: _ @constant
+ val: (identifier)? @function)?)
+
+;; Edit command
+(plus_plus_opt
+ val: _? @constant) @property
+(plus_cmd "+" @property) @property
+
+;; Runtime command
+
+(runtime_statement (where) @keyword.operator)
+
+;; Colorscheme command
+
+(colorscheme_statement (name) @string)
+
+;; Literals
+
+(string_literal) @string @spell
+(integer_literal) @number
+(float_literal) @float
+(comment) @comment @spell
+(pattern) @string.special
+(pattern_multi) @string.regex
+(filename) @string
+(heredoc (body) @string)
+((heredoc (parameter) @keyword))
+((scoped_identifier
+ (scope) @_scope . (identifier) @boolean)
+ (#eq? @_scope "v:")
+ (#any-of? @boolean "true" "false"))
+
+;; Operators
+
+[
+ "||"
+ "&&"
+ "&"
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ ".."
+ "is"
+ "isnot"
+ "=="
+ "!="
+ ">"
+ ">="
+ "<"
+ "<="
+ "=~"
+ "!~"
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ ".="
+ "..="
+] @operator
+
+; Some characters have different meanings based on the context
+(unary_operation "!" @operator)
+(binary_operation "." @operator)
+
+;; Punctuation
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+(field_expression "." @punctuation.delimiter)
+
+[
+ ","
+ ":"
+] @punctuation.delimiter
+
+(ternary_expression ["?" ":"] @conditional)
+
+; Options
+((set_value) @number
+ (#match? @number "^[0-9]+(\.[0-9]+)?$"))
+
+((set_item
+ option: (option_name) @_option
+ value: (set_value) @function)
+ (#any-of? @_option
+ "tagfunc" "tfu"
+ "completefunc" "cfu"
+ "omnifunc" "ofu"
+ "operatorfunc" "opfunc"))
diff --git a/runtime/queries/vim/injections.scm b/runtime/queries/vim/injections.scm
new file mode 100644
index 0000000000..e2dea8fe75
--- /dev/null
+++ b/runtime/queries/vim/injections.scm
@@ -0,0 +1,26 @@
+(lua_statement (script (body) @lua))
+(lua_statement (chunk) @lua)
+; (ruby_statement (script (body) @ruby))
+; (ruby_statement (chunk) @ruby)
+; (python_statement (script (body) @python))
+; (python_statement (chunk) @python)
+;; (perl_statement (script (body) @perl))
+;; (perl_statement (chunk) @perl)
+
+; (autocmd_statement (pattern) @regex)
+
+((set_item
+ option: (option_name) @_option
+ value: (set_value) @vim)
+ (#any-of? @_option
+ "includeexpr" "inex"
+ "printexpr" "pexpr"
+ "formatexpr" "fex"
+ "indentexpr" "inde"
+ "foldtext" "fdt"
+ "foldexpr" "fde"
+ "diffexpr" "dex"
+ "patchexpr" "pex"
+ "charconvert" "ccv"))
+
+; (comment) @comment
diff --git a/runtime/syntax/gdresource.vim b/runtime/syntax/gdresource.vim
new file mode 100644
index 0000000000..7e1a2513e2
--- /dev/null
+++ b/runtime/syntax/gdresource.vim
@@ -0,0 +1,65 @@
+" Vim syntax file for Godot resource (scenes)
+" Language: gdresource
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Filenames: *.tscn, *.tres
+" Website: https://github.com/habamax/vim-gdscript
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:keepcpo = &cpo
+set cpo&vim
+
+syn match gdResourceNumber "\<0x\%(_\=\x\)\+\>"
+syn match gdResourceNumber "\<0b\%(_\=[01]\)\+\>"
+syn match gdResourceNumber "\<\d\%(_\=\d\)*\>"
+syn match gdResourceNumber "\<\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>"
+syn match gdResourceNumber "\<\d\%(_\=\d\)*\.\%(e[+-]\=\d\%(_\=\d\)*\)\=\%(\W\|$\)\@="
+syn match gdResourceNumber "\%(^\|\W\)\@1<=\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>"
+
+syn keyword gdResourceKeyword true false
+
+syn region gdResourceString
+ \ start=+[uU]\="+ end='"' skip='\\\\\|\\"'
+ \ contains=@Spell keepend
+
+" Section
+syn region gdResourceSection matchgroup=gdResourceSectionDelimiter
+ \ start='^\[' end=']\s*$'
+ \ oneline keepend
+ \ contains=gdResourceSectionName,gdResourceSectionAttribute
+
+syn match gdResourceSectionName '\[\@<=\S\+' contained skipwhite
+syn match gdResourceSectionAttribute '\S\+\s*=\s*\S\+'
+ \ skipwhite keepend contained
+ \ contains=gdResourceSectionAttributeName,gdResourceSectionAttributeValue
+syn match gdResourceSectionAttributeName '\S\+\ze\(\s*=\)' skipwhite contained
+syn match gdResourceSectionAttributeValue '\(=\s*\)\zs\S\+\ze' skipwhite
+ \ contained
+ \ contains=gdResourceString,gdResourceNumber,gdResourceKeyword
+
+
+" Section body
+syn match gdResourceAttribute '^\s*\S\+\s*=.*$'
+ \ skipwhite keepend
+ \ contains=gdResourceAttributeName,gdResourceAttributeValue
+
+syn match gdResourceAttributeName '\S\+\ze\(\s*=\)' skipwhite contained
+syn match gdResourceAttributeValue '\(=\s*\)\zs.*$' skipwhite
+ \ contained
+ \ contains=gdResourceString,gdResourceNumber,gdResourceKeyword
+
+
+hi def link gdResourceNumber Constant
+hi def link gdResourceKeyword Constant
+hi def link gdResourceSectionName Statement
+hi def link gdResourceSectionDelimiter Delimiter
+hi def link gdResourceSectionAttributeName Type
+hi def link gdResourceAttributeName Identifier
+hi def link gdResourceString String
+
+let b:current_syntax = "gdresource"
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
diff --git a/runtime/syntax/gdscript.vim b/runtime/syntax/gdscript.vim
new file mode 100644
index 0000000000..e9295a411d
--- /dev/null
+++ b/runtime/syntax/gdscript.vim
@@ -0,0 +1,105 @@
+" Vim syntax file for Godot gdscript
+" Language: gdscript
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-gdscript
+" Filenames: *.gd
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:keepcpo = &cpo
+set cpo&vim
+
+syntax sync maxlines=100
+
+syn keyword gdscriptConditional if else elif match
+syn keyword gdscriptRepeat for while break continue
+
+syn keyword gdscriptOperator is as not and or in
+
+syn match gdscriptClass "\v<\u\w+>"
+syn match gdscriptConstant "\<[_A-Z]\+[0-9_A-Z]*\>"
+syn match gdscriptBlockStart ":\s*$"
+
+syn keyword gdscriptKeyword null self owner parent tool
+syn keyword gdscriptBoolean false true
+
+syn keyword gdscriptStatement remote master puppet remotesync mastersync puppetsync sync
+syn keyword gdscriptStatement return pass
+syn keyword gdscriptStatement static const enum
+syn keyword gdscriptStatement breakpoint assert
+syn keyword gdscriptStatement onready
+syn keyword gdscriptStatement class_name extends
+
+syn keyword gdscriptType void bool int float String contained
+
+syn keyword gdscriptStatement var nextgroup=gdscriptTypeDecl skipwhite
+syn keyword gdscriptStatement const nextgroup=gdscriptTypeDecl skipwhite
+syn match gdscriptTypeDecl "\h\w*\s*:\s*\h\w*" contains=gdscriptOperator,gdscriptType,gdscriptClass contained skipwhite
+syn match gdscriptTypeDecl "->\s*\h\w*" contains=gdscriptOperator,gdscriptType,gdscriptClass skipwhite
+
+syn keyword gdscriptStatement export nextgroup=gdscriptExportTypeDecl skipwhite
+syn match gdscriptExportTypeDecl "(.\{-}[,)]" contains=gdscriptOperator,gdscriptType,gdscriptClass contained skipwhite
+
+syn keyword gdscriptStatement setget nextgroup=gdscriptSetGet,gdscriptSetGetSeparator skipwhite
+syn match gdscriptSetGet "\h\w*" nextgroup=gdscriptSetGetSeparator display contained skipwhite
+syn match gdscriptSetGetSeparator "," nextgroup=gdscriptSetGet display contained skipwhite
+
+syn keyword gdscriptStatement class func signal nextgroup=gdscriptFunctionName skipwhite
+syn match gdscriptFunctionName "\h\w*" nextgroup=gdscriptFunctionParams display contained skipwhite
+syn match gdscriptFunctionParams "(.*)" contains=gdscriptTypeDecl display contained skipwhite
+
+syn match gdscriptNode "\$\h\w*\%(/\h\w*\)*"
+
+syn match gdscriptComment "#.*$" contains=@Spell,gdscriptTodo
+
+syn region gdscriptString matchgroup=gdscriptQuotes
+ \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
+ \ contains=gdscriptEscape,@Spell
+
+syn region gdscriptString matchgroup=gdscriptTripleQuotes
+ \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
+ \ contains=gdscriptEscape,@Spell
+
+syn match gdscriptEscape +\\[abfnrtv'"\\]+ contained
+syn match gdscriptEscape "\\$"
+
+" Numbers
+syn match gdscriptNumber "\<0x\%(_\=\x\)\+\>"
+syn match gdscriptNumber "\<0b\%(_\=[01]\)\+\>"
+syn match gdscriptNumber "\<\d\%(_\=\d\)*\>"
+syn match gdscriptNumber "\<\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>"
+syn match gdscriptNumber "\<\d\%(_\=\d\)*\.\%(e[+-]\=\d\%(_\=\d\)*\)\=\%(\W\|$\)\@="
+syn match gdscriptNumber "\%(^\|\W\)\@1<=\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>"
+
+" XXX, TODO, etc
+syn keyword gdscriptTodo TODO XXX FIXME HACK NOTE BUG contained
+
+hi def link gdscriptStatement Statement
+hi def link gdscriptKeyword Keyword
+hi def link gdscriptConditional Conditional
+hi def link gdscriptBoolean Boolean
+hi def link gdscriptOperator Operator
+hi def link gdscriptRepeat Repeat
+hi def link gdscriptSetGet Function
+hi def link gdscriptFunctionName Function
+hi def link gdscriptClass Type
+hi def link gdscriptConstant Constant
+hi def link gdscriptBuiltinStruct Typedef
+hi def link gdscriptComment Comment
+hi def link gdscriptString String
+hi def link gdscriptQuotes String
+hi def link gdscriptTripleQuotes String
+hi def link gdscriptEscape Special
+hi def link gdscriptNode PreProc
+hi def link gdscriptType Type
+hi def link gdscriptNumber Number
+hi def link gdscriptBlockStart Special
+hi def link gdscriptTodo Todo
+
+
+let b:current_syntax = "gdscript"
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
diff --git a/runtime/syntax/gdshader.vim b/runtime/syntax/gdshader.vim
new file mode 100644
index 0000000000..f0d9f7edd9
--- /dev/null
+++ b/runtime/syntax/gdshader.vim
@@ -0,0 +1,57 @@
+" Vim syntax file for Godot shading language
+" Language: gdshader
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Filenames: *.gdshader
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn keyword gdshaderConditional if else switch case default
+syn keyword gdshaderRepeat for while do
+syn keyword gdshaderStatement return discard
+syn keyword gdshaderBoolean true false
+
+syn keyword gdshaderKeyword shader_type render_mode
+syn keyword gdshaderKeyword in out inout
+syn keyword gdshaderKeyword lowp mediump highp
+syn keyword gdshaderKeyword uniform varying const
+syn keyword gdshaderKeyword flat smooth
+
+syn keyword gdshaderType float vec2 vec3 vec4
+syn keyword gdshaderType uint uvec2 uvec3 uvec4
+syn keyword gdshaderType int ivec2 ivec3 ivec4
+syn keyword gdshaderType void bool
+syn keyword gdshaderType bvec2 bvec3 bvec4
+syn keyword gdshaderType mat2 mat3 mat4
+syn keyword gdshaderType sampler2D isampler2D usampler2D samplerCube
+
+syn match gdshaderMember "\v<(\.)@<=[a-z_]+\w*>"
+syn match gdshaderBuiltin "\v<[A-Z_]+[A-Z0-9_]*>"
+syn match gdshaderFunction "\v<\w*>(\()@="
+
+syn match gdshaderNumber "\v<\d+(\.)@!>"
+syn match gdshaderFloat "\v<\d*\.\d+(\.)@!>"
+syn match gdshaderFloat "\v<\d*\.=\d+(e-=\d+)@="
+syn match gdshaderExponent "\v(\d*\.=\d+)@<=e-=\d+>"
+
+syn match gdshaderComment "\v//.*$" contains=@Spell
+syn region gdshaderComment start="/\*" end="\*/" contains=@Spell
+syn keyword gdshaderTodo TODO FIXME XXX NOTE BUG HACK OPTIMIZE containedin=gdshaderComment
+
+hi def link gdshaderConditional Conditional
+hi def link gdshaderRepeat Repeat
+hi def link gdshaderStatement Statement
+hi def link gdshaderBoolean Boolean
+hi def link gdshaderKeyword Keyword
+hi def link gdshaderMember Identifier
+hi def link gdshaderBuiltin Identifier
+hi def link gdshaderFunction Function
+hi def link gdshaderType Type
+hi def link gdshaderNumber Number
+hi def link gdshaderFloat Float
+hi def link gdshaderExponent Special
+hi def link gdshaderComment Comment
+hi def link gdshaderTodo Todo
+
+let b:current_syntax = "gdshader"
diff --git a/runtime/syntax/gitattributes.vim b/runtime/syntax/gitattributes.vim
new file mode 100644
index 0000000000..b6d997f45d
--- /dev/null
+++ b/runtime/syntax/gitattributes.vim
@@ -0,0 +1,63 @@
+" Vim syntax file
+" Language: git attributes
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Filenames: .gitattributes, *.git/info/attributes
+" Last Change: 2022 Sep 09
+
+if exists('b:current_syntax')
+ finish
+endif
+
+let s:cpo_save = &cpoptions
+set cpoptions&vim
+
+" Comment
+syn keyword gitattributesTodo contained TODO FIXME XXX
+syn match gitattributesComment /^\s*#.*/ contains=gitattributesTodo
+
+" Pattern
+syn match gitattributesPattern /^\s*#\@!\(".\+"\|\S\+\)/ skipwhite
+ \ nextgroup=gitattributesAttrPrefixed,gitattributesAttrAssigned skipwhite
+ \ contains=gitattributesGlob,gitattributesRange,gitattributesSeparator
+syn match gitattributesGlob /\\\@1<![?*]/ contained
+syn match gitattributesRange /\\\@1<!\[.\{-}\]/ contained
+syn match gitattributesSeparator '/' contained
+
+" Attribute
+syn match gitattributesAttrPrefixed /[!-]\?[A-Za-z0-9_.][-A-Za-z0-9_.]*/
+ \ transparent contained skipwhite
+ \ nextgroup=gitattributesAttrPrefixed,gitattributesAttrAssigned
+ \ contains=gitattributesPrefix,gitattributesName
+syn match gitattributesAttrAssigned /[A-Za-z0-9_.][-A-Za-z0-9_.]*=\S\+/
+ \ transparent contained skipwhite
+ \ nextgroup=gitattributesAttrPrefixed,gitattributesAttrAssigned
+ \ contains=gitattributesName,gitattributesAssign,gitattributesBoolean,gitattributesString
+syn match gitattributesName /[A-Za-z0-9_.][-A-Za-z0-9_.]*/
+ \ contained nextgroup=gitattributesAssign
+syn match gitattributesPrefix /[!-]/ contained
+ \ nextgroup=gitAttributesName
+syn match gitattributesAssign '=' contained
+ \ nextgroup=gitattributesBoolean,gitattributesString
+syn match gitattributesString /=\@1<=\S\+/ contained
+syn keyword gitattributesBoolean true false contained
+
+" Macro
+syn match gitattributesMacro /^\s*\[attr\]\s*\S\+/
+ \ nextgroup=gitattributesAttribute skipwhite
+
+hi def link gitattributesAssign Operator
+hi def link gitattributesBoolean Boolean
+hi def link gitattributesComment Comment
+hi def link gitattributesGlob Special
+hi def link gitattributesMacro Define
+hi def link gitattributesName Identifier
+hi def link gitattributesPrefix SpecialChar
+hi def link gitattributesRange Special
+hi def link gitattributesSeparator Delimiter
+hi def link gitattributesString String
+hi def link gitattributesTodo Todo
+
+let b:current_syntax = 'gitattributes'
+
+let &cpoptions = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/syntax/gitignore.vim b/runtime/syntax/gitignore.vim
new file mode 100644
index 0000000000..8e6d098acd
--- /dev/null
+++ b/runtime/syntax/gitignore.vim
@@ -0,0 +1,29 @@
+" Vim syntax file
+" Language: git ignore
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Filenames: .gitignore, *.git/info/exclude
+" Last Change: 2022 Sep 10
+
+if exists('b:current_syntax')
+ finish
+endif
+
+" Comment
+syn keyword gitignoreTodo contained TODO FIXME XXX
+syn match gitignoreComment /^#.*/ contains=gitignoreTodo
+
+" Pattern
+syn match gitignorePattern /^#\@!.*$/ contains=gitignoreNegation,gitignoreGlob,gitignoreRange,gitignoreSeparator
+syn match gitignoreNegation /^!/ contained
+syn match gitignoreGlob /\\\@1<![?*]/ contained
+syn match gitignoreRange /\\\@1<!\[.\{-}\]/ contained
+syn match gitignoreSeparator '/' contained
+
+hi def link gitignoreComment Comment
+hi def link gitignoreGlob Special
+hi def link gitignoreNegation SpecialChar
+hi def link gitignoreRange Special
+hi def link gitignoreSeparator Delimiter
+hi def link gitignoreTodo Todo
+
+let b:current_syntax = 'gitignore'
diff --git a/runtime/syntax/lua.vim b/runtime/syntax/lua.vim
index b398e2e5c6..437a1ff113 100644
--- a/runtime/syntax/lua.vim
+++ b/runtime/syntax/lua.vim
@@ -1,11 +1,11 @@
" Vim syntax file
-" 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: 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
+" 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: 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
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -33,11 +33,11 @@ syn sync minlines=100
syn keyword luaTodo contained TODO FIXME XXX
syn match luaComment "--.*$" contains=luaTodo,@Spell
if lua_version == 5 && lua_subversion == 0
- syn region luaComment matchgroup=luaComment start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell
+ syn region luaComment matchgroup=luaCommentDelimiter start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell
syn region luaInnerComment contained transparent start="\[\[" end="\]\]"
elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1)
" Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc.
- syn region luaComment matchgroup=luaComment start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell
+ syn region luaComment matchgroup=luaCommentDelimiter start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell
endif
" First line may start with #!
@@ -99,18 +99,18 @@ if lua_version < 5
elseif lua_version == 5
if lua_subversion == 0
syn match luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}#
- syn region luaString2 matchgroup=luaString start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell
+ syn region luaString2 matchgroup=luaStringDelimiter start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell
else
if lua_subversion == 1
syn match luaSpecial contained #\\[\\abfnrtv'"]\|\\[[:digit:]]\{,3}#
else " Lua 5.2
syn match luaSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}#
endif
- syn region luaString2 matchgroup=luaString start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell
+ syn region luaString2 matchgroup=luaStringDelimiter start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell
endif
endif
-syn region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial,@Spell
-syn region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial,@Spell
+syn region luaString matchgroup=luaStringDelimiter start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial,@Spell
+syn region luaString matchgroup=luaStringDelimiter start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial,@Spell
" integer number
syn match luaNumber "\<\d\+\>"
@@ -333,27 +333,29 @@ endif
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
-hi def link luaStatement Statement
-hi def link luaRepeat Repeat
-hi def link luaFor Repeat
-hi def link luaString String
-hi def link luaString2 String
-hi def link luaNumber Number
-hi def link luaOperator Operator
-hi def link luaIn Operator
-hi def link luaConstant Constant
-hi def link luaCond Conditional
-hi def link luaElse Conditional
-hi def link luaFunction Function
-hi def link luaComment Comment
-hi def link luaTodo Todo
-hi def link luaTable Structure
-hi def link luaError Error
-hi def link luaParenError Error
-hi def link luaBraceError Error
-hi def link luaSpecial SpecialChar
-hi def link luaFunc Identifier
-hi def link luaLabel Label
+hi def link luaStatement Statement
+hi def link luaRepeat Repeat
+hi def link luaFor Repeat
+hi def link luaString String
+hi def link luaString2 String
+hi def link luaStringDelimiter luaString
+hi def link luaNumber Number
+hi def link luaOperator Operator
+hi def link luaIn Operator
+hi def link luaConstant Constant
+hi def link luaCond Conditional
+hi def link luaElse Conditional
+hi def link luaFunction Function
+hi def link luaComment Comment
+hi def link luaCommentDelimiter luaComment
+hi def link luaTodo Todo
+hi def link luaTable Structure
+hi def link luaError Error
+hi def link luaParenError Error
+hi def link luaBraceError Error
+hi def link luaSpecial SpecialChar
+hi def link luaFunc Identifier
+hi def link luaLabel Label
let b:current_syntax = "lua"
diff --git a/runtime/syntax/plsql.vim b/runtime/syntax/plsql.vim
index 7b36c0a180..21681d59e4 100644
--- a/runtime/syntax/plsql.vim
+++ b/runtime/syntax/plsql.vim
@@ -4,12 +4,13 @@
" 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
+" Last Change: Aug 21, 2022
" History Lee Lindley (lee dot lindley at gmail dot com)
+" use get with default 0 instead of exists per Bram suggestion
+" make procedure folding optional
" 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>.
+" revised folding
" Eugene Lysyonok (lysyonok at inbox ru)
" Added folding.
" Geoff Evans & Bill Pribyl (bill at plnet dot org)
@@ -23,12 +24,19 @@
" To enable folding (It does setlocal foldmethod=syntax)
" let plsql_fold = 1
"
+" To disable folding procedure/functions (recommended if you habitually
+" do not put the method name on the END statement)
+" let plsql_disable_procedure_fold = 1
+"
" From my vimrc file -- turn syntax and syntax folding on,
" associate file suffixes as plsql, open all the folds on file open
+" syntax enable
" 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
+" au Syntax plsql set foldcolumn=2 "optional if you want to see choosable folds on the left
+
if exists("b:current_syntax")
finish
@@ -49,12 +57,12 @@ syn match plsqlIdentifier "[a-z][a-z0-9$_#]*"
syn match plsqlHostIdentifier ":[a-z][a-z0-9$_#]*"
" When wanted, highlight the trailing whitespace.
-if exists("plsql_space_errors")
- if !exists("plsql_no_trail_space_error")
+if get(g:,"plsql_space_errors",0) == 1
+ if get(g:,"plsql_no_trail_space_error",0) == 0
syn match plsqlSpaceError "\s\+$"
endif
- if !exists("plsql_no_tab_space_error")
+ if get(g:,"plsql_no_tab_space_error",0) == 0
syn match plsqlSpaceError " \+\t"me=e-1
endif
endif
@@ -134,7 +142,8 @@ syn keyword plsqlKeyword CPU_TIME CRASH CREATE_FILE_DEST CREATE_STORED_OUTLINES
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 match plsqlKeyword "\<CURSOR\>"
+syn keyword plsqlKeyword 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
@@ -515,7 +524,7 @@ 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")
+if get(g:,"plsql_legacy_sql_keywords",0) == 1
" 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
@@ -565,7 +574,7 @@ 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
-if exists("plsql_highlight_triggers")
+if get(g:,"plsql_highlight_triggers",0) == 1
syn keyword plsqlTrigger INSERTING UPDATING DELETING
endif
@@ -576,7 +585,7 @@ syn match plsqlISAS "\<\(IS\|AS\)\>"
" Various types of comments.
syntax region plsqlCommentL start="--" skip="\\$" end="$" keepend extend contains=@plsqlCommentGroup,plsqlSpaceError
-if exists("plsql_fold")
+if get(g:,"plsql_fold",0) == 1
syntax region plsqlComment
\ start="/\*" end="\*/"
\ extend
@@ -612,7 +621,7 @@ syn region plsqlQuotedIdentifier matchgroup=plsqlOperator start=+n\?"+ end=+
syn cluster plsqlIdentifiers contains=plsqlIdentifier,plsqlQuotedIdentifier
" quoted string literals
-if exists("plsql_fold")
+if get(g:,"plsql_fold",0) == 1
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
@@ -639,10 +648,10 @@ 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("plsql_bracket_error")
+if get(g:,"plsql_bracket_error",0) == 1
" 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")
+ if get(g:,"plsql_fold",0) == 1
syn region plsqlParen start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInBracket fold keepend extend transparent
else
syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInBracket
@@ -652,7 +661,7 @@ if exists("plsql_bracket_error")
syn region plsqlBracket transparent start='\[' end=']' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen
syn match plsqlErrInBracket contained "[);{}]"
else
- if exists("plsql_fold")
+ if get(g:,"plsql_fold",0) == 1
syn region plsqlParen start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen fold keepend extend transparent
else
syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,@plsqlParenGroup,plsqlErrInParen
@@ -673,12 +682,12 @@ syn match plsqlConditional "\<END\>\_s\+\<IF\>"
syn match plsqlCase "\<END\>\_s\+\<CASE\>"
syn match plsqlCase "\<CASE\>"
-if exists("plsql_fold")
+if get(g:,"plsql_fold",0) == 1
setlocal foldmethod=syntax
syn sync fromstart
syn cluster plsqlProcedureGroup contains=plsqlProcedure
- syn cluster plsqlOnlyGroup contains=@plsqlProcedure,plsqlConditionalBlock,plsqlLoopBlock,plsqlBlock
+ syn cluster plsqlOnlyGroup contains=@plsqlProcedure,plsqlConditionalBlock,plsqlLoopBlock,plsqlBlock,plsqlCursor
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\>"
@@ -698,24 +707,40 @@ if exists("plsql_fold")
\ 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*;"
+ if get(g:,"plsql_disable_procedure_fold",0) == 0
+ " 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.
+ "
+ " If you habitualy do not put the method name in the END statement,
+ " this can be expensive because it searches to end of file on every
+ " procedure/function declaration
+ "
+ "\ start="\(create\(\_s\+or\_s\+replace\)\?\_s\+\)\?\<\(procedure\|function\)\>\_s\+\z([a-z][a-z0-9$_#]*\)"
+ syntax region plsqlProcedure
+ \ 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
+ endif
+
+ syntax region plsqlCursor
+ \ start="\<cursor\>\_s\+[a-z][a-z0-9$_#]*\(\_s*([^)]\+)\)\?\(\_s\+return\_s\+\S\+\)\?\_s\+is"
+ \ end=";"
\ fold
\ keepend
\ extend
\ transparent
- \ contains=ALLBUT,plsqlBlock
+ \ contains=ALLBUT,@plsqlOnlyGroup
syntax region plsqlBlock
\ start="\<begin\>"
@@ -802,7 +827,7 @@ 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")
+if get(g:,"plsql_legacy_sql_keywords",0) == 1
hi link plsqlSQLKeyword Function
hi link plsqlSymbol Normal
hi link plsqlParen Normal
diff --git a/runtime/syntax/racket.vim b/runtime/syntax/racket.vim
new file mode 100644
index 0000000000..b1ed2b454c
--- /dev/null
+++ b/runtime/syntax/racket.vim
@@ -0,0 +1,656 @@
+" Vim syntax file
+" Language: Racket
+" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
+" Previous Maintainer: Will Langstroth <will@langstroth.com>
+" URL: https://github.com/benknoble/vim-racket
+" Description: Contains all of the keywords in #lang racket
+" Last Change: 2022 Aug 12
+
+" Initializing:
+if exists("b:current_syntax")
+ finish
+endif
+
+" Highlight unmatched parens
+syntax match racketError ,[]})],
+
+if version < 800
+ set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
+else
+ " syntax iskeyword 33,35-39,42-58,60-90,94,95,97-122,126,_
+ " converted from decimal to char
+ " :s/\d\+/\=submatch(0)->str2nr()->nr2char()/g
+ " but corrected to remove duplicate _, move ^ to end
+ syntax iskeyword @,!,#-',*-:,<-Z,a-z,~,_,^
+ " expanded
+ " syntax iskeyword !,#,$,%,&,',*,+,,,-,.,/,0-9,:,<,=,>,?,@,A-Z,_,a-z,~,^
+endif
+
+" Forms in order of appearance at
+" http://docs.racket-lang.org/reference/index.html
+"
+syntax keyword racketSyntax module module* module+ require provide quote
+syntax keyword racketSyntax #%datum #%expression #%top #%variable-reference #%app
+syntax keyword racketSyntax lambda case-lambda let let* letrec
+syntax keyword racketSyntax let-values let*-values let-syntax letrec-syntax
+syntax keyword racketSyntax let-syntaxes letrec-syntaxes letrec-syntaxes+values
+syntax keyword racketSyntax local shared
+syntax keyword racketSyntax if cond and or case define else =>
+syntax keyword racketSyntax define define-values define-syntax define-syntaxes
+syntax keyword racketSyntax define-for-syntax define-require-syntax define-provide-syntax
+syntax keyword racketSyntax define-syntax-rule
+syntax keyword racketSyntax define-record-type
+syntax keyword racketSyntax begin begin0
+syntax keyword racketSyntax begin-for-syntax
+syntax keyword racketSyntax when unless
+syntax keyword racketSyntax set! set!-values
+syntax keyword racketSyntax for for/list for/vector for/hash for/hasheq for/hasheqv
+syntax keyword racketSyntax for/and for/or for/lists for/first
+syntax keyword racketSyntax for/last for/fold
+syntax keyword racketSyntax for* for*/list for*/vector for*/hash for*/hasheq for*/hasheqv
+syntax keyword racketSyntax for*/and for*/or for*/lists for*/first
+syntax keyword racketSyntax for*/last for*/fold
+syntax keyword racketSyntax for/fold/derived for*/fold/derived
+syntax keyword racketSyntax define-sequence-syntax :do-in do
+syntax keyword racketSyntax with-continuation-mark
+syntax keyword racketSyntax quasiquote unquote unquote-splicing quote-syntax
+syntax keyword racketSyntax #%top-interaction
+syntax keyword racketSyntax define-package open-package package-begin
+syntax keyword racketSyntax define* define*-values define*-syntax define*-syntaxes open*-package
+syntax keyword racketSyntax package? package-exported-identifiers package-original-identifiers
+syntax keyword racketSyntax block #%stratified-body
+
+" 8 Contracts
+" 8.2 Function contracts
+syntax keyword racketSyntax -> ->* ->i ->d case-> dynamic->* unconstrained-domain->
+
+" 8.6.1 Nested Contract Boundaries
+syntax keyword racketSyntax with-contract define/contract define-struct/contract
+syntax keyword racketSyntax invariant-assertion current-contract-region
+
+" 9 Pattern Matching
+syntax keyword racketSyntax match match* match/values define/match
+syntax keyword racketSyntax match-lambda match-lambda* match-lambda**
+syntax keyword racketSyntax match-let match-let* match-let-values match-let*-values
+syntax keyword racketSyntax match-letrec match-define match-define-values
+
+" 10.2.3 Handling Exceptions
+syntax keyword racketSyntax with-handlers with-handlers*
+
+" 10.4 Continuations
+syntax keyword racketSyntax let/cc let/ec
+
+" 10.4.1 Additional Control Operators
+syntax keyword racketSyntax % prompt control prompt-at control-at reset shift
+syntax keyword racketSyntax reset-at shift-at prompt0 reset0 control0 shift0
+syntax keyword racketSyntax prompt0-at reset0-at control0-at shift0-at
+syntax keyword racketSyntax set cupto
+
+" 11.3.2 Parameters
+syntax keyword racketSyntax parameterize parameterize*
+
+" 12.5 Writing
+syntax keyword racketSyntax write display displayln print
+syntax keyword racketSyntax fprintf printf eprintf format
+syntax keyword racketSyntax print-pair-curly-braces print-mpair-curly-braces print-unreadable
+syntax keyword racketSyntax print-graph print-struct print-box print-vector-length print-hash-table
+syntax keyword racketSyntax print-boolean-long-form print-reader-abbreviations print-as-expression print-syntax-width
+syntax keyword racketSyntax current-write-relative-directory port-write-handler port-display-handler
+syntax keyword racketSyntax port-print-handler global-port-print-handler
+
+" 13.7 Custodians
+syntax keyword racketSyntax custodian? custodian-memory-accounting-available? custodian-box?
+syntax keyword racketSyntax make-custodian custodian-shutdown-all current-custodian custodian-managed-list
+syntax keyword racketSyntax custodian-require-memory custodian-limit-memory
+syntax keyword racketSyntax make-custodian-box custodian-box-value
+
+" lambda sign
+syntax match racketSyntax /\<[\u03bb]\>/
+
+
+" Functions ==================================================================
+
+syntax keyword racketFunc boolean? not equal? eqv? eq? equal?/recur immutable?
+syntax keyword racketFunc true false symbol=? boolean=? false?
+syntax keyword racketFunc number? complex? real? rational? integer?
+syntax keyword racketFunc exact-integer? exact-nonnegative-integer?
+syntax keyword racketFunc exact-positive-integer? inexact-real?
+syntax keyword racketFunc fixnum? flonum? zero? positive? negative?
+syntax keyword racketFunc even? odd? exact? inexact?
+syntax keyword racketFunc inexact->exact exact->inexact
+
+" 3.2.2 General Arithmetic
+
+" 3.2.2.1 Arithmetic
+syntax keyword racketFunc + - * / quotient remainder quotient/remainder modulo
+syntax keyword racketFunc add1 sub1 abs max min gcd lcm round exact-round floor
+syntax keyword racketFunc ceiling truncate numerator denominator rationalize
+
+" 3.2.2.2 Number Comparison
+syntax keyword racketFunc = < <= > >=
+
+" 3.2.2.3 Powers and Roots
+syntax keyword racketFunc sqrt integer-sqrt integer-sqrt/remainder
+syntax keyword racketFunc expt exp log
+
+" 3.2.2.3 Trigonometric Functions
+syntax keyword racketFunc sin cos tan asin acos atan
+
+" 3.2.2.4 Complex Numbers
+syntax keyword racketFunc make-rectangular make-polar
+syntax keyword racketFunc real-part imag-part magnitude angle
+syntax keyword racketFunc bitwise-ior bitwise-and bitwise-xor bitwise-not
+syntax keyword racketFunc bitwise-bit-set? bitwise-bit-field arithmetic-shift
+syntax keyword racketFunc integer-length
+
+" 3.2.2.5 Random Numbers
+syntax keyword racketFunc random random-seed
+syntax keyword racketFunc make-pseudo-random-generator pseudo-random-generator?
+syntax keyword racketFunc current-pseudo-random-generator pseudo-random-generator->vector
+syntax keyword racketFunc vector->pseudo-random-generator vector->pseudo-random-generator!
+
+" 3.2.2.8 Number-String Conversions
+syntax keyword racketFunc number->string string->number real->decimal-string
+syntax keyword racketFunc integer->integer-bytes
+syntax keyword racketFunc floating-point-bytes->real real->floating-point-bytes
+syntax keyword racketFunc system-big-endian?
+
+" 3.2.2.9 Extra Constants and Functions
+syntax keyword racketFunc pi sqr sgn conjugate sinh cosh tanh order-of-magnitude
+
+" 3.2.3 Flonums
+
+" 3.2.3.1 Flonum Arithmetic
+syntax keyword racketFunc fl+ fl- fl* fl/ flabs
+syntax keyword racketFunc fl= fl< fl> fl<= fl>= flmin flmax
+syntax keyword racketFunc flround flfloor flceiling fltruncate
+syntax keyword racketFunc flsin flcos fltan flasin flacos flatan
+syntax keyword racketFunc fllog flexp flsqrt
+syntax keyword racketFunc ->fl fl->exact-integer make-flrectangular
+syntax keyword racketFunc flreal-part flimag-part
+
+" 3.2.3.2 Flonum Vectors
+syntax keyword racketFunc flvector? flvector make-flvector flvector-length
+syntax keyword racketFunc flvector-ref flvector-set! flvector-copy in-flvector
+syntax keyword racketFunc shared-flvector make-shared-flvector
+syntax keyword racketSyntax for/flvector for*/flvector
+
+" 3.2.4 Fixnums
+syntax keyword racketFunc fx+ fx- fx* fxquotient fxremainder fxmodulo fxabs
+syntax keyword racketFunc fxand fxior fxxor fxnot fxlshift fxrshift
+syntax keyword racketFunc fx= fx< fx> fx<= fx>= fxmin fxmax fx->fl fl->fx
+
+" 3.2.4.2 Fixnum Vectors
+syntax keyword racketFunc fxvector? fxvector make-fxvector fxvector-length
+syntax keyword racketFunc fxvector-ref fxvector-set! fxvector-copy in-fxvector
+syntax keyword racketFunc for/fxvector for*/fxvector
+syntax keyword racketFunc shared-fxvector make-shared-fxvector
+
+" 3.3 Strings
+syntax keyword racketFunc string? make-string string string->immutable-string string-length
+syntax keyword racketFunc string-ref string-set! substring string-copy string-copy!
+syntax keyword racketFunc string-fill! string-append string->list list->string
+syntax keyword racketFunc build-string string=? string<? string<=? string>? string>=?
+syntax keyword racketFunc string-ci=? string-ci<? string-ci<=? string-ci>? string-ci>=?
+syntax keyword racketFunc string-upcase string-downcase string-titlecase string-foldcase
+syntax keyword racketFunc string-normalize-nfd string-normalize-nfc string-normalize-nfkc
+syntax keyword racketFunc string-normalize-spaces string-trim
+syntax keyword racketFunc string-locale=? string-locale>? string-locale<?
+syntax keyword racketFunc string-locale-ci=? string-locale<=?
+syntax keyword racketFunc string-locale-upcase string-locale-downcase
+syntax keyword racketFunc string-append* string-join
+
+" 3.4 Bytestrings
+syntax keyword racketFunc bytes? make-bytes bytes bytes->immutable-bytes byte?
+syntax keyword racketFunc bytes-length bytes-ref bytes-set! subbytes bytes-copy
+syntax keyword racketFunc bytes-copy! bytes-fill! bytes-append bytes->list list->bytes
+syntax keyword racketFunc make-shared-bytes shared-bytes
+syntax keyword racketFunc bytes=? bytes<? bytes>?
+syntax keyword racketFunc bytes->string/utf-8 bytes->string/latin-1
+syntax keyword racketFunc string->bytes/locale string->bytes/latin-1 string->bytes/utf-8
+syntax keyword racketFunc string-utf-8-length bytes-utf8-ref bytes-utf-8-index
+syntax keyword racketFunc bytes-open-converter bytes-close-converter
+syntax keyword racketFunc bytes-convert bytes-convert-end bytes-converter?
+syntax keyword racketFunc locale-string-encoding
+
+" 3.5 Characters
+syntax keyword racketFunc char? char->integer integer->char
+syntax keyword racketFunc char=? char<? char<=? char>? char>=?
+syntax keyword racketFunc char-ci=? char-ci<? char-ci<=? char-ci>? char-ci>=?
+syntax keyword racketFunc char-alphabetic? char-lower-case? char-upper-case? char-title-case?
+syntax keyword racketFunc char-numeric? char-symbolic? char-punctuation? char-graphic?
+syntax keyword racketFunc char-whitespace? char-blank?
+syntax keyword racketFunc char-iso-control? char-general-category
+syntax keyword racketFunc make-known-char-range-list
+syntax keyword racketFunc char-upcase char-downcase char-titlecase char-foldcase
+
+" 3.6 Symbols
+syntax keyword racketFunc symbol? symbol-interned? symbol-unreadable?
+syntax keyword racketFunc symbol->string string->symbol
+syntax keyword racketFunc string->uninterned-symbol string->unreadable-symbol
+syntax keyword racketFunc gensym
+
+" 3.7 Regular Expressions
+syntax keyword racketFunc regexp? pregexp? byte-regexp? byte-pregexp?
+syntax keyword racketFunc regexp pregexp byte-regexp byte-pregexp
+syntax keyword racketFunc regexp-quote regexp-match regexp-match*
+syntax keyword racketFunc regexp-try-match regexp-match-positions
+syntax keyword racketFunc regexp-match-positions* regexp-match?
+syntax keyword racketFunc regexp-match-peek-positions regexp-match-peek-immediate
+syntax keyword racketFunc regexp-match-peek regexp-match-peek-positions*
+syntax keyword racketFunc regexp-match/end regexp-match-positions/end
+syntax keyword racketFunc regexp-match-peek-positions-immediat/end
+syntax keyword racketFunc regexp-split regexp-replace regexp-replace*
+syntax keyword racketFunc regexp-replace-quote
+
+" 3.8 Keywords
+syntax keyword racketFunc keyword? keyword->string string->keyword keyword<?
+
+" 3.9 Pairs and Lists
+syntax keyword racketFunc pair? null? cons car cdr null
+syntax keyword racketFunc list? list list* build-list length
+syntax keyword racketFunc list-ref list-tail append reverse map andmap ormap
+syntax keyword racketFunc for-each foldl foldr filter remove remq remv remove*
+syntax keyword racketFunc remq* remv* sort member memv memq memf
+syntax keyword racketFunc findf assoc assv assq assf
+syntax keyword racketFunc caar cadr cdar cddr caaar caadr cadar caddr cdaar
+syntax keyword racketFunc cddar cdddr caaaar caaadr caadar caaddr cadadr caddar
+syntax keyword racketFunc cadddr cdaaar cdaadr cdadar cddaar cdddar cddddr
+
+" 3.9.7 Additional List Functions and Synonyms
+" (require racket/list)
+syntax keyword racketFunc empty cons? empty? first rest
+syntax keyword racketFunc second third fourth fifth sixth seventh eighth ninth tenth
+syntax keyword racketFunc last last-pair make-list take drop split-at
+syntax keyword racketFunc take-right drop-right split-at-right add-between
+syntax keyword racketFunc append* flatten remove-duplicates filter-map
+syntax keyword racketFunc count partition append-map filter-not shuffle
+syntax keyword racketFunc argmin argmax make-reader-graph placeholder? make-placeholder
+syntax keyword racketFunc placeholder-set! placeholder-get hash-placeholder?
+syntax keyword racketFunc make-hash-placeholder make-hasheq-placeholder
+syntax keyword racketFunc make-hasheqv-placeholder make-immutable-hasheqv
+
+" 3.10 Mutable Pairs and Lists
+syntax keyword racketFunc mpair? mcons mcar mcdr
+
+" 3.11 Vectors
+syntax keyword racketFunc vector? make-vector vector vector-immutable vector-length
+syntax keyword racketFunc vector-ref vector-set! vector->list list->vector
+syntax keyword racketFunc vector->immutable-vector vector-fill! vector-copy!
+syntax keyword racketFunc vector->values build-vector vector-set*! vector-map
+syntax keyword racketFunc vector-map! vector-append vector-take vector-take-right
+syntax keyword racketFunc vector-drop vector-drop-right vector-split-at
+syntax keyword racketFunc vector-split-at-right vector-copy vector-filter
+syntax keyword racketFunc vector-filter-not vector-count vector-argmin vector-argmax
+syntax keyword racketFunc vector-member vector-memv vector-memq
+
+" 3.12 Boxes
+syntax keyword racketFunc box? box box-immutable unbox set-box!
+
+" 3.13 Hash Tables
+syntax keyword racketFunc hash? hash-equal? hash-eqv? hash-eq? hash-weak? hash
+syntax keyword racketFunc hasheq hasheqv
+syntax keyword racketFunc make-hash make-hasheqv make-hasheq make-weak-hash make-weak-hasheqv
+syntax keyword racketFunc make-weak-hasheq make-immutable-hash make-immutable-hasheqv
+syntax keyword racketFunc make-immutable-hasheq
+syntax keyword racketFunc hash-set! hash-set*! hash-set hash-set* hash-ref hash-ref!
+syntax keyword racketFunc hash-has-key? hash-update! hash-update hash-remove!
+syntax keyword racketFunc hash-remove hash-map hash-keys hash-values
+syntax keyword racketFunc hash->list hash-for-each hash-count
+syntax keyword racketFunc hash-iterate-first hash-iterate-next hash-iterate-key
+syntax keyword racketFunc hash-iterate-value hash-copy eq-hash-code eqv-hash-code
+syntax keyword racketFunc equal-hash-code equal-secondary-hash-code
+
+" 3.15 Dictionaries
+syntax keyword racketFunc dict? dict-mutable? dict-can-remove-keys? dict-can-functional-set?
+syntax keyword racketFunc dict-set! dict-set*! dict-set dict-set* dict-has-key? dict-ref
+syntax keyword racketFunc dict-ref! dict-update! dict-update dict-remove! dict-remove
+syntax keyword racketFunc dict-map dict-for-each dict-count dict-iterate-first dict-iterate-next
+syntax keyword racketFunc dict-iterate-key dict-iterate-value in-dict in-dict-keys
+syntax keyword racketFunc in-dict-values in-dict-pairs dict-keys dict-values
+syntax keyword racketFunc dict->list prop: dict prop: dict/contract dict-key-contract
+syntax keyword racketFunc dict-value-contract dict-iter-contract make-custom-hash
+syntax keyword racketFunc make-immutable-custom-hash make-weak-custom-hash
+
+" 3.16 Sets
+syntax keyword racketFunc set seteqv seteq set-empty? set-count set-member?
+syntax keyword racketFunc set-add set-remove set-union set-intersect set-subtract
+syntax keyword racketFunc set-symmetric-difference set=? subset? proper-subset?
+syntax keyword racketFunc set-map set-for-each set? set-equal? set-eqv? set-eq?
+syntax keyword racketFunc set/c in-set for/set for/seteq for/seteqv for*/set
+syntax keyword racketFunc for*/seteq for*/seteqv list->set list->seteq
+syntax keyword racketFunc list->seteqv set->list
+
+" 3.17 Procedures
+syntax keyword racketFunc procedure? apply compose compose1 procedure-rename procedure->method
+syntax keyword racketFunc keyword-apply procedure-arity procedure-arity?
+syntax keyword racketFunc procedure-arity-includes? procedure-reduce-arity
+syntax keyword racketFunc procedure-keywords make-keyword-procedure
+syntax keyword racketFunc procedure-reduce-keyword-arity procedure-struct-type?
+syntax keyword racketFunc procedure-extract-target checked-procedure-check-and-extract
+syntax keyword racketFunc primitive? primitive-closure? primitive-result-arity
+syntax keyword racketFunc identity const thunk thunk* negate curry curryr
+
+" 3.18 Void
+syntax keyword racketFunc void void?
+
+" 4.1 Defining Structure Types
+syntax keyword racketFunc struct struct-field-index define-struct define-struct define-struct/derived
+
+" 4.2 Creating Structure Types
+syntax keyword racketFunc make-struct-type make-struct-field-accessor make-struct-field-mutator
+
+" 4.3 Structure Type Properties
+syntax keyword racketFunc make-struct-type-property struct-type-property? struct-type-property-accessor-procedure?
+
+" 4.4 Copying and Updating Structures
+syntax keyword racketFunc struct-copy
+
+" 4.5 Structure Utilities
+syntax keyword racketFunc struct->vector struct? struct-type?
+syntax keyword racketFunc struct-constructor-procedure? struct-predicate-procedure? struct-accessor-procedure? struct-mutator-procedure?
+syntax keyword racketFunc prefab-struct-key make-prefab-struct prefab-key->struct-type
+
+" 4.6 Structure Type Transformer Binding
+syntax keyword racketFunc struct-info? check-struct-info? make-struct-info extract-struct-info
+syntax keyword racketFunc struct-auto-info? struct-auto-info-lists
+
+" 5.1 Creating Interfaces
+syntax keyword racketFunc interface interface*
+
+" 5.2 Creating Classes
+syntax keyword racketFunc class* class inspect
+syntax keyword racketFunc init init-field field inherit field init-rest
+syntax keyword racketFunc public public* pubment pubment* public-final public-final*
+syntax keyword racketFunc override override* overment overment* override-final override-final*
+syntax keyword racketFunc augride augride* augment augment* augment-final augment-final*
+syntax keyword racketFunc abstract inherit inherit/super inherit/inner
+syntax keyword racketFunc rename-inner rename-super
+syntax keyword racketFunc define/public define/pubment define/public-final
+syntax keyword racketFunc define/override define/overment define/override-final
+syntax keyword racketFunc define/augride define/augment define/augment-final
+syntax keyword racketFunc private* define/private
+
+" 5.2.3 Methods
+syntax keyword racketFunc class/derived
+syntax keyword racketFunc super inner define-local-member-name define-member-name
+syntax keyword racketFunc member-name-key generate-member-key member-name-key?
+syntax keyword racketFunc member-name-key=? member-name-key-hash-code
+
+" 5.3 Creating Objects
+syntax keyword racketFunc make-object instantiate new
+syntax keyword racketFunc super-make-object super-instantiate super-new
+
+"5.4 Field and Method Access
+syntax keyword racketFunc method-id send send/apply send/keyword-apply dynamic-send send*
+syntax keyword racketFunc get-field set-field! field-bound?
+syntax keyword racketFunc class-field-accessor class-field-mutator
+
+"5.4.3 Generics
+syntax keyword racketFunc generic send-generic make-generic
+
+" 8.1 Data-strucure contracts
+syntax keyword racketFunc flat-contract-with-explanation flat-named-contract
+" TODO where do any/c and none/c `value`s go?
+syntax keyword racketFunc or/c first-or/c and/c not/c =/c </c >/c <=/c >=/c
+syntax keyword racketFunc between/c real-in integer-in char-in natural-number/c
+syntax keyword racketFunc string-len/c printable/c one-of/c symbols vectorof
+syntax keyword racketFunc vector-immutableof vector/c box/c box-immutable/c listof
+syntax keyword racketFunc non-empty-listof list*of cons/c cons/dc list/c *list/c
+syntax keyword racketFunc syntax/c struct/c struct/dc parameter/c
+syntax keyword racketFunc procedure-arity-includes/c hash/c hash/dc channel/c
+syntax keyword racketFunc prompt-tag/c continuation-mark-key/c evt/c promise/c
+syntax keyword racketFunc flat-contract flat-contract-predicate suggest/c
+
+" 9.1 Multiple Values
+syntax keyword racketFunc values call-with-values
+
+" 10.2.2 Raising Exceptions
+syntax keyword racketFunc raise error raise-user-error raise-argument-error
+syntax keyword racketFunc raise-result-error raise-argument-error raise-range-error
+syntax keyword racketFunc raise-type-error raise-mismatch-error raise-arity-error
+syntax keyword racketFunc raise-syntax-error
+
+" 10.2.3 Handling Exceptions
+syntax keyword racketFunc call-with-exception-handler uncaught-exception-handler
+
+" 10.2.4 Configuring Default Handlers
+syntax keyword racketFunc error-escape-handler error-display-handler error-print-width
+syntax keyword racketFunc error-print-context-length error-values->string-handler
+syntax keyword racketFunc error-print-source-location
+
+" 10.2.5 Built-in Exception Types
+syntax keyword racketFunc exn exn:fail exn:fail:contract exn:fail:contract:arity
+syntax keyword racketFunc exn:fail:contract:divide-by-zero exn:fail:contract:non-fixnum-result
+syntax keyword racketFunc exn:fail:contract:continuation exn:fail:contract:variable
+syntax keyword racketFunc exn:fail:syntax exn:fail:syntax:unbound exn:fail:syntax:missing-module
+syntax keyword racketFunc exn:fail:read exn:fail:read:eof exn:fail:read:non-char
+syntax keyword racketFunc exn:fail:filesystem exn:fail:filesystem:exists
+syntax keyword racketFunc exn:fail:filesystem:version exn:fail:filesystem:errno
+syntax keyword racketFunc exn:fail:filesystem:missing-module
+syntax keyword racketFunc exn:fail:network exn:fail:network:errno exn:fail:out-of-memory
+syntax keyword racketFunc exn:fail:unsupported exn:fail:user
+syntax keyword racketFunc exn:break exn:break:hang-up exn:break:terminate
+
+" 10.3 Delayed Evaluation
+syntax keyword racketFunc promise? delay lazy force promise-forced? promise-running?
+
+" 10.3.1 Additional Promise Kinds
+syntax keyword racketFunc delay/name promise/name delay/strict delay/sync delay/thread delay/idle
+
+" 10.4 Continuations
+syntax keyword racketFunc call-with-continuation-prompt abort-current-continuation make-continuation-prompt-tag
+syntax keyword racketFunc default-continuation-prompt-tag call-with-current-continuation call/cc
+syntax keyword racketFunc call-with-composable-continuation call-with-escape-continuation call/ec
+syntax keyword racketFunc call-with-continuation-barrier continuation-prompt-available
+syntax keyword racketFunc continuation? continuation-prompt-tag dynamic-wind
+
+" 10.4.1 Additional Control Operators
+syntax keyword racketFunc call/prompt abort/cc call/comp abort fcontrol spawn splitter new-prompt
+
+" 11.3.2 Parameters
+syntax keyword racketFunc make-parameter make-derived-parameter parameter?
+syntax keyword racketFunc parameter-procedure=? current-parameterization
+syntax keyword racketFunc call-with-parameterization parameterization?
+
+" 14.1.1 Manipulating Paths
+syntax keyword racketFunc path? path-string? path-for-some-system? string->path path->string path->bytes
+syntax keyword racketFunc string->path-element bytes->path-element path-element->string path-element->bytes
+syntax keyword racketFunc path-convention-type system-path-convention-type build-type
+syntax keyword racketFunc build-type/convention-type
+syntax keyword racketFunc absolute-path? relative-path? complete-path?
+syntax keyword racketFunc path->complete-path path->directory-path
+syntax keyword racketFunc resolve-path cleanse-path expand-user-path simplify-path normal-case-path split-path
+syntax keyword racketFunc path-replace-suffix path-add-suffix
+
+" 14.1.2 More Path Utilities
+syntax keyword racketFunc explode-path file-name-from-path filename-extension find-relative-path normalize-path
+syntax keyword racketFunc path-element? path-only simple-form-path some-simple-path->string string->some-system-path
+
+" 15.6 Time
+syntax keyword racketFunc current-seconds current-inexact-milliseconds
+syntax keyword racketFunc seconds->date current-milliseconds
+
+
+syntax match racketDelimiter !\<\.\>!
+
+syntax cluster racketTop contains=racketSyntax,racketFunc,racketDelimiter
+
+syntax match racketConstant ,\<\*\k\+\*\>,
+syntax match racketConstant ,\<<\k\+>\>,
+
+" Non-quoted lists, and strings
+syntax region racketStruc matchgroup=racketParen start="("rs=s+1 end=")"re=e-1 contains=@racketTop
+syntax region racketStruc matchgroup=racketParen start="#("rs=s+2 end=")"re=e-1 contains=@racketTop
+syntax region racketStruc matchgroup=racketParen start="{"rs=s+1 end="}"re=e-1 contains=@racketTop
+syntax region racketStruc matchgroup=racketParen start="#{"rs=s+2 end="}"re=e-1 contains=@racketTop
+syntax region racketStruc matchgroup=racketParen start="\["rs=s+1 end="\]"re=e-1 contains=@racketTop
+syntax region racketStruc matchgroup=racketParen start="#\["rs=s+2 end="\]"re=e-1 contains=@racketTop
+
+for lit in ['hash', 'hasheq', 'hasheqv']
+ execute printf('syntax match racketLit "\<%s\>" nextgroup=@racketParen containedin=ALLBUT,.*String,.*Comment', '#'.lit)
+endfor
+
+for lit in ['rx', 'rx#', 'px', 'px#']
+ execute printf('syntax match racketRe "\<%s\>" nextgroup=@racketString containedin=ALLBUT,.*String,.*Comment,', '#'.lit)
+endfor
+
+unlet lit
+
+" Simple literals
+
+" Strings
+
+syntax match racketStringEscapeError "\\." contained display
+
+syntax match racketStringEscape "\\[abtnvfre'"\\]" contained display
+syntax match racketStringEscape "\\$" contained display
+syntax match racketStringEscape "\\\o\{1,3}\|\\x\x\{1,2}" contained display
+
+syntax match racketUStringEscape "\\u\x\{1,4}\|\\U\x\{1,8}" contained display
+syntax match racketUStringEscape "\\u\x\{4}\\u\x\{4}" contained display
+
+syntax region racketString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/ contains=racketStringEscapeError,racketStringEscape,racketUStringEscape
+syntax region racketString start=/#"/ skip=/\\[\\"]/ end=/"/ contains=racketStringEscapeError,racketStringEscape
+
+if exists("racket_no_string_fold")
+ syn region racketString start=/#<<\z(.*\)$/ end=/^\z1$/
+else
+ syn region racketString start=/#<<\z(.*\)$/ end=/^\z1$/ fold
+endif
+
+
+syntax cluster racketTop add=racketError,racketConstant,racketStruc,racketString
+
+" Numbers
+
+" anything which doesn't match the below rules, but starts with a #d, #b, #o,
+" #x, #i, or #e, is an error
+syntax match racketNumberError "\<#[xdobie]\k*"
+
+syntax match racketContainedNumberError "\<#o\k*[^-+0-7delfinas#./@]\>"
+syntax match racketContainedNumberError "\<#b\k*[^-+01delfinas#./@]\>"
+syntax match racketContainedNumberError "\<#[ei]#[ei]"
+syntax match racketContainedNumberError "\<#[xdob]#[xdob]"
+
+" start with the simpler sorts
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\d\+/\d\+\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\d\+/\d\+[-+]\d\+\(/\d\+\)\?i\>" contains=racketContainedNumberError
+
+" different possible ways of expressing complex values
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?[-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f][-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?[-+]\(inf\|nan\)\.[0f]i\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?@[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]@[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?@[-+]\(inf\|nan\)\.[0f]\>" contains=racketContainedNumberError
+
+" hex versions of the above (separate because of the different possible exponent markers)
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\x\+/\x\+\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\x\+/\x\+[-+]\x\+\(/\x\+\)\?i\>"
+
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?i\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?[-+]\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?i\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\(inf\|nan\)\.[0f][-+]\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?i\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?[-+]\(inf\|nan\)\.[0f]i\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?@[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\(inf\|nan\)\.[0f]@[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?\>"
+syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?@[-+]\(inf\|nan\)\.[0f]\>"
+
+" these work for any radix
+syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]i\?\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f][-+]\(inf\|nan\)\.[0f]i\>" contains=racketContainedNumberError
+syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]@[-+]\(inf\|nan\)\.[0f]\>" contains=racketContainedNumberError
+
+syntax keyword racketBoolean #t #f #true #false #T #F
+
+syntax match racketError "\<#\\\k*\>"
+
+syntax match racketChar "\<#\\.\w\@!"
+syntax match racketChar "\<#\\space\>"
+syntax match racketChar "\<#\\newline\>"
+syntax match racketChar "\<#\\return\>"
+syntax match racketChar "\<#\\null\?\>"
+syntax match racketChar "\<#\\backspace\>"
+syntax match racketChar "\<#\\tab\>"
+syntax match racketChar "\<#\\linefeed\>"
+syntax match racketChar "\<#\\vtab\>"
+syntax match racketChar "\<#\\page\>"
+syntax match racketChar "\<#\\rubout\>"
+syntax match racketChar "\<#\\\o\{1,3}\>"
+syntax match racketChar "\<#\\x\x\{1,2}\>"
+syntax match racketChar "\<#\\u\x\{1,6}\>"
+
+syntax cluster racketTop add=racketNumber,racketBoolean,racketChar
+
+" Command-line parsing
+syntax keyword racketExtFunc command-line current-command-line-arguments once-any help-labels multi once-each
+
+syntax match racketSyntax "#lang "
+syntax match racketExtSyntax "#:\k\+"
+
+syntax cluster racketTop add=racketExtFunc,racketExtSyntax
+
+" syntax quoting, unquoting and quasiquotation
+syntax match racketQuote "#\?['`]"
+
+syntax match racketUnquote "#,"
+syntax match racketUnquote "#,@"
+syntax match racketUnquote ","
+syntax match racketUnquote ",@"
+
+" Comments
+syntax match racketSharpBang "\%^#![ /].*" display
+syntax match racketComment /;.*$/ contains=racketTodo,racketNote,@Spell
+syntax region racketMultilineComment start=/#|/ end=/|#/ contains=racketMultilineComment,racketTodo,racketNote,@Spell
+syntax match racketFormComment "#;" nextgroup=@racketTop
+
+syntax match racketTodo /\C\<\(FIXME\|TODO\|XXX\)\ze:\?\>/ contained
+syntax match racketNote /\CNOTE\ze:\?/ contained
+
+syntax cluster racketTop add=racketQuote,racketUnquote,racketComment,racketMultilineComment,racketFormComment
+
+" Synchronization and the wrapping up...
+syntax sync match matchPlace grouphere NONE "^[^ \t]"
+" ... i.e. synchronize on a line that starts at the left margin
+
+" Define the default highlighting.
+highlight default link racketSyntax Statement
+highlight default link racketFunc Function
+
+highlight default link racketString String
+highlight default link racketStringEscape Special
+highlight default link racketUStringEscape Special
+highlight default link racketStringEscapeError Error
+highlight default link racketChar Character
+highlight default link racketBoolean Boolean
+
+highlight default link racketNumber Number
+highlight default link racketNumberError Error
+highlight default link racketContainedNumberError Error
+
+highlight default link racketQuote SpecialChar
+highlight default link racketUnquote SpecialChar
+
+highlight default link racketDelimiter Delimiter
+highlight default link racketParen Delimiter
+highlight default link racketConstant Constant
+
+highlight default link racketLit Type
+highlight default link racketRe Type
+
+highlight default link racketComment Comment
+highlight default link racketMultilineComment Comment
+highlight default link racketFormComment SpecialChar
+highlight default link racketSharpBang Comment
+highlight default link racketTodo Todo
+highlight default link racketNote SpecialComment
+highlight default link racketError Error
+
+highlight default link racketExtSyntax Type
+highlight default link racketExtFunc PreProc
+
+let b:current_syntax = "racket"
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index e44699faa5..822b1a9ed2 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: Jun 29, 2022
-" Version: 202
+" Last Change: Jul 08, 2022
+" Version: 203
" 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
@@ -141,7 +141,7 @@ endif
syn cluster shArithParenList contains=shArithmetic,shArithParen,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shArithList contains=@shArithParenList,shParenError
syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
-syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
+syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDblBrace,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shCaseList add=shForPP
endif
diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim
index b88cd95103..056e38bf79 100644
--- a/runtime/syntax/synload.vim
+++ b/runtime/syntax/synload.vim
@@ -30,7 +30,7 @@ fun! s:SynSet()
unlet b:current_syntax
endif
- let s = expand("<amatch>")
+ 0verbose let s = expand("<amatch>")
if s == "ON"
" :set syntax=ON
if &filetype == ""
diff --git a/runtime/syntax/syntax.vim b/runtime/syntax/syntax.vim
index ac7dc314b9..5ec99c7e05 100644
--- a/runtime/syntax/syntax.vim
+++ b/runtime/syntax/syntax.vim
@@ -27,12 +27,13 @@ else
endif
" Set up the connection between FileType and Syntax autocommands.
-" This makes the syntax automatically set when the file type is detected.
+" This makes the syntax automatically set when the file type is detected
+" unless treesitter highlighting is enabled.
+" Avoid an error when 'verbose' is set and <amatch> expansion fails.
augroup syntaxset
- au! FileType * exe "set syntax=" . expand("<amatch>")
+ au! FileType * if !exists('b:ts_highlight') | 0verbose exe "set syntax=" . expand("<amatch>") | endif
augroup END
-
" Execute the syntax autocommands for the each buffer.
" If the filetype wasn't detected yet, do that now.
" Always do the syntaxset autocommands, for buffers where the 'filetype'
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 2b1c58c449..d5e138dbc3 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -53,7 +53,7 @@ syn case ignore
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
" Default highlighting groups {{{2
-syn keyword vimHLGroup contained 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 MessageWindow 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
diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim
index bab89b916e..69671c59ca 100644
--- a/runtime/syntax/zsh.vim
+++ b/runtime/syntax/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2020-11-21
+" Latest Revision: 2022-07-26
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
@@ -19,9 +19,9 @@ function! s:ContainedGroup()
" vim-pandoc syntax defines the @langname cluster for embedded syntax languages
" However, if no syntax is defined yet, `syn list @zsh` will return
" "No syntax items defined", so make sure the result is actually a valid syn cluster
- for cluster in ['markdownHighlightzsh', 'zsh']
+ for cluster in ['markdownHighlight_zsh', 'zsh']
try
- " markdown syntax defines embedded clusters as @markdownhighlight<lang>,
+ " markdown syntax defines embedded clusters as @markdownhighlight_<lang>,
" pandoc just uses @<lang>, so check both for both clusters
let a=split(execute('syn list @'. cluster), "\n")
if len(a) == 2 && a[0] =~# '^---' && a[1] =~? cluster
@@ -48,17 +48,28 @@ syn match zshPOSIXQuoted '\\u[0-9a-fA-F]\{1,4}'
syn match zshPOSIXQuoted '\\U[1-9a-fA-F]\{1,8}'
syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+
- \ contains=zshQuoted,@zshDerefs,@zshSubst fold
+ \ contains=zshQuoted,@zshDerefs,@zshSubstQuoted fold
syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold
syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+
\ skip=+\\[\\']+ end=+'+ contains=zshPOSIXQuoted,zshQuoted
syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)'
+syn match zshNumber '[+-]\=\<\d\+\>'
+syn match zshNumber '[+-]\=\<0x\x\+\>'
+syn match zshNumber '[+-]\=\<0\o\+\>'
+syn match zshNumber '[+-]\=\d\+#[-+]\=\w\+\>'
+syn match zshNumber '[+-]\=\d\+\.\d\+\>'
+
syn keyword zshPrecommand noglob nocorrect exec command builtin - time
syn keyword zshDelimiter do done end
-syn keyword zshConditional if then elif else fi case in esac select
+syn keyword zshConditional if then elif else fi esac select
+
+syn keyword zshCase case nextgroup=zshCaseWord skipwhite
+syn match zshCaseWord /\S\+/ nextgroup=zshCaseIn skipwhite contained transparent
+syn keyword zshCaseIn in nextgroup=zshCasePattern skipwhite skipnl contained
+syn match zshCasePattern /\S[^)]*)/ contained
syn keyword zshRepeat while until repeat
@@ -73,9 +84,13 @@ syn match zshFunction '^\s*\k\+\ze\s*()'
syn match zshOperator '||\|&&\|;\|&!\='
-syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)'
-syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\='
-syn match zshRedir '|&\='
+ " <<<, <, <>, and variants.
+syn match zshRedir '\d\=\(<<<\|<&\s*[0-9p-]\=\|<>\?\)'
+ " >, >>, and variants.
+syn match zshRedir '\d\=\(>&\s*[0-9p-]\=\|&>>\?\|>>\?&\?\)[|!]\='
+ " | and |&, but only if it's not preceeded or
+ " followed by a | to avoid matching ||.
+syn match zshRedir '|\@1<!|&\=|\@!'
syn region zshHereDoc matchgroup=zshRedir
\ start='<\@<!<<\s*\z([^<]\S*\)'
@@ -125,7 +140,7 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd
\ enable eval exec exit export false fc fg
\ functions getcap getln getopts hash history
\ jobs kill let limit log logout popd print
- \ printf pushd pushln pwd r read
+ \ printf prompt pushd pushln pwd r read
\ rehash return sched set setcap shift
\ source stat suspend test times trap true
\ ttyctl type ulimit umask unalias unfunction
@@ -139,10 +154,120 @@ syn case ignore
syn match zshOptStart
\ /\v^\s*%(%(un)?setopt|set\s+[-+]o)/
\ nextgroup=zshOption skipwhite
-syn match zshOption nextgroup=zshOption,zshComment skipwhite contained /\v
- \ <%(no_?)?%(
- \ auto_?cd|auto_?pushd|cdable_?vars|cd_?silent|chase_?dots|chase_?links|posix_?cd|pushd_?ignore_?dups|pushd_?minus|pushd_?silent|pushd_?to_?home|always_?last_?prompt|always_?to_?end|auto_?list|auto_?menu|auto_?name_?dirs|auto_?param_?keys|auto_?param_?slash|auto_?remove_?slash|bash_?auto_?list|complete_?aliases|complete_?in_?word|glob_?complete|hash_?list_?all|list_?ambiguous|list_?beep|list_?packed|list_?rows_?first|list_?types|menu_?complete|rec_?exact|bad_?pattern|bare_?glob_?qual|brace_?ccl|case_?glob|case_?match|case_?paths|csh_?null_?glob|equals|extended_?glob|force_?float|glob|glob_?assign|glob_?dots|glob_?star_?short|glob_?subst|hist_?subst_?pattern|ignore_?braces|ignore_?close_?braces|ksh_?glob|magic_?equal_?subst|mark_?dirs|multibyte|nomatch|null_?glob|numeric_?glob_?sort|rc_?expand_?param|rematch_?pcre|sh_?glob|unset|warn_?create_?global|warn_?nested_?var|warnnestedvar|append_?history|bang_?hist|extended_?history|hist_?allow_?clobber|hist_?beep|hist_?expire_?dups_?first|hist_?fcntl_?lock|hist_?find_?no_?dups|hist_?ignore_?all_?dups|hist_?ignore_?dups|hist_?ignore_?space|hist_?lex_?words|hist_?no_?functions|hist_?no_?store|hist_?reduce_?blanks|hist_?save_?by_?copy|hist_?save_?no_?dups|hist_?verify|inc_?append_?history|inc_?append_?history_?time|share_?history|all_?export|global_?export|global_?rcs|rcs|aliases|clobber|clobber_?empty|correct|correct_?all|dvorak|flow_?control|ignore_?eof|interactive_?comments|hash_?cmds|hash_?dirs|hash_?executables_?only|mail_?warning|path_?dirs|path_?script|print_?eight_?bit|print_?exit_?value|rc_?quotes|rm_?star_?silent|rm_?star_?wait|short_?loops|short_?repeat|sun_?keyboard_?hack|auto_?continue|auto_?resume|bg_?nice|check_?jobs|check_?running_?jobs|hup|long_?list_?jobs|monitor|notify|posix_?jobs|prompt_?bang|prompt_?cr|prompt_?sp|prompt_?percent|prompt_?subst|transient_?rprompt|alias_?func_?def|c_?bases|c_?precedences|debug_?before_?cmd|err_?exit|err_?return|eval_?lineno|exec|function_?argzero|local_?loops|local_?options|local_?patterns|local_?traps|multi_?func_?def|multios|octal_?zeroes|pipe_?fail|source_?trace|typeset_?silent|typeset_?to_?unset|verbose|xtrace|append_?create|bash_?rematch|bsd_?echo|continue_?on_?error|csh_?junkie_?history|csh_?junkie_?loops|csh_?junkie_?quotes|csh_?nullcmd|ksh_?arrays|ksh_?autoload|ksh_?option_?print|ksh_?typeset|ksh_?zero_?subscript|posix_?aliases|posix_?argzero|posix_?builtins|posix_?identifiers|posix_?strings|posix_?traps|sh_?file_?expansion|sh_?nullcmd|sh_?option_?letters|sh_?word_?split|traps_?async|interactive|login|privileged|restricted|shin_?stdin|single_?command|beep|combining_?chars|emacs|overstrike|single_?line_?zle|vi|zle|brace_?expand|dot_?glob|hash_?all|hist_?append|hist_?expand|log|mail_?warn|one_?cmd|physical|prompt_?vars|stdin|track_?all|no_?match
- \)>/
+syn keyword zshOption nextgroup=zshOption,zshComment skipwhite contained
+ \ auto_cd no_auto_cd autocd noautocd auto_pushd no_auto_pushd autopushd noautopushd cdable_vars
+ \ no_cdable_vars cdablevars nocdablevars cd_silent no_cd_silent cdsilent nocdsilent chase_dots
+ \ no_chase_dots chasedots nochasedots chase_links no_chase_links chaselinks nochaselinks posix_cd
+ \ posixcd no_posix_cd noposixcd pushd_ignore_dups no_pushd_ignore_dups pushdignoredups
+ \ nopushdignoredups pushd_minus no_pushd_minus pushdminus nopushdminus pushd_silent no_pushd_silent
+ \ pushdsilent nopushdsilent pushd_to_home no_pushd_to_home pushdtohome nopushdtohome
+ \ always_last_prompt no_always_last_prompt alwayslastprompt noalwayslastprompt always_to_end
+ \ no_always_to_end alwaystoend noalwaystoend auto_list no_auto_list autolist noautolist auto_menu
+ \ no_auto_menu automenu noautomenu auto_name_dirs no_auto_name_dirs autonamedirs noautonamedirs
+ \ auto_param_keys no_auto_param_keys autoparamkeys noautoparamkeys auto_param_slash
+ \ no_auto_param_slash autoparamslash noautoparamslash auto_remove_slash no_auto_remove_slash
+ \ autoremoveslash noautoremoveslash bash_auto_list no_bash_auto_list bashautolist nobashautolist
+ \ complete_aliases no_complete_aliases completealiases nocompletealiases complete_in_word
+ \ no_complete_in_word completeinword nocompleteinword glob_complete no_glob_complete globcomplete
+ \ noglobcomplete hash_list_all no_hash_list_all hashlistall nohashlistall list_ambiguous
+ \ no_list_ambiguous listambiguous nolistambiguous list_beep no_list_beep listbeep nolistbeep
+ \ list_packed no_list_packed listpacked nolistpacked list_rows_first no_list_rows_first listrowsfirst
+ \ nolistrowsfirst list_types no_list_types listtypes nolisttypes menu_complete no_menu_complete
+ \ menucomplete nomenucomplete rec_exact no_rec_exact recexact norecexact bad_pattern no_bad_pattern
+ \ badpattern nobadpattern bare_glob_qual no_bare_glob_qual bareglobqual nobareglobqual brace_ccl
+ \ no_brace_ccl braceccl nobraceccl case_glob no_case_glob caseglob nocaseglob case_match
+ \ no_case_match casematch nocasematch case_paths no_case_paths casepaths nocasepaths csh_null_glob
+ \ no_csh_null_glob cshnullglob nocshnullglob equals no_equals noequals extended_glob no_extended_glob
+ \ extendedglob noextendedglob force_float no_force_float forcefloat noforcefloat glob no_glob noglob
+ \ glob_assign no_glob_assign globassign noglobassign glob_dots no_glob_dots globdots noglobdots
+ \ glob_star_short no_glob_star_short globstarshort noglobstarshort glob_subst no_glob_subst globsubst
+ \ noglobsubst hist_subst_pattern no_hist_subst_pattern histsubstpattern nohistsubstpattern
+ \ ignore_braces no_ignore_braces ignorebraces noignorebraces ignore_close_braces
+ \ no_ignore_close_braces ignoreclosebraces noignoreclosebraces ksh_glob no_ksh_glob kshglob nokshglob
+ \ magic_equal_subst no_magic_equal_subst magicequalsubst nomagicequalsubst mark_dirs no_mark_dirs
+ \ markdirs nomarkdirs multibyte no_multibyte nomultibyte nomatch no_nomatch nonomatch null_glob
+ \ no_null_glob nullglob nonullglob numeric_glob_sort no_numeric_glob_sort numericglobsort
+ \ nonumericglobsort rc_expand_param no_rc_expand_param rcexpandparam norcexpandparam rematch_pcre
+ \ no_rematch_pcre rematchpcre norematchpcre sh_glob no_sh_glob shglob noshglob unset no_unset nounset
+ \ warn_create_global no_warn_create_global warncreateglobal nowarncreateglobal warn_nested_var
+ \ no_warn_nested_var warnnestedvar no_warnnestedvar append_history no_append_history appendhistory
+ \ noappendhistory bang_hist no_bang_hist banghist nobanghist extended_history no_extended_history
+ \ extendedhistory noextendedhistory hist_allow_clobber no_hist_allow_clobber histallowclobber
+ \ nohistallowclobber hist_beep no_hist_beep histbeep nohistbeep hist_expire_dups_first
+ \ no_hist_expire_dups_first histexpiredupsfirst nohistexpiredupsfirst hist_fcntl_lock
+ \ no_hist_fcntl_lock histfcntllock nohistfcntllock hist_find_no_dups no_hist_find_no_dups
+ \ histfindnodups nohistfindnodups hist_ignore_all_dups no_hist_ignore_all_dups histignorealldups
+ \ nohistignorealldups hist_ignore_dups no_hist_ignore_dups histignoredups nohistignoredups
+ \ hist_ignore_space no_hist_ignore_space histignorespace nohistignorespace hist_lex_words
+ \ no_hist_lex_words histlexwords nohistlexwords hist_no_functions no_hist_no_functions
+ \ histnofunctions nohistnofunctions hist_no_store no_hist_no_store histnostore nohistnostore
+ \ hist_reduce_blanks no_hist_reduce_blanks histreduceblanks nohistreduceblanks hist_save_by_copy
+ \ no_hist_save_by_copy histsavebycopy nohistsavebycopy hist_save_no_dups no_hist_save_no_dups
+ \ histsavenodups nohistsavenodups hist_verify no_hist_verify histverify nohistverify
+ \ inc_append_history no_inc_append_history incappendhistory noincappendhistory
+ \ inc_append_history_time no_inc_append_history_time incappendhistorytime noincappendhistorytime
+ \ share_history no_share_history sharehistory nosharehistory all_export no_all_export allexport
+ \ noallexport global_export no_global_export globalexport noglobalexport global_rcs no_global_rcs
+ \ globalrcs noglobalrcs rcs no_rcs norcs aliases no_aliases noaliases clobber no_clobber noclobber
+ \ clobber_empty no_clobber_empty clobberempty noclobberempty correct no_correct nocorrect correct_all
+ \ no_correct_all correctall nocorrectall dvorak no_dvorak nodvorak flow_control no_flow_control
+ \ flowcontrol noflowcontrol ignore_eof no_ignore_eof ignoreeof noignoreeof interactive_comments
+ \ no_interactive_comments interactivecomments nointeractivecomments hash_cmds no_hash_cmds hashcmds
+ \ nohashcmds hash_dirs no_hash_dirs hashdirs nohashdirs hash_executables_only
+ \ no_hash_executables_only hashexecutablesonly nohashexecutablesonly mail_warning no_mail_warning
+ \ mailwarning nomailwarning path_dirs no_path_dirs pathdirs nopathdirs path_script no_path_script
+ \ pathscript nopathscript print_eight_bit no_print_eight_bit printeightbit noprinteightbit
+ \ print_exit_value no_print_exit_value printexitvalue noprintexitvalue rc_quotes no_rc_quotes
+ \ rcquotes norcquotes rm_star_silent no_rm_star_silent rmstarsilent normstarsilent rm_star_wait
+ \ no_rm_star_wait rmstarwait normstarwait short_loops no_short_loops shortloops noshortloops
+ \ short_repeat no_short_repeat shortrepeat noshortrepeat sun_keyboard_hack no_sun_keyboard_hack
+ \ sunkeyboardhack nosunkeyboardhack auto_continue no_auto_continue autocontinue noautocontinue
+ \ auto_resume no_auto_resume autoresume noautoresume bg_nice no_bg_nice bgnice nobgnice check_jobs
+ \ no_check_jobs checkjobs nocheckjobs check_running_jobs no_check_running_jobs checkrunningjobs
+ \ nocheckrunningjobs hup no_hup nohup long_list_jobs no_long_list_jobs longlistjobs nolonglistjobs
+ \ monitor no_monitor nomonitor notify no_notify nonotify posix_jobs posixjobs no_posix_jobs
+ \ noposixjobs prompt_bang no_prompt_bang promptbang nopromptbang prompt_cr no_prompt_cr promptcr
+ \ nopromptcr prompt_sp no_prompt_sp promptsp nopromptsp prompt_percent no_prompt_percent
+ \ promptpercent nopromptpercent prompt_subst no_prompt_subst promptsubst nopromptsubst
+ \ transient_rprompt no_transient_rprompt transientrprompt notransientrprompt alias_func_def
+ \ no_alias_func_def aliasfuncdef noaliasfuncdef c_bases no_c_bases cbases nocbases c_precedences
+ \ no_c_precedences cprecedences nocprecedences debug_before_cmd no_debug_before_cmd debugbeforecmd
+ \ nodebugbeforecmd err_exit no_err_exit errexit noerrexit err_return no_err_return errreturn
+ \ noerrreturn eval_lineno no_eval_lineno evallineno noevallineno exec no_exec noexec function_argzero
+ \ no_function_argzero functionargzero nofunctionargzero local_loops no_local_loops localloops
+ \ nolocalloops local_options no_local_options localoptions nolocaloptions local_patterns
+ \ no_local_patterns localpatterns nolocalpatterns local_traps no_local_traps localtraps nolocaltraps
+ \ multi_func_def no_multi_func_def multifuncdef nomultifuncdef multios no_multios nomultios
+ \ octal_zeroes no_octal_zeroes octalzeroes nooctalzeroes pipe_fail no_pipe_fail pipefail nopipefail
+ \ source_trace no_source_trace sourcetrace nosourcetrace typeset_silent no_typeset_silent
+ \ typesetsilent notypesetsilent typeset_to_unset no_typeset_to_unset typesettounset notypesettounset
+ \ verbose no_verbose noverbose xtrace no_xtrace noxtrace append_create no_append_create appendcreate
+ \ noappendcreate bash_rematch no_bash_rematch bashrematch nobashrematch bsd_echo no_bsd_echo bsdecho
+ \ nobsdecho continue_on_error no_continue_on_error continueonerror nocontinueonerror
+ \ csh_junkie_history no_csh_junkie_history cshjunkiehistory nocshjunkiehistory csh_junkie_loops
+ \ no_csh_junkie_loops cshjunkieloops nocshjunkieloops csh_junkie_quotes no_csh_junkie_quotes
+ \ cshjunkiequotes nocshjunkiequotes csh_nullcmd no_csh_nullcmd cshnullcmd nocshnullcmd ksh_arrays
+ \ no_ksh_arrays ksharrays noksharrays ksh_autoload no_ksh_autoload kshautoload nokshautoload
+ \ ksh_option_print no_ksh_option_print kshoptionprint nokshoptionprint ksh_typeset no_ksh_typeset
+ \ kshtypeset nokshtypeset ksh_zero_subscript no_ksh_zero_subscript kshzerosubscript
+ \ nokshzerosubscript posix_aliases no_posix_aliases posixaliases noposixaliases posix_argzero
+ \ no_posix_argzero posixargzero noposixargzero posix_builtins no_posix_builtins posixbuiltins
+ \ noposixbuiltins posix_identifiers no_posix_identifiers posixidentifiers noposixidentifiers
+ \ posix_strings no_posix_strings posixstrings noposixstrings posix_traps no_posix_traps posixtraps
+ \ noposixtraps sh_file_expansion no_sh_file_expansion shfileexpansion noshfileexpansion sh_nullcmd
+ \ no_sh_nullcmd shnullcmd noshnullcmd sh_option_letters no_sh_option_letters shoptionletters
+ \ noshoptionletters sh_word_split no_sh_word_split shwordsplit noshwordsplit traps_async
+ \ no_traps_async trapsasync notrapsasync interactive no_interactive nointeractive login no_login
+ \ nologin privileged no_privileged noprivileged restricted no_restricted norestricted shin_stdin
+ \ no_shin_stdin shinstdin noshinstdin single_command no_single_command singlecommand nosinglecommand
+ \ beep no_beep nobeep combining_chars no_combining_chars combiningchars nocombiningchars emacs
+ \ no_emacs noemacs overstrike no_overstrike nooverstrike single_line_zle no_single_line_zle
+ \ singlelinezle nosinglelinezle vi no_vi novi zle no_zle nozle brace_expand no_brace_expand
+ \ braceexpand nobraceexpand dot_glob no_dot_glob dotglob nodotglob hash_all no_hash_all hashall
+ \ nohashall hist_append no_hist_append histappend nohistappend hist_expand no_hist_expand histexpand
+ \ nohistexpand log no_log nolog mail_warn no_mail_warn mailwarn nomailwarn one_cmd no_one_cmd onecmd
+ \ noonecmd physical no_physical nophysical prompt_vars no_prompt_vars promptvars nopromptvars stdin
+ \ no_stdin nostdin track_all no_track_all trackall notrackall
syn case match
syn keyword zshTypes float integer local typeset declare private readonly
@@ -150,15 +275,12 @@ syn keyword zshTypes float integer local typeset declare private read
" XXX: this may be too much
" syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+'
-syn match zshNumber '[+-]\=\<\d\+\>'
-syn match zshNumber '[+-]\=\<0x\x\+\>'
-syn match zshNumber '[+-]\=\<0\o\+\>'
-syn match zshNumber '[+-]\=\d\+#[-+]\=\w\+\>'
-syn match zshNumber '[+-]\=\d\+\.\d\+\>'
-
" TODO: $[...] is the same as $((...)), so add that as well.
syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst
+syn cluster zshSubstQuoted contains=zshSubstQuoted,zshOldSubst,zshMathSubst
exe 'syn region zshSubst matchgroup=zshSubstDelim transparent start=/\$(/ skip=/\\)/ end=/)/ contains='.s:contained. ' fold'
+exe 'syn region zshSubstQuoted matchgroup=zshSubstDelim transparent start=/\$(/ skip=/\\)/ end=/)/ contains='.s:contained. ' fold'
+syn region zshSubstQuoted matchgroup=zshSubstDelim start='\${' skip='\\}' end='}' contains=@zshSubst,zshBrackets,zshQuoted fold
syn region zshParentheses transparent start='(' skip='\\)' end=')' fold
syn region zshGlob start='(#' end=')'
syn region zshMathSubst matchgroup=zshSubstDelim transparent
@@ -201,6 +323,8 @@ hi def link zshJobSpec Special
hi def link zshPrecommand Special
hi def link zshDelimiter Keyword
hi def link zshConditional Conditional
+hi def link zshCase zshConditional
+hi def link zshCaseIn zshCase
hi def link zshException Exception
hi def link zshRepeat Repeat
hi def link zshKeyword Keyword
@@ -223,6 +347,7 @@ hi def link zshTypes Type
hi def link zshSwitches Special
hi def link zshNumber Number
hi def link zshSubst PreProc
+hi def link zshSubstQuoted zshSubst
hi def link zshMathSubst zshSubst
hi def link zshOldSubst zshSubst
hi def link zshSubstDelim zshSubst