aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.yml2
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.yml2
-rw-r--r--.github/ISSUE_TEMPLATE/lsp_bug_report.yml3
-rw-r--r--.github/workflows/news.yml2
-rw-r--r--runtime/autoload/netrwFileHandlers.vim0
-rw-r--r--runtime/autoload/netrwSettings.vim249
-rw-r--r--runtime/doc/api.txt77
-rw-r--r--runtime/doc/cmdline.txt4
-rw-r--r--runtime/doc/deprecated.txt1
-rw-r--r--runtime/doc/diagnostic.txt2
-rw-r--r--runtime/doc/lsp.txt9
-rw-r--r--runtime/doc/map.txt16
-rw-r--r--runtime/doc/news.txt9
-rw-r--r--runtime/doc/syntax.txt11
-rw-r--r--runtime/doc/treesitter.txt15
-rw-r--r--runtime/doc/ui.txt2
-rw-r--r--runtime/doc/vim_diff.txt6
-rw-r--r--runtime/ftplugin/c.vim2
-rw-r--r--runtime/ftplugin/kconfig.vim3
-rw-r--r--runtime/lua/vim/_meta/api.lua39
-rw-r--r--runtime/lua/vim/diagnostic.lua4
-rw-r--r--runtime/lua/vim/filetype.lua1
-rw-r--r--runtime/lua/vim/filetype/detect.lua1
-rw-r--r--runtime/lua/vim/lsp/buf.lua9
-rw-r--r--runtime/lua/vim/lsp/completion.lua27
-rw-r--r--runtime/lua/vim/lsp/util.lua11
-rw-r--r--runtime/lua/vim/treesitter/_fold.lua4
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua10
-rw-r--r--runtime/pack/dist/opt/netrw/LICENSE.txt16
-rw-r--r--runtime/pack/dist/opt/netrw/README.md544
-rw-r--r--runtime/pack/dist/opt/netrw/autoload/netrw.vim (renamed from runtime/autoload/netrw.vim)60
-rw-r--r--runtime/pack/dist/opt/netrw/autoload/netrwSettings.vim242
-rw-r--r--runtime/pack/dist/opt/netrw/autoload/netrw_gitignore.vim (renamed from runtime/autoload/netrw_gitignore.vim)13
-rw-r--r--runtime/pack/dist/opt/netrw/doc/netrw.txt (renamed from runtime/doc/pi_netrw.txt)621
-rw-r--r--runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim214
-rw-r--r--runtime/pack/dist/opt/netrw/syntax/netrw.vim149
-rw-r--r--runtime/plugin/netrwPlugin.vim235
-rw-r--r--runtime/syntax/c.vim138
-rw-r--r--runtime/syntax/kconfig.vim1392
-rw-r--r--runtime/syntax/netrw.vim148
-rw-r--r--runtime/syntax/sh.vim12
-rw-r--r--runtime/syntax/tex.vim7
-rw-r--r--runtime/syntax/vim.vim42
-rwxr-xr-xscripts/bump_deps.lua459
-rw-r--r--src/nvim/api/deprecated.c86
-rw-r--r--src/nvim/api/extmark.c91
-rw-r--r--src/nvim/drawscreen.c4
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/fileio.c6
-rw-r--r--src/nvim/lua/executor.c3
-rw-r--r--src/nvim/message.c26
-rw-r--r--src/nvim/option.c6
-rw-r--r--src/nvim/optionstr.c112
-rw-r--r--src/nvim/statusline.c9
-rw-r--r--src/nvim/window.c11
-rw-r--r--test/functional/api/window_spec.lua42
-rw-r--r--test/functional/lua/diagnostic_spec.lua26
-rw-r--r--test/functional/lua/filetype_spec.lua2
-rw-r--r--test/functional/lua/thread_spec.lua20
-rw-r--r--test/functional/plugin/lsp/completion_spec.lua37
-rw-r--r--test/functional/ui/inccommand_user_spec.lua44
-rw-r--r--test/old/testdir/test_filetype.vim18
62 files changed, 2615 insertions, 2745 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index ce0dbd40de..8cbd3d4ef5 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -1,6 +1,6 @@
name: Bug Report
description: Report a problem in Nvim
-labels: [bug]
+type: 'bug'
body:
- type: markdown
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
index 49bd8158bf..f7cf5980b3 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -1,6 +1,6 @@
name: Feature request
description: Request an enhancement for Nvim
-labels: [enhancement]
+type: 'enhancement'
body:
- type: markdown
diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
index 277fabca5e..a186a1ee98 100644
--- a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
@@ -1,7 +1,8 @@
name: Language server (LSP) client bug
description: Report an issue with Nvim LSP
title: "LSP: "
-labels: [bug, lsp]
+type: bug
+labels: [lsp]
body:
- type: markdown
diff --git a/.github/workflows/news.yml b/.github/workflows/news.yml
index ca07876197..e2d9a058c3 100644
--- a/.github/workflows/news.yml
+++ b/.github/workflows/news.yml
@@ -20,7 +20,7 @@ jobs:
type="$(echo "$message" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')"
breaking="$(echo "$message" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')"
if [[ "$type" == "feat" ]] || [[ "$type" == "perf" ]] || [[ "$breaking" == "breaking-change" ]]; then
- ! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt ||
+ ! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt runtime/doc/deprecated.txt ||
{
echo "
Pull request includes a new feature, performance improvement
diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim
deleted file mode 100644
index e69de29bb2..0000000000
--- a/runtime/autoload/netrwFileHandlers.vim
+++ /dev/null
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
deleted file mode 100644
index 3452602272..0000000000
--- a/runtime/autoload/netrwSettings.vim
+++ /dev/null
@@ -1,249 +0,0 @@
-" netrwSettings.vim: makes netrw settings simpler
-" Date: Nov 15, 2021
-" Maintainer: This runtime file is looking for a new maintainer.
-" Former Maintainer: Charles E Campbell
-" Version: 18
-" Last Change:
-" 2024 May 08 by Vim Project: cleanup legacy Win9X checks
-" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
-" Permission is hereby granted to use and distribute this code,
-" with or without modifications, provided that this copyright
-" notice is copied with it. Like anything else that's free,
-" netrwSettings.vim is provided *as is* and comes with no
-" warranty of any kind, either expressed or implied. By using
-" this plugin, you agree that in no event will the copyright
-" holder be liable for any damages resulting from the use
-" of this software.
-"
-" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
-" synagogues, preaching the gospel of the kingdom, and healing
-" every disease and every sickness among the people.
-" Load Once: {{{1
-if exists("g:loaded_netrwSettings") || &cp
- finish
-endif
-let g:loaded_netrwSettings = "v18"
-if v:version < 700
- echohl WarningMsg
- echo "***warning*** this version of netrwSettings needs vim 7.0"
- echohl Normal
- finish
-endif
-
-" ---------------------------------------------------------------------
-" NetrwSettings: {{{1
-fun! netrwSettings#NetrwSettings()
- " this call is here largely just to insure that netrw has been loaded
- call netrw#WinPath("")
- if !exists("g:loaded_netrw")
- echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
- return
- endif
-
- above wincmd s
- enew
- setlocal noswapfile bh=wipe
- set ft=vim
- file Netrw\ Settings
-
- " these variables have the following default effects when they don't
- " exist (ie. have not been set by the user in his/her .vimrc)
- if !exists("g:netrw_liststyle")
- let g:netrw_liststyle= 0
- let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
- endif
- if !exists("g:netrw_silent")
- let g:netrw_silent= 0
- endif
- if !exists("g:netrw_use_nt_rcp")
- let g:netrw_use_nt_rcp= 0
- endif
- if !exists("g:netrw_ftp")
- let g:netrw_ftp= 0
- endif
- if !exists("g:netrw_ignorenetrc")
- let g:netrw_ignorenetrc= 0
- endif
-
- put ='+ ---------------------------------------------'
- put ='+ NetrwSettings: by Charles E. Campbell'
- put ='+ Press <F1> with cursor atop any line for help'
- put ='+ ---------------------------------------------'
- let s:netrw_settings_stop= line(".")
-
- put =''
- put ='+ Netrw Protocol Commands'
- put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
- put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
- put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
- put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
- put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
- put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
- put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
- put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
- put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
- let s:netrw_protocol_stop= line(".")
- put = ''
-
- put ='+Netrw Transfer Control'
- put = 'let g:netrw_cygwin = '.g:netrw_cygwin
- put = 'let g:netrw_ftp = '.g:netrw_ftp
- put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
- put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
- put = 'let g:netrw_sshport = '.g:netrw_sshport
- put = 'let g:netrw_silent = '.g:netrw_silent
- put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
- let s:netrw_xfer_stop= line(".")
- put =''
- put ='+ Netrw Messages'
- put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
-
- put = ''
- put ='+ Netrw Browser Control'
- if exists("g:netrw_altfile")
- put = 'let g:netrw_altfile = '.g:netrw_altfile
- else
- put = 'let g:netrw_altfile = 0'
- endif
- put = 'let g:netrw_alto = '.g:netrw_alto
- put = 'let g:netrw_altv = '.g:netrw_altv
- put = 'let g:netrw_banner = '.g:netrw_banner
- if exists("g:netrw_bannerbackslash")
- put = 'let g:netrw_bannerbackslash = '.g:netrw_bannerbackslash
- else
- put = '\" let g:netrw_bannerbackslash = (not defined)'
- endif
- put = 'let g:netrw_browse_split = '.g:netrw_browse_split
- if exists("g:netrw_browsex_viewer")
- put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
- else
- put = '\" let g:netrw_browsex_viewer = (not defined)'
- endif
- put = 'let g:netrw_compress = '.g:netrw_compress
- if exists("g:Netrw_corehandler")
- put = 'let g:Netrw_corehandler = '.g:Netrw_corehandler
- else
- put = '\" let g:Netrw_corehandler = (not defined)'
- endif
- put = 'let g:netrw_ctags = '.g:netrw_ctags
- put = 'let g:netrw_cursor = '.g:netrw_cursor
- let decompressline= line("$")
- put = 'let g:netrw_decompress = '.string(g:netrw_decompress)
- if exists("g:netrw_dynamic_maxfilenamelen")
- put = 'let g:netrw_dynamic_maxfilenamelen='.g:netrw_dynamic_maxfilenamelen
- else
- put = '\" let g:netrw_dynamic_maxfilenamelen= (not defined)'
- endif
- put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
- put = 'let g:netrw_errorlvl = '.g:netrw_errorlvl
- put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
- let fnameescline= line("$")
- put = 'let g:netrw_fname_escape = '.string(g:netrw_fname_escape)
- put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
- put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
- put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
- put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
- let globescline= line("$")
- put = 'let g:netrw_glob_escape = '.string(g:netrw_glob_escape)
- put = 'let g:netrw_hide = '.g:netrw_hide
- if exists("g:netrw_home")
- put = 'let g:netrw_home = '.g:netrw_home
- else
- put = '\" let g:netrw_home = (not defined)'
- endif
- put = 'let g:netrw_keepdir = '.g:netrw_keepdir
- put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
- put = 'let g:netrw_list_hide = '.g:netrw_list_hide
- put = 'let g:netrw_liststyle = '.g:netrw_liststyle
- put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
- put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt
- put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
- put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt
- put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
- put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt
- put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
- put = 'let g:netrw_menu = '.g:netrw_menu
- put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps
- put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
- if exists("g:netrw_nobeval")
- put = 'let g:netrw_nobeval = '.g:netrw_nobeval
- else
- put = '\" let g:netrw_nobeval = (not defined)'
- endif
- put = 'let g:netrw_remote_mkdir = '.g:netrw_remote_mkdir
- put = 'let g:netrw_preview = '.g:netrw_preview
- put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
- put = 'let g:netrw_retmap = '.g:netrw_retmap
- put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
- put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
- put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
- put = 'let g:netrw_sort_by = '.g:netrw_sort_by
- put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
- put = 'let g:netrw_sort_options = '.g:netrw_sort_options
- put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
- put = 'let g:netrw_servername = '.g:netrw_servername
- put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax
- put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
- put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
- put = 'let g:netrw_scpport = '.g:netrw_scpport
- put = 'let g:netrw_sepchr = '.g:netrw_sepchr
- put = 'let g:netrw_sshport = '.g:netrw_sshport
- put = 'let g:netrw_timefmt = '.g:netrw_timefmt
- let tmpfileescline= line("$")
- put ='let g:netrw_tmpfile_escape...'
- put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
- put = 'let g:netrw_xstrlen = '.g:netrw_xstrlen
- put = 'let g:netrw_winsize = '.g:netrw_winsize
-
- put =''
- put ='+ For help, place cursor on line and press <F1>'
-
- 1d
- silent %s/^+/"/e
- res 99
- silent %s/= \([^0-9].*\)$/= '\1'/e
- silent %s/= $/= ''/e
- 1
-
- call setline(decompressline,"let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
- call setline(fnameescline, "let g:netrw_fname_escape = '".escape(g:netrw_fname_escape,"'")."'")
- call setline(globescline, "let g:netrw_glob_escape = '".escape(g:netrw_glob_escape,"'")."'")
- call setline(tmpfileescline,"let g:netrw_tmpfile_escape = '".escape(g:netrw_tmpfile_escape,"'")."'")
-
- set nomod
-
- nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
- nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
- let tmpfile= tempname()
- exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
-endfun
-
-" ---------------------------------------------------------------------
-" NetrwSettingHelp: {{{2
-fun! NetrwSettingHelp()
-" call Dfunc("NetrwSettingHelp()")
- let curline = getline(".")
- if curline =~ '='
- let varhelp = substitute(curline,'^\s*let ','','e')
- let varhelp = substitute(varhelp,'\s*=.*$','','e')
-" call Decho("trying help ".varhelp)
- try
- exe "he ".varhelp
- catch /^Vim\%((\a\+)\)\=:E149/
- echo "***sorry*** no help available for <".varhelp.">"
- endtry
- elseif line(".") < s:netrw_settings_stop
- he netrw-settings
- elseif line(".") < s:netrw_protocol_stop
- he netrw-externapp
- elseif line(".") < s:netrw_xfer_stop
- he netrw-variables
- else
- he netrw-browse-var
- endif
-" call Dret("NetrwSettingHelp")
-endfun
-
-" ---------------------------------------------------------------------
-" Modelines: {{{1
-" vim:ts=8 fdm=marker
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 1cc4350654..b452db9f3e 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -406,18 +406,9 @@ Another use case are plugins that show output in an append-only buffer, and
want to add highlights to the outputs. Highlight data cannot be preserved
on writing and loading a buffer to file, nor in undo/redo cycles.
-Highlights are registered using the |nvim_buf_add_highlight()| function. If an
-external highlighter plugin wants to add many highlights in a batch,
-performance can be improved by calling |nvim_buf_add_highlight()| as an
-asynchronous notification, after first (synchronously) requesting a source id.
-
-|nvim_buf_add_highlight()| adds highlights as |extmarks|. If highlights need to
-be tracked or manipulated after adding them, it is better to use
-|nvim_buf_set_extmark()| directly, as this function returns the placed |extmark|
-id. Thus, instead of >lua
- vim.api.nvim_buf_add_highlight(buf, ns_id, hl_group, line, col_start, col_end)
-<
-use >lua
+Highlights are registered using the |nvim_buf_set_extmark()| function, which
+adds highlights as |extmarks|. If highlights need to be tracked or manipulated
+after adding them, the returned |extmark| id can be used. >lua
-- create the highlight through an extmark
extid = vim.api.nvim_buf_set_extmark(buf, ns_id, line, col_start, {end_col = col_end, hl_group = hl_group})
@@ -428,29 +419,7 @@ use >lua
vim.api.nvim_buf_set_extmark(buf, ns_id, NEW_LINE, col_start, {end_col = col_end, hl_group = NEW_HL_GROUP, id = extid})
<
-Example using the Python API client (|pynvim|):
->python
- src = vim.new_highlight_source()
- buf = vim.current.buffer
- for i in range(5):
- buf.add_highlight("String",i,0,-1,src_id=src)
- # some time later ...
- buf.clear_namespace(src)
-<
-If the highlights don't need to be deleted or updated, just pass -1 as
-src_id (this is the default in python). Use |nvim_buf_clear_namespace()| to
-clear highlights from a specific source, in a specific line range or the
-entire buffer by passing in the line range 0, -1 (the latter is the default in
-python as used above).
-
-Example using the API from Vimscript: >vim
-
- call nvim_buf_set_lines(0, 0, 0, v:true, ["test text"])
- let src = nvim_buf_add_highlight(0, 0, "String", 1, 0, 4)
- call nvim_buf_add_highlight(0, src, "Identifier", 0, 5, -1)
- " some time later ...
- call nvim_buf_clear_namespace(0, src, 0, -1)
-
+See also |vim.hl.range()|.
==============================================================================
Floating windows *api-floatwin*
@@ -2491,42 +2460,6 @@ nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()*
==============================================================================
Extmark Functions *api-extmark*
- *nvim_buf_add_highlight()*
-nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},
- {col_end})
- Adds a highlight to buffer.
-
- Useful for plugins that dynamically generate highlights to a buffer (like
- a semantic highlighter or linter). The function adds a single highlight to
- a buffer. Unlike |matchaddpos()| highlights follow changes to line
- numbering (as lines are inserted/removed above the highlighted line), like
- signs and marks do.
-
- Namespaces are used for batch deletion/updating of a set of highlights. To
- create a namespace, use |nvim_create_namespace()| which returns a
- namespace id. Pass it in to this function as `ns_id` to add highlights to
- the namespace. All highlights in the same namespace can then be cleared
- with single call to |nvim_buf_clear_namespace()|. If the highlight never
- will be deleted by an API call, pass `ns_id = -1`.
-
- As a shorthand, `ns_id = 0` can be used to create a new namespace for the
- highlight, the allocated id is then returned. If `hl_group` is the empty
- string no highlight is added, but a new `ns_id` is still returned. This is
- supported for backwards compatibility, new code should use
- |nvim_create_namespace()| to create a new empty namespace.
-
- Parameters: ~
- • {buffer} Buffer handle, or 0 for current buffer
- • {ns_id} namespace to use or -1 for ungrouped highlight
- • {hl_group} Name of the highlight group to use
- • {line} Line to highlight (zero-indexed)
- • {col_start} Start of (byte-indexed) column range to highlight
- • {col_end} End of (byte-indexed) column range to highlight, or -1 to
- highlight to end of line
-
- Return: ~
- The ns_id that was used
-
*nvim_buf_clear_namespace()*
nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
Clears |namespace|d objects (highlights, |extmarks|, virtual text) from a
@@ -2766,7 +2699,7 @@ nvim_create_namespace({name}) *nvim_create_namespace()*
Creates a new namespace or gets an existing one. *namespace*
Namespaces are used for buffer highlights and virtual text, see
- |nvim_buf_add_highlight()| and |nvim_buf_set_extmark()|.
+ |nvim_buf_set_extmark()|.
Namespaces can be named or anonymous. If `name` matches an existing
namespace, the associated id is returned. If `name` is an empty string a
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index f6a3e95b35..3fc17af185 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -1222,10 +1222,10 @@ Thus you can resize the command-line window, but not others.
The |getcmdwintype()| function returns the type of the command-line being
edited as described in |cmdwin-char|.
-Nvim defines this default CmdWinEnter autocmd in the "nvim_cmdwin" group: >
+Nvim defines this default CmdWinEnter autocmd in the "nvim.cmdwin" group: >
autocmd CmdWinEnter [:>] syntax sync minlines=1 maxlines=1
<
-You can disable this in your config with "autocmd! nvim_cmdwin". |default-autocmds|
+You can disable this in your config with "autocmd! nvim.cmdwin". |default-autocmds|
AUTOCOMMANDS
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 4f320aeab3..ff9c21fad9 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -22,6 +22,7 @@ API
• nvim_out_write() Use |nvim_echo()|.
• nvim_err_write() Use |nvim_echo()| with `{err=true}`.
• nvim_err_writeln() Use |nvim_echo()| with `{err=true}`.
+• nvim_buf_add_highlight() Use |vim.hl.range()| or |nvim_buf_set_extmark()|
DIAGNOSTICS
• *vim.diagnostic.goto_next()* Use |vim.diagnostic.jump()| with `{count=1, float=true}` instead.
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 7d97a18437..d4939d8cc7 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -464,7 +464,7 @@ Lua module: vim.diagnostic *diagnostic-api*
Fields: ~
• {underline}? (`boolean|vim.diagnostic.Opts.Underline|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Underline`, default: `true`)
Use underline for diagnostics.
- • {virtual_text}? (`boolean|vim.diagnostic.Opts.VirtualText|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.VirtualText`, default: `true`)
+ • {virtual_text}? (`boolean|vim.diagnostic.Opts.VirtualText|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.VirtualText`, default: `false`)
Use virtual text for diagnostics. If multiple
diagnostics are set for a namespace, one prefix
per diagnostic + the last diagnostic message are
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index e8270123d7..fffd668919 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -1445,12 +1445,11 @@ Lua module: vim.lsp.buf *lsp-buf*
vim.lsp.buf.definition({ on_list = on_list })
vim.lsp.buf.references(nil, { on_list = on_list })
<
-
- If you prefer loclist instead of qflist: >lua
+ • {loclist}? (`boolean`) Whether to use the |location-list| or the
+ |quickfix| list. >lua
vim.lsp.buf.definition({ loclist = true })
- vim.lsp.buf.references(nil, { loclist = true })
+ vim.lsp.buf.references(nil, { loclist = false })
<
- • {loclist}? (`boolean`)
*vim.lsp.LocationOpts*
Extends: |vim.lsp.ListOpts|
@@ -1553,7 +1552,7 @@ document_highlight() *vim.lsp.buf.document_highlight()*
|hl-LspReferenceWrite|
document_symbol({opts}) *vim.lsp.buf.document_symbol()*
- Lists all symbols in the current buffer in the quickfix window.
+ Lists all symbols in the current buffer in the |location-list|.
Parameters: ~
• {opts} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 1e472422ce..52c04333fc 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1545,7 +1545,7 @@ Your command preview routine must implement this protocol:
3. Add required highlights to the target buffers. If preview buffer is
provided, add required highlights to the preview buffer as well. All
highlights must be added to the preview namespace which is provided as an
- argument to the preview callback (see |nvim_buf_add_highlight()| and
+ argument to the preview callback (see |vim.hl.range()| and
|nvim_buf_set_extmark()| for help on how to add highlights to a namespace).
4. Return an integer (0, 1, 2) which controls how Nvim behaves as follows:
0: No preview is shown.
@@ -1574,13 +1574,12 @@ supports incremental command preview:
if start_idx then
-- Highlight the match
- vim.api.nvim_buf_add_highlight(
+ vim.hl.range(
buf,
preview_ns,
'Substitute',
- line1 + i - 2,
- start_idx - 1,
- end_idx
+ {line1 + i - 2, start_idx - 1},
+ {line1 + i - 2, end_idx},
)
-- Add lines and set highlights in the preview buffer
@@ -1595,13 +1594,12 @@ supports incremental command preview:
false,
{ prefix .. line }
)
- vim.api.nvim_buf_add_highlight(
+ vim.hl.range(
preview_buf,
preview_ns,
'Substitute',
- preview_buf_line,
- #prefix + start_idx - 1,
- #prefix + end_idx
+ {preview_buf_line, #prefix + start_idx - 1},
+ {preview_buf_line, #prefix + end_idx},
)
preview_buf_line = preview_buf_line + 1
end
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index b777d22a26..0d5fa3ca18 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -26,6 +26,9 @@ LSP
• `lsp/` runtimepath files should return a table instead of calling
|vim.lsp.config()| (or assigning to `vim.lsp.config`). See |lsp-config|
+• `vim.lsp.buf.document_symbol()` uses the |location-list| by default. Use
+ `vim.lsp.buf.document_symbol({ loclist = false })` to use the |quickfix|
+ list.
OPTIONS
@@ -70,7 +73,9 @@ DIAGNOSTICS
the "severity_sort" option.
• Diagnostics are filtered by severity before being passed to a diagnostic
handler |diagnostic-handlers|.
-
+• The "virtual_text" handler is disabled by default. Enable with >lua
+ vim.diagnostic.config({ virtual_text = true })
+<
EDITOR
• The order in which signs are placed was changed. Higher priority signs will
@@ -315,6 +320,8 @@ PLUGINS
• EditorConfig
• spelling_language property is now supported.
+• 'inccommand' incremental preview can run on 'nomodifiable' buffers and
+ restores their 'modifiable' state
STARTUP
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index f5183e3247..75d6d85183 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -593,6 +593,7 @@ Variable Highlight ~
*c_no_cformat* don't highlight %-formats in strings
*c_no_c99* don't highlight C99 standard items
*c_no_c11* don't highlight C11 standard items
+*c_no_c23* don't highlight C23 standard items
*c_no_bsd* don't highlight BSD specific types
*c_functions* highlight function calls and definitions
*c_function_pointers* highlight function pointers definitions
@@ -1744,6 +1745,16 @@ To disable numbers having their own color add the following to your vimrc: >
If you want quotes to have different highlighting than strings >
let g:jq_quote_highlight = 1
+KCONFIG *ft-kconfig-syntax*
+
+Kconfig syntax highlighting language. For syntax syncing, you can configure
+the following variable (default: 50): >
+
+ let kconfig_minlines = 50
+
+To configure a bit more (heavier) highlighting, set the following variable: >
+
+ let kconfig_syntax_heavy = 1
LACE *lace.vim* *ft-lace-syntax*
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 83fa2c5a17..3d76c8c0ff 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -1502,6 +1502,9 @@ analysis on a tree should use a timer to throttle too frequent updates.
LanguageTree:children() *LanguageTree:children()*
Returns a map of language to child tree.
+ Return: ~
+ (`table<string,vim.treesitter.LanguageTree>`)
+
LanguageTree:contains({range}) *LanguageTree:contains()*
Determines whether {range} is contained in the |LanguageTree|.
@@ -1566,6 +1569,9 @@ LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()*
LanguageTree:lang() *LanguageTree:lang()*
Gets the language of this tree node.
+ Return: ~
+ (`string`)
+
*LanguageTree:language_for_range()*
LanguageTree:language_for_range({range})
Gets the appropriate language that contains {range}.
@@ -1614,6 +1620,12 @@ LanguageTree:node_for_range({range}, {opts})
Return: ~
(`TSNode?`)
+LanguageTree:parent() *LanguageTree:parent()*
+ Returns the parent tree. `nil` for the root tree.
+
+ Return: ~
+ (`vim.treesitter.LanguageTree?`)
+
LanguageTree:parse({range}, {on_parse}) *LanguageTree:parse()*
Recursively parse all regions in the language tree using
|treesitter-parsers| for the corresponding languages and run injection
@@ -1674,6 +1686,9 @@ LanguageTree:register_cbs({cbs}, {recursive})
LanguageTree:source() *LanguageTree:source()*
Returns the source content of the language tree (bufnr or string).
+ Return: ~
+ (`integer|string`)
+
*LanguageTree:tree_for_range()*
LanguageTree:tree_for_range({range}, {opts})
Gets the tree that contains {range}.
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 4d212e2779..d8a0e3d0d7 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -562,7 +562,7 @@ with the following possible keys:
"ui": Builtin UI highlight. |highlight-groups|
"syntax": Highlight applied to a buffer by a syntax declaration or
other runtime/plugin functionality such as
- |nvim_buf_add_highlight()|
+ |nvim_buf_set_extmark()|
"terminal": highlight from a process running in a |terminal-emulator|.
Contains no further semantic information.
`ui_name`: Highlight name from |highlight-groups|. Only for "ui" kind.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 59c1c4b21c..c870de00ef 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -170,7 +170,7 @@ DEFAULT AUTOCOMMANDS
Default autocommands exist in the following groups. Use ":autocmd! {group}" to
remove them and ":autocmd {group}" to see how they're defined.
-nvim_terminal:
+nvim.terminal:
- BufReadCmd: Treats "term://" buffers as |terminal| buffers. |terminal-start|
- TermClose: A |terminal| buffer started with no arguments (which thus uses
'shell') and which exits with no error is closed automatically.
@@ -193,10 +193,10 @@ nvim_terminal:
- 'winhighlight' uses |hl-StatusLineTerm| and |hl-StatusLineTermNC| in
place of |hl-StatusLine| and |hl-StatusLineNC|
-nvim_cmdwin:
+nvim.cmdwin:
- CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|.
-nvim_swapfile:
+nvim.swapfile:
- SwapExists: Skips the swapfile prompt (sets |v:swapchoice| to "e") when the
swapfile is owned by a running Nvim process. Shows |W325| "Ignoring
swapfile…" message.
diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim
index 8b2b784eb4..3b05ce182a 100644
--- a/runtime/ftplugin/c.vim
+++ b/runtime/ftplugin/c.vim
@@ -39,7 +39,7 @@ endif
" When the matchit plugin is loaded, this makes the % command skip parens and
" braces in comments properly.
if !exists("b:match_words")
- let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>'
+ let b:match_words = '^\s*#\s*if\%(\|def\|ndef\)\>:^\s*#\s*elif\%(\|def\|ndef\)\>:^\s*#\s*else\>:^\s*#\s*endif\>'
let b:match_skip = 's:comment\|string\|character\|special'
let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words"
endif
diff --git a/runtime/ftplugin/kconfig.vim b/runtime/ftplugin/kconfig.vim
index 767490701b..1c2857ec50 100644
--- a/runtime/ftplugin/kconfig.vim
+++ b/runtime/ftplugin/kconfig.vim
@@ -2,7 +2,7 @@
" Vim syntax file
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2024-04-12
+" Latest Revision: 2025 Jan 20
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-kconfig
@@ -19,4 +19,5 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
" For matchit.vim
if exists("loaded_matchit")
let b:match_words = '^\<menu\>:\<endmenu\>,^\<if\>:\<endif\>,^\<choice\>:\<endchoice\>'
+ let b:undo_ftplugin .= "| unlet! b:match_words"
endif
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index 3ffbc89b08..2f9ab5b846 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -163,35 +163,14 @@ function vim.api.nvim__stats() end
--- @return any
function vim.api.nvim__unpack(str) end
---- Adds a highlight to buffer.
----
---- Useful for plugins that dynamically generate highlights to a buffer
---- (like a semantic highlighter or linter). The function adds a single
---- highlight to a buffer. Unlike `matchaddpos()` highlights follow changes to
---- line numbering (as lines are inserted/removed above the highlighted line),
---- like signs and marks do.
----
---- Namespaces are used for batch deletion/updating of a set of highlights. To
---- create a namespace, use `nvim_create_namespace()` which returns a namespace
---- id. Pass it in to this function as `ns_id` to add highlights to the
---- namespace. All highlights in the same namespace can then be cleared with
---- single call to `nvim_buf_clear_namespace()`. If the highlight never will be
---- deleted by an API call, pass `ns_id = -1`.
----
---- As a shorthand, `ns_id = 0` can be used to create a new namespace for the
---- highlight, the allocated id is then returned. If `hl_group` is the empty
---- string no highlight is added, but a new `ns_id` is still returned. This is
---- supported for backwards compatibility, new code should use
---- `nvim_create_namespace()` to create a new empty namespace.
----
---- @param buffer integer Buffer handle, or 0 for current buffer
---- @param ns_id integer namespace to use or -1 for ungrouped highlight
---- @param hl_group string Name of the highlight group to use
---- @param line integer Line to highlight (zero-indexed)
---- @param col_start integer Start of (byte-indexed) column range to highlight
---- @param col_end integer End of (byte-indexed) column range to highlight,
---- or -1 to highlight to end of line
---- @return integer # The ns_id that was used
+--- @deprecated
+--- @param buffer integer
+--- @param ns_id integer
+--- @param hl_group string
+--- @param line integer
+--- @param col_start integer
+--- @param col_end integer
+--- @return integer
function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) end
--- Activates buffer-update events on a channel, or as Lua callbacks.
@@ -990,7 +969,7 @@ function vim.api.nvim_create_buf(listed, scratch) end
--- Creates a new namespace or gets an existing one. [namespace]()
---
--- Namespaces are used for buffer highlights and virtual text, see
---- `nvim_buf_add_highlight()` and `nvim_buf_set_extmark()`.
+--- `nvim_buf_set_extmark()`.
---
--- Namespaces can be named or anonymous. If `name` matches an existing
--- namespace, the associated id is returned. If `name` is an empty string
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 0939ff591e..ead75f7d51 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -70,7 +70,7 @@ end
--- Use virtual text for diagnostics. If multiple diagnostics are set for a
--- namespace, one prefix per diagnostic + the last diagnostic message are
--- shown.
---- (default: `true`)
+--- (default: `false`)
--- @field virtual_text? boolean|vim.diagnostic.Opts.VirtualText|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.VirtualText
---
--- Use signs for diagnostics |diagnostic-signs|.
@@ -312,7 +312,7 @@ M.severity = {
local global_diagnostic_options = {
signs = true,
underline = true,
- virtual_text = true,
+ virtual_text = false,
float = true,
update_in_insert = false,
severity_sort = false,
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index e5ba3b1211..efc41269f8 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -1636,6 +1636,7 @@ local filename = {
['.lintstagedrc'] = 'json',
['deno.lock'] = 'json',
['flake.lock'] = 'json',
+ ['.swcrc'] = 'json',
['.babelrc'] = 'jsonc',
['.eslintrc'] = 'jsonc',
['.hintrc'] = 'jsonc',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 30a9951f6a..31c88c80bd 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -1527,7 +1527,6 @@ local function sh(path, contents, name)
vim.b[b].is_kornshell = nil
vim.b[b].is_sh = nil
end
- return M.shell(path, contents, 'bash'), on_detect
-- Ubuntu links sh to dash
elseif matchregex(name, [[\<\(sh\|dash\)\>]]) then
on_detect = function(b)
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 0acbc50003..8efc6996dd 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -252,13 +252,13 @@ end
--- vim.lsp.buf.definition({ on_list = on_list })
--- vim.lsp.buf.references(nil, { on_list = on_list })
--- ```
+--- @field on_list? fun(t: vim.lsp.LocationOpts.OnList)
---
---- If you prefer loclist instead of qflist:
+--- Whether to use the |location-list| or the |quickfix| list.
--- ```lua
--- vim.lsp.buf.definition({ loclist = true })
---- vim.lsp.buf.references(nil, { loclist = true })
+--- vim.lsp.buf.references(nil, { loclist = false })
--- ```
---- @field on_list? fun(t: vim.lsp.LocationOpts.OnList)
--- @field loclist? boolean
--- @class vim.lsp.LocationOpts.OnList
@@ -796,9 +796,10 @@ function M.references(context, opts)
end
end
---- Lists all symbols in the current buffer in the quickfix window.
+--- Lists all symbols in the current buffer in the |location-list|.
--- @param opts? vim.lsp.ListOpts
function M.document_symbol(opts)
+ opts = vim.tbl_deep_extend('keep', opts or {}, { loclist = true })
local params = { textDocument = util.make_text_document_params() }
request_with_opts(ms.textDocument_documentSymbol, params, opts)
end
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
index edbc329939..bdf31d8514 100644
--- a/runtime/lua/vim/lsp/completion.lua
+++ b/runtime/lua/vim/lsp/completion.lua
@@ -127,8 +127,10 @@ end
--- See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
---
--- @param item lsp.CompletionItem
+--- @param prefix string
+--- @param match fun(text: string, prefix: string):boolean
--- @return string
-local function get_completion_word(item)
+local function get_completion_word(item, prefix, match)
if item.insertTextFormat == protocol.InsertTextFormat.Snippet then
if item.textEdit then
-- Use label instead of text if text has different starting characters.
@@ -146,7 +148,12 @@ local function get_completion_word(item)
--
-- Typing `i` would remove the candidate because newText starts with `t`.
local text = parse_snippet(item.insertText or item.textEdit.newText)
- return #text < #item.label and vim.fn.matchstr(text, '\\k*') or item.label
+ local word = #text < #item.label and vim.fn.matchstr(text, '\\k*') or item.label
+ if item.filterText and not match(word, prefix) then
+ return item.filterText
+ else
+ return word
+ end
elseif item.insertText and item.insertText ~= '' then
return parse_snippet(item.insertText)
else
@@ -224,6 +231,9 @@ end
---@param prefix string
---@return boolean
local function match_item_by_value(value, prefix)
+ if prefix == '' then
+ return true
+ end
if vim.o.completeopt:find('fuzzy') ~= nil then
return next(vim.fn.matchfuzzy({ value }, prefix)) ~= nil
end
@@ -276,7 +286,7 @@ function M._lsp_to_complete_items(result, prefix, client_id)
local user_convert = vim.tbl_get(buf_handles, bufnr, 'convert')
for _, item in ipairs(items) do
if matches(item) then
- local word = get_completion_word(item)
+ local word = get_completion_word(item, prefix, match_item_by_value)
local hl_group = ''
if
item.deprecated
@@ -605,6 +615,12 @@ local function on_complete_done()
end
end
+---@param bufnr integer
+---@return string
+local function get_augroup(bufnr)
+ return string.format('nvim.lsp.completion_%d', bufnr)
+end
+
--- @class vim.lsp.completion.BufferOpts
--- @field autotrigger? boolean Default: false When true, completion triggers automatically based on the server's `triggerCharacters`.
--- @field convert? fun(item: lsp.CompletionItem): table Transforms an LSP CompletionItem to |complete-items|.
@@ -629,8 +645,7 @@ local function enable_completions(client_id, bufnr, opts)
})
-- Set up autocommands.
- local group =
- api.nvim_create_augroup(string.format('nvim.lsp.completion_%d', bufnr), { clear = true })
+ local group = api.nvim_create_augroup(get_augroup(bufnr), { clear = true })
api.nvim_create_autocmd('CompleteDone', {
group = group,
buffer = bufnr,
@@ -698,7 +713,7 @@ local function disable_completions(client_id, bufnr)
handle.clients[client_id] = nil
if not next(handle.clients) then
buf_handles[bufnr] = nil
- api.nvim_del_augroup_by_name(string.format('vim/lsp/completion-%d', bufnr))
+ api.nvim_del_augroup_by_name(get_augroup(bufnr))
else
for char, clients in pairs(handle.triggers) do
--- @param c vim.lsp.Client
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 4e0adf3366..b9b53d36a8 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -1568,8 +1568,6 @@ function M.open_floating_preview(contents, syntax, opts)
if do_stylize then
local width = M._make_floating_popup_size(contents, opts)
contents = M._normalize_markdown(contents, { width = width })
- vim.bo[floating_bufnr].filetype = 'markdown'
- vim.treesitter.start(floating_bufnr)
else
-- Clean up input: trim empty lines
contents = vim.split(table.concat(contents, '\n'), '\n', { trimempty = true })
@@ -1635,9 +1633,6 @@ function M.open_floating_preview(contents, syntax, opts)
})
end
- if do_stylize then
- vim.wo[floating_winnr].conceallevel = 2
- end
vim.wo[floating_winnr].foldenable = false -- Disable folding.
vim.wo[floating_winnr].wrap = opts.wrap -- Soft wrapping.
vim.wo[floating_winnr].breakindent = true -- Slightly better list presentation.
@@ -1646,6 +1641,12 @@ function M.open_floating_preview(contents, syntax, opts)
vim.bo[floating_bufnr].modifiable = false
vim.bo[floating_bufnr].bufhidden = 'wipe'
+ if do_stylize then
+ vim.wo[floating_winnr].conceallevel = 2
+ vim.bo[floating_bufnr].filetype = 'markdown'
+ vim.treesitter.start(floating_bufnr)
+ end
+
return floating_bufnr, floating_winnr
end
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua
index 4a571bbaf7..f8d18d8427 100644
--- a/runtime/lua/vim/treesitter/_fold.lua
+++ b/runtime/lua/vim/treesitter/_fold.lua
@@ -387,7 +387,9 @@ function M.foldexpr(lnum)
parser:register_cbs({
on_changedtree = function(tree_changes)
- on_changedtree(bufnr, foldinfos[bufnr], tree_changes)
+ if foldinfos[bufnr] then
+ on_changedtree(bufnr, foldinfos[bufnr], tree_changes)
+ end
end,
on_bytes = function(_, _, start_row, start_col, _, old_row, old_col, _, new_row, new_col, _)
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 945a2301a9..3db7fe5c9e 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -267,6 +267,7 @@ function LanguageTree:trees()
end
--- Gets the language of this tree node.
+--- @return string
function LanguageTree:lang()
return self._lang
end
@@ -307,11 +308,13 @@ function LanguageTree:is_valid(exclude_children)
end
--- Returns a map of language to child tree.
+--- @return table<string,vim.treesitter.LanguageTree>
function LanguageTree:children()
return self._children
end
--- Returns the source content of the language tree (bufnr or string).
+--- @return integer|string
function LanguageTree:source()
return self._source
end
@@ -450,8 +453,8 @@ function LanguageTree:_run_async_callbacks(range, err, trees)
for _, cb in ipairs(self._cb_queues[key]) do
cb(err, trees)
end
- self._ranges_being_parsed[key] = false
- self._cb_queues[key] = {}
+ self._ranges_being_parsed[key] = nil
+ self._cb_queues[key] = nil
end
--- Run an asynchronous parse, calling {on_parse} when complete.
@@ -630,7 +633,8 @@ function LanguageTree:add_child(lang)
return self._children[lang]
end
---- @package
+---Returns the parent tree. `nil` for the root tree.
+---@return vim.treesitter.LanguageTree?
function LanguageTree:parent()
return self._parent
end
diff --git a/runtime/pack/dist/opt/netrw/LICENSE.txt b/runtime/pack/dist/opt/netrw/LICENSE.txt
new file mode 100644
index 0000000000..702c2386ac
--- /dev/null
+++ b/runtime/pack/dist/opt/netrw/LICENSE.txt
@@ -0,0 +1,16 @@
+Unless otherwise stated, all files in this directory are distributed under the
+Zero-Clause BSD license.
+
+Zero-Clause BSD
+===============
+
+Permission to use, copy, modify, and/or distribute this software for
+any purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/runtime/pack/dist/opt/netrw/README.md b/runtime/pack/dist/opt/netrw/README.md
new file mode 100644
index 0000000000..ecd97f1e9a
--- /dev/null
+++ b/runtime/pack/dist/opt/netrw/README.md
@@ -0,0 +1,544 @@
+# Netrw.vim
+
+netrw.vim plugin from vim (upstream repository)
+
+The upstream maintained netrw plugin. The original has been created and
+maintained by Charles E Campbell and maintained by the vim project until
+v9.1.0988.
+
+Every major version a snapshot from here will be sent to the main [Vim][1]
+upstream for distribution with Vim.
+
+# License
+
+To see License informations see the LICENSE.txt file included in this
+repository.
+
+# Credits
+
+Below are stated the contribution made in the past to netrw.
+
+Changes made to `autoload/netrw.vim`:
+- 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a)
+- 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a)
+- 2024 Feb 19 by Vim Project: (announce adoption)
+- 2024 Feb 29 by Vim Project: handle symlinks in tree mode correctly
+- 2024 Apr 03 by Vim Project: detect filetypes for remote edited files
+- 2024 May 08 by Vim Project: cleanup legacy Win9X checks
+- 2024 May 09 by Vim Project: remove hard-coded private.ppk
+- 2024 May 10 by Vim Project: recursively delete directories by default
+- 2024 May 13 by Vim Project: prefer scp over pscp
+- 2024 Jun 04 by Vim Project: set bufhidden if buffer changed, nohidden is set and buffer shall be switched (#14915)
+- 2024 Jun 13 by Vim Project: glob() on Windows fails when a directory name contains [] (#14952)
+- 2024 Jun 23 by Vim Project: save ad restore registers when liststyle = WIDELIST (#15077, #15114)
+- 2024 Jul 22 by Vim Project: avoid endless recursion (#15318)
+- 2024 Jul 23 by Vim Project: escape filename before trying to delete it (#15330)
+- 2024 Jul 30 by Vim Project: handle mark-copy to same target directory (#12112)
+- 2024 Aug 02 by Vim Project: honor g:netrw_alt{o,v} for :{S,H,V}explore (#15417)
+- 2024 Aug 15 by Vim Project: style changes, prevent E121 (#15501)
+- 2024 Aug 22 by Vim Project: fix mf-selection highlight (#15551)
+- 2024 Aug 22 by Vim Project: adjust echo output of mx command (#15550)
+- 2024 Sep 15 by Vim Project: more strict confirmation dialog (#15680)
+- 2024 Sep 19 by Vim Project: mf-selection highlight uses wrong pattern (#15700)
+- 2024 Sep 21 by Vim Project: remove extraneous closing bracket (#15718)
+- 2024 Oct 21 by Vim Project: remove netrwFileHandlers (#15895)
+- 2024 Oct 27 by Vim Project: clean up gx mapping (#15721)
+- 2024 Oct 30 by Vim Project: fix filetype detection for remote files (#15961)
+- 2024 Oct 30 by Vim Project: fix x mapping on cygwin (#13687)
+- 2024 Oct 31 by Vim Project: add netrw#Launch() and netrw#Open() (#15962)
+- 2024 Oct 31 by Vim Project: fix E874 when browsing remote dir (#15964)
+- 2024 Nov 07 by Vim Project: use keeppatterns to prevent polluting the search history
+- 2024 Nov 07 by Vim Project: fix a few issues with netrw tree listing (#15996)
+- 2024 Nov 10 by Vim Project: directory symlink not resolved in tree view (#16020)
+- 2024 Nov 14 by Vim Project: small fixes to netrw#BrowseX (#16056)
+- 2024 Nov 23 by Vim Project: update decompress defaults (#16104)
+- 2024 Nov 23 by Vim Project: fix powershell escaping issues (#16094)
+- 2024 Dec 04 by Vim Project: do not detach for gvim (#16168)
+- 2024 Dec 08 by Vim Project: check the first arg of netrw_browsex_viewer for being executable (#16185)
+- 2024 Dec 12 by Vim Project: do not pollute the search history (#16206)
+- 2024 Dec 19 by Vim Project: change style (#16248)
+- 2024 Dec 20 by Vim Project: change style continued (#16266), fix escaping of # in :Open command (#16265)
+
+General changes made to netrw:
+
+```
+ v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go"
+ * (Bram Moolenaar) no need for "b" in
+ netrw-safe guioptions
+ Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir
+ references
+ Aug 18, 2022 * (Miguel Barro) improving compatibility with
+ powershell
+ v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe()
+ to allow |'bh'| to be set to delete when
+ rather than hide when g:netrw_fastbrowse
+ was zero.
+ * Installed |g:netrw_clipboard| setting
+ * Installed option bypass for |'guioptions'|
+ a/A settings
+ * Changed popup_beval() to |popup_atcursor()|
+ in netrw#ErrorMsg (lacygoill). Apparently
+ popup_beval doesn't reliably close the
+ popup when the mouse is moved.
+ * VimEnter() now using win_execute to examine
+ buffers for an attempt to open a directory.
+ Avoids issues with popups/terminal from
+ command line. (lacygoill)
+ Jun 28, 2021 * (zeertzjq) provided a patch for use of
+ xmap,xno instead of vmap,vno in
+ netrwPlugin.vim. Avoids entanglement with
+ select mode.
+ Jul 14, 2021 * Fixed problem addressed by tst976; opening
+ a file using tree mode, going up a
+ directory, and opening a file there was
+ opening the file in the wrong directory.
+ Jul 28, 2021 * (Ingo Karkat) provided a patch fixing an
+ E488 error with netrwPlugin.vim
+ (occurred for vim versions < 8.02)
+ v170: Mar 11, 2020 * (reported by Reiner Herrmann) netrw+tree
+ would not hide with the ^\..* pattern
+ correctly.
+ * (Marcin Szamotulski) NetrwOptionRestore
+ did not restore options correctly that
+ had a single quote in the option string.
+ Apr 13, 2020 * implemented error handling via popup
+ windows (see |popup_beval()|)
+ Apr 30, 2020 * (reported by Manatsu Takahashi) while
+ using Lexplore, a modified file could
+ be overwritten. Sol'n: will not overwrite,
+ but will emit an |E37| (although one cannot
+ add an ! to override)
+ Jun 07, 2020 * (reported by Jo Totland) repeatedly invoking
+ :Lexplore and quitting it left unused
+ hidden buffers. Netrw will now set netrw
+ buffers created by :Lexplore to |'bh'|=wipe.
+ v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x
+ (|netrw-x|) would throw an error when
+ attempting to open a local directory.
+ v168: Dec 12, 2019 * scp timeout error message not reported,
+ hopefully now fixed (Shane Xb Qian)
+ v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
+ That causes problems with the clipboard.
+ Now restores occurs only if @* or @+ have
+ been changed.
+ * netrw will change @* or @+ less often.
+ Never if I happen to have caught all the
+ operations that modify the unnamed
+ register (which also writes @*).
+ * Modified hiding behavior so that "s"
+ will not ignore hiding.
+ v166: Nov 06, 2019 * Removed a space from a nmap for "-"
+ * Numerous debugging statement changes
+ v163: Dec 05, 2017 * (Cristi Balan) reported that a setting ('sel')
+ was left changed
+ * (Holger Mitschke) reported a problem with
+ saving and restoring history. Fixed.
+ * Hopefully I fixed a nasty bug that caused a
+ file rename to wipe out a buffer that it
+ should not have wiped out.
+ * (Holger Mitschke) amended this help file
+ with additional |g:netrw_special_syntax|
+ items
+ * Prioritized wget over curl for
+ g:netrw_http_cmd
+ v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors
+ with a patch; these are now fixed.
+ Oct 26, 2016 * I started using mate-terminal and found that
+ x and gx (|netrw-x| and |netrw-gx|) were no
+ longer working. Fixed (using atril when
+ $DESKTOP_SESSION is "mate").
+ Nov 04, 2016 * (Martin Vuille) pointed out that @+ was
+ being restored with keepregstar rather than
+ keepregplus.
+ Nov 09, 2016 * Broke apart the command from the options,
+ mostly for Windows. Introduced new netrw
+ settings: |g:netrw_localcopycmdopt|
+ |g:netrw_localcopydircmdopt|
+ |g:netrw_localmkdiropt|
+ |g:netrw_localmovecmdopt|
+ Nov 21, 2016 * (mattn) provided a patch for preview; swapped
+ winwidth() with winheight()
+ Nov 22, 2016 * (glacambre) reported that files containing
+ spaces weren't being obtained properly via
+ scp. Fix: apparently using single quotes
+ such as with 'file name' wasn't enough; the
+ spaces inside the quotes also had to be
+ escaped (ie. 'file\ name').
+ * Also fixed obtain (|netrw-O|) to be able to
+ obtain files with spaces in their names
+ Dec 20, 2016 * (xc1427) Reported that using "I" (|netrw-I|)
+ when atop "Hiding" in the banner also caused
+ the active-banner hiding control to occur
+ Jan 03, 2017 * (Enno Nagel) reported that attempting to
+ apply netrw to a directory that was without
+ read permission caused a syntax error.
+ Jan 13, 2017 * (Ingo Karkat) provided a patch which makes
+ using netrw#Call() better. Now returns
+ value of internal routines return, for example.
+ Jan 13, 2017 * (Ingo Karkat) changed netrw#FileUrlRead to
+ use |:edit| instead of |:read|. I also
+ changed the routine name to netrw#FileUrlEdit.
+ Jan 16, 2017 * (Sayem) reported a problem where :Lexplore
+ could generate a new listing buffer and
+ window instead of toggling the netrw display.
+ Unfortunately, the directions for eliciting
+ the problem weren't complete, so I may or
+ may not have fixed that issue.
+ Feb 06, 2017 * Implemented cb and cB. Changed "c" to "cd".
+ (see |netrw-cb|, |netrw-cB|, and |netrw-cd|)
+ Mar 21, 2017 * previously, netrw would specify (safe) settings
+ even when the setting was already safe for
+ netrw. Netrw now attempts to leave such
+ already-netrw-safe settings alone.
+ (affects s:NetrwOptionRestore() and
+ s:NetrwSafeOptions(); also introduced
+ s:NetrwRestoreSetting())
+ Jun 26, 2017 * (Christian Brabandt) provided a patch to
+ allow curl to follow redirects (ie. -L
+ option)
+ Jun 26, 2017 * (Callum Howard) reported a problem with
+ :Lexpore not removing the Lexplore window
+ after a change-directory
+ Aug 30, 2017 * (Ingo Karkat) one cannot switch to the
+ previously edited file (e.g. with CTRL-^)
+ after editing a file:// URL. Patch to
+ have a "keepalt" included.
+ Oct 17, 2017 * (Adam Faryna) reported that gn (|netrw-gn|)
+ did not work on directories in the current
+ tree
+ v157: Apr 20, 2016 * (Nicola) had set up a "nmap <expr> ..." with
+ a function that returned a 0 while silently
+ invoking a shell command. The shell command
+ activated a ShellCmdPost event which in turn
+ called s:LocalBrowseRefresh(). That looks
+ over all netrw buffers for changes needing
+ refreshes. However, inside a |:map-<expr>|,
+ tab and window changes are disallowed. Fixed.
+ (affects netrw's s:LocalBrowseRefresh())
+ * g:netrw_localrmdir not used any more, but
+ the relevant patch that causes |delete()| to
+ take over was #1107 (not #1109).
+ * |expand()| is now used on |g:netrw_home|;
+ consequently, g:netrw_home may now use
+ environment variables
+ * s:NetrwLeftmouse and s:NetrwCLeftmouse will
+ return without doing anything if invoked
+ when inside a non-netrw window
+ Jun 15, 2016 * gx now calls netrw#GX() which returns
+ the word under the cursor. The new
+ wrinkle: if one is in a netrw buffer,
+ then netrw's s:NetrwGetWord().
+ Jun 22, 2016 * Netrw was executing all its associated
+ Filetype commands silently; I'm going
+ to try doing that "noisily" and see if
+ folks have a problem with that.
+ Aug 12, 2016 * Changed order of tool selection for
+ handling http://... viewing.
+ (Nikolay Aleksandrovich Pavlov)
+ Aug 21, 2016 * Included hiding/showing/all for tree
+ listings
+ * Fixed refresh (^L) for tree listings
+ v156: Feb 18, 2016 * Changed =~ to =~# where appropriate
+ Feb 23, 2016 * s:ComposePath(base,subdir) now uses
+ fnameescape() on the base portion
+ Mar 01, 2016 * (gt_macki) reported where :Explore would
+ make file unlisted. Fixed (tst943)
+ Apr 04, 2016 * (reported by John Little) netrw normally
+ suppresses browser messages, but sometimes
+ those "messages" are what is wanted.
+ See |g:netrw_suppress_gx_mesg|
+ Apr 06, 2016 * (reported by Carlos Pita) deleting a remote
+ file was giving an error message. Fixed.
+ Apr 08, 2016 * (Charles Cooper) had a problem with an
+ undefined b:netrw_curdir. He also provided
+ a fix.
+ Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses
+ dictionaries. Also fixed the "No Name"
+ buffer problem.
+ v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's
+ mapping of ctrl-l was not allowing refresh of
+ other windows when it was done in a netrw
+ window.
+ Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search()
+ instead of a loop
+ * NetrwBrowse() will return line to
+ w:netrw_bannercnt if cursor ended up in
+ banner
+ Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|)
+ Nov 17, 2015 * Commented out imaps -- perhaps someone can
+ tell me how they're useful and should be
+ retained?
+ Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support
+ Nov 20, 2015 * gx (|netrw-gx|) on a URL downloaded the
+ file in addition to simply bringing up the
+ URL in a browser. Fixed.
+ Nov 23, 2015 * Added |g:netrw_sizestyle| support
+ Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw
+ maps.
+ Jan 05, 2016 * |netrw-qL| implemented to mark files based
+ upon |location-list|s; similar to |netrw-qF|.
+ Jan 19, 2016 * using - call delete(directoryname,"d") -
+ instead of using g:netrw_localrmdir if
+ v7.4 + patch#1107 is available
+ Jan 28, 2016 * changed to using |winsaveview()| and
+ |winrestview()|
+ Jan 28, 2016 * s:NetrwTreePath() now does a save and
+ restore of view
+ Feb 08, 2016 * Fixed a tree-listing problem with remote
+ directories
+ v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where
+ a file was not treated properly as a file
+ due to g:netrw_keepdir == 1
+ Mar 25, 2015 * (requested by Ben Friz) one may now sort by
+ extension
+ Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot
+ of buffer-local mappings; however, some
+ plugins (such as vim-surround) set up
+ conflicting mappings that cause vim to wait.
+ The "<nowait>" modifier has been included
+ with most of netrw's mappings to avoid that
+ delay.
+ Jun 26, 2015 * |netrw-gn| mapping implemented
+ * :Ntree NotADir resulted in having
+ the tree listing expand in the error messages
+ window. Fixed.
+ Jun 29, 2015 * Attempting to delete a file remotely caused
+ an error with "keepsol" mentioned; fixed.
+ Jul 08, 2015 * Several changes to keep the |:jumps| table
+ correct when working with
+ |g:netrw_fastbrowse| set to 2
+ * wide listing with accented characters fixed
+ (using %-S instead of %-s with a |printf()|
+ Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true
+ but kfmclient not installed. Changed order
+ in netrw#BrowseX(): checks if kde and
+ kfmclient, then will use xdg-open on a unix
+ system (if xdg-open is executable)
+ Aug 11, 2015 * (McDonnell) tree listing mode wouldn't
+ select a file in a open subdirectory.
+ * (McDonnell) when multiple subdirectories
+ were concurrently open in tree listing
+ mode, a ctrl-L wouldn't refresh properly.
+ * The netrw:target menu showed duplicate
+ entries
+ Oct 13, 2015 * (mattn) provided an exception to handle
+ windows with shellslash set but no shell
+ Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used
+ to control whether NetrwShrink is used
+ (see |netrw-c-tab|)
+ v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2
+ May 14, 2014 * changed s:PerformListing() so that it
+ always sets ft=netrw for netrw buffers
+ (ie. even when syntax highlighting is
+ off, not available, etc)
+ May 16, 2014 * introduced the |netrw-ctrl-r| functionality
+ May 17, 2014 * introduced the |netrw-:NetrwMB| functionality
+ * mb and mB (|netrw-mb|, |netrw-mB|) will
+ add/remove marked files from bookmark list
+ May 20, 2014 * (Enno Nagel) reported that :Lex <dirname>
+ wasn't working. Fixed.
+ May 26, 2014 * restored test to prevent leftmouse window
+ resizing from causing refresh.
+ (see s:NetrwLeftmouse())
+ * fixed problem where a refresh caused cursor
+ to go just under the banner instead of
+ staying put
+ May 28, 2014 * (László Bimba) provided a patch for opening
+ the |:Lexplore| window 100% high, optionally
+ on the right, and will work with remote
+ files.
+ May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|)
+ Jun 01, 2014 * Removed some "silent"s from commands used
+ to implemented scp://... and pscp://...
+ directory listing. Permits request for
+ password to appear.
+ Jun 05, 2014 * (Enno Nagel) reported that user maps "/"
+ caused problems with "b" and "w", which
+ are mapped (for wide listings only) to
+ skip over files rather than just words.
+ Jun 10, 2014 * |g:netrw_gx| introduced to allow users to
+ override default "<cfile>" with the gx
+ (|netrw-gx|) map
+ Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set,
+ will write modified files. s:NetrwBrowseX()
+ will now save, turn off, and restore the
+ |'autowrite'| setting.
+ Jun 13, 2014 * added visual map for gx use
+ Jun 15, 2014 * (Enno Nagel) reported that with having hls
+ set and wide listing style in use, that the
+ b and w maps caused unwanted highlighting.
+ Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included
+ Jul 09, 2014 * |g:netrw_keepj| included, allowing optional
+ keepj
+ Jul 09, 2014 * fixing bugs due to previous update
+ Jul 21, 2014 * (Bruno Sutic) provided an updated
+ netrw_gitignore.vim
+ Jul 30, 2014 * (Yavuz Yetim) reported that editing two
+ remote files of the same name caused the
+ second instance to have a "temporary"
+ name. Fixed: now they use the same buffer.
+ Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which
+ allows scp and windows local paths to work.
+ Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory,
+ will now do |gf| instead
+ Nov 06, 2014 * For cygwin: cygstart will be available for
+ netrw#BrowseX() to use if its executable.
+ Nov 07, 2014 * Began support for file://... urls. Will use
+ |g:netrw_file_cmd| (typically elinks or links)
+ Dec 02, 2014 * began work on having mc (|netrw-mc|) copy
+ directories. Works for linux machines,
+ cygwin+vim, but not for windows+gvim.
+ Dec 02, 2014 * in tree mode, netrw was not opening
+ directories via symbolic links.
+ Dec 02, 2014 * added resolved link information to
+ thin and tree modes
+ Dec 30, 2014 * (issue#231) |:ls| was not showing
+ remote-file buffers reliably. Fixed.
+ v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2
+ vim 7.4 with patch 213)
+ * (Enno Nagel) turn |'rnu'| off in netrw
+ buffers.
+ * (Quinn Strahl) suggested that netrw
+ allow regular window splitting to occur,
+ thereby allowing |'equalalways'| to take
+ effect.
+ * (qingtian zhao) normally, netrw will
+ save and restore the |'fileformat'|;
+ however, sometimes that isn't wanted
+ Apr 14, 2014 * whenever netrw marks a buffer as ro,
+ it will also mark it as nomod.
+ Apr 16, 2014 * sftp protocol now supported by
+ netrw#Obtain(); this means that one
+ may use "mc" to copy a remote file
+ to a local file using sftp, and that
+ the |netrw-O| command can obtain remote
+ files via sftp.
+ * added [count]C support (see |netrw-C|)
+ Apr 18, 2014 * when |g:netrw_chgwin| is one more than
+ the last window, then vertically split
+ the last window and use it as the
+ chgwin window.
+ May 09, 2014 * SavePosn was "saving filename under cursor"
+ from a non-netrw window when using :Rex.
+ v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2
+ prior to Explore or editing a directory
+ * (Ken Takata) netrw gave error when
+ clipboard was disabled. Sol'n: Placed
+ several if has("clipboard") tests in.
+ * Fixed ftp://X@Y@Z// problem; X@Y now
+ part of user id, and only Z is part of
+ hostname.
+ * (A Loumiotis) reported that completion
+ using a directory name containing spaces
+ did not work. Fixed with a retry in
+ netrw#Explore() which removes the
+ backslashes vim inserted.
+ Feb 26, 2014 * :Rexplore now records the current file
+ using w:netrw_rexfile when returning via
+ |:Rexplore|
+ Mar 08, 2014 * (David Kotchan) provided some patches
+ allowing netrw to work properly with
+ windows shares.
+ * Multiple one-liner help messages available
+ by pressing <cr> while atop the "Quick
+ Help" line
+ * worked on ShellCmdPost, FocusGained event
+ handling.
+ * |:Lexplore| path: will be used to update
+ a left-side netrw browsing directory.
+ Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close
+ tree directory implemented
+ Mar 13, 2014 * (Tony Mechylynck) reported that using
+ the browser with ftp on a directory,
+ and selecting a gzipped txt file, that
+ an E19 occurred (which was issued by
+ gzip.vim). Fixed.
+ Mar 14, 2014 * Implemented :MF and :MT (see |netrw-:MF|
+ and |netrw-:MT|, respectively)
+ Mar 17, 2014 * |:Ntree| [dir] wasn't working properly; fixed
+ Mar 18, 2014 * Changed all uses of set to setl
+ Mar 18, 2014 * Commented the netrw_btkeep line in
+ s:NetrwOptionSave(); the effect is that
+ netrw buffers will remain as |'bt'|=nofile.
+ This should prevent swapfiles being created
+ for netrw buffers.
+ Mar 20, 2014 * Changed all uses of lcd to use s:NetrwLcd()
+ instead. Consistent error handling results
+ and it also handles Window's shares
+ * Fixed |netrw-d| command when applied with ftp
+ * https: support included for netrw#NetRead()
+ v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2
+ return to the netrw directory listing
+ Jul 13, 2013 * (Jonas Diemer) suggested changing
+ a <cWORD> to <cfile>.
+ Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
+ use of mkdir did not produce directories
+ following the user's umask.
+ Aug 27, 2013 * introduced |g:netrw_altfile| option
+ Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
+ when available, by default
+ Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
+ opening some directories properly from the
+ command line.
+ Nov 09, 2013 * |:Lexplore| introduced
+ * (Ondrej Platek) reported an issue with
+ netrw's trees (P15). Fixed.
+ * (Jorge Solis) reported that "t" in
+ tree mode caused netrw to forget its
+ line position.
+ Dec 05, 2013 * Added <s-leftmouse> file marking
+ (see |netrw-mf|)
+ Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
+ strlen() instead s:Strlen() when handling
+ multibyte chars with strpart()
+ (ie. strpart() is byte oriented, not
+ display-width oriented).
+ Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
+ and a portion of timestamps were wrongly
+ highlighted with the directory color when
+ setting `:let g:netrw_liststyle=1` on Windows.
+ * (Paul Domaskis) noted that sometimes
+ cursorline was activating in non-netrw
+ windows. All but one setting of cursorline
+ was done via setl; there was one that was
+ overlooked. Fixed.
+ Dec 24, 2013 * (esquifit) asked that netrw allow the
+ /cygdrive prefix be a user-alterable
+ parameter.
+ Jan 02, 2014 * Fixed a problem with netrw-based ballon
+ evaluation (ie. netrw#NetrwBaloonHelp()
+ not having been loaded error messages)
+ Jan 03, 2014 * Fixed a problem with tree listings
+ * New command installed: |:Ntree|
+ Jan 06, 2014 * (Ivan Brennan) reported a problem with
+ |netrw-P|. Fixed.
+ Jan 06, 2014 * Fixed a problem with |netrw-P| when the
+ modified file was to be abandoned.
+ Jan 15, 2014 * (Matteo Cavalleri) reported that when the
+ banner is suppressed and tree listing is
+ used, a blank line was left at the top of
+ the display. Fixed.
+ Jan 20, 2014 * (Gideon Go) reported that, in tree listing
+ style, with a previous window open, that
+ the wrong directory was being used to open
+ a file. Fixed. (P21)
+ v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2
+ w and b to move to next/previous file
+ Apr 26, 2013 * one may now copy files in the same
+ directory; netrw will issue requests for
+ what names the files should be copied under
+ Apr 29, 2013 * Trying Benzinger's problem again. Seems
+ that commenting out the BufEnter and
+ installing VimEnter (only) works. Weird
+ problem! (tree listing, vim -O Dir1 Dir2)
+ May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
+ May 02, 2013 * introduced |g:netrw_bannerbackslash| as
+ requested by Paul Domaskis.
+ Jul 03, 2013 * Explore now avoids splitting when a buffer
+ will be hidden.
+ v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2
+ choice of listing style, hiding style, and
+ sorting style
+```
+
+[1]: https://github.com/vim/vim
diff --git a/runtime/autoload/netrw.vim b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 8e991e88f1..ae794954ce 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -1,51 +1,6 @@
-" netrw.vim: Handles file transfer and remote directory listing across
-" AUTOLOAD SECTION
-" Maintainer: This runtime file is looking for a new maintainer.
-" Date: May 03, 2023
-" Version: 173a
-" Last Change: {{{1
-" 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a)
-" 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a)
-" 2024 Feb 19 by Vim Project: (announce adoption)
-" 2024 Feb 29 by Vim Project: handle symlinks in tree mode correctly
-" 2024 Apr 03 by Vim Project: detect filetypes for remote edited files
-" 2024 May 08 by Vim Project: cleanup legacy Win9X checks
-" 2024 May 09 by Vim Project: remove hard-coded private.ppk
-" 2024 May 10 by Vim Project: recursively delete directories by default
-" 2024 May 13 by Vim Project: prefer scp over pscp
-" 2024 Jun 04 by Vim Project: set bufhidden if buffer changed, nohidden is set and buffer shall be switched (#14915)
-" 2024 Jun 13 by Vim Project: glob() on Windows fails when a directory name contains [] (#14952)
-" 2024 Jun 23 by Vim Project: save ad restore registers when liststyle = WIDELIST (#15077, #15114)
-" 2024 Jul 22 by Vim Project: avoid endless recursion (#15318)
-" 2024 Jul 23 by Vim Project: escape filename before trying to delete it (#15330)
-" 2024 Jul 30 by Vim Project: handle mark-copy to same target directory (#12112)
-" 2024 Aug 02 by Vim Project: honor g:netrw_alt{o,v} for :{S,H,V}explore (#15417)
-" 2024 Aug 15 by Vim Project: style changes, prevent E121 (#15501)
-" 2024 Aug 22 by Vim Project: fix mf-selection highlight (#15551)
-" 2024 Aug 22 by Vim Project: adjust echo output of mx command (#15550)
-" 2024 Sep 15 by Vim Project: more strict confirmation dialog (#15680)
-" 2024 Sep 19 by Vim Project: mf-selection highlight uses wrong pattern (#15700)
-" 2024 Sep 21 by Vim Project: remove extraneous closing bracket (#15718)
-" 2024 Oct 21 by Vim Project: remove netrwFileHandlers (#15895)
-" 2024 Oct 27 by Vim Project: clean up gx mapping (#15721)
-" 2024 Oct 30 by Vim Project: fix filetype detection for remote files (#15961)
-" 2024 Oct 30 by Vim Project: fix x mapping on cygwin (#13687)
-" 2024 Oct 31 by Vim Project: add netrw#Launch() and netrw#Open() (#15962)
-" 2024 Oct 31 by Vim Project: fix E874 when browsing remote dir (#15964)
-" 2024 Nov 07 by Vim Project: use keeppatterns to prevent polluting the search history
-" 2024 Nov 07 by Vim Project: fix a few issues with netrw tree listing (#15996)
-" 2024 Nov 10 by Vim Project: directory symlink not resolved in tree view (#16020)
-" 2024 Nov 14 by Vim Project: small fixes to netrw#BrowseX (#16056)
-" 2024 Nov 23 by Vim Project: update decompress defaults (#16104)
-" 2024 Nov 23 by Vim Project: fix powershell escaping issues (#16094)
-" 2024 Dec 04 by Vim Project: do not detach for gvim (#16168)
-" 2024 Dec 08 by Vim Project: check the first arg of netrw_browsex_viewer for being executable (#16185)
-" 2024 Dec 12 by Vim Project: do not pollute the search history (#16206)
-" 2024 Dec 19 by Vim Project: change style (#16248)
-" 2024 Dec 20 by Vim Project: change style continued (#16266)
-" }}}
-" Former Maintainer: Charles E Campbell
-" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Former Maintainer: Charles E Campbell
+" Upstream: <https://github.com/saccarosium/netrw.vim>
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
@@ -58,12 +13,7 @@
"
" Note: the code here was started in 1999 under a much earlier version of vim. The directory browsing
" code was written using vim v6, which did not have Lists (Lists were first offered with vim-v7).
-"
-"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
-"
-" But be doers of the Word, and not only hearers, deluding your own selves {{{1
-" (James 1:22 RSV)
-" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
" Load Once: {{{1
if &cp || exists("g:loaded_netrw")
finish
@@ -85,7 +35,7 @@ if exists("s:needspatches")
endfor
endif
-let g:loaded_netrw = "v173"
+let g:loaded_netrw = "v175"
let s:keepcpo= &cpo
setl cpo&vim
diff --git a/runtime/pack/dist/opt/netrw/autoload/netrwSettings.vim b/runtime/pack/dist/opt/netrw/autoload/netrwSettings.vim
new file mode 100644
index 0000000000..884d9ce081
--- /dev/null
+++ b/runtime/pack/dist/opt/netrw/autoload/netrwSettings.vim
@@ -0,0 +1,242 @@
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Former Maintainer: Charles E Campbell
+" Upstream: <https://github.com/saccarosium/netrw.vim>
+" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{
+" Permission is hereby granted to use and distribute this code,
+" with or without modifications, provided that this copyright
+" notice is copied with it. Like anything else that's free,
+" netrwSettings.vim is provided *as is* and comes with no
+" warranty of any kind, either expressed or implied. By using
+" this plugin, you agree that in no event will the copyright
+" holder be liable for any damages resulting from the use
+" of this software. }}}
+
+if &cp || exists("g:loaded_netrwSettings")
+ finish
+endif
+
+let g:loaded_netrwSettings = "v175"
+if v:version < 700
+ echohl WarningMsg
+ echo "***warning*** this version of netrwSettings needs vim 7.0"
+ echohl Normal
+ finish
+endif
+
+" NetrwSettings: {{{
+
+function! netrwSettings#NetrwSettings()
+ " this call is here largely just to insure that netrw has been loaded
+ call netrw#WinPath("")
+ if !exists("g:loaded_netrw")
+ echohl WarningMsg
+ echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings"
+ echohl None
+ return
+ endif
+
+ above wincmd s
+ enew
+ setlocal noswapfile bh=wipe
+ set ft=vim
+ file Netrw\ Settings
+
+ " these variables have the following default effects when they don't
+ " exist (ie. have not been set by the user in his/her .vimrc)
+ if !exists("g:netrw_liststyle")
+ let g:netrw_liststyle= 0
+ let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
+ endif
+ if !exists("g:netrw_silent")
+ let g:netrw_silent= 0
+ endif
+ if !exists("g:netrw_use_nt_rcp")
+ let g:netrw_use_nt_rcp= 0
+ endif
+ if !exists("g:netrw_ftp")
+ let g:netrw_ftp= 0
+ endif
+ if !exists("g:netrw_ignorenetrc")
+ let g:netrw_ignorenetrc= 0
+ endif
+
+ put ='+ ---------------------------------------------'
+ put ='+ NetrwSettings: by Charles E. Campbell'
+ put ='+ Press <F1> with cursor atop any line for help'
+ put ='+ ---------------------------------------------'
+ let s:netrw_settings_stop= line(".")
+
+ put =''
+ put ='+ Netrw Protocol Commands'
+ put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
+ put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
+ put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
+ put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
+ put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
+ put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
+ put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
+ put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
+ put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
+ let s:netrw_protocol_stop= line(".")
+ put = ''
+
+ put ='+Netrw Transfer Control'
+ put = 'let g:netrw_cygwin = '.g:netrw_cygwin
+ put = 'let g:netrw_ftp = '.g:netrw_ftp
+ put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
+ put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
+ put = 'let g:netrw_sshport = '.g:netrw_sshport
+ put = 'let g:netrw_silent = '.g:netrw_silent
+ put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
+ let s:netrw_xfer_stop= line(".")
+ put =''
+ put ='+ Netrw Messages'
+ put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
+
+ put = ''
+ put ='+ Netrw Browser Control'
+ if exists("g:netrw_altfile")
+ put = 'let g:netrw_altfile = '.g:netrw_altfile
+ else
+ put = 'let g:netrw_altfile = 0'
+ endif
+ put = 'let g:netrw_alto = '.g:netrw_alto
+ put = 'let g:netrw_altv = '.g:netrw_altv
+ put = 'let g:netrw_banner = '.g:netrw_banner
+ if exists("g:netrw_bannerbackslash")
+ put = 'let g:netrw_bannerbackslash = '.g:netrw_bannerbackslash
+ else
+ put = '\" let g:netrw_bannerbackslash = (not defined)'
+ endif
+ put = 'let g:netrw_browse_split = '.g:netrw_browse_split
+ if exists("g:netrw_browsex_viewer")
+ put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
+ else
+ put = '\" let g:netrw_browsex_viewer = (not defined)'
+ endif
+ put = 'let g:netrw_compress = '.g:netrw_compress
+ if exists("g:Netrw_corehandler")
+ put = 'let g:Netrw_corehandler = '.g:Netrw_corehandler
+ else
+ put = '\" let g:Netrw_corehandler = (not defined)'
+ endif
+ put = 'let g:netrw_ctags = '.g:netrw_ctags
+ put = 'let g:netrw_cursor = '.g:netrw_cursor
+ let decompressline= line("$")
+ put = 'let g:netrw_decompress = '.string(g:netrw_decompress)
+ if exists("g:netrw_dynamic_maxfilenamelen")
+ put = 'let g:netrw_dynamic_maxfilenamelen='.g:netrw_dynamic_maxfilenamelen
+ else
+ put = '\" let g:netrw_dynamic_maxfilenamelen= (not defined)'
+ endif
+ put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
+ put = 'let g:netrw_errorlvl = '.g:netrw_errorlvl
+ put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
+ let fnameescline= line("$")
+ put = 'let g:netrw_fname_escape = '.string(g:netrw_fname_escape)
+ put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
+ put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
+ put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
+ put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
+ let globescline= line("$")
+ put = 'let g:netrw_glob_escape = '.string(g:netrw_glob_escape)
+ put = 'let g:netrw_hide = '.g:netrw_hide
+ if exists("g:netrw_home")
+ put = 'let g:netrw_home = '.g:netrw_home
+ else
+ put = '\" let g:netrw_home = (not defined)'
+ endif
+ put = 'let g:netrw_keepdir = '.g:netrw_keepdir
+ put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
+ put = 'let g:netrw_list_hide = '.g:netrw_list_hide
+ put = 'let g:netrw_liststyle = '.g:netrw_liststyle
+ put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
+ put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt
+ put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
+ put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt
+ put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
+ put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt
+ put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
+ put = 'let g:netrw_menu = '.g:netrw_menu
+ put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps
+ put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
+ if exists("g:netrw_nobeval")
+ put = 'let g:netrw_nobeval = '.g:netrw_nobeval
+ else
+ put = '\" let g:netrw_nobeval = (not defined)'
+ endif
+ put = 'let g:netrw_remote_mkdir = '.g:netrw_remote_mkdir
+ put = 'let g:netrw_preview = '.g:netrw_preview
+ put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
+ put = 'let g:netrw_retmap = '.g:netrw_retmap
+ put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
+ put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
+ put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
+ put = 'let g:netrw_sort_by = '.g:netrw_sort_by
+ put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
+ put = 'let g:netrw_sort_options = '.g:netrw_sort_options
+ put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
+ put = 'let g:netrw_servername = '.g:netrw_servername
+ put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax
+ put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
+ put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
+ put = 'let g:netrw_scpport = '.g:netrw_scpport
+ put = 'let g:netrw_sepchr = '.g:netrw_sepchr
+ put = 'let g:netrw_sshport = '.g:netrw_sshport
+ put = 'let g:netrw_timefmt = '.g:netrw_timefmt
+ let tmpfileescline= line("$")
+ put ='let g:netrw_tmpfile_escape...'
+ put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
+ put = 'let g:netrw_xstrlen = '.g:netrw_xstrlen
+ put = 'let g:netrw_winsize = '.g:netrw_winsize
+
+ put =''
+ put ='+ For help, place cursor on line and press <F1>'
+
+ 1d
+ silent %s/^+/"/e
+ res 99
+ silent %s/= \([^0-9].*\)$/= '\1'/e
+ silent %s/= $/= ''/e
+ 1
+
+ call setline(decompressline, "let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
+ call setline(fnameescline, "let g:netrw_fname_escape = '".escape(g:netrw_fname_escape,"'")."'")
+ call setline(globescline, "let g:netrw_glob_escape = '".escape(g:netrw_glob_escape,"'")."'")
+ call setline(tmpfileescline, "let g:netrw_tmpfile_escape = '".escape(g:netrw_tmpfile_escape,"'")."'")
+
+ set nomod
+
+ nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
+ nnoremap <buffer> <silent> <leftmouse> <leftmouse> :call NetrwSettingHelp()<cr>
+ let tmpfile= tempname()
+ exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
+endfunction
+
+" }}}
+" NetrwSettingHelp: {{{
+
+function! NetrwSettingHelp()
+ let curline = getline(".")
+ if curline =~ '='
+ let varhelp = substitute(curline,'^\s*let ','','e')
+ let varhelp = substitute(varhelp,'\s*=.*$','','e')
+ try
+ exe "he ".varhelp
+ catch /^Vim\%((\a\+)\)\=:E149/
+ echo "***sorry*** no help available for <".varhelp.">"
+ endtry
+ elseif line(".") < s:netrw_settings_stop
+ he netrw-settings
+ elseif line(".") < s:netrw_protocol_stop
+ he netrw-externapp
+ elseif line(".") < s:netrw_xfer_stop
+ he netrw-variables
+ else
+ he netrw-browse-var
+ endif
+endfunction
+
+" }}}
+
+" vim:ts=8 sts=4 sw=4 et fdm=marker
diff --git a/runtime/autoload/netrw_gitignore.vim b/runtime/pack/dist/opt/netrw/autoload/netrw_gitignore.vim
index 1b55e2488a..c76d28db04 100644
--- a/runtime/autoload/netrw_gitignore.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw_gitignore.vim
@@ -1,3 +1,7 @@
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Former Maintainer: Bruno Sutic
+" Upstream: <https://github.com/saccarosium/netrw.vim>
+
" netrw_gitignore#Hide: gitignore-based hiding
" Function returns a string of comma separated patterns convenient for
" assignment to `g:netrw_list_hide` option.
@@ -8,7 +12,7 @@
" let g:netrw_list_hide = netrw_gitignore#Hide()
" let g:netrw_list_hide = netrw_gitignore#Hide() . 'more,hide,patterns'
"
-" Copyright: Copyright (C) 2013 Bruno Sutic {{{1
+" Copyright: Copyright (C) 2013 Bruno Sutic {{{
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@@ -16,7 +20,10 @@
" warranty of any kind, either expressed or implied. By using
" this plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use
-" of this software.
+" of this software. }}}
+
function! netrw_gitignore#Hide(...)
- return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
+ return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
endfunction
+
+" vim:ts=8 sts=4 sw=4 et fdm=marker
diff --git a/runtime/doc/pi_netrw.txt b/runtime/pack/dist/opt/netrw/doc/netrw.txt
index 01e6b5fa6a..9fc7b42bb7 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/pack/dist/opt/netrw/doc/netrw.txt
@@ -1,14 +1,12 @@
-*pi_netrw.txt* Nvim
+*netrw.txt* Nvim
------------------------------------------------
NETRW REFERENCE MANUAL by Charles E. Campbell
------------------------------------------------
-Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
- (remove NOSPAM from Campbell's email first)
-
+Original Author: Charles E. Campbell
Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
The VIM LICENSE applies to the files in this package, including
- netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and
+ netrw.vim, netrw.txt, netrwSettings.vim, and
syntax/netrw.vim. Like anything else that's free, netrw.vim and its
associated files are provided *as is* and comes with no warranty of
any kind, either expressed or implied. No guarantees of
@@ -110,10 +108,7 @@ Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
Selecting Sorting Style.............................|netrw-s|
Setting Editing Window..............................|netrw-C|
10. Problems and Fixes....................................|netrw-problems|
-11. Debugging Netrw Itself................................|netrw-debug|
-12. History...............................................|netrw-history|
-13. Todo..................................................|netrw-todo|
-14. Credits...............................................|netrw-credits|
+11. Credits...............................................|netrw-credits|
==============================================================================
2. Starting With Netrw *netrw-start* {{{1
@@ -3400,7 +3395,6 @@ Example: Clear netrw's marked file list via a mapping on gu >
10. Problems and Fixes *netrw-problems* {{{1
(This section is likely to grow as I get feedback)
- (also see |netrw-debug|)
*netrw-p1*
P1. I use Windows, and my network browsing with ftp doesn't sort by {{{2
time or size! -or- The remote system is a Windows server; why
@@ -3763,613 +3757,8 @@ Example: Clear netrw's marked file list via a mapping on gu >
directory, which may not be the same as the browsing directory
shown by netrw (see |g:netrw_keepdir|).
-
-==============================================================================
-11. Debugging Netrw Itself *netrw-debug* {{{1
-
-Step 1: check that the problem you've encountered hasn't already been resolved
-by obtaining a copy of the latest (often developmental) netrw at:
-
- http://www.drchip.org/astronaut/vim/index.html#NETRW
-
-The <netrw.vim> script is typically installed on systems as something like:
->
- /usr/local/share/vim/vim8x/plugin/netrwPlugin.vim
- /usr/local/share/vim/vim8x/autoload/netrw.vim
- (see output of :echo &rtp)
-<
-which is loaded automatically at startup (assuming :set nocp). If you
-installed a new netrw, then it will be located at >
-
- $HOME/.vim/plugin/netrwPlugin.vim
- $HOME/.vim/autoload/netrw.vim
-<
-Step 2: assuming that you've installed the latest version of netrw,
-check that your problem is really due to netrw. Create a file
-called netrw.vimrc with the following contents: >
-
- set nocp
- so $HOME/.vim/plugin/netrwPlugin.vim
-<
-Then run netrw as follows: >
-
- vim -u netrw.vimrc --noplugins -i NONE [some path here]
-<
-Perform whatever netrw commands you need to, and check that the problem is
-still present. This procedure sidesteps any issues due to personal .vimrc
-settings, .viminfo file, and other plugins. If the problem does not appear,
-then you need to determine which setting in your .vimrc is causing the
-conflict with netrw or which plugin(s) is/are involved.
-
-Step 3: If the problem still is present, then get a debugging trace from
-netrw:
-
- 1. Get the <Decho.vim> script, available as:
-
- http://www.drchip.org/astronaut/vim/index.html#DECHO
- or
- http://vim.sourceforge.net/scripts/script.php?script_id=120
-
- Decho.vim is provided as a "vimball". You
- should edit the Decho.vba.gz file and source it in: >
-
- vim Decho.vba.gz
- :so %
- :q
-<
- 2. To turn on debug tracing in netrw, then edit the <netrw.vim>
- file by typing: >
-
- vim netrw.vim
- :DechoOn
- :wq
-<
- To restore to normal non-debugging behavior, re-edit <netrw.vim>
- and type >
-
- vim netrw.vim
- :DechoOff
- :wq
-<
- This command, provided by <Decho.vim>, will comment out all
- Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
-
- 3. Then bring up vim and attempt to evoke the problem by doing a
- transfer or doing some browsing. A set of messages should appear
- concerning the steps that <netrw.vim> took in attempting to
- read/write your file over the network in a separate tab or
- server vim window.
-
- Change the netrw.vimrc file to include the Decho plugin: >
-
- set nocp
- so $HOME/.vim/plugin/Decho.vim
- so $HOME/.vim/plugin/netrwPlugin.vim
-<
- You should continue to run vim with >
-
- vim -u netrw.vimrc --noplugins -i NONE [some path here]
-<
- to avoid entanglements with options and other plugins.
-
- To save the file: under linux, the output will be in a separate
- remote server window; in it, just save the file with >
-
- :w! DBG
-
-< Under a vim that doesn't support clientserver, your debugging
- output will appear in another tab: >
-
- :tabnext
- :set bt=
- :w! DBG
-<
- Furthermore, it'd be helpful if you would type >
-
- :Dsep <command>
-
-< where <command> is the command you're about to type next,
- thereby making it easier to associate which part of the
- debugging trace is due to which command.
-
- Please send that information to <netrw.vim>'s maintainer along
- with the o/s you're using and the vim version that you're using
- (see |:version|) (remove the embedded NOSPAM first) >
-
- NcampObell@SdrPchip.AorgM-NOSPAM
-<
-==============================================================================
-12. History *netrw-history* {{{1
-
- v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go"
- * (Bram Moolenaar) no need for "b" in
- netrw-safe guioptions
- Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir
- references
- Aug 18, 2022 * (Miguel Barro) improving compatibility with
- powershell
- v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe()
- to allow |'bh'| to be set to delete when
- rather than hide when g:netrw_fastbrowse
- was zero.
- * Installed |g:netrw_clipboard| setting
- * Installed option bypass for |'guioptions'|
- a/A settings
- * Changed popup_beval() to popup_atcursor()
- in netrw#ErrorMsg (lacygoill). Apparently
- popup_beval doesn't reliably close the
- popup when the mouse is moved.
- * VimEnter() now using win_execute to examine
- buffers for an attempt to open a directory.
- Avoids issues with popups/terminal from
- command line. (lacygoill)
- Jun 28, 2021 * (zeertzjq) provided a patch for use of
- xmap,xno instead of vmap,vno in
- netrwPlugin.vim. Avoids entanglement with
- select mode.
- Jul 14, 2021 * Fixed problem addressed by tst976; opening
- a file using tree mode, going up a
- directory, and opening a file there was
- opening the file in the wrong directory.
- Jul 28, 2021 * (Ingo Karkat) provided a patch fixing an
- E488 error with netrwPlugin.vim
- (occurred for vim versions < 8.02)
- v170: Mar 11, 2020 * (reported by Reiner Herrmann) netrw+tree
- would not hide with the ^\..* pattern
- correctly.
- * (Marcin Szamotulski) NetrwOptionRestore
- did not restore options correctly that
- had a single quote in the option string.
- Apr 13, 2020 * implemented error handling via popup
- windows (see popup_beval())
- Apr 30, 2020 * (reported by Manatsu Takahashi) while
- using Lexplore, a modified file could
- be overwritten. Sol'n: will not overwrite,
- but will emit an |E37| (although one cannot
- add an ! to override)
- Jun 07, 2020 * (reported by Jo Totland) repeatedly invoking
- :Lexplore and quitting it left unused
- hidden buffers. Netrw will now set netrw
- buffers created by :Lexplore to |'bh'|=wipe.
- v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x
- (|netrw-x|) would throw an error when
- attempting to open a local directory.
- v168: Dec 12, 2019 * scp timeout error message not reported,
- hopefully now fixed (Shane Xb Qian)
- v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
- That causes problems with the clipboard.
- Now restores occurs only if @* or @+ have
- been changed.
- * netrw will change @* or @+ less often.
- Never if I happen to have caught all the
- operations that modify the unnamed
- register (which also writes @*).
- * Modified hiding behavior so that "s"
- will not ignore hiding.
- v166: Nov 06, 2019 * Removed a space from a nmap for "-"
- * Numerous debugging statement changes
- v163: Dec 05, 2017 * (Cristi Balan) reported that a setting ('sel')
- was left changed
- * (Holger Mitschke) reported a problem with
- saving and restoring history. Fixed.
- * Hopefully I fixed a nasty bug that caused a
- file rename to wipe out a buffer that it
- should not have wiped out.
- * (Holger Mitschke) amended this help file
- with additional |g:netrw_special_syntax|
- items
- * Prioritized wget over curl for
- g:netrw_http_cmd
- v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors
- with a patch; these are now fixed.
- Oct 26, 2016 * I started using mate-terminal and found that
- x and gx (|netrw-x| and |netrw-gx|) were no
- longer working. Fixed (using atril when
- $DESKTOP_SESSION is "mate").
- Nov 04, 2016 * (Martin Vuille) pointed out that @+ was
- being restored with keepregstar rather than
- keepregplus.
- Nov 09, 2016 * Broke apart the command from the options,
- mostly for Windows. Introduced new netrw
- settings: |g:netrw_localcopycmdopt|
- |g:netrw_localcopydircmdopt|
- |g:netrw_localmkdiropt|
- |g:netrw_localmovecmdopt|
- Nov 21, 2016 * (mattn) provided a patch for preview; swapped
- winwidth() with winheight()
- Nov 22, 2016 * (glacambre) reported that files containing
- spaces weren't being obtained properly via
- scp. Fix: apparently using single quotes
- such as with "file name" wasn't enough; the
- spaces inside the quotes also had to be
- escaped (ie. "file\ name").
- * Also fixed obtain (|netrw-O|) to be able to
- obtain files with spaces in their names
- Dec 20, 2016 * (xc1427) Reported that using "I" (|netrw-I|)
- when atop "Hiding" in the banner also caused
- the active-banner hiding control to occur
- Jan 03, 2017 * (Enno Nagel) reported that attempting to
- apply netrw to a directory that was without
- read permission caused a syntax error.
- Jan 13, 2017 * (Ingo Karkat) provided a patch which makes
- using netrw#Call() better. Now returns
- value of internal routines return, for example.
- Jan 13, 2017 * (Ingo Karkat) changed netrw#FileUrlRead to
- use |:edit| instead of |:read|. I also
- changed the routine name to netrw#FileUrlEdit.
- Jan 16, 2017 * (Sayem) reported a problem where :Lexplore
- could generate a new listing buffer and
- window instead of toggling the netrw display.
- Unfortunately, the directions for eliciting
- the problem weren't complete, so I may or
- may not have fixed that issue.
- Feb 06, 2017 * Implemented cb and cB. Changed "c" to "cd".
- (see |netrw-cb|, |netrw-cB|, and |netrw-cd|)
- Mar 21, 2017 * previously, netrw would specify (safe) settings
- even when the setting was already safe for
- netrw. Netrw now attempts to leave such
- already-netrw-safe settings alone.
- (affects s:NetrwOptionRestore() and
- s:NetrwSafeOptions(); also introduced
- s:NetrwRestoreSetting())
- Jun 26, 2017 * (Christian Brabandt) provided a patch to
- allow curl to follow redirects (ie. -L
- option)
- Jun 26, 2017 * (Callum Howard) reported a problem with
- :Lexpore not removing the Lexplore window
- after a change-directory
- Aug 30, 2017 * (Ingo Karkat) one cannot switch to the
- previously edited file (e.g. with CTRL-^)
- after editing a file:// URL. Patch to
- have a "keepalt" included.
- Oct 17, 2017 * (Adam Faryna) reported that gn (|netrw-gn|)
- did not work on directories in the current
- tree
- v157: Apr 20, 2016 * (Nicola) had set up a "nmap <expr> ..." with
- a function that returned a 0 while silently
- invoking a shell command. The shell command
- activated a ShellCmdPost event which in turn
- called s:LocalBrowseRefresh(). That looks
- over all netrw buffers for changes needing
- refreshes. However, inside a |:map-<expr>|,
- tab and window changes are disallowed. Fixed.
- (affects netrw's s:LocalBrowseRefresh())
- * g:netrw_localrmdir not used any more, but
- the relevant patch that causes |delete()| to
- take over was #1107 (not #1109).
- * |expand()| is now used on |g:netrw_home|;
- consequently, g:netrw_home may now use
- environment variables
- * s:NetrwLeftmouse and s:NetrwCLeftmouse will
- return without doing anything if invoked
- when inside a non-netrw window
- Jun 15, 2016 * gx now calls netrw#GX() which returns
- the word under the cursor. The new
- wrinkle: if one is in a netrw buffer,
- then netrw's s:NetrwGetWord().
- Jun 22, 2016 * Netrw was executing all its associated
- Filetype commands silently; I'm going
- to try doing that "noisily" and see if
- folks have a problem with that.
- Aug 12, 2016 * Changed order of tool selection for
- handling http://... viewing.
- (Nikolay Aleksandrovich Pavlov)
- Aug 21, 2016 * Included hiding/showing/all for tree
- listings
- * Fixed refresh (^L) for tree listings
- v156: Feb 18, 2016 * Changed =~ to =~# where appropriate
- Feb 23, 2016 * s:ComposePath(base,subdir) now uses
- fnameescape() on the base portion
- Mar 01, 2016 * (gt_macki) reported where :Explore would
- make file unlisted. Fixed (tst943)
- Apr 04, 2016 * (reported by John Little) netrw normally
- suppresses browser messages, but sometimes
- those "messages" are what is wanted.
- See |g:netrw_suppress_gx_mesg|
- Apr 06, 2016 * (reported by Carlos Pita) deleting a remote
- file was giving an error message. Fixed.
- Apr 08, 2016 * (Charles Cooper) had a problem with an
- undefined b:netrw_curdir. He also provided
- a fix.
- Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses
- dictionaries. Also fixed the "No Name"
- buffer problem.
- v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's
- mapping of ctrl-l was not allowing refresh of
- other windows when it was done in a netrw
- window.
- Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search()
- instead of a loop
- * NetrwBrowse() will return line to
- w:netrw_bannercnt if cursor ended up in
- banner
- Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|)
- Nov 17, 2015 * Commented out imaps -- perhaps someone can
- tell me how they're useful and should be
- retained?
- Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support
- Nov 20, 2015 * gx (|netrw-gx|) on a URL downloaded the
- file in addition to simply bringing up the
- URL in a browser. Fixed.
- Nov 23, 2015 * Added |g:netrw_sizestyle| support
- Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw
- maps.
- Jan 05, 2016 * |netrw-qL| implemented to mark files based
- upon |location-list|s; similar to |netrw-qF|.
- Jan 19, 2016 * using - call delete(directoryname,"d") -
- instead of using g:netrw_localrmdir if
- v7.4 + patch#1107 is available
- Jan 28, 2016 * changed to using |winsaveview()| and
- |winrestview()|
- Jan 28, 2016 * s:NetrwTreePath() now does a save and
- restore of view
- Feb 08, 2016 * Fixed a tree-listing problem with remote
- directories
- v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where
- a file was not treated properly as a file
- due to g:netrw_keepdir == 1
- Mar 25, 2015 * (requested by Ben Friz) one may now sort by
- extension
- Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot
- of buffer-local mappings; however, some
- plugins (such as vim-surround) set up
- conflicting mappings that cause vim to wait.
- The "<nowait>" modifier has been included
- with most of netrw's mappings to avoid that
- delay.
- Jun 26, 2015 * |netrw-gn| mapping implemented
- * :Ntree NotADir resulted in having
- the tree listing expand in the error messages
- window. Fixed.
- Jun 29, 2015 * Attempting to delete a file remotely caused
- an error with "keepsol" mentioned; fixed.
- Jul 08, 2015 * Several changes to keep the |:jumps| table
- correct when working with
- |g:netrw_fastbrowse| set to 2
- * wide listing with accented characters fixed
- (using %-S instead of %-s with a |printf()|
- Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true
- but kfmclient not installed. Changed order
- in netrw#BrowseX(): checks if kde and
- kfmclient, then will use xdg-open on a unix
- system (if xdg-open is executable)
- Aug 11, 2015 * (McDonnell) tree listing mode wouldn't
- select a file in a open subdirectory.
- * (McDonnell) when multiple subdirectories
- were concurrently open in tree listing
- mode, a ctrl-L wouldn't refresh properly.
- * The netrw:target menu showed duplicate
- entries
- Oct 13, 2015 * (mattn) provided an exception to handle
- windows with shellslash set but no shell
- Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used
- to control whether NetrwShrink is used
- (see |netrw-c-tab|)
- v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2
- May 14, 2014 * changed s:PerformListing() so that it
- always sets ft=netrw for netrw buffers
- (ie. even when syntax highlighting is
- off, not available, etc)
- May 16, 2014 * introduced the |netrw-ctrl-r| functionality
- May 17, 2014 * introduced the |netrw-:NetrwMB| functionality
- * mb and mB (|netrw-mb|, |netrw-mB|) will
- add/remove marked files from bookmark list
- May 20, 2014 * (Enno Nagel) reported that :Lex <dirname>
- wasn't working. Fixed.
- May 26, 2014 * restored test to prevent leftmouse window
- resizing from causing refresh.
- (see s:NetrwLeftmouse())
- * fixed problem where a refresh caused cursor
- to go just under the banner instead of
- staying put
- May 28, 2014 * (László Bimba) provided a patch for opening
- the |:Lexplore| window 100% high, optionally
- on the right, and will work with remote
- files.
- May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|)
- Jun 01, 2014 * Removed some "silent"s from commands used
- to implemented scp://... and pscp://...
- directory listing. Permits request for
- password to appear.
- Jun 05, 2014 * (Enno Nagel) reported that user maps "/"
- caused problems with "b" and "w", which
- are mapped (for wide listings only) to
- skip over files rather than just words.
- Jun 10, 2014 * |g:netrw_gx| introduced to allow users to
- override default "<cfile>" with the gx
- (|netrw-gx|) map
- Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set,
- will write modified files. s:NetrwBrowseX()
- will now save, turn off, and restore the
- |'autowrite'| setting.
- Jun 13, 2014 * added visual map for gx use
- Jun 15, 2014 * (Enno Nagel) reported that with having hls
- set and wide listing style in use, that the
- b and w maps caused unwanted highlighting.
- Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included
- Jul 09, 2014 * |g:netrw_keepj| included, allowing optional
- keepj
- Jul 09, 2014 * fixing bugs due to previous update
- Jul 21, 2014 * (Bruno Sutic) provided an updated
- netrw_gitignore.vim
- Jul 30, 2014 * (Yavuz Yetim) reported that editing two
- remote files of the same name caused the
- second instance to have a "temporary"
- name. Fixed: now they use the same buffer.
- Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which
- allows scp and windows local paths to work.
- Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory,
- will now do |gf| instead
- Nov 06, 2014 * For cygwin: cygstart will be available for
- netrw#BrowseX() to use if its executable.
- Nov 07, 2014 * Began support for file://... urls. Will use
- |g:netrw_file_cmd| (typically elinks or links)
- Dec 02, 2014 * began work on having mc (|netrw-mc|) copy
- directories. Works for linux machines,
- cygwin+vim, but not for windows+gvim.
- Dec 02, 2014 * in tree mode, netrw was not opening
- directories via symbolic links.
- Dec 02, 2014 * added resolved link information to
- thin and tree modes
- Dec 30, 2014 * (issue#231) |:ls| was not showing
- remote-file buffers reliably. Fixed.
- v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2
- vim 7.4 with patch 213)
- * (Enno Nagel) turn |'rnu'| off in netrw
- buffers.
- * (Quinn Strahl) suggested that netrw
- allow regular window splitting to occur,
- thereby allowing |'equalalways'| to take
- effect.
- * (qingtian zhao) normally, netrw will
- save and restore the |'fileformat'|;
- however, sometimes that isn't wanted
- Apr 14, 2014 * whenever netrw marks a buffer as ro,
- it will also mark it as nomod.
- Apr 16, 2014 * sftp protocol now supported by
- netrw#Obtain(); this means that one
- may use "mc" to copy a remote file
- to a local file using sftp, and that
- the |netrw-O| command can obtain remote
- files via sftp.
- * added [count]C support (see |netrw-C|)
- Apr 18, 2014 * when |g:netrw_chgwin| is one more than
- the last window, then vertically split
- the last window and use it as the
- chgwin window.
- May 09, 2014 * SavePosn was "saving filename under cursor"
- from a non-netrw window when using :Rex.
- v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2
- prior to Explore or editing a directory
- * (Ken Takata) netrw gave error when
- clipboard was disabled. Sol'n: Placed
- several if has("clipboard") tests in.
- * Fixed ftp://X@Y@Z// problem; X@Y now
- part of user id, and only Z is part of
- hostname.
- * (A Loumiotis) reported that completion
- using a directory name containing spaces
- did not work. Fixed with a retry in
- netrw#Explore() which removes the
- backslashes vim inserted.
- Feb 26, 2014 * :Rexplore now records the current file
- using w:netrw_rexfile when returning via
- |:Rexplore|
- Mar 08, 2014 * (David Kotchan) provided some patches
- allowing netrw to work properly with
- windows shares.
- * Multiple one-liner help messages available
- by pressing <cr> while atop the "Quick
- Help" line
- * worked on ShellCmdPost, FocusGained event
- handling.
- * |:Lexplore| path: will be used to update
- a left-side netrw browsing directory.
- Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close
- tree directory implemented
- Mar 13, 2014 * (Tony Mechylynck) reported that using
- the browser with ftp on a directory,
- and selecting a gzipped txt file, that
- an E19 occurred (which was issued by
- gzip.vim). Fixed.
- Mar 14, 2014 * Implemented :MF and :MT (see |netrw-:MF|
- and |netrw-:MT|, respectively)
- Mar 17, 2014 * |:Ntree| [dir] wasn't working properly; fixed
- Mar 18, 2014 * Changed all uses of set to setl
- Mar 18, 2014 * Commented the netrw_btkeep line in
- s:NetrwOptionSave(); the effect is that
- netrw buffers will remain as |'bt'|=nofile.
- This should prevent swapfiles being created
- for netrw buffers.
- Mar 20, 2014 * Changed all uses of lcd to use s:NetrwLcd()
- instead. Consistent error handling results
- and it also handles Window's shares
- * Fixed |netrw-d| command when applied with ftp
- * https: support included for netrw#NetRead()
- v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2
- return to the netrw directory listing
- Jul 13, 2013 * (Jonas Diemer) suggested changing
- a <cWORD> to <cfile>.
- Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
- use of mkdir did not produce directories
- following the user's umask.
- Aug 27, 2013 * introduced |g:netrw_altfile| option
- Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
- when available, by default
- Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
- opening some directories properly from the
- command line.
- Nov 09, 2013 * |:Lexplore| introduced
- * (Ondrej Platek) reported an issue with
- netrw's trees (P15). Fixed.
- * (Jorge Solis) reported that "t" in
- tree mode caused netrw to forget its
- line position.
- Dec 05, 2013 * Added <s-leftmouse> file marking
- (see |netrw-mf|)
- Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
- strlen() instead s:Strlen() when handling
- multibyte chars with strpart()
- (ie. strpart() is byte oriented, not
- display-width oriented).
- Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
- and a portion of timestamps were wrongly
- highlighted with the directory color when
- setting `:let g:netrw_liststyle=1` on Windows.
- * (Paul Domaskis) noted that sometimes
- cursorline was activating in non-netrw
- windows. All but one setting of cursorline
- was done via setl; there was one that was
- overlooked. Fixed.
- Dec 24, 2013 * (esquifit) asked that netrw allow the
- /cygdrive prefix be a user-alterable
- parameter.
- Jan 02, 2014 * Fixed a problem with netrw-based balloon
- evaluation (ie. netrw#NetrwBalloonHelp()
- not having been loaded error messages)
- Jan 03, 2014 * Fixed a problem with tree listings
- * New command installed: |:Ntree|
- Jan 06, 2014 * (Ivan Brennan) reported a problem with
- |netrw-P|. Fixed.
- Jan 06, 2014 * Fixed a problem with |netrw-P| when the
- modified file was to be abandoned.
- Jan 15, 2014 * (Matteo Cavalleri) reported that when the
- banner is suppressed and tree listing is
- used, a blank line was left at the top of
- the display. Fixed.
- Jan 20, 2014 * (Gideon Go) reported that, in tree listing
- style, with a previous window open, that
- the wrong directory was being used to open
- a file. Fixed. (P21)
- v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2
- w and b to move to next/previous file
- Apr 26, 2013 * one may now copy files in the same
- directory; netrw will issue requests for
- what names the files should be copied under
- Apr 29, 2013 * Trying Benzinger's problem again. Seems
- that commenting out the BufEnter and
- installing VimEnter (only) works. Weird
- problem! (tree listing, vim -O Dir1 Dir2)
- May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
- May 02, 2013 * introduced |g:netrw_bannerbackslash| as
- requested by Paul Domaskis.
- Jul 03, 2013 * Explore now avoids splitting when a buffer
- will be hidden.
- v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2
- choice of listing style, hiding style, and
- sorting style
-
-==============================================================================
-13. Todo *netrw-todo* {{{1
-
-07/29/09 : banner :|g:netrw_banner| can be used to suppress the
- suppression banner. This feature is new and experimental,
- so its in the process of being debugged.
-09/04/09 : "gp" : See if it can be made to work for remote systems.
- : See if it can be made to work with marked files.
-
==============================================================================
-14. Credits *netrw-credits* {{{1
+11. Credits *netrw-credits* {{{1
Vim editor by Bram Moolenaar (Thanks, Bram!)
dav support by C Campbell
diff --git a/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim b/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim
new file mode 100644
index 0000000000..8d10c00153
--- /dev/null
+++ b/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim
@@ -0,0 +1,214 @@
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Former Maintainer: Charles E Campbell
+" Upstream: <https://github.com/saccarosium/netrw.vim>
+" Copyright: Copyright (C) 1999-2021 Charles E. Campbell {{{
+" Permission is hereby granted to use and distribute this code,
+" with or without modifications, provided that this copyright
+" notice is copied with it. Like anything else that's free,
+" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided
+" *as is* and comes with no warranty of any kind, either
+" expressed or implied. By using this plugin, you agree that
+" in no event will the copyright holder be liable for any damages
+" resulting from the use of this software. }}}
+
+if &cp || exists("g:loaded_netrwPlugin")
+ finish
+endif
+
+let g:loaded_netrwPlugin = "v175"
+
+let s:keepcpo = &cpo
+set cpo&vim
+
+" Commands Launch/URL: {{{
+
+command -complete=shellcmd -nargs=1 Launch call netrw#Launch(trim(<q-args>))
+command -complete=file -nargs=1 Open call netrw#Open(trim(<q-args>))
+
+" }}}
+" Local Browsing Autocmds: {{{
+
+augroup FileExplorer
+ au!
+ au BufLeave * if &ft != "netrw"|let w:netrw_prvfile= expand("%:p")|endif
+ au BufEnter * sil call s:LocalBrowse(expand("<amatch>"))
+ au VimEnter * sil call s:VimEnter(expand("<amatch>"))
+ if has("win32")
+ au BufEnter .* sil call s:LocalBrowse(expand("<amatch>"))
+ endif
+augroup END
+
+" }}}
+" Network Browsing Reading Writing: {{{
+
+augroup Network
+ au!
+ au BufReadCmd file://* call netrw#FileUrlEdit(expand("<amatch>"))
+ au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>"))
+ au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>"))
+ au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
+ au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
+ try
+ au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
+ catch /^Vim\%((\a\+)\)\=:E216/
+ au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
+ endtry
+augroup END
+
+" }}}
+" Commands: :Nread, :Nwrite, :NetUserPass {{{
+
+command! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos)
+command! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos)
+command! -nargs=* NetUserPass call NetUserPass(<f-args>)
+command! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos)
+command! -nargs=? Ntree call netrw#SetTreetop(1,<q-args>)
+
+" }}}
+" Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{
+
+command! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>, 0, 0+<bang>0, <q-args>)
+command! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(<count>, 1, 0+<bang>0, <q-args>)
+command! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>, 1, 2+<bang>0, <q-args>)
+command! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<count>, 1, 4+<bang>0, <q-args>)
+command! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>, 0, 6, <q-args>)
+command! -nargs=* -bar -bang -count=0 -complete=dir Lexplore call netrw#Lexplore(<count>, <bang>0, <q-args>)
+command! -nargs=* -bar -bang Nexplore call netrw#Explore(-1, 0, 0, <q-args>)
+command! -nargs=* -bar -bang Pexplore call netrw#Explore(-2, 0, 0, <q-args>)
+
+" }}}
+" Commands: NetrwSettings {{{
+
+command! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings()
+command! -bang NetrwClean call netrw#Clean(<bang>0)
+
+" }}}
+" Maps: {{{
+
+if !exists("g:netrw_nogx")
+ if maparg('gx','n') == ""
+ if !hasmapto('<Plug>NetrwBrowseX')
+ nmap <unique> gx <Plug>NetrwBrowseX
+ endif
+ nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr>
+ endif
+ if maparg('gx','x') == ""
+ if !hasmapto('<Plug>NetrwBrowseXVis')
+ xmap <unique> gx <Plug>NetrwBrowseXVis
+ endif
+ xno <silent> <Plug>NetrwBrowseXVis :<c-u>call netrw#BrowseXVis()<cr>
+ endif
+endif
+
+if exists("g:netrw_usetab") && g:netrw_usetab
+ if maparg('<c-tab>','n') == ""
+ nmap <unique> <c-tab> <Plug>NetrwShrink
+ endif
+ nno <silent> <Plug>NetrwShrink :call netrw#Shrink()<cr>
+endif
+
+" }}}
+" LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{
+
+function! s:LocalBrowse(dirname)
+ " do not trigger in the terminal
+ " https://github.com/vim/vim/issues/16463
+ if &buftype ==# 'terminal'
+ return
+ endif
+
+ if !exists("s:vimentered")
+ " If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will,
+ " and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined.
+ return
+ endif
+
+ if has("amiga")
+ " The check against '' is made for the Amiga, where the empty
+ " string is the current directory and not checking would break
+ " things such as the help command.
+ if a:dirname != '' && isdirectory(a:dirname)
+ sil! call netrw#LocalBrowseCheck(a:dirname)
+ if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt
+ exe w:netrw_bannercnt
+ endif
+ endif
+ elseif isdirectory(a:dirname)
+ " Jul 13, 2021: for whatever reason, preceding the following call with
+ " a sil! causes an unbalanced if-endif vim error
+ call netrw#LocalBrowseCheck(a:dirname)
+ if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt
+ exe w:netrw_bannercnt
+ endif
+ endif
+endfunction
+
+" }}}
+" s:VimEnter: after all vim startup stuff is done, this function is called. {{{
+" Its purpose: to look over all windows and run s:LocalBrowse() on
+" them, which checks if they're directories and will create a directory
+" listing when appropriate.
+" It also sets s:vimentered, letting s:LocalBrowse() know that s:VimEnter()
+" has already been called.
+function! s:VimEnter(dirname)
+ if has('nvim') || v:version < 802
+ " Johann Höchtl: reported that the call range... line causes an E488: Trailing characters
+ " error with neovim. I suspect its because neovim hasn't updated with recent
+ " vim patches. As is, this code will have problems with popup terminals
+ " instantiated before the VimEnter event runs.
+ " Ingo Karkat : E488 also in Vim 8.1.1602
+ let curwin = winnr()
+ let s:vimentered = 1
+ windo call s:LocalBrowse(expand("%:p"))
+ exe curwin."wincmd w"
+ else
+ " the following complicated expression comes courtesy of lacygoill; largely does the same thing as the windo and
+ " wincmd which are commented out, but avoids some side effects. Allows popup terminal before VimEnter.
+ let s:vimentered = 1
+ call range(1, winnr('$'))->map({_, v -> win_execute(win_getid(v), 'call expand("%:p")->s:LocalBrowse()')})
+ endif
+endfunction
+
+" }}}
+" NetrwStatusLine: {{{
+
+function! NetrwStatusLine()
+ if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list")
+ let &stl= s:netrw_explore_stl
+ unlet! w:netrw_explore_bufnr w:netrw_explore_line
+ return ""
+ else
+ return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
+ endif
+endfunction
+
+" }}}
+" NetUserPass: set username and password for subsequent ftp transfer {{{
+" Usage: :call NetUserPass() -- will prompt for userid and password
+" :call NetUserPass("uid") -- will prompt for password
+" :call NetUserPass("uid","password") -- sets global userid and password
+function! NetUserPass(...)
+ " get/set userid
+ if a:0 == 0
+ if !exists("g:netrw_uid") || g:netrw_uid == ""
+ " via prompt
+ let g:netrw_uid= input('Enter username: ')
+ endif
+ else " from command line
+ let g:netrw_uid= a:1
+ endif
+
+ " get password
+ if a:0 <= 1 " via prompt
+ let g:netrw_passwd= inputsecret("Enter Password: ")
+ else " from command line
+ let g:netrw_passwd=a:2
+ endif
+endfunction
+
+" }}}
+
+let &cpo= s:keepcpo
+unlet s:keepcpo
+
+" vim:ts=8 sts=4 sw=4 et fdm=marker
diff --git a/runtime/pack/dist/opt/netrw/syntax/netrw.vim b/runtime/pack/dist/opt/netrw/syntax/netrw.vim
new file mode 100644
index 0000000000..8042854a12
--- /dev/null
+++ b/runtime/pack/dist/opt/netrw/syntax/netrw.vim
@@ -0,0 +1,149 @@
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Former Maintainer: Charles E Campbell
+" Upstream: <https://github.com/saccarosium/netrw.vim>
+" Language: Netrw Listing Syntax
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let b:current_syntax = "netrwlist"
+
+" Directory List Syntax Highlighting: {{{
+
+syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt
+syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe
+
+syn match netrwPlain "\(\S\+ \)*\S\+" contains=netrwLink,@NoSpell
+syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
+syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell
+syn match netrwDir "\%(\S\+ \)*\S\+/\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
+syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime
+syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
+syn match netrwExe "\%(\S\+ \)*\S*[^~]\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
+if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4')
+ syn match netrwTreeBar "^\%([-+|│] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
+else
+ syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
+endif
+syn match netrwTreeBarSpace " " contained
+
+syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained
+syn match netrwDateSep "/" contained
+syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep
+syn match netrwTimeSep ":"
+
+syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup,@NoSpell
+syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite contains=@NoSpell nextgroup=netrwHidePat
+syn match netrwSlash "/" contained
+syn match netrwHidePat "[^,]\+" contained skipwhite contains=@NoSpell nextgroup=netrwHideSep
+syn match netrwHideSep "," contained skipwhite nextgroup=netrwHidePat
+syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
+syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
+syn match netrwCopyTgt "Copy/Move Tgt:" contained transparent skipwhite nextgroup=netrwList
+syn match netrwList ".*$" contained contains=netrwComma,@NoSpell
+syn match netrwComma "," contained
+syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd,netrwQHTopic,@NoSpell keepend contained
+syn match netrwHelpCmd "\S\+\ze:" contained skipwhite contains=@NoSpell nextgroup=netrwCmdSep
+syn match netrwQHTopic "([a-zA-Z &]\+)" contained skipwhite
+syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote
+syn match netrwCmdNote ".\{-}\ze " contained contains=@NoSpell
+syn match netrwVersion "(netrw.*)" contained contains=@NoSpell
+syn match netrwLink "-->" contained skipwhite
+
+" }}}
+" Special filetype highlighting {{{
+
+if exists("g:netrw_special_syntax") && g:netrw_special_syntax
+ if exists("+suffixes") && &suffixes != ""
+ let suflist= join(split(&suffixes,','))
+ let suflist= escape(substitute(suflist," ",'\\|','g'),'.~')
+ exe "syn match netrwSpecFile '\\(\\S\\+ \\)*\\S*\\(".suflist."\\)\\>' contains=netrwTreeBar,@NoSpell"
+ endif
+ syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar,@NoSpell
+ if has("unix")
+ syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell
+ endif
+ syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\|docx\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwHdr "\(\S\+ \)*\S\+\.\%(h\|hpp\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwPix "\c\(\S\+ \)*\S*\.\%(bmp\|fits\=\|gif\|je\=pg\|pcx\|ppc\|pgm\|png\|ppm\|psd\|rgb\|tif\|xbm\|xcf\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell
+ syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell
+endif
+
+" }}}
+" Highlighting Links: {{{
+
+if !exists("did_drchip_netrwlist_syntax")
+ let did_drchip_netrwlist_syntax= 1
+ hi default link netrwClassify Function
+ hi default link netrwCmdSep Delimiter
+ hi default link netrwComment Comment
+ hi default link netrwDir Directory
+ hi default link netrwHelpCmd Function
+ hi default link netrwQHTopic Number
+ hi default link netrwHidePat Statement
+ hi default link netrwHideSep netrwComment
+ hi default link netrwList Statement
+ hi default link netrwVersion Identifier
+ hi default link netrwSymLink Question
+ hi default link netrwExe PreProc
+ hi default link netrwDateSep Delimiter
+
+ hi default link netrwTreeBar Special
+ hi default link netrwTimeSep netrwDateSep
+ hi default link netrwComma netrwComment
+ hi default link netrwHide netrwComment
+ hi default link netrwMarkFile TabLineSel
+ hi default link netrwLink Special
+
+ " special syntax highlighting (see :he g:netrw_special_syntax)
+ hi default link netrwCoreDump WarningMsg
+ hi default link netrwData Folded
+ hi default link netrwHdr netrwPlain
+ hi default link netrwLex netrwPlain
+ hi default link netrwLib DiffChange
+ hi default link netrwMakefile DiffChange
+ hi default link netrwYacc netrwPlain
+ hi default link netrwPix Special
+
+ hi default link netrwBak netrwGray
+ hi default link netrwCompress netrwGray
+ hi default link netrwSpecFile netrwGray
+ hi default link netrwObj netrwGray
+ hi default link netrwTags netrwGray
+ hi default link netrwTilde netrwGray
+ hi default link netrwTmp netrwGray
+endif
+
+" set up netrwGray to be understated (but not Ignore'd or Conceal'd, as those
+" can be hard/impossible to read). Users may override this in a colorscheme by
+" specifying netrwGray highlighting.
+redir => s:netrwgray
+sil hi netrwGray
+redir END
+
+if s:netrwgray !~ 'guifg'
+ if has("gui") && has("gui_running")
+ if &bg == "dark"
+ exe "hi netrwGray gui=NONE guifg=gray30"
+ else
+ exe "hi netrwGray gui=NONE guifg=gray70"
+ endif
+ else
+ hi link netrwGray Folded
+ endif
+endif
+
+" }}}
+
+" vim:ts=8 sts=4 sw=4 et fdm=marker
diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim
index d534b36966..6d7a8660ff 100644
--- a/runtime/plugin/netrwPlugin.vim
+++ b/runtime/plugin/netrwPlugin.vim
@@ -1,234 +1,9 @@
-" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
-" PLUGIN SECTION
-" Maintainer: This runtime file is looking for a new maintainer.
-" Date: Sep 09, 2021
-" Last Change:
-" 2024 May 08 by Vim Project: cleanup legacy Win9X checks
-" 2024 Oct 27 by Vim Project: cleanup gx mapping
-" 2024 Oct 28 by Vim Project: further improvements
-" 2024 Oct 31 by Vim Project: use autoloaded functions
-" 2024 Dec 19 by Vim Project: change style (#16248)
-" Former Maintainer: Charles E Campbell
-" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
-" Copyright: Copyright (C) 1999-2021 Charles E. Campbell {{{1
-" Permission is hereby granted to use and distribute this code,
-" with or without modifications, provided that this copyright
-" notice is copied with it. Like anything else that's free,
-" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided
-" *as is* and comes with no warranty of any kind, either
-" expressed or implied. By using this plugin, you agree that
-" in no event will the copyright holder be liable for any damages
-" resulting from the use of this software.
-"
-" But be doers of the Word, and not only hearers, deluding your own selves {{{1
-" (James 1:22 RSV)
-" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-" Load Once: {{{1
-if &cp || exists("g:loaded_netrwPlugin")
- finish
-endif
-let g:loaded_netrwPlugin = "v173"
-let s:keepcpo = &cpo
-set cpo&vim
-"DechoRemOn
-
-" ---------------------------------------------------------------------
-" Public Interface: {{{1
-
-" Commands Launch/URL {{{2
-command -complete=shellcmd -nargs=1 Launch call netrw#Launch(trim(<q-args>))
-command -complete=file -nargs=1 Open call netrw#Open(trim(<q-args>))
-" " }}}
-" Local Browsing Autocmds: {{{2
-augroup FileExplorer
- au!
- au BufLeave * if &ft != "netrw"|let w:netrw_prvfile= expand("%:p")|endif
- au BufEnter * sil call s:LocalBrowse(expand("<amatch>"))
- au VimEnter * sil call s:VimEnter(expand("<amatch>"))
- if has("win32")
- au BufEnter .* sil call s:LocalBrowse(expand("<amatch>"))
- endif
-augroup END
-
-" Network Browsing Reading Writing: {{{2
-augroup Network
- au!
- au BufReadCmd file://* call netrw#FileUrlEdit(expand("<amatch>"))
- au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>"))
- au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>"))
- au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
- au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
- try
- au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
- catch /^Vim\%((\a\+)\)\=:E216/
- au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
- endtry
-augroup END
-
-" Commands: :Nread, :Nwrite, :NetUserPass {{{2
-com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos)
-com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos)
-com! -nargs=* NetUserPass call NetUserPass(<f-args>)
-com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos)
-com! -nargs=? Ntree call netrw#SetTreetop(1,<q-args>)
+" Load the netrw package.
-" Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2
-com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
-com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>)
-com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>)
-com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<count>,1,4+<bang>0,<q-args>)
-com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>)
-com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>)
-com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>)
-com! -nargs=* -bar -bang -count=0 -complete=dir Lexplore call netrw#Lexplore(<count>,<bang>0,<q-args>)
-
-" Commands: NetrwSettings {{{2
-com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings()
-com! -bang NetrwClean call netrw#Clean(<bang>0)
-
-" Maps:
-if !exists("g:netrw_nogx")
- if maparg('gx','n') == ""
- if !hasmapto('<Plug>NetrwBrowseX')
- nmap <unique> gx <Plug>NetrwBrowseX
- endif
- nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr>
- endif
- if maparg('gx','x') == ""
- if !hasmapto('<Plug>NetrwBrowseXVis')
- xmap <unique> gx <Plug>NetrwBrowseXVis
- endif
- xno <silent> <Plug>NetrwBrowseXVis :<c-u>call netrw#BrowseXVis()<cr>
- endif
-endif
-if exists("g:netrw_usetab") && g:netrw_usetab
- if maparg('<c-tab>','n') == ""
- nmap <unique> <c-tab> <Plug>NetrwShrink
- endif
- nno <silent> <Plug>NetrwShrink :call netrw#Shrink()<cr>
+if &cp || exists("g:loaded_netrw") || exists("g:loaded_netrwPlugin")
+ finish
endif
-" ---------------------------------------------------------------------
-" LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2
-fun! s:LocalBrowse(dirname)
- " Unfortunate interaction -- only DechoMsg debugging calls can be safely used here.
- " Otherwise, the BufEnter event gets triggered when attempts to write to
- " the DBG buffer are made.
-
- if !exists("s:vimentered")
- " If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will,
- " and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined.
- " call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered doesn't exist)")
- " call Dret("s:LocalBrowse")
- return
- endif
-
- " call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered=".s:vimentered.")")
-
- if has("amiga")
- " The check against '' is made for the Amiga, where the empty
- " string is the current directory and not checking would break
- " things such as the help command.
- " call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)")
- if a:dirname != '' && isdirectory(a:dirname)
- sil! call netrw#LocalBrowseCheck(a:dirname)
- if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt
- exe w:netrw_bannercnt
- endif
- endif
-
- elseif isdirectory(a:dirname)
- " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)")
- " call Dredir("LocalBrowse ft last set: ","verbose set ft")
- " Jul 13, 2021: for whatever reason, preceding the following call with
- " a sil! causes an unbalanced if-endif vim error
- call netrw#LocalBrowseCheck(a:dirname)
- if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt
- exe w:netrw_bannercnt
- endif
-
- else
- " not a directory, ignore it
- " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...")
- endif
-
- " call Dret("s:LocalBrowse")
-endfun
-
-" ---------------------------------------------------------------------
-" s:VimEnter: after all vim startup stuff is done, this function is called. {{{2
-" Its purpose: to look over all windows and run s:LocalBrowse() on
-" them, which checks if they're directories and will create a directory
-" listing when appropriate.
-" It also sets s:vimentered, letting s:LocalBrowse() know that s:VimEnter()
-" has already been called.
-fun! s:VimEnter(dirname)
- " call Dfunc("s:VimEnter(dirname<".a:dirname.">) expand(%)<".expand("%").">")
- if has('nvim') || v:version < 802
- " Johann Höchtl: reported that the call range... line causes an E488: Trailing characters
- " error with neovim. I suspect its because neovim hasn't updated with recent
- " vim patches. As is, this code will have problems with popup terminals
- " instantiated before the VimEnter event runs.
- " Ingo Karkat : E488 also in Vim 8.1.1602
- let curwin = winnr()
- let s:vimentered = 1
- windo call s:LocalBrowse(expand("%:p"))
- exe curwin."wincmd w"
- else
- " the following complicated expression comes courtesy of lacygoill; largely does the same thing as the windo and
- " wincmd which are commented out, but avoids some side effects. Allows popup terminal before VimEnter.
- let s:vimentered = 1
- call range(1, winnr('$'))->map({_, v -> win_execute(win_getid(v), 'call expand("%:p")->s:LocalBrowse()')})
- endif
- " call Dret("s:VimEnter")
-endfun
-
-" ---------------------------------------------------------------------
-" NetrwStatusLine: {{{1
-fun! NetrwStatusLine()
- " let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".")
- if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list")
- let &stl= s:netrw_explore_stl
- if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
- if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
- return ""
- else
- return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
- endif
-endfun
-
-" ------------------------------------------------------------------------
-" NetUserPass: set username and password for subsequent ftp transfer {{{1
-" Usage: :call NetUserPass() -- will prompt for userid and password
-" :call NetUserPass("uid") -- will prompt for password
-" :call NetUserPass("uid","password") -- sets global userid and password
-fun! NetUserPass(...)
-
- " get/set userid
- if a:0 == 0
- " call Dfunc("NetUserPass(a:0<".a:0.">)")
- if !exists("g:netrw_uid") || g:netrw_uid == ""
- " via prompt
- let g:netrw_uid= input('Enter username: ')
- endif
- else " from command line
- " call Dfunc("NetUserPass(a:1<".a:1.">) {")
- let g:netrw_uid= a:1
- endif
-
- " get password
- if a:0 <= 1 " via prompt
- " call Decho("a:0=".a:0." case <=1:")
- let g:netrw_passwd= inputsecret("Enter Password: ")
- else " from command line
- " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
- let g:netrw_passwd=a:2
- endif
- " call Dret("NetUserPass")
-endfun
+packadd netrw
-" ------------------------------------------------------------------------
-" Modelines And Restoration: {{{1
-let &cpo= s:keepcpo
-unlet s:keepcpo
-" vim:ts=8 sts=2 sw=2 et fdm=marker
+" vim:ts=8 sts=2 sw=2 et
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 30db9438d0..68b6778c73 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
-" Language: C
-" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Language: C
+" Maintainer: The Vim Project <https://github.com/vim/vim>
+" Last Change: 2025 Jan 18
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Quit when a (custom) syntax file was already loaded
@@ -111,6 +111,20 @@ if (s:ft ==# "c" && !exists("c_no_c11")) || (s:in_cpp_family && !exists("cpp_no_
syn match cSpecialCharacter display "[Uu]'\\x\x\+'"
endif
+if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp17"))
+ syn match cCharacter "u8'[^\\]'"
+ syn match cCharacter "u8'[^']*'" contains=cSpecial
+ if exists("c_gnu")
+ syn match cSpecialError "u8'\\[^'\"?\\abefnrtv]'"
+ syn match cSpecialCharacter "u8'\\['\"?\\abefnrtv]'"
+ else
+ syn match cSpecialError "u8'\\[^'\"?\\abfnrtv]'"
+ syn match cSpecialCharacter "u8'\\['\"?\\abfnrtv]'"
+ endif
+ syn match cSpecialCharacter display "u8'\\\o\{1,3}'"
+ syn match cSpecialCharacter display "u8'\\x\x\+'"
+endif
+
"when wanted, highlight trailing white space
if exists("c_space_errors")
if !exists("c_no_trail_space_error")
@@ -191,12 +205,25 @@ syn case ignore
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
" Same, but without octal error (for comments)
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
-syn match cNumber display contained "\d\+\%(u\=l\{0,2}\|ll\=u\)\>"
-"hex number
-syn match cNumber display contained "0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>"
-" Flag the first zero of an octal number as something special
-syn match cOctal display contained "0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
-syn match cOctalZero display contained "\<0"
+
+" cpp.vim handles these
+if !exists("c_no_c23") && !s:in_cpp_family
+ syn match cNumber display contained "\d\%('\=\d\+\)*\%(u\=l\{0,2}\|ll\=u\|u\=wb\|wbu\=\)\>"
+ "hex number
+ syn match cNumber display contained "0x\x\%('\=\x\+\)*\%(u\=l\{0,2}\|ll\=u\|u\=wb\|wbu\=\)\>"
+ " Flag the first zero of an octal number as something special
+ syn match cOctal display contained "0\o\%('\=\o\+\)*\%(u\=l\{0,2}\|ll\=u\|u\=wb\|wbu\=\)\>" contains=cOctalZero
+ "binary number
+ syn match cNumber display contained "0b[01]\%('\=[01]\+\)*\%(u\=l\{0,2}\|ll\=u\|u\=wb\|wbu\=\)\>"
+else
+ syn match cNumber display contained "\d\+\%(u\=l\{0,2}\|ll\=u\)\>"
+ "hex number
+ syn match cNumber display contained "0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>"
+ " Flag the first zero of an octal number as something special
+ syn match cOctal display contained "0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
+ syn match cOctalZero display contained "\<0"
+endif
+
"floating point number, with dot, optional exponent
syn match cFloat display contained "\d\+\.\d*\%(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
@@ -277,6 +304,13 @@ if !exists("c_no_c99") " ISO C99
syn keyword cType intptr_t uintptr_t
syn keyword cType intmax_t uintmax_t
endif
+if !exists("c_no_c23") && !s:in_cpp_family
+ syn keyword cOperator typeof typeof_unqual
+ syn keyword cType _BitInt _Decimal32 _Decimal64 _Decimal128
+endif
+if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp11"))
+ syn keyword cType nullptr_t
+endif
syn keyword cTypedef typedef
syn keyword cStructure struct union enum
@@ -284,6 +318,9 @@ syn keyword cStorageClass static register auto volatile extern const
if !exists("c_no_c99") && !s:in_cpp_family
syn keyword cStorageClass inline restrict
endif
+if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp11"))
+ syn keyword cStorageClass constexpr
+endif
if !exists("c_no_c11")
syn keyword cStorageClass _Alignas alignas
syn keyword cOperator _Alignof alignof
@@ -312,10 +349,15 @@ if !exists("c_no_c11")
syn keyword cType atomic_intmax_t atomic_uintmax_t
endif
+if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp20"))
+ syn keyword cType char8_t
+endif
+
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
if exists("c_gnu")
syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__ __func__
endif
+ " TODO: __STDC_HOSTED__ is C99 and C++11
syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__ __STDC_VERSION__ __STDC_HOSTED__
syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX
syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
@@ -324,6 +366,8 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
if !exists("c_no_c99")
+ syn keyword cConstant __STDC_ISO_10646__ __STDC_IEC_559_COMPLEX__
+ syn keyword cConstant __STDC_MB_MIGHT_NEQ_WC__
syn keyword cConstant __func__ __VA_ARGS__
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
@@ -340,6 +384,26 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX
syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX
endif
+ if !exists("c_no_c11")
+ syn keyword cConstant __STDC_UTF_16__ __STDC_UTF_32__ __STDC_ANALYZABLE__
+ syn keyword cConstant __STDC_LIB_EXT1__ __STDC_NO_ATOMICS__
+ syn keyword cConstant __STDC_NO_COMPLEX__ __STDC_NO_THREADS__
+ syn keyword cConstant __STDC_NO_VLA__
+ endif
+ if !exists("c_no_c23")
+ syn keyword cConstant __STDC_UTF_16__ __STDC_UTF_32__
+ syn keyword cConstant __STDC_EMBED_NOT_FOUND__ __STDC_EMBED_FOUND__
+ syn keyword cConstant __STDC_EMBED_EMPTY__ __STDC_IEC_60559_BFP__
+ syn keyword cConstant __STDC_IEC_60559_DFP__ __STDC_IEC_60559_COMPLEX__
+ syn keyword cConstant __STDC_IEC_60559_TYPES__
+ syn keyword cConstant BITINT_MAXWIDTH
+ endif
+ if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp20"))
+ syn keyword cConstant __VA_OPT__
+ endif
+ if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp11"))
+ syn keyword cConstant nullptr
+ endif
syn keyword cConstant FLT_RADIX FLT_ROUNDS FLT_DIG FLT_MANT_DIG FLT_EPSILON DBL_DIG DBL_MANT_DIG DBL_EPSILON
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP FLT_MIN_10_EXP FLT_MAX_10_EXP
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP DBL_MIN_10_EXP DBL_MAX_10_EXP LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
@@ -377,37 +441,77 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
endif
if !exists("c_no_c99") " ISO C99
syn keyword cConstant true false
+ syn keyword cConstant INFINITY NAN
+ " math.h
+ syn keyword cConstant HUGE_VAL HUGE_VALF HUGE_VALL
+ syn keyword cConstant FP_FAST_FMAF FP_FAST_FMA FP_FAST_FMAL
+ syn keyword cConstant FP_ILOGB0 FP_ILOGBNAN
+ syn keyword cConstant math_errhandling MATH_ERRNO MATH_ERREXCEPT
+ syn keyword cConstant FP_NORMAL FP_SUBNORMAL FP_ZERO FP_INFINITE FP_NAN
endif
" Accept %: for # (C99)
-syn region cPreCondit start="^\s*\zs\%(%:\|#\)\s*\%(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
+syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock
+if !exists("c_no_c23")
+ syn region cPreCondit start="^\s*\zs\%(%:\|#\)\s*\%(el\)\=\%(if\|ifdef\|ifndef\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
+else
+ syn region cPreCondit start="^\s*\zs\%(%:\|#\)\s*\%(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
+endif
syn match cPreConditMatch display "^\s*\zs\%(%:\|#\)\s*\%(else\|endif\)\>"
if !exists("c_no_if0")
syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip
syn region cCppOutWrapper start="^\s*\zs\%(%:\|#\)\s*if\s\+0\+\s*\%($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\%(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
if !exists("c_no_if0_fold")
- syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
+ if !exists("c_no_c23")
+ syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|el\%(if\|ifdef\|ifndef\)\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
+ else
+ syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
+ endif
+ else
+ if !exists("c_no_c23")
+ syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|el\%(if\|ifdef\|ifndef\)\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
+ else
+ syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
+ endif
+ endif
+ if !exists("c_no_c23")
+ syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\%(%:\|#\)\s*\%(else\|el\%(if\|ifdef\|ifndef\)\)" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
else
- syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
+ syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\%(%:\|#\)\s*\%(else\|elif\)" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
endif
- syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\%(%:\|#\)\s*\%(else\|elif\)" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
syn region cCppInWrapper start="^\s*\zs\%(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\%($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold
syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\%(%:\|#\)\s*endif\>" contains=TOP,cPreCondit
if !exists("c_no_if0_fold")
- syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
+ if !exists("c_no_c23")
+ syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|el\%(if\|ifdef\|ifndef\)\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
+ else
+ syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
+ endif
else
- syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
+ if !exists("c_no_c23")
+ syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|el\%(if\|ifdef\|ifndef\)\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
+ else
+ syn region cCppInElse contained start="^\s*\%(%:\|#\)\s*\%(else\>\|elif\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
+ endif
+ endif
+ if !exists("c_no_c23")
+ syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\%(%:\|#\)\s*\%(else\|el\%(if\|ifdef\|ifndef\)\)\%([^/]\|/[^/*]\)*" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
+ else
+ syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\%(%:\|#\)\s*\%(else\|elif\)\%([^/]\|/[^/*]\)*" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
endif
- syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\%(%:\|#\)\s*\%(else\|elif\)\%([^/]\|/[^/*]\)*" end="^\s*\%(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
syn region cCppOutSkip contained start="^\s*\%(%:\|#\)\s*\%(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\%(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip
syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\%(%:\|#\)\s*\%(if\s\+\%(\d\+\s*\%($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\%(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc
endif
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>"
syn match cInclude display "^\s*\zs\%(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
+if !exists("c_no_c23") && !s:in_cpp_family
+ syn region cInclude start="^\s*\zs\%(%:\|#\)\s*embed\>" skip="\\$" end="$" keepend contains=cEmbed,cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
+ syn match cEmbed contained "\%(%:\|#\)\s*embed\>" nextgroup=cIncluded skipwhite transparent
+ syn cluster cPreProcGroup add=cEmbed
+endif
"syn match cLineSkip "\\$"
-syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock
syn region cDefine start="^\s*\zs\%(%:\|#\)\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
syn region cPreProc start="^\s*\zs\%(%:\|#\)\s*\%(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
diff --git a/runtime/syntax/kconfig.vim b/runtime/syntax/kconfig.vim
index 0aecc00060..64a47a5995 100644
--- a/runtime/syntax/kconfig.vim
+++ b/runtime/syntax/kconfig.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2024-07-19
+" Latest Revision: 2025 Jan 20
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-kconfig
@@ -12,722 +12,722 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+exe "syn sync minlines=" . get(g:, 'kconfig_minlines', 50)
+
if exists("g:kconfig_syntax_heavy")
-syn match kconfigBegin '^' nextgroup=kconfigKeyword
- \ skipwhite
-
-syn keyword kconfigTodo contained TODO FIXME XXX NOTE
-
-syn match kconfigComment display '#.*$' contains=kconfigTodo
-
-syn keyword kconfigKeyword config nextgroup=kconfigSymbol
- \ skipwhite
-
-syn keyword kconfigKeyword menuconfig nextgroup=kconfigSymbol
- \ skipwhite
-
-syn keyword kconfigKeyword comment menu mainmenu
- \ nextgroup=kconfigKeywordPrompt
- \ skipwhite
-
-syn keyword kconfigKeyword choice
- \ nextgroup=@kconfigConfigOptions
- \ skipwhite skipnl
-
-syn keyword kconfigKeyword endmenu endchoice
-
-syn keyword kconfigPreProc source
- \ nextgroup=kconfigPath
- \ skipwhite
-
-" TODO: This is a hack. The who .*Expr stuff should really be generated so
-" that we can reuse it for various nextgroups.
-syn keyword kconfigConditional if endif
- \ nextgroup=@kconfigConfigOptionIfExpr
- \ skipwhite
-
-syn match kconfigKeywordPrompt '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=@kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigPath '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
- \ contained
-
-syn match kconfigSymbol '\<\k\+\>'
- \ contained
- \ nextgroup=@kconfigConfigOptions
- \ skipwhite skipnl
-
-" FIXME: There is – probably – no reason to cluster these instead of just
-" defining them in the same group.
-syn cluster kconfigConfigOptions contains=kconfigTypeDefinition,
- \ kconfigInputPrompt,
- \ kconfigDefaultValue,
- \ kconfigDependencies,
- \ kconfigReverseDependencies,
- \ kconfigNumericalRanges,
- \ kconfigHelpText,
- \ kconfigDefBool,
- \ kconfigOptional
-
-syn keyword kconfigTypeDefinition bool boolean tristate string hex int
- \ contained
- \ nextgroup=kconfigTypeDefPrompt,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigTypeDefPrompt '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigTypeDefPrompt "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn keyword kconfigInputPrompt prompt
- \ contained
- \ nextgroup=kconfigPromptPrompt
- \ skipwhite
-
-syn match kconfigPromptPrompt '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigPromptPrompt "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn keyword kconfigDefaultValue default
- \ contained
- \ nextgroup=@kconfigConfigOptionExpr
- \ skipwhite
-
-syn match kconfigDependencies 'depends on\|requires'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfExpr
- \ skipwhite
-
-syn keyword kconfigReverseDependencies select
- \ contained
- \ nextgroup=@kconfigRevDepSymbol
- \ skipwhite
-
-syn cluster kconfigRevDepSymbol contains=kconfigRevDepCSymbol,
- \ kconfigRevDepNCSymbol
-
-syn match kconfigRevDepCSymbol '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigRevDepCSymbol "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigRevDepNCSymbol '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn keyword kconfigNumericalRanges range
- \ contained
- \ nextgroup=@kconfigRangeSymbol
- \ skipwhite
-
-syn cluster kconfigRangeSymbol contains=kconfigRangeCSymbol,
- \ kconfigRangeNCSymbol
-
-syn match kconfigRangeCSymbol '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=@kconfigRangeSymbol2
- \ skipwhite skipnl
-
-syn match kconfigRangeCSymbol "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=@kconfigRangeSymbol2
- \ skipwhite skipnl
-
-syn match kconfigRangeNCSymbol '\<\k\+\>'
- \ contained
- \ nextgroup=@kconfigRangeSymbol2
- \ skipwhite skipnl
-
-syn cluster kconfigRangeSymbol2 contains=kconfigRangeCSymbol2,
- \ kconfigRangeNCSymbol2
-
-syn match kconfigRangeCSymbol2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigRangeNCSymbol2 '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn region kconfigHelpText contained
- \ matchgroup=kconfigConfigOption
- \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
- \ skip='^$'
- \ end='^\z1\@!'
- \ nextgroup=@kconfigConfigOptions
- \ skipwhite skipnl
-
-" XXX: Undocumented
-syn keyword kconfigDefBool def_bool
- \ contained
- \ nextgroup=@kconfigDefBoolSymbol
- \ skipwhite
-
-syn cluster kconfigDefBoolSymbol contains=kconfigDefBoolCSymbol,
- \ kconfigDefBoolNCSymbol
-
-syn match kconfigDefBoolCSymbol '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigDefBoolCSymbol "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigDefBoolNCSymbol '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-" XXX: This is actually only a valid option for “choice”, but treating it
-" specially would require a lot of extra groups.
-syn keyword kconfigOptional optional
- \ contained
- \ nextgroup=@kconfigConfigOptions
- \ skipwhite skipnl
-
-syn keyword kconfigConfigOptionIf if
- \ contained
- \ nextgroup=@kconfigConfigOptionIfExpr
- \ skipwhite
-
-syn cluster kconfigConfigOptionIfExpr contains=@kconfigConfOptIfExprSym,
- \ kconfigConfOptIfExprNeg,
- \ kconfigConfOptIfExprGroup
-
-syn cluster kconfigConfOptIfExprSym contains=kconfigConfOptIfExprCSym,
- \ kconfigConfOptIfExprNCSym
-
-syn match kconfigConfOptIfExprCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=@kconfigConfigOptions,
- \ kconfigConfOptIfExprAnd,
- \ kconfigConfOptIfExprOr,
- \ kconfigConfOptIfExprEq,
- \ kconfigConfOptIfExprNEq
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfExprCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=@kconfigConfigOptions,
- \ kconfigConfOptIfExprAnd,
- \ kconfigConfOptIfExprOr,
- \ kconfigConfOptIfExprEq,
- \ kconfigConfOptIfExprNEq
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfExprNCSym '\<\k\+\>'
- \ contained
- \ nextgroup=@kconfigConfigOptions,
- \ kconfigConfOptIfExprAnd,
- \ kconfigConfOptIfExprOr,
- \ kconfigConfOptIfExprEq,
- \ kconfigConfOptIfExprNEq
- \ skipwhite skipnl
-
-syn cluster kconfigConfOptIfExprSym2 contains=kconfigConfOptIfExprCSym2,
- \ kconfigConfOptIfExprNCSym2
-
-syn match kconfigConfOptIfExprEq '='
- \ contained
- \ nextgroup=@kconfigConfOptIfExprSym2
- \ skipwhite
-
-syn match kconfigConfOptIfExprNEq '!='
- \ contained
- \ nextgroup=@kconfigConfOptIfExprSym2
- \ skipwhite
-
-syn match kconfigConfOptIfExprCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=@kconfigConfigOptions,
- \ kconfigConfOptIfExprAnd,
- \ kconfigConfOptIfExprOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfExprNCSym2 '\<\k\+\>'
- \ contained
- \ nextgroup=@kconfigConfigOptions,
- \ kconfigConfOptIfExprAnd,
- \ kconfigConfOptIfExprOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfExprNeg '!'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfExpr
- \ skipwhite
-
-syn match kconfigConfOptIfExprAnd '&&'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfExpr
- \ skipwhite
-
-syn match kconfigConfOptIfExprOr '||'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfExpr
- \ skipwhite
-
-syn match kconfigConfOptIfExprGroup '('
- \ contained
- \ nextgroup=@kconfigConfigOptionIfGExp
- \ skipwhite
-
-" TODO: hm, this kind of recursion doesn't work right. We need another set of
-" expressions that have kconfigConfigOPtionIfGExp as nextgroup and a matcher
-" for '(' that sets it all off.
-syn cluster kconfigConfigOptionIfGExp contains=@kconfigConfOptIfGExpSym,
- \ kconfigConfOptIfGExpNeg,
- \ kconfigConfOptIfExprGroup
-
-syn cluster kconfigConfOptIfGExpSym contains=kconfigConfOptIfGExpCSym,
- \ kconfigConfOptIfGExpNCSym
-
-syn match kconfigConfOptIfGExpCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=@kconfigConfigIf,
- \ kconfigConfOptIfGExpAnd,
- \ kconfigConfOptIfGExpOr,
- \ kconfigConfOptIfGExpEq,
- \ kconfigConfOptIfGExpNEq
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfGExpCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=@kconfigConfigIf,
- \ kconfigConfOptIfGExpAnd,
- \ kconfigConfOptIfGExpOr,
- \ kconfigConfOptIfGExpEq,
- \ kconfigConfOptIfGExpNEq
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfGExpNCSym '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfOptIfExprGrpE,
- \ kconfigConfOptIfGExpAnd,
- \ kconfigConfOptIfGExpOr,
- \ kconfigConfOptIfGExpEq,
- \ kconfigConfOptIfGExpNEq
- \ skipwhite skipnl
-
-syn cluster kconfigConfOptIfGExpSym2 contains=kconfigConfOptIfGExpCSym2,
- \ kconfigConfOptIfGExpNCSym2
-
-syn match kconfigConfOptIfGExpEq '='
- \ contained
- \ nextgroup=@kconfigConfOptIfGExpSym2
- \ skipwhite
-
-syn match kconfigConfOptIfGExpNEq '!='
- \ contained
- \ nextgroup=@kconfigConfOptIfGExpSym2
- \ skipwhite
-
-syn match kconfigConfOptIfGExpCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfOptIfExprGrpE,
- \ kconfigConfOptIfGExpAnd,
- \ kconfigConfOptIfGExpOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfGExpCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfOptIfExprGrpE,
- \ kconfigConfOptIfGExpAnd,
- \ kconfigConfOptIfGExpOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfGExpNCSym2 '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfOptIfExprGrpE,
- \ kconfigConfOptIfGExpAnd,
- \ kconfigConfOptIfGExpOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptIfGExpNeg '!'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfGExp
- \ skipwhite
-
-syn match kconfigConfOptIfGExpAnd '&&'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfGExp
- \ skipwhite
-
-syn match kconfigConfOptIfGExpOr '||'
- \ contained
- \ nextgroup=@kconfigConfigOptionIfGExp
- \ skipwhite
-
-syn match kconfigConfOptIfExprGrpE ')'
- \ contained
- \ nextgroup=@kconfigConfigOptions,
- \ kconfigConfOptIfExprAnd,
- \ kconfigConfOptIfExprOr
- \ skipwhite skipnl
-
-
-syn cluster kconfigConfigOptionExpr contains=@kconfigConfOptExprSym,
- \ kconfigConfOptExprNeg,
- \ kconfigConfOptExprGroup
-
-syn cluster kconfigConfOptExprSym contains=kconfigConfOptExprCSym,
- \ kconfigConfOptExprNCSym
-
-syn match kconfigConfOptExprCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr,
- \ kconfigConfOptExprEq,
- \ kconfigConfOptExprNEq,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigConfOptExprCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr,
- \ kconfigConfOptExprEq,
- \ kconfigConfOptExprNEq,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigConfOptExprNCSym '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr,
- \ kconfigConfOptExprEq,
- \ kconfigConfOptExprNEq,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn cluster kconfigConfOptExprSym2 contains=kconfigConfOptExprCSym2,
- \ kconfigConfOptExprNCSym2
-
-syn match kconfigConfOptExprEq '='
- \ contained
- \ nextgroup=@kconfigConfOptExprSym2
- \ skipwhite
-
-syn match kconfigConfOptExprNEq '!='
- \ contained
- \ nextgroup=@kconfigConfOptExprSym2
- \ skipwhite
-
-syn match kconfigConfOptExprCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigConfOptExprCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigConfOptExprNCSym2 '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr,
- \ @kconfigConfigOptions
- \ skipwhite skipnl
-
-syn match kconfigConfOptExprNeg '!'
- \ contained
- \ nextgroup=@kconfigConfigOptionExpr
- \ skipwhite
-
-syn match kconfigConfOptExprAnd '&&'
- \ contained
- \ nextgroup=@kconfigConfigOptionExpr
- \ skipwhite
-
-syn match kconfigConfOptExprOr '||'
- \ contained
- \ nextgroup=@kconfigConfigOptionExpr
- \ skipwhite
-
-syn match kconfigConfOptExprGroup '('
- \ contained
- \ nextgroup=@kconfigConfigOptionGExp
- \ skipwhite
-
-syn cluster kconfigConfigOptionGExp contains=@kconfigConfOptGExpSym,
- \ kconfigConfOptGExpNeg,
- \ kconfigConfOptGExpGroup
-
-syn cluster kconfigConfOptGExpSym contains=kconfigConfOptGExpCSym,
- \ kconfigConfOptGExpNCSym
-
-syn match kconfigConfOptGExpCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfOptExprGrpE,
- \ kconfigConfOptGExpAnd,
- \ kconfigConfOptGExpOr,
- \ kconfigConfOptGExpEq,
- \ kconfigConfOptGExpNEq
- \ skipwhite skipnl
-
-syn match kconfigConfOptGExpCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfOptExprGrpE,
- \ kconfigConfOptGExpAnd,
- \ kconfigConfOptGExpOr,
- \ kconfigConfOptGExpEq,
- \ kconfigConfOptGExpNEq
- \ skipwhite skipnl
-
-syn match kconfigConfOptGExpNCSym '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfOptExprGrpE,
- \ kconfigConfOptGExpAnd,
- \ kconfigConfOptGExpOr,
- \ kconfigConfOptGExpEq,
- \ kconfigConfOptGExpNEq
- \ skipwhite skipnl
-
-syn cluster kconfigConfOptGExpSym2 contains=kconfigConfOptGExpCSym2,
- \ kconfigConfOptGExpNCSym2
-
-syn match kconfigConfOptGExpEq '='
- \ contained
- \ nextgroup=@kconfigConfOptGExpSym2
- \ skipwhite
-
-syn match kconfigConfOptGExpNEq '!='
- \ contained
- \ nextgroup=@kconfigConfOptGExpSym2
- \ skipwhite
-
-syn match kconfigConfOptGExpCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
- \ contained
- \ nextgroup=kconfigConfOptExprGrpE,
- \ kconfigConfOptGExpAnd,
- \ kconfigConfOptGExpOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptGExpCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
- \ contained
- \ nextgroup=kconfigConfOptExprGrpE,
- \ kconfigConfOptGExpAnd,
- \ kconfigConfOptGExpOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptGExpNCSym2 '\<\k\+\>'
- \ contained
- \ nextgroup=kconfigConfOptExprGrpE,
- \ kconfigConfOptGExpAnd,
- \ kconfigConfOptGExpOr
- \ skipwhite skipnl
-
-syn match kconfigConfOptGExpNeg '!'
- \ contained
- \ nextgroup=@kconfigConfigOptionGExp
- \ skipwhite
-
-syn match kconfigConfOptGExpAnd '&&'
- \ contained
- \ nextgroup=@kconfigConfigOptionGExp
- \ skipwhite
-
-syn match kconfigConfOptGExpOr '||'
- \ contained
- \ nextgroup=@kconfigConfigOptionGExp
- \ skipwhite
-
-syn match kconfigConfOptExprGrpE ')'
- \ contained
- \ nextgroup=kconfigConfigOptionIf,
- \ kconfigConfOptExprAnd,
- \ kconfigConfOptExprOr
- \ skipwhite skipnl
-
-syn sync minlines=50
-
-hi def link kconfigTodo Todo
-hi def link kconfigComment Comment
-hi def link kconfigKeyword Keyword
-hi def link kconfigPreProc PreProc
-hi def link kconfigConditional Conditional
-hi def link kconfigPrompt String
-hi def link kconfigKeywordPrompt kconfigPrompt
-hi def link kconfigPath String
-hi def link kconfigSymbol String
-hi def link kconfigConstantSymbol Constant
-hi def link kconfigConfigOption Type
-hi def link kconfigTypeDefinition kconfigConfigOption
-hi def link kconfigTypeDefPrompt kconfigPrompt
-hi def link kconfigInputPrompt kconfigConfigOption
-hi def link kconfigPromptPrompt kconfigPrompt
-hi def link kconfigDefaultValue kconfigConfigOption
-hi def link kconfigDependencies kconfigConfigOption
-hi def link kconfigReverseDependencies kconfigConfigOption
-hi def link kconfigRevDepCSymbol kconfigConstantSymbol
-hi def link kconfigRevDepNCSymbol kconfigSymbol
-hi def link kconfigNumericalRanges kconfigConfigOption
-hi def link kconfigRangeCSymbol kconfigConstantSymbol
-hi def link kconfigRangeNCSymbol kconfigSymbol
-hi def link kconfigRangeCSymbol2 kconfigConstantSymbol
-hi def link kconfigRangeNCSymbol2 kconfigSymbol
-hi def link kconfigHelpText Normal
-hi def link kconfigDefBool kconfigConfigOption
-hi def link kconfigDefBoolCSymbol kconfigConstantSymbol
-hi def link kconfigDefBoolNCSymbol kconfigSymbol
-hi def link kconfigOptional kconfigConfigOption
-hi def link kconfigConfigOptionIf Conditional
-hi def link kconfigConfOptIfExprCSym kconfigConstantSymbol
-hi def link kconfigConfOptIfExprNCSym kconfigSymbol
-hi def link kconfigOperator Operator
-hi def link kconfigConfOptIfExprEq kconfigOperator
-hi def link kconfigConfOptIfExprNEq kconfigOperator
-hi def link kconfigConfOptIfExprCSym2 kconfigConstantSymbol
-hi def link kconfigConfOptIfExprNCSym2 kconfigSymbol
-hi def link kconfigConfOptIfExprNeg kconfigOperator
-hi def link kconfigConfOptIfExprAnd kconfigOperator
-hi def link kconfigConfOptIfExprOr kconfigOperator
-hi def link kconfigDelimiter Delimiter
-hi def link kconfigConfOptIfExprGroup kconfigDelimiter
-hi def link kconfigConfOptIfGExpCSym kconfigConstantSymbol
-hi def link kconfigConfOptIfGExpNCSym kconfigSymbol
-hi def link kconfigConfOptIfGExpEq kconfigOperator
-hi def link kconfigConfOptIfGExpNEq kconfigOperator
-hi def link kconfigConfOptIfGExpCSym2 kconfigConstantSymbol
-hi def link kconfigConfOptIfGExpNCSym2 kconfigSymbol
-hi def link kconfigConfOptIfGExpNeg kconfigOperator
-hi def link kconfigConfOptIfGExpAnd kconfigOperator
-hi def link kconfigConfOptIfGExpOr kconfigOperator
-hi def link kconfigConfOptIfExprGrpE kconfigDelimiter
-hi def link kconfigConfOptExprCSym kconfigConstantSymbol
-hi def link kconfigConfOptExprNCSym kconfigSymbol
-hi def link kconfigConfOptExprEq kconfigOperator
-hi def link kconfigConfOptExprNEq kconfigOperator
-hi def link kconfigConfOptExprCSym2 kconfigConstantSymbol
-hi def link kconfigConfOptExprNCSym2 kconfigSymbol
-hi def link kconfigConfOptExprNeg kconfigOperator
-hi def link kconfigConfOptExprAnd kconfigOperator
-hi def link kconfigConfOptExprOr kconfigOperator
-hi def link kconfigConfOptExprGroup kconfigDelimiter
-hi def link kconfigConfOptGExpCSym kconfigConstantSymbol
-hi def link kconfigConfOptGExpNCSym kconfigSymbol
-hi def link kconfigConfOptGExpEq kconfigOperator
-hi def link kconfigConfOptGExpNEq kconfigOperator
-hi def link kconfigConfOptGExpCSym2 kconfigConstantSymbol
-hi def link kconfigConfOptGExpNCSym2 kconfigSymbol
-hi def link kconfigConfOptGExpNeg kconfigOperator
-hi def link kconfigConfOptGExpAnd kconfigOperator
-hi def link kconfigConfOptGExpOr kconfigOperator
-hi def link kconfigConfOptExprGrpE kconfigConfOptIfExprGroup
+ syn match kconfigBegin '^' nextgroup=kconfigKeyword
+ \ skipwhite
+
+ syn keyword kconfigTodo contained TODO FIXME XXX NOTE
+
+ syn match kconfigComment display '#.*$' contains=kconfigTodo
+
+ syn keyword kconfigKeyword config nextgroup=kconfigSymbol
+ \ skipwhite
+
+ syn keyword kconfigKeyword menuconfig nextgroup=kconfigSymbol
+ \ skipwhite
+
+ syn keyword kconfigKeyword comment menu mainmenu
+ \ nextgroup=kconfigKeywordPrompt
+ \ skipwhite
+
+ syn keyword kconfigKeyword choice
+ \ nextgroup=@kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn keyword kconfigKeyword endmenu endchoice
+
+ syn keyword kconfigPreProc source
+ \ nextgroup=kconfigPath
+ \ skipwhite
+
+ " TODO: This is a hack. The who .*Expr stuff should really be generated so
+ " that we can reuse it for various nextgroups.
+ syn keyword kconfigConditional if endif
+ \ nextgroup=@kconfigConfigOptionIfExpr
+ \ skipwhite
+
+ syn match kconfigKeywordPrompt '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=@kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigPath '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
+ \ contained
+
+ syn match kconfigSymbol '\<\k\+\>'
+ \ contained
+ \ nextgroup=@kconfigConfigOptions
+ \ skipwhite skipnl
+
+ " FIXME: There is – probably – no reason to cluster these instead of just
+ " defining them in the same group.
+ syn cluster kconfigConfigOptions contains=kconfigTypeDefinition,
+ \ kconfigInputPrompt,
+ \ kconfigDefaultValue,
+ \ kconfigDependencies,
+ \ kconfigReverseDependencies,
+ \ kconfigNumericalRanges,
+ \ kconfigHelpText,
+ \ kconfigDefBool,
+ \ kconfigOptional
+
+ syn keyword kconfigTypeDefinition bool boolean tristate string hex int
+ \ contained
+ \ nextgroup=kconfigTypeDefPrompt,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigTypeDefPrompt '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigTypeDefPrompt "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn keyword kconfigInputPrompt prompt
+ \ contained
+ \ nextgroup=kconfigPromptPrompt
+ \ skipwhite
+
+ syn match kconfigPromptPrompt '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigPromptPrompt "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn keyword kconfigDefaultValue default
+ \ contained
+ \ nextgroup=@kconfigConfigOptionExpr
+ \ skipwhite
+
+ syn match kconfigDependencies 'depends on\|requires'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfExpr
+ \ skipwhite
+
+ syn keyword kconfigReverseDependencies select
+ \ contained
+ \ nextgroup=@kconfigRevDepSymbol
+ \ skipwhite
+
+ syn cluster kconfigRevDepSymbol contains=kconfigRevDepCSymbol,
+ \ kconfigRevDepNCSymbol
+
+ syn match kconfigRevDepCSymbol '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigRevDepCSymbol "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigRevDepNCSymbol '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn keyword kconfigNumericalRanges range
+ \ contained
+ \ nextgroup=@kconfigRangeSymbol
+ \ skipwhite
+
+ syn cluster kconfigRangeSymbol contains=kconfigRangeCSymbol,
+ \ kconfigRangeNCSymbol
+
+ syn match kconfigRangeCSymbol '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=@kconfigRangeSymbol2
+ \ skipwhite skipnl
+
+ syn match kconfigRangeCSymbol "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=@kconfigRangeSymbol2
+ \ skipwhite skipnl
+
+ syn match kconfigRangeNCSymbol '\<\k\+\>'
+ \ contained
+ \ nextgroup=@kconfigRangeSymbol2
+ \ skipwhite skipnl
+
+ syn cluster kconfigRangeSymbol2 contains=kconfigRangeCSymbol2,
+ \ kconfigRangeNCSymbol2
+
+ syn match kconfigRangeCSymbol2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigRangeNCSymbol2 '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn region kconfigHelpText contained
+ \ matchgroup=kconfigConfigOption
+ \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
+ \ skip='^$'
+ \ end='^\z1\@!'
+ \ nextgroup=@kconfigConfigOptions
+ \ skipwhite skipnl
+
+ " XXX: Undocumented
+ syn keyword kconfigDefBool def_bool
+ \ contained
+ \ nextgroup=@kconfigDefBoolSymbol
+ \ skipwhite
+
+ syn cluster kconfigDefBoolSymbol contains=kconfigDefBoolCSymbol,
+ \ kconfigDefBoolNCSymbol
+
+ syn match kconfigDefBoolCSymbol '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigDefBoolCSymbol "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigDefBoolNCSymbol '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ " XXX: This is actually only a valid option for “choice”, but treating it
+ " specially would require a lot of extra groups.
+ syn keyword kconfigOptional optional
+ \ contained
+ \ nextgroup=@kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn keyword kconfigConfigOptionIf if
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfExpr
+ \ skipwhite
+
+ syn cluster kconfigConfigOptionIfExpr contains=@kconfigConfOptIfExprSym,
+ \ kconfigConfOptIfExprNeg,
+ \ kconfigConfOptIfExprGroup
+
+ syn cluster kconfigConfOptIfExprSym contains=kconfigConfOptIfExprCSym,
+ \ kconfigConfOptIfExprNCSym
+
+ syn match kconfigConfOptIfExprCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=@kconfigConfigOptions,
+ \ kconfigConfOptIfExprAnd,
+ \ kconfigConfOptIfExprOr,
+ \ kconfigConfOptIfExprEq,
+ \ kconfigConfOptIfExprNEq
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfExprCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=@kconfigConfigOptions,
+ \ kconfigConfOptIfExprAnd,
+ \ kconfigConfOptIfExprOr,
+ \ kconfigConfOptIfExprEq,
+ \ kconfigConfOptIfExprNEq
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfExprNCSym '\<\k\+\>'
+ \ contained
+ \ nextgroup=@kconfigConfigOptions,
+ \ kconfigConfOptIfExprAnd,
+ \ kconfigConfOptIfExprOr,
+ \ kconfigConfOptIfExprEq,
+ \ kconfigConfOptIfExprNEq
+ \ skipwhite skipnl
+
+ syn cluster kconfigConfOptIfExprSym2 contains=kconfigConfOptIfExprCSym2,
+ \ kconfigConfOptIfExprNCSym2
+
+ syn match kconfigConfOptIfExprEq '='
+ \ contained
+ \ nextgroup=@kconfigConfOptIfExprSym2
+ \ skipwhite
+
+ syn match kconfigConfOptIfExprNEq '!='
+ \ contained
+ \ nextgroup=@kconfigConfOptIfExprSym2
+ \ skipwhite
+
+ syn match kconfigConfOptIfExprCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=@kconfigConfigOptions,
+ \ kconfigConfOptIfExprAnd,
+ \ kconfigConfOptIfExprOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfExprNCSym2 '\<\k\+\>'
+ \ contained
+ \ nextgroup=@kconfigConfigOptions,
+ \ kconfigConfOptIfExprAnd,
+ \ kconfigConfOptIfExprOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfExprNeg '!'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfExpr
+ \ skipwhite
+
+ syn match kconfigConfOptIfExprAnd '&&'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfExpr
+ \ skipwhite
+
+ syn match kconfigConfOptIfExprOr '||'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfExpr
+ \ skipwhite
+
+ syn match kconfigConfOptIfExprGroup '('
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfGExp
+ \ skipwhite
+
+ " TODO: hm, this kind of recursion doesn't work right. We need another set of
+ " expressions that have kconfigConfigOPtionIfGExp as nextgroup and a matcher
+ " for '(' that sets it all off.
+ syn cluster kconfigConfigOptionIfGExp contains=@kconfigConfOptIfGExpSym,
+ \ kconfigConfOptIfGExpNeg,
+ \ kconfigConfOptIfExprGroup
+
+ syn cluster kconfigConfOptIfGExpSym contains=kconfigConfOptIfGExpCSym,
+ \ kconfigConfOptIfGExpNCSym
+
+ syn match kconfigConfOptIfGExpCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=@kconfigConfigIf,
+ \ kconfigConfOptIfGExpAnd,
+ \ kconfigConfOptIfGExpOr,
+ \ kconfigConfOptIfGExpEq,
+ \ kconfigConfOptIfGExpNEq
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfGExpCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=@kconfigConfigIf,
+ \ kconfigConfOptIfGExpAnd,
+ \ kconfigConfOptIfGExpOr,
+ \ kconfigConfOptIfGExpEq,
+ \ kconfigConfOptIfGExpNEq
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfGExpNCSym '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfOptIfExprGrpE,
+ \ kconfigConfOptIfGExpAnd,
+ \ kconfigConfOptIfGExpOr,
+ \ kconfigConfOptIfGExpEq,
+ \ kconfigConfOptIfGExpNEq
+ \ skipwhite skipnl
+
+ syn cluster kconfigConfOptIfGExpSym2 contains=kconfigConfOptIfGExpCSym2,
+ \ kconfigConfOptIfGExpNCSym2
+
+ syn match kconfigConfOptIfGExpEq '='
+ \ contained
+ \ nextgroup=@kconfigConfOptIfGExpSym2
+ \ skipwhite
+
+ syn match kconfigConfOptIfGExpNEq '!='
+ \ contained
+ \ nextgroup=@kconfigConfOptIfGExpSym2
+ \ skipwhite
+
+ syn match kconfigConfOptIfGExpCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfOptIfExprGrpE,
+ \ kconfigConfOptIfGExpAnd,
+ \ kconfigConfOptIfGExpOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfGExpCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfOptIfExprGrpE,
+ \ kconfigConfOptIfGExpAnd,
+ \ kconfigConfOptIfGExpOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfGExpNCSym2 '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfOptIfExprGrpE,
+ \ kconfigConfOptIfGExpAnd,
+ \ kconfigConfOptIfGExpOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptIfGExpNeg '!'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfGExp
+ \ skipwhite
+
+ syn match kconfigConfOptIfGExpAnd '&&'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfGExp
+ \ skipwhite
+
+ syn match kconfigConfOptIfGExpOr '||'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionIfGExp
+ \ skipwhite
+
+ syn match kconfigConfOptIfExprGrpE ')'
+ \ contained
+ \ nextgroup=@kconfigConfigOptions,
+ \ kconfigConfOptIfExprAnd,
+ \ kconfigConfOptIfExprOr
+ \ skipwhite skipnl
+
+
+ syn cluster kconfigConfigOptionExpr contains=@kconfigConfOptExprSym,
+ \ kconfigConfOptExprNeg,
+ \ kconfigConfOptExprGroup
+
+ syn cluster kconfigConfOptExprSym contains=kconfigConfOptExprCSym,
+ \ kconfigConfOptExprNCSym
+
+ syn match kconfigConfOptExprCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr,
+ \ kconfigConfOptExprEq,
+ \ kconfigConfOptExprNEq,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptExprCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr,
+ \ kconfigConfOptExprEq,
+ \ kconfigConfOptExprNEq,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptExprNCSym '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr,
+ \ kconfigConfOptExprEq,
+ \ kconfigConfOptExprNEq,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn cluster kconfigConfOptExprSym2 contains=kconfigConfOptExprCSym2,
+ \ kconfigConfOptExprNCSym2
+
+ syn match kconfigConfOptExprEq '='
+ \ contained
+ \ nextgroup=@kconfigConfOptExprSym2
+ \ skipwhite
+
+ syn match kconfigConfOptExprNEq '!='
+ \ contained
+ \ nextgroup=@kconfigConfOptExprSym2
+ \ skipwhite
+
+ syn match kconfigConfOptExprCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptExprCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptExprNCSym2 '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr,
+ \ @kconfigConfigOptions
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptExprNeg '!'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionExpr
+ \ skipwhite
+
+ syn match kconfigConfOptExprAnd '&&'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionExpr
+ \ skipwhite
+
+ syn match kconfigConfOptExprOr '||'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionExpr
+ \ skipwhite
+
+ syn match kconfigConfOptExprGroup '('
+ \ contained
+ \ nextgroup=@kconfigConfigOptionGExp
+ \ skipwhite
+
+ syn cluster kconfigConfigOptionGExp contains=@kconfigConfOptGExpSym,
+ \ kconfigConfOptGExpNeg,
+ \ kconfigConfOptGExpGroup
+
+ syn cluster kconfigConfOptGExpSym contains=kconfigConfOptGExpCSym,
+ \ kconfigConfOptGExpNCSym
+
+ syn match kconfigConfOptGExpCSym '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfOptExprGrpE,
+ \ kconfigConfOptGExpAnd,
+ \ kconfigConfOptGExpOr,
+ \ kconfigConfOptGExpEq,
+ \ kconfigConfOptGExpNEq
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptGExpCSym "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfOptExprGrpE,
+ \ kconfigConfOptGExpAnd,
+ \ kconfigConfOptGExpOr,
+ \ kconfigConfOptGExpEq,
+ \ kconfigConfOptGExpNEq
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptGExpNCSym '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfOptExprGrpE,
+ \ kconfigConfOptGExpAnd,
+ \ kconfigConfOptGExpOr,
+ \ kconfigConfOptGExpEq,
+ \ kconfigConfOptGExpNEq
+ \ skipwhite skipnl
+
+ syn cluster kconfigConfOptGExpSym2 contains=kconfigConfOptGExpCSym2,
+ \ kconfigConfOptGExpNCSym2
+
+ syn match kconfigConfOptGExpEq '='
+ \ contained
+ \ nextgroup=@kconfigConfOptGExpSym2
+ \ skipwhite
+
+ syn match kconfigConfOptGExpNEq '!='
+ \ contained
+ \ nextgroup=@kconfigConfOptGExpSym2
+ \ skipwhite
+
+ syn match kconfigConfOptGExpCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
+ \ contained
+ \ nextgroup=kconfigConfOptExprGrpE,
+ \ kconfigConfOptGExpAnd,
+ \ kconfigConfOptGExpOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptGExpCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
+ \ contained
+ \ nextgroup=kconfigConfOptExprGrpE,
+ \ kconfigConfOptGExpAnd,
+ \ kconfigConfOptGExpOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptGExpNCSym2 '\<\k\+\>'
+ \ contained
+ \ nextgroup=kconfigConfOptExprGrpE,
+ \ kconfigConfOptGExpAnd,
+ \ kconfigConfOptGExpOr
+ \ skipwhite skipnl
+
+ syn match kconfigConfOptGExpNeg '!'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionGExp
+ \ skipwhite
+
+ syn match kconfigConfOptGExpAnd '&&'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionGExp
+ \ skipwhite
+
+ syn match kconfigConfOptGExpOr '||'
+ \ contained
+ \ nextgroup=@kconfigConfigOptionGExp
+ \ skipwhite
+
+ syn match kconfigConfOptExprGrpE ')'
+ \ contained
+ \ nextgroup=kconfigConfigOptionIf,
+ \ kconfigConfOptExprAnd,
+ \ kconfigConfOptExprOr
+ \ skipwhite skipnl
+
+ hi def link kconfigTodo Todo
+ hi def link kconfigComment Comment
+ hi def link kconfigKeyword Keyword
+ hi def link kconfigPreProc PreProc
+ hi def link kconfigConditional Conditional
+ hi def link kconfigPrompt String
+ hi def link kconfigKeywordPrompt kconfigPrompt
+ hi def link kconfigPath String
+ hi def link kconfigSymbol String
+ hi def link kconfigConstantSymbol Constant
+ hi def link kconfigConfigOption Type
+ hi def link kconfigTypeDefinition kconfigConfigOption
+ hi def link kconfigTypeDefPrompt kconfigPrompt
+ hi def link kconfigInputPrompt kconfigConfigOption
+ hi def link kconfigPromptPrompt kconfigPrompt
+ hi def link kconfigDefaultValue kconfigConfigOption
+ hi def link kconfigDependencies kconfigConfigOption
+ hi def link kconfigReverseDependencies kconfigConfigOption
+ hi def link kconfigRevDepCSymbol kconfigConstantSymbol
+ hi def link kconfigRevDepNCSymbol kconfigSymbol
+ hi def link kconfigNumericalRanges kconfigConfigOption
+ hi def link kconfigRangeCSymbol kconfigConstantSymbol
+ hi def link kconfigRangeNCSymbol kconfigSymbol
+ hi def link kconfigRangeCSymbol2 kconfigConstantSymbol
+ hi def link kconfigRangeNCSymbol2 kconfigSymbol
+ hi def link kconfigHelpText Normal
+ hi def link kconfigDefBool kconfigConfigOption
+ hi def link kconfigDefBoolCSymbol kconfigConstantSymbol
+ hi def link kconfigDefBoolNCSymbol kconfigSymbol
+ hi def link kconfigOptional kconfigConfigOption
+ hi def link kconfigConfigOptionIf Conditional
+ hi def link kconfigConfOptIfExprCSym kconfigConstantSymbol
+ hi def link kconfigConfOptIfExprNCSym kconfigSymbol
+ hi def link kconfigOperator Operator
+ hi def link kconfigConfOptIfExprEq kconfigOperator
+ hi def link kconfigConfOptIfExprNEq kconfigOperator
+ hi def link kconfigConfOptIfExprCSym2 kconfigConstantSymbol
+ hi def link kconfigConfOptIfExprNCSym2 kconfigSymbol
+ hi def link kconfigConfOptIfExprNeg kconfigOperator
+ hi def link kconfigConfOptIfExprAnd kconfigOperator
+ hi def link kconfigConfOptIfExprOr kconfigOperator
+ hi def link kconfigDelimiter Delimiter
+ hi def link kconfigConfOptIfExprGroup kconfigDelimiter
+ hi def link kconfigConfOptIfGExpCSym kconfigConstantSymbol
+ hi def link kconfigConfOptIfGExpNCSym kconfigSymbol
+ hi def link kconfigConfOptIfGExpEq kconfigOperator
+ hi def link kconfigConfOptIfGExpNEq kconfigOperator
+ hi def link kconfigConfOptIfGExpCSym2 kconfigConstantSymbol
+ hi def link kconfigConfOptIfGExpNCSym2 kconfigSymbol
+ hi def link kconfigConfOptIfGExpNeg kconfigOperator
+ hi def link kconfigConfOptIfGExpAnd kconfigOperator
+ hi def link kconfigConfOptIfGExpOr kconfigOperator
+ hi def link kconfigConfOptIfExprGrpE kconfigDelimiter
+ hi def link kconfigConfOptExprCSym kconfigConstantSymbol
+ hi def link kconfigConfOptExprNCSym kconfigSymbol
+ hi def link kconfigConfOptExprEq kconfigOperator
+ hi def link kconfigConfOptExprNEq kconfigOperator
+ hi def link kconfigConfOptExprCSym2 kconfigConstantSymbol
+ hi def link kconfigConfOptExprNCSym2 kconfigSymbol
+ hi def link kconfigConfOptExprNeg kconfigOperator
+ hi def link kconfigConfOptExprAnd kconfigOperator
+ hi def link kconfigConfOptExprOr kconfigOperator
+ hi def link kconfigConfOptExprGroup kconfigDelimiter
+ hi def link kconfigConfOptGExpCSym kconfigConstantSymbol
+ hi def link kconfigConfOptGExpNCSym kconfigSymbol
+ hi def link kconfigConfOptGExpEq kconfigOperator
+ hi def link kconfigConfOptGExpNEq kconfigOperator
+ hi def link kconfigConfOptGExpCSym2 kconfigConstantSymbol
+ hi def link kconfigConfOptGExpNCSym2 kconfigSymbol
+ hi def link kconfigConfOptGExpNeg kconfigOperator
+ hi def link kconfigConfOptGExpAnd kconfigOperator
+ hi def link kconfigConfOptGExpOr kconfigOperator
+ hi def link kconfigConfOptExprGrpE kconfigConfOptIfExprGroup
else
-syn keyword kconfigTodo contained TODO FIXME XXX NOTE
+ syn keyword kconfigTodo contained TODO FIXME XXX NOTE
-syn match kconfigComment display '#.*$' contains=kconfigTodo
+ syn match kconfigComment display '#.*$' contains=kconfigTodo
-syn keyword kconfigKeyword config menuconfig comment mainmenu
+ syn keyword kconfigKeyword config menuconfig comment mainmenu
-syn keyword kconfigConditional menu endmenu choice endchoice if endif
+ syn keyword kconfigConditional menu endmenu choice endchoice if endif
-syn keyword kconfigPreProc source
- \ nextgroup=kconfigPath
- \ skipwhite
+ syn keyword kconfigPreProc source
+ \ nextgroup=kconfigPath
+ \ skipwhite
-syn keyword kconfigTriState y m n
+ syn keyword kconfigTriState y m n
-syn match kconfigSpecialChar contained '\\.'
-syn match kconfigSpecialChar '\\$'
+ syn match kconfigSpecialChar contained '\\.'
+ syn match kconfigSpecialChar '\\$'
-syn region kconfigPath matchgroup=kconfigPath
- \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
- \ contains=kconfigSpecialChar
+ syn region kconfigPath matchgroup=kconfigPath
+ \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
+ \ contains=kconfigSpecialChar
-syn region kconfigPath matchgroup=kconfigPath
- \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
- \ contains=kconfigSpecialChar
+ syn region kconfigPath matchgroup=kconfigPath
+ \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
+ \ contains=kconfigSpecialChar
-syn match kconfigPath '\S\+'
- \ contained
+ syn match kconfigPath '\S\+'
+ \ contained
-syn region kconfigString matchgroup=kconfigString
- \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
- \ contains=kconfigSpecialChar
+ syn region kconfigString matchgroup=kconfigString
+ \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
+ \ contains=kconfigSpecialChar
-syn region kconfigString matchgroup=kconfigString
- \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
- \ contains=kconfigSpecialChar
+ syn region kconfigString matchgroup=kconfigString
+ \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
+ \ contains=kconfigSpecialChar
-syn keyword kconfigType bool boolean tristate string hex int
+ syn keyword kconfigType bool boolean tristate string hex int
-syn keyword kconfigOption prompt default requires select range
- \ optional
-syn match kconfigOption 'depends\%( on\)\='
+ syn keyword kconfigOption prompt default requires select range
+ \ optional
+ syn match kconfigOption 'depends\%( on\)\='
-syn keyword kconfigMacro def_bool def_tristate
+ syn keyword kconfigMacro def_bool def_tristate
-syn region kconfigHelpText
- \ matchgroup=kconfigOption
- \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
- \ skip='^$'
- \ end='^\z1\@!'
+ syn region kconfigHelpText
+ \ matchgroup=kconfigOption
+ \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
+ \ skip='^$'
+ \ end='^\z1\@!'
-hi def link kconfigTodo Todo
-hi def link kconfigComment Comment
-hi def link kconfigKeyword Keyword
-hi def link kconfigConditional Conditional
-hi def link kconfigPreProc PreProc
-hi def link kconfigTriState Boolean
-hi def link kconfigSpecialChar SpecialChar
-hi def link kconfigPath String
-hi def link kconfigString String
-hi def link kconfigType Type
-hi def link kconfigOption Identifier
-hi def link kconfigHelpText Normal
-hi def link kconfigmacro Macro
+ hi def link kconfigTodo Todo
+ hi def link kconfigComment Comment
+ hi def link kconfigKeyword Keyword
+ hi def link kconfigConditional Conditional
+ hi def link kconfigPreProc PreProc
+ hi def link kconfigTriState Boolean
+ hi def link kconfigSpecialChar SpecialChar
+ hi def link kconfigPath String
+ hi def link kconfigString String
+ hi def link kconfigType Type
+ hi def link kconfigOption Identifier
+ hi def link kconfigHelpText Normal
+ hi def link kconfigmacro Macro
endif
diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim
deleted file mode 100644
index f5b7fdc2c6..0000000000
--- a/runtime/syntax/netrw.vim
+++ /dev/null
@@ -1,148 +0,0 @@
-" Language : Netrw Listing Syntax
-" Maintainer: This runtime file is looking for a new maintainer.
-" Former Maintainer: Charles E. Campbell
-" Last Change: Nov 07, 2019
-" 2024 Feb 19 by Vim Project (announce adoption)
-" Version : 20
-" ---------------------------------------------------------------------
-if exists("b:current_syntax")
- finish
-endif
-
-" ---------------------------------------------------------------------
-" Directory List Syntax Highlighting: {{{1
-syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt
-syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe
-
-syn match netrwPlain "\(\S\+ \)*\S\+" contains=netrwLink,@NoSpell
-syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
-syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell
-syn match netrwDir "\%(\S\+ \)*\S\+/\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
-syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime
-syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
-syn match netrwExe "\%(\S\+ \)*\S*[^~]\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
-if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4')
-syn match netrwTreeBar "^\%([-+|│] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
-else
-syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
-endif
-syn match netrwTreeBarSpace " " contained
-
-syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained
-syn match netrwDateSep "/" contained
-syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep
-syn match netrwTimeSep ":"
-
-syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup,@NoSpell
-syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite contains=@NoSpell nextgroup=netrwHidePat
-syn match netrwSlash "/" contained
-syn match netrwHidePat "[^,]\+" contained skipwhite contains=@NoSpell nextgroup=netrwHideSep
-syn match netrwHideSep "," contained skipwhite nextgroup=netrwHidePat
-syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
-syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
-syn match netrwCopyTgt "Copy/Move Tgt:" contained transparent skipwhite nextgroup=netrwList
-syn match netrwList ".*$" contained contains=netrwComma,@NoSpell
-syn match netrwComma "," contained
-syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd,netrwQHTopic,@NoSpell keepend contained
-syn match netrwHelpCmd "\S\+\ze:" contained skipwhite contains=@NoSpell nextgroup=netrwCmdSep
-syn match netrwQHTopic "([a-zA-Z &]\+)" contained skipwhite
-syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote
-syn match netrwCmdNote ".\{-}\ze " contained contains=@NoSpell
-syn match netrwVersion "(netrw.*)" contained contains=@NoSpell
-syn match netrwLink "-->" contained skipwhite
-
-" -----------------------------
-" Special filetype highlighting {{{1
-" -----------------------------
-if exists("g:netrw_special_syntax") && g:netrw_special_syntax
- if exists("+suffixes") && &suffixes != ""
- let suflist= join(split(&suffixes,','))
- let suflist= escape(substitute(suflist," ",'\\|','g'),'.~')
- exe "syn match netrwSpecFile '\\(\\S\\+ \\)*\\S*\\(".suflist."\\)\\>' contains=netrwTreeBar,@NoSpell"
- endif
- syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar,@NoSpell
- syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar,@NoSpell
- if has("unix")
- syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell
- endif
- syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell
- syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell
- syn match netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\|docx\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwHdr "\(\S\+ \)*\S\+\.\%(h\|hpp\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell
- syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwPix "\c\(\S\+ \)*\S*\.\%(bmp\|fits\=\|gif\|je\=pg\|pcx\|ppc\|pgm\|png\|ppm\|psd\|rgb\|tif\|xbm\|xcf\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell
- syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell
- syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell
- syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell
-endif
-
-" ---------------------------------------------------------------------
-" Highlighting Links: {{{1
-if !exists("did_drchip_netrwlist_syntax")
- let did_drchip_netrwlist_syntax= 1
- hi default link netrwClassify Function
- hi default link netrwCmdSep Delimiter
- hi default link netrwComment Comment
- hi default link netrwDir Directory
- hi default link netrwHelpCmd Function
- hi default link netrwQHTopic Number
- hi default link netrwHidePat Statement
- hi default link netrwHideSep netrwComment
- hi default link netrwList Statement
- hi default link netrwVersion Identifier
- hi default link netrwSymLink Question
- hi default link netrwExe PreProc
- hi default link netrwDateSep Delimiter
-
- hi default link netrwTreeBar Special
- hi default link netrwTimeSep netrwDateSep
- hi default link netrwComma netrwComment
- hi default link netrwHide netrwComment
- hi default link netrwMarkFile TabLineSel
- hi default link netrwLink Special
-
- " special syntax highlighting (see :he g:netrw_special_syntax)
- hi default link netrwCoreDump WarningMsg
- hi default link netrwData Folded
- hi default link netrwHdr netrwPlain
- hi default link netrwLex netrwPlain
- hi default link netrwLib DiffChange
- hi default link netrwMakefile DiffChange
- hi default link netrwYacc netrwPlain
- hi default link netrwPix Special
-
- hi default link netrwBak netrwGray
- hi default link netrwCompress netrwGray
- hi default link netrwSpecFile netrwGray
- hi default link netrwObj netrwGray
- hi default link netrwTags netrwGray
- hi default link netrwTilde netrwGray
- hi default link netrwTmp netrwGray
-endif
-
- " set up netrwGray to be understated (but not Ignore'd or Conceal'd, as those
- " can be hard/impossible to read). Users may override this in a colorscheme by
- " specifying netrwGray highlighting.
- redir => s:netrwgray
- sil hi netrwGray
- redir END
- if s:netrwgray !~ 'guifg'
- if has("gui") && has("gui_running")
- if &bg == "dark"
- exe "hi netrwGray gui=NONE guifg=gray30"
- else
- exe "hi netrwGray gui=NONE guifg=gray70"
- endif
- else
- hi link netrwGray Folded
- endif
- endif
-
-" Current Syntax: {{{1
-let b:current_syntax = "netrwlist"
-" ---------------------------------------------------------------------
-" vim: ts=8 fdm=marker
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index d71a966553..67268cdfe3 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -6,6 +6,7 @@
" Last Change: 2024 Mar 04 by Vim Project
" 2024 Nov 03 by Aliaksei Budavei <0x000c70 AT gmail DOT com> (improved bracket expressions, #15941)
" 2025 Jan 06 add $PS0 to bashSpecialVariables (#16394)
+" 2025 Jan 18 add bash coproc, remove duplicate syn keywords (#16467)
" Version: 208
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
@@ -24,7 +25,7 @@ elseif getline(1) =~ '\<bash\>'
elseif getline(1) =~ '\<dash\>'
let b:is_dash = 1
elseif !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") && !exists("g:is_dash")
- " user did not specify which shell to use, and
+ " user did not specify which shell to use, and
" the script itself does not specify which shell to use. FYI: /bin/sh is ambiguous.
" Assuming /bin/sh is executable, and if its a link, find out what it links to.
let s:shell = ""
@@ -352,7 +353,7 @@ if exists("b:is_bash")
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end=";;&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
elseif exists("b:is_kornshell")
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
-else
+else
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
endif
ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
@@ -405,7 +406,7 @@ syn region shCmdParenRegion matchgroup=shCmdSubRegion start="((\@!" skip='\\\\\|
if exists("b:is_bash")
syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
syn cluster shCaseList add=bashAdminStatement,bashStatement
- syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS0 PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID
+ syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ARGC BASH_ARGV BASH_CMDS BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_LINENO BASHOPTS BASHPID BASH_REMATCH BASH_SOURCE BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD CDPATH COLUMNS COMP_CWORD COMP_KEY COMP_LINE COMP_POINT COMPREPLY COMP_TYPE COMP_WORDBREAKS COMP_WORDS COPROC COPROC_PID DIRSTACK EMACS ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_NUMERIC LINENO LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT PPID PROMPT_COMMAND PS0 PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_POINT REPLY SECONDS SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR UID
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep head less ls mkdir mv rm rmdir rpm sed sleep sort strip tail
syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
syn keyword bashStatement command compgen
@@ -540,6 +541,7 @@ if !exists("b:is_posix")
endif
if exists("b:is_bash")
+ syn keyword shFunctionKey coproc
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
@@ -693,10 +695,10 @@ if exists("b:is_kornshell") || exists("b:is_posix")
" Additional bash Keywords: {{{1
" =====================
elseif exists("b:is_bash")
- syn keyword shStatement bg builtin disown export false fg getopts jobs let printf sleep true unalias
+ syn keyword shStatement bg builtin disown export false fg getopts jobs let printf true unalias
syn keyword shStatement typeset nextgroup=shSetOption
syn keyword shStatement fc hash history source suspend times type
- syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout local mapfile popd pushd readarray shopt source typeset
+ syn keyword shStatement bind caller compopt declare dirs enable help logout local mapfile popd pushd readarray shopt typeset
else
syn keyword shStatement login newgrp
endif
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index 77a40e11d3..4f35bba939 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -3,7 +3,8 @@
" Maintainer: This runtime file is looking for a new maintainer.
" Former Maintainer: Charles E. Campbell
" Last Change: Apr 22, 2022
-" 2024 Feb 19 by Vim Project (announce adoption)
+" 2024 Feb 19 by Vim Project: announce adoption
+" 2025 Jan 18 by Vim Project: add texEmphStyle to texMatchGroup, #16228
" Version: 121
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
@@ -176,11 +177,11 @@ if !s:tex_excludematcher
endif
if !s:tex_nospell
if !s:tex_no_error
- syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
+ syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texEmphStyle,texZone,texInputFile,texOption,@Spell
syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texError,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell
else
- syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
+ syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texEmphStyle,texZone,texInputFile,texOption,@Spell
syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell
syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell
endif
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index edc69b907c..c4e231d145 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -185,13 +185,13 @@ Vim9 syn keyword vim9Boolean true false
" Numbers {{{2
" =======
syn case ignore
-syn match vimNumber '\<\d\+\%(\.\d\+\%(e[+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
-syn match vimNumber '\<0b[01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
-syn match vimNumber '\<0o\=\o\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
-syn match vimNumber '\<0x\x\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
-syn match vimNumber '\<0z\>' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
-syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
-syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,@vimComment
+syn match vimNumber '\<\d\+\%(\.\d\+\%(e[+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
+syn match vimNumber '\<0b[01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
+syn match vimNumber '\<0o\=\o\+' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
+syn match vimNumber '\<0x\x\+' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
+syn match vimNumber '\<0z\>' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
+syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
+syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst1,@vimComment
syn case match
" All vimCommands are contained by vimIsCommand. {{{2
@@ -274,10 +274,16 @@ syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBan
" Operators: {{{2
" =========
syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar,vimBoolean,vimNull
-syn match vimOper "\a\@<!!" skipwhite nextgroup=vimString,vimSpecFile
-syn match vimOper "||\|&&\|[-+*/%.]" skipwhite nextgroup=vimString,vimSpecFile
-syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
-syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile
+syn match vimOper "\a\@<!!" skipwhite nextgroup=vimString,vimSpecFile
+syn match vimOper "||\|&&\|[-+*/%.]" skipwhite nextgroup=vimString,vimSpecFile
+syn match vimOper "?" skipwhite nextgroup=@vimExprList
+" distinguish ternary : from ex-colon
+syn match vimOper "\s\@1<=:\ze\s\|\s\@1<=:$" skipwhite nextgroup=@vimExprList
+syn match vimOper "??" skipwhite nextgroup=@vimExprList
+syn match vimOper "=" skipwhite nextgroup=vimString,vimSpecFile
+syn match vimOper "\%#=1\%(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\)[?#]\=" skipwhite nextgroup=vimString,vimSpecFile
+syn match vimOper "\<is\%(not\)\=\>" skipwhite nextgroup=vimString,vimSpecFile
+syn match vimOper "\<is\%(not\)\=[?#]" skipwhite nextgroup=vimString,vimSpecFile
syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup
syn region vimOperParen matchgroup=vimSep start="#\={" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror")
@@ -289,9 +295,9 @@ endif
syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFuncSID,Tag
syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag
-syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold,vimDefFold
-syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet
-syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For
+syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSpecFile,vimString,vimSubst,vimFuncFold,vimDefFold
+syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet,vimSearch
+syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For,vim9Search
syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList
syn match vimFunction "\<fu\%[nction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey
@@ -1017,8 +1023,10 @@ syn match vim9CommentTitleLeader '#\s\+'ms=s+1 contained
" Searches And Globals: {{{2
" ====================
-syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim
+VimL syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim
syn match vimSearchDelim '^\s*\zs[/?]\|[/?]$' contained
+Vim9 syn match vim9Search '^\s*:[/?].*' contains=vim9SearchDelim
+syn match vim9SearchDelim '^\s*\zs:[/?]\|[/?]$' contained contains=vimCmdSep
syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
@@ -1404,8 +1412,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vimQuoteEscape vimEscape
hi def link vimRegister SpecialChar
hi def link vimScriptDelim Comment
- hi def link vimSearchDelim Statement
hi def link vimSearch vimString
+ hi def link vimSearchDelim Delimiter
hi def link vimSep Delimiter
hi def link vimSet vimCommand
hi def link vimSetAll vimOption
@@ -1498,6 +1506,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vim9MethodNameError vimFunctionError
hi def link vim9Null Constant
hi def link vim9Public vimCommand
+ hi def link vim9Search vimString
+ hi def link vim9SearchDelim Delimiter
hi def link vim9Static vimCommand
hi def link vim9Super Identifier
hi def link vim9This Identifier
diff --git a/scripts/bump_deps.lua b/scripts/bump_deps.lua
index ad71da5150..333c7ea8ed 100755
--- a/scripts/bump_deps.lua
+++ b/scripts/bump_deps.lua
@@ -3,40 +3,45 @@
-- Usage:
-- ./scripts/bump_deps.lua -h
-local M = {}
+assert(vim.fn.executable('sed') == 1)
-local _trace = false
local required_branch_prefix = 'bump-'
local commit_prefix = 'build(deps): '
--- Print message
-local function p(s)
- vim.cmd('set verbose=1')
- vim.api.nvim_echo({ { s, '' } }, false, {})
- vim.cmd('set verbose=0')
-end
-
-local function die()
- p('')
+local repos = {
+ 'luajit/luajit',
+ 'libuv/libuv',
+ 'luvit/luv',
+ 'neovim/unibilium',
+ 'juliastrings/utf8proc',
+ 'tree-sitter/tree-sitter',
+ 'tree-sitter/tree-sitter-c',
+ 'tree-sitter-grammars/tree-sitter-lua',
+ 'tree-sitter-grammars/tree-sitter-vim',
+ 'neovim/tree-sitter-vimdoc',
+ 'tree-sitter-grammars/tree-sitter-query',
+ 'tree-sitter-grammars/tree-sitter-markdown',
+ 'bytecodealliance/wasmtime',
+ 'uncrustify/uncrustify',
+}
+
+local dependency_table = {} --- @type table<string, string>
+for _, repo in pairs(repos) do
+ dependency_table[vim.fs.basename(repo)] = repo
+end
+
+local function die(msg)
+ print(msg)
vim.cmd('cquit 1')
end
-- Executes and returns the output of `cmd`, or nil on failure.
-- if die_on_fail is true, process dies with die_msg on failure
---
--- Prints `cmd` if `trace` is enabled.
local function _run(cmd, die_on_fail, die_msg)
- if _trace then
- p('run: ' .. vim.inspect(cmd))
- end
- local rv = vim.trim(vim.fn.system(cmd)) or ''
+ local rv = vim.trim(vim.system(cmd, { text = true }):wait().stdout) or ''
if vim.v.shell_error ~= 0 then
if die_on_fail then
- if _trace then
- p(rv)
- end
- p(die_msg)
- die()
+ die(die_msg)
end
return nil
end
@@ -53,106 +58,19 @@ local function run_die(cmd, err_msg)
return _run(cmd, true, err_msg)
end
-local function require_executable(cmd)
- local cmd_path = run_die({ 'sh', '-c', 'command -v ' .. cmd }, cmd .. ' not found!')
- run_die({ 'test', '-x', cmd_path }, cmd .. ' is not executable')
-end
-
-local function rm_file_if_present(path_to_file)
- run({ 'rm', '-f', path_to_file })
-end
-
-local nvim_src_dir = vim.fn.getcwd()
+local nvim_src_dir = run({ 'git', 'rev-parse', '--show-toplevel' })
local deps_file = nvim_src_dir .. '/' .. 'cmake.deps/deps.txt'
-local temp_dir = nvim_src_dir .. '/tmp'
-run({ 'mkdir', '-p', temp_dir })
-
-local function get_dependency(dependency_name)
- local dependency_table = {
- ['luajit'] = {
- repo = 'LuaJIT/LuaJIT',
- symbol = 'LUAJIT',
- },
- ['libuv'] = {
- repo = 'libuv/libuv',
- symbol = 'LIBUV',
- },
- ['luv'] = {
- repo = 'luvit/luv',
- symbol = 'LUV',
- },
- ['unibilium'] = {
- repo = 'neovim/unibilium',
- symbol = 'UNIBILIUM',
- },
- ['utf8proc'] = {
- repo = 'JuliaStrings/utf8proc',
- symbol = 'UTF8PROC',
- },
- ['tree-sitter'] = {
- repo = 'tree-sitter/tree-sitter',
- symbol = 'TREESITTER',
- },
- ['tree-sitter-c'] = {
- repo = 'tree-sitter/tree-sitter-c',
- symbol = 'TREESITTER_C',
- },
- ['tree-sitter-lua'] = {
- repo = 'tree-sitter-grammars/tree-sitter-lua',
- symbol = 'TREESITTER_LUA',
- },
- ['tree-sitter-vim'] = {
- repo = 'tree-sitter-grammars/tree-sitter-vim',
- symbol = 'TREESITTER_VIM',
- },
- ['tree-sitter-vimdoc'] = {
- repo = 'neovim/tree-sitter-vimdoc',
- symbol = 'TREESITTER_VIMDOC',
- },
- ['tree-sitter-query'] = {
- repo = 'tree-sitter-grammars/tree-sitter-query',
- symbol = 'TREESITTER_QUERY',
- },
- ['tree-sitter-markdown'] = {
- repo = 'tree-sitter-grammars/tree-sitter-markdown',
- symbol = 'TREESITTER_MARKDOWN',
- },
- ['wasmtime'] = {
- repo = 'bytecodealliance/wasmtime',
- symbol = 'WASMTIME',
- },
- ['uncrustify'] = {
- repo = 'uncrustify/uncrustify',
- symbol = 'UNCRUSTIFY',
- },
- }
- local dependency = dependency_table[dependency_name]
- if dependency == nil then
- p('Not a dependency: ' .. dependency_name)
- die()
- end
- dependency.name = dependency_name
- return dependency
-end
-
-local function get_gh_commit_sha(repo, ref)
- require_executable('gh')
-
- local sha = run_die(
- { 'gh', 'api', 'repos/' .. repo .. '/commits/' .. ref, '--jq', '.sha' },
- 'Failed to get commit hash from GitHub. Not a valid ref?'
- )
- return sha
-end
+--- @param repo string
+--- @param ref string
local function get_archive_info(repo, ref)
- require_executable('curl')
+ local temp_dir = os.getenv('TMPDIR') or os.getenv('TEMP')
local archive_name = ref .. '.tar.gz'
local archive_path = temp_dir .. '/' .. archive_name
local archive_url = 'https://github.com/' .. repo .. '/archive/' .. archive_name
- rm_file_if_present(archive_path)
+ vim.fs.rm(archive_path, { force = true })
run_die(
{ 'curl', '-sL', archive_url, '-o', archive_path },
'Failed to download archive from GitHub'
@@ -166,9 +84,7 @@ local function get_archive_info(repo, ref)
return { url = archive_url, sha = archive_sha }
end
-local function write_cmakelists_line(symbol, kind, value)
- require_executable('sed')
-
+local function update_deps_file(symbol, kind, value)
run_die({
'sed',
'-i',
@@ -178,290 +94,107 @@ local function write_cmakelists_line(symbol, kind, value)
}, 'Failed to write ' .. deps_file)
end
-local function explicit_create_branch(dep)
- require_executable('git')
+local function ref(name, _ref)
+ local repo = dependency_table[name]
+ local symbol = string.gsub(name, 'tree%-sitter', 'treesitter'):gsub('%-', '_'):upper()
- local checked_out_branch = run({ 'git', 'rev-parse', '--abbrev-ref', 'HEAD' })
- if checked_out_branch ~= 'master' then
- p('Not on master!')
- die()
- end
- run_die({ 'git', 'checkout', '-b', 'bump-' .. dep }, 'git failed to create branch')
-end
+ run_die(
+ { 'git', 'diff', '--quiet', 'HEAD', '--', deps_file },
+ deps_file .. ' has uncommitted changes'
+ )
-local function verify_branch(new_branch_suffix)
- require_executable('git')
+ local full_repo = string.format('https://github.com/%s.git', repo)
+ -- `git ls-remote` returning empty string means provided ref is a regular commit hash and not a
+ -- tag nor HEAD.
+ local sha = vim.split(assert(run_die({ 'git', 'ls-remote', full_repo, _ref })), '\t')[1]
+ local commit_sha = sha == '' and _ref or sha
+
+ local archive = get_archive_info(repo, commit_sha)
+ local comment = string.sub(_ref, 1, 9)
local checked_out_branch = assert(run({ 'git', 'rev-parse', '--abbrev-ref', 'HEAD' }))
if not checked_out_branch:match('^' .. required_branch_prefix) then
- p(
+ print(
"Current branch '"
.. checked_out_branch
.. "' doesn't seem to start with "
.. required_branch_prefix
)
- p('Checking out to bump-' .. new_branch_suffix)
- explicit_create_branch(new_branch_suffix)
+ print('Checking out to bump-' .. name)
+ run_die({ 'git', 'checkout', '-b', 'bump-' .. name }, 'git failed to create branch')
end
-end
-
-local function update_cmakelists(dependency, archive, comment)
- require_executable('git')
- verify_branch(dependency.name)
-
- p('Updating ' .. dependency.name .. ' to ' .. archive.url .. '\n')
- write_cmakelists_line(dependency.symbol, 'URL', archive.url:gsub('/', '\\/'))
- write_cmakelists_line(dependency.symbol, 'SHA256', archive.sha)
+ print('Updating ' .. name .. ' to ' .. archive.url .. '\n')
+ update_deps_file(symbol, 'URL', archive.url:gsub('/', '\\/'))
+ update_deps_file(symbol, 'SHA256', archive.sha)
run_die({
'git',
'commit',
deps_file,
'-m',
- commit_prefix .. 'bump ' .. dependency.name .. ' to ' .. comment,
+ commit_prefix .. 'bump ' .. name .. ' to ' .. comment,
}, 'git failed to commit')
end
-local function verify_cmakelists_committed()
- require_executable('git')
-
- run_die(
- { 'git', 'diff', '--quiet', 'HEAD', '--', deps_file },
- deps_file .. ' has uncommitted changes'
- )
-end
-
-local function warn_luv_symbol()
- p('warning: ' .. get_dependency('Luv').symbol .. '_VERSION will not be updated')
-end
-
--- return first 9 chars of commit
-local function short_commit(commit)
- return string.sub(commit, 1, 9)
-end
-
--- TODO: remove hardcoded fork
-local function gh_pr(pr_title, pr_body)
- require_executable('gh')
-
- local pr_url = run_die({
- 'gh',
- 'pr',
- 'create',
- '--title',
- pr_title,
- '--body',
- pr_body,
- }, 'Failed to create PR')
- return pr_url
-end
-
-local function find_git_remote(fork)
- require_executable('git')
-
- local remotes = assert(run({ 'git', 'remote', '-v' }))
- local git_remote = ''
- for remote in remotes:gmatch('[^\r\n]+') do
- local words = {}
- for word in remote:gmatch('%w+') do
- table.insert(words, word)
- end
- local match = words[1]:match('/github.com[:/]neovim/neovim/')
- if fork == 'fork' then
- match = not match
- end
- if match and words[3] == '(fetch)' then
- git_remote = words[0]
- break
- end
- end
- if git_remote == '' then
- git_remote = 'origin'
- end
- return git_remote
-end
-
-local function create_pr(pr_title, pr_body)
- require_executable('git')
-
- local push_first = true
-
- local checked_out_branch = run({ 'git', 'rev-parse', '--abbrev-ref', 'HEAD' })
- if push_first then
- local push_remote =
- run({ 'git', 'config', '--get', 'branch.' .. checked_out_branch .. '.pushRemote' })
- if push_remote == nil then
- push_remote = run({ 'git', 'config', '--get', 'remote.pushDefault' })
- if push_remote == nil then
- push_remote =
- run({ 'git', 'config', '--get', 'branch.' .. checked_out_branch .. '.remote' })
- if push_remote == nil or push_remote == find_git_remote(nil) then
- push_remote = find_git_remote('fork')
- end
- end
- end
-
- p('Pushing to ' .. push_remote .. '/' .. checked_out_branch)
- run_die({ 'git', 'push', push_remote, checked_out_branch }, 'Git failed to push')
- end
-
- local pr_url = gh_pr(pr_title, pr_body)
- p('\nCreated PR: ' .. pr_url .. '\n')
-end
-
-function M.commit(dependency_name, commit)
- local dependency = assert(get_dependency(dependency_name))
- verify_cmakelists_committed()
- local commit_sha = get_gh_commit_sha(dependency.repo, commit)
- if commit_sha ~= commit then
- p('Not a commit: ' .. commit .. '. Did you mean version?')
- die()
- end
- local archive = get_archive_info(dependency.repo, commit)
- if dependency_name == 'Luv' then
- warn_luv_symbol()
- end
- update_cmakelists(dependency, archive, short_commit(commit))
-end
-
-function M.version(dependency_name, version)
- vim.validate('dependency_name', dependency_name, 'string')
- vim.validate('version', version, 'string')
- local dependency = assert(get_dependency(dependency_name))
- verify_cmakelists_committed()
- local commit_sha = get_gh_commit_sha(dependency.repo, version)
- if commit_sha == version then
- p('Not a version: ' .. version .. '. Did you mean commit?')
- die()
- end
- local archive = get_archive_info(dependency.repo, version)
- if dependency_name == 'Luv' then
- write_cmakelists_line(dependency.symbol, 'VERSION', version)
- end
- update_cmakelists(dependency, archive, version)
-end
-
-function M.head(dependency_name)
- local dependency = assert(get_dependency(dependency_name))
- verify_cmakelists_committed()
- local commit_sha = get_gh_commit_sha(dependency.repo, 'HEAD')
- local archive = get_archive_info(dependency.repo, commit_sha)
- if dependency_name == 'Luv' then
- warn_luv_symbol()
- end
- update_cmakelists(dependency, archive, 'HEAD - ' .. short_commit(commit_sha))
-end
-
-function M.create_branch(dep)
- explicit_create_branch(dep)
-end
-
-function M.submit_pr()
- require_executable('git')
-
- verify_branch('deps')
-
- local nvim_remote = find_git_remote(nil)
- local relevant_commit = assert(run_die({
- 'git',
- 'log',
- '--grep=' .. commit_prefix,
- '--reverse',
- "--format='%s'",
- nvim_remote .. '/master..HEAD',
- '-1',
- }, 'Failed to fetch commits'))
-
- local pr_title
- local pr_body
-
- if relevant_commit == '' then
- pr_title = commit_prefix .. 'bump some dependencies'
- pr_body = 'bump some dependencies'
- else
- relevant_commit = relevant_commit:gsub("'", '')
- pr_title = relevant_commit
- pr_body = relevant_commit:gsub(commit_prefix:gsub('%(', '%%('):gsub('%)', '%%)'), '')
- end
- pr_body = pr_body .. '\n\n(add explanations if needed)'
- p(pr_title .. '\n' .. pr_body .. '\n')
- create_pr(pr_title, pr_body)
-end
-
local function usage()
- local this_script = _G.arg[0]:match('[^/]*.lua$')
- print(([=[
+ local this_script = tostring(vim.fs.basename(_G.arg[0]))
+ local script_exe = './' .. this_script
+ local help = ([=[
Bump Nvim dependencies
- Usage: nvim -l %s [options]
- Bump to HEAD, tagged version, commit, or branch:
- nvim -l %s --dep Luv --head
- nvim -l %s --dep Luv --version 1.43.0-0
- nvim -l %s --dep Luv --commit abc123
- nvim -l %s --dep Luv --branch
- Create a PR:
- nvim -l %s --pr
+ Usage: %s [options]
+ Bump to HEAD, tagged version or commit:
+ %s luv --head
+ %s luv --ref 1.43.0-0
+ %s luv --ref abc123
Options:
- -h show this message and exit.
- --pr submit pr for bumping deps.
- --branch <dep> create a branch bump-<dep> from current branch.
- --dep <dependency> bump to a specific release or tag.
+ -h, --help show this message and exit.
+ --list list all dependencies
Dependency Options:
- --version <tag> bump to a specific release or tag.
- --commit <hash> bump to a specific commit.
- --HEAD bump to a current head.
+ --ref <ref> bump to a specific commit or tag.
+ --head bump to a current head.
+ ]=]):format(script_exe, script_exe, script_exe, script_exe)
+ print(help)
+end
- <dependency> is one of:
- "LuaJIT", "libuv", "Luv", "tree-sitter"
- ]=]):format(this_script, this_script, this_script, this_script, this_script, this_script))
+local function list_deps()
+ local l = 'Dependencies:\n'
+ for k in vim.spairs(dependency_table) do
+ l = string.format('%s\n%s%s', l, string.rep(' ', 2), k)
+ end
+ print(l)
end
-local function parseargs()
+do
local args = {}
- for i = 1, #_G.arg do
- if _G.arg[i] == '-h' then
+ local i = 1
+ while i <= #_G.arg do
+ if _G.arg[i] == '-h' or _G.arg[i] == '--help' then
args.h = true
- elseif _G.arg[i] == '--pr' then
- args.pr = true
- elseif _G.arg[i] == '--branch' then
- args.branch = _G.arg[i + 1]
- elseif _G.arg[i] == '--dep' then
- args.dep = _G.arg[i + 1]
- elseif _G.arg[i] == '--version' then
- args.version = _G.arg[i + 1]
- elseif _G.arg[i] == '--commit' then
- args.commit = _G.arg[i + 1]
+ elseif _G.arg[i] == '--list' then
+ args.list = true
+ elseif _G.arg[i] == '--ref' then
+ args.ref = _G.arg[i + 1]
+ i = i + 1
elseif _G.arg[i] == '--head' then
- args.head = true
+ args.ref = 'HEAD'
+ elseif vim.startswith(_G.arg[i], '--') then
+ die(string.format('Invalid argument %s\n', _G.arg[i]))
+ else
+ args.dep = _G.arg[i]
end
+ i = i + 1
end
- return args
-end
-
-local is_main = _G.arg[0]:match('bump_deps.lua')
-if is_main then
- local args = parseargs()
if args.h then
usage()
- elseif args.pr then
- M.submit_pr()
- elseif args.head then
- M.head(args.dep)
- elseif args.branch then
- M.create_branch(args.dep)
- elseif args.version then
- M.version(args.dep, args.version)
- elseif args.commit then
- M.commit(args.dep, args.commit)
- elseif args.pr then
- M.submit_pr()
+ elseif args.list then
+ list_deps()
+ elseif args.ref then
+ ref(args.dep, args.ref)
else
- print('missing required arg\n')
- os.exit(1)
+ die('missing required arg\n')
end
-else
- return M
end
diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c
index b9e7d7143a..1d81b21be6 100644
--- a/src/nvim/api/deprecated.c
+++ b/src/nvim/api/deprecated.c
@@ -21,6 +21,7 @@
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/lua/executor.h"
+#include "nvim/marktree.h"
#include "nvim/memory.h"
#include "nvim/memory_defs.h"
#include "nvim/message.h"
@@ -84,6 +85,17 @@ Integer nvim_buf_get_number(Buffer buffer, Error *err)
return buf->b_fnum;
}
+static uint32_t src2ns(Integer *src_id)
+{
+ if (*src_id == 0) {
+ *src_id = nvim_create_namespace((String)STRING_INIT);
+ }
+ if (*src_id < 0) {
+ return (((uint32_t)1) << 31) - 1;
+ }
+ return (uint32_t)(*src_id);
+}
+
/// Clears highlights and virtual text from namespace and range of lines
///
/// @deprecated use |nvim_buf_clear_namespace()|.
@@ -102,6 +114,80 @@ void nvim_buf_clear_highlight(Buffer buffer, Integer ns_id, Integer line_start,
nvim_buf_clear_namespace(buffer, ns_id, line_start, line_end, err);
}
+/// Adds a highlight to buffer.
+///
+/// @deprecated use |nvim_buf_set_extmark()| or |vim.hl.range()|
+///
+/// Namespaces are used for batch deletion/updating of a set of highlights. To
+/// create a namespace, use |nvim_create_namespace()| which returns a namespace
+/// id. Pass it in to this function as `ns_id` to add highlights to the
+/// namespace. All highlights in the same namespace can then be cleared with
+/// single call to |nvim_buf_clear_namespace()|. If the highlight never will be
+/// deleted by an API call, pass `ns_id = -1`.
+///
+/// As a shorthand, `ns_id = 0` can be used to create a new namespace for the
+/// highlight, the allocated id is then returned. If `hl_group` is the empty
+/// string no highlight is added, but a new `ns_id` is still returned. This is
+/// supported for backwards compatibility, new code should use
+/// |nvim_create_namespace()| to create a new empty namespace.
+///
+/// @param buffer Buffer handle, or 0 for current buffer
+/// @param ns_id namespace to use or -1 for ungrouped highlight
+/// @param hl_group Name of the highlight group to use
+/// @param line Line to highlight (zero-indexed)
+/// @param col_start Start of (byte-indexed) column range to highlight
+/// @param col_end End of (byte-indexed) column range to highlight,
+/// or -1 to highlight to end of line
+/// @param[out] err Error details, if any
+/// @return The ns_id that was used
+Integer nvim_buf_add_highlight(Buffer buffer, Integer ns_id, String hl_group, Integer line,
+ Integer col_start, Integer col_end, Error *err)
+ FUNC_API_SINCE(1)
+ FUNC_API_DEPRECATED_SINCE(13)
+{
+ buf_T *buf = find_buffer_by_handle(buffer, err);
+ if (!buf) {
+ return 0;
+ }
+
+ VALIDATE_RANGE((line >= 0 && line < MAXLNUM), "line number", {
+ return 0;
+ });
+ VALIDATE_RANGE((col_start >= 0 && col_start <= MAXCOL), "column", {
+ return 0;
+ });
+
+ if (col_end < 0 || col_end > MAXCOL) {
+ col_end = MAXCOL;
+ }
+
+ uint32_t ns = src2ns(&ns_id);
+
+ if (!(line < buf->b_ml.ml_line_count)) {
+ // safety check, we can't add marks outside the range
+ return ns_id;
+ }
+
+ int hl_id = 0;
+ if (hl_group.size > 0) {
+ hl_id = syn_check_group(hl_group.data, hl_group.size);
+ } else {
+ return ns_id;
+ }
+
+ int end_line = (int)line;
+ if (col_end == MAXCOL) {
+ col_end = 0;
+ end_line++;
+ }
+
+ DecorInline decor = DECOR_INLINE_INIT;
+ decor.data.hl.hl_id = hl_id;
+
+ extmark_set(buf, ns, NULL, (int)line, (colnr_T)col_start, end_line, (colnr_T)col_end,
+ decor, MT_FLAG_DECOR_HL, true, false, false, false, NULL);
+ return ns_id;
+}
/// Set the virtual text (annotation) for a buffer line.
///
/// @deprecated use nvim_buf_set_extmark to use full virtual text functionality.
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 18e37012ee..e66140da5a 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -49,7 +49,7 @@ void api_extmark_free_all_mem(void)
/// Creates a new namespace or gets an existing one. [namespace]()
///
/// Namespaces are used for buffer highlights and virtual text, see
-/// |nvim_buf_add_highlight()| and |nvim_buf_set_extmark()|.
+/// |nvim_buf_set_extmark()|.
///
/// Namespaces can be named or anonymous. If `name` matches an existing
/// namespace, the associated id is returned. If `name` is an empty string
@@ -901,95 +901,6 @@ Boolean nvim_buf_del_extmark(Buffer buffer, Integer ns_id, Integer id, Error *er
return extmark_del_id(buf, (uint32_t)ns_id, (uint32_t)id);
}
-uint32_t src2ns(Integer *src_id)
-{
- if (*src_id == 0) {
- *src_id = nvim_create_namespace((String)STRING_INIT);
- }
- if (*src_id < 0) {
- return (((uint32_t)1) << 31) - 1;
- }
- return (uint32_t)(*src_id);
-}
-
-/// Adds a highlight to buffer.
-///
-/// Useful for plugins that dynamically generate highlights to a buffer
-/// (like a semantic highlighter or linter). The function adds a single
-/// highlight to a buffer. Unlike |matchaddpos()| highlights follow changes to
-/// line numbering (as lines are inserted/removed above the highlighted line),
-/// like signs and marks do.
-///
-/// Namespaces are used for batch deletion/updating of a set of highlights. To
-/// create a namespace, use |nvim_create_namespace()| which returns a namespace
-/// id. Pass it in to this function as `ns_id` to add highlights to the
-/// namespace. All highlights in the same namespace can then be cleared with
-/// single call to |nvim_buf_clear_namespace()|. If the highlight never will be
-/// deleted by an API call, pass `ns_id = -1`.
-///
-/// As a shorthand, `ns_id = 0` can be used to create a new namespace for the
-/// highlight, the allocated id is then returned. If `hl_group` is the empty
-/// string no highlight is added, but a new `ns_id` is still returned. This is
-/// supported for backwards compatibility, new code should use
-/// |nvim_create_namespace()| to create a new empty namespace.
-///
-/// @param buffer Buffer handle, or 0 for current buffer
-/// @param ns_id namespace to use or -1 for ungrouped highlight
-/// @param hl_group Name of the highlight group to use
-/// @param line Line to highlight (zero-indexed)
-/// @param col_start Start of (byte-indexed) column range to highlight
-/// @param col_end End of (byte-indexed) column range to highlight,
-/// or -1 to highlight to end of line
-/// @param[out] err Error details, if any
-/// @return The ns_id that was used
-Integer nvim_buf_add_highlight(Buffer buffer, Integer ns_id, String hl_group, Integer line,
- Integer col_start, Integer col_end, Error *err)
- FUNC_API_SINCE(1)
-{
- buf_T *buf = find_buffer_by_handle(buffer, err);
- if (!buf) {
- return 0;
- }
-
- VALIDATE_RANGE((line >= 0 && line < MAXLNUM), "line number", {
- return 0;
- });
- VALIDATE_RANGE((col_start >= 0 && col_start <= MAXCOL), "column", {
- return 0;
- });
-
- if (col_end < 0 || col_end > MAXCOL) {
- col_end = MAXCOL;
- }
-
- uint32_t ns = src2ns(&ns_id);
-
- if (!(line < buf->b_ml.ml_line_count)) {
- // safety check, we can't add marks outside the range
- return ns_id;
- }
-
- int hl_id = 0;
- if (hl_group.size > 0) {
- hl_id = syn_check_group(hl_group.data, hl_group.size);
- } else {
- return ns_id;
- }
-
- int end_line = (int)line;
- if (col_end == MAXCOL) {
- col_end = 0;
- end_line++;
- }
-
- DecorInline decor = DECOR_INLINE_INIT;
- decor.data.hl.hl_id = hl_id;
-
- extmark_set(buf, ns, NULL, (int)line, (colnr_T)col_start, end_line, (colnr_T)col_end,
- decor, MT_FLAG_DECOR_HL, true, false, false, false, NULL);
- return ns_id;
-}
-
/// Clears |namespace|d objects (highlights, |extmarks|, virtual text) from
/// a region.
///
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 7f4de9eab8..b1ea38e280 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2580,9 +2580,9 @@ int compute_foldcolumn(win_T *wp, int col)
{
int fdc = win_fdccol_count(wp);
int wmw = wp == curwin && p_wmw == 0 ? 1 : (int)p_wmw;
- int wwidth = wp->w_grid.cols;
+ int n = wp->w_grid.cols - (col + wmw);
- return MIN(fdc, wwidth - (col + wmw));
+ return MIN(fdc, n);
}
/// Return the width of the 'number' and 'relativenumber' column.
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 423b50cd32..1eecee2a38 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -163,6 +163,7 @@ typedef struct {
typedef struct {
buf_T *buf;
OptInt save_b_p_ul;
+ int save_b_p_ma;
int save_b_changed;
pos_T save_b_op_start;
pos_T save_b_op_end;
@@ -2419,6 +2420,7 @@ static void cmdpreview_prepare(CpInfo *cpinfo)
if (!set_has(ptr_t, &saved_bufs, buf)) {
CpBufInfo cp_bufinfo;
cp_bufinfo.buf = buf;
+ cp_bufinfo.save_b_p_ma = buf->b_p_ma;
cp_bufinfo.save_b_p_ul = buf->b_p_ul;
cp_bufinfo.save_b_changed = buf->b_changed;
cp_bufinfo.save_b_op_start = buf->b_op_start;
@@ -2509,6 +2511,7 @@ static void cmdpreview_restore_state(CpInfo *cpinfo)
}
buf->b_p_ul = cp_bufinfo.save_b_p_ul; // Restore 'undolevels'
+ buf->b_p_ma = cp_bufinfo.save_b_p_ma; // Restore 'modifiable'
}
for (size_t i = 0; i < cpinfo->win_info.size; i++) {
@@ -2704,7 +2707,6 @@ static int command_line_changed(CommandLineState *s)
&& current_sctx.sc_sid == 0 // only if interactive
&& *p_icm != NUL // 'inccommand' is set
&& !exmode_active // not in ex mode
- && curbuf->b_p_ma // buffer is modifiable
&& cmdline_star == 0 // not typing a password
&& !vpeekc_any()
&& cmdpreview_may_show(s)) {
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 031ae30d41..1c9903695e 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -3276,7 +3276,11 @@ static void vim_mktempdir(void)
expand_env((char *)temp_dirs[i], tmp, TEMP_FILE_PATH_MAXLEN - 64);
if (!os_isdir(tmp)) {
if (strequal("$TMPDIR", temp_dirs[i])) {
- WLOG("$TMPDIR tempdir not a directory (or does not exist): %s", tmp);
+ if (!os_getenv("TMPDIR")) {
+ WLOG("$TMPDIR is unset");
+ } else {
+ WLOG("$TMPDIR tempdir not a directory (or does not exist): \"%s\"", tmp);
+ }
}
continue;
}
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 68d3af6074..a5b48a5d5e 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -276,10 +276,9 @@ static int nlua_luv_thread_common_cfpcall(lua_State *lstate, int nargs, int nres
#endif
}
const char *error = lua_tostring(lstate, -1);
-
loop_schedule_deferred(&main_loop,
event_create(nlua_luv_error_event,
- xstrdup(error),
+ error != NULL ? xstrdup(error) : NULL,
(void *)(intptr_t)(is_callback
? kThreadCallback
: kThread)));
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 5423446ef9..4c20edb7eb 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -153,7 +153,6 @@ static Array *msg_ext_chunks = NULL;
static garray_T msg_ext_last_chunk = GA_INIT(sizeof(char), 40);
static sattr_T msg_ext_last_attr = -1;
static int msg_ext_last_hl_id;
-static size_t msg_ext_cur_len = 0;
static bool msg_ext_history = false; ///< message was added to history
static bool msg_ext_overwrite = false; ///< will overwrite last message
@@ -2246,14 +2245,13 @@ static void msg_puts_display(const char *str, int maxlen, int hl_id, int recurse
// Concat pieces with the same highlight
size_t len = maxlen < 0 ? strlen(str) : strnlen(str, (size_t)maxlen);
ga_concat_len(&msg_ext_last_chunk, str, len);
- msg_ext_cur_len += len;
- msg_col += (int)mb_string2cells(str);
- // When message ends in newline, reset variables used to format message: msg_advance().
- assert(len > 0);
- if (str[len - 1] == '\n') {
- msg_ext_cur_len = 0;
- msg_col = 0;
- }
+
+ // Find last newline in the message and calculate the current message column
+ const char *lastline = strrchr(str, '\n');
+ maxlen -= (int)(lastline ? (lastline - str) : 0);
+ const char *p = lastline ? lastline + 1 : str;
+ int col = (int)(maxlen < 0 ? mb_string2cells(p) : mb_string2cells_len(p, (size_t)(maxlen)));
+ msg_col = (lastline ? 0 : msg_col) + col;
return;
}
@@ -3155,7 +3153,7 @@ static Array *msg_ext_init_chunks(void)
{
Array *tofree = msg_ext_chunks;
msg_ext_chunks = xcalloc(1, sizeof(*msg_ext_chunks));
- msg_ext_cur_len = 0;
+ msg_col = 0;
return tofree;
}
@@ -3472,14 +3470,6 @@ void msg_advance(int col)
msg_col = col; // for redirection, may fill it up later
return;
}
- if (ui_has(kUIMessages)) {
- // TODO(bfredl): use byte count as a basic proxy.
- // later on we might add proper support for formatted messages.
- while (msg_ext_cur_len < (size_t)col) {
- msg_putchar(' ');
- }
- return;
- }
col = MIN(col, Columns - 1); // not enough room
while (msg_col < col) {
msg_putchar(' ');
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 073a816d0c..f9eb67ff83 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -980,12 +980,12 @@ static int validate_opt_idx(win_T *win, OptIndex opt_idx, int opt_flags, uint32_
// Skip all options that are not window-local (used when showing
// an already loaded buffer in a window).
- if ((opt_flags & OPT_WINONLY) && (opt_idx == kOptInvalid || !option_is_window_local(opt_idx))) {
+ if ((opt_flags & OPT_WINONLY) && !option_is_window_local(opt_idx)) {
return FAIL;
}
// Skip all options that are window-local (used for :vimgrep).
- if ((opt_flags & OPT_NOWIN) && opt_idx != kOptInvalid && option_is_window_local(opt_idx)) {
+ if ((opt_flags & OPT_NOWIN) && option_is_window_local(opt_idx)) {
return FAIL;
}
@@ -3267,7 +3267,7 @@ bool is_option_hidden(OptIndex opt_idx)
/// Check if option supports a specific type.
bool option_has_type(OptIndex opt_idx, OptValType type)
{
- return options[opt_idx].type == type;
+ return opt_idx != kOptInvalid && options[opt_idx].type == type;
}
/// Check if option supports a specific scope.
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index be5047f814..645bb23638 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <string.h>
+#include "nvim/api/private/defs.h"
#include "nvim/ascii_defs.h"
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
@@ -2086,49 +2087,54 @@ static schar_T get_encoded_char_adv(const char **p)
}
struct chars_tab {
- schar_T *cp; ///< char value
- const char *name; ///< char id
- const char *def; ///< default value
- const char *fallback; ///< default value when "def" isn't single-width
+ schar_T *cp; ///< char value
+ String name; ///< char id
+ const char *def; ///< default value
+ const char *fallback; ///< default value when "def" isn't single-width
};
+#define CHARSTAB_ENTRY(cp, name, def, fallback) \
+ { (cp), { name, STRLEN_LITERAL(name) }, def, fallback }
+
static fcs_chars_T fcs_chars;
static const struct chars_tab fcs_tab[] = {
- { &fcs_chars.stl, "stl", " ", NULL },
- { &fcs_chars.stlnc, "stlnc", " ", NULL },
- { &fcs_chars.wbr, "wbr", " ", NULL },
- { &fcs_chars.horiz, "horiz", "─", "-" },
- { &fcs_chars.horizup, "horizup", "┴", "-" },
- { &fcs_chars.horizdown, "horizdown", "┬", "-" },
- { &fcs_chars.vert, "vert", "│", "|" },
- { &fcs_chars.vertleft, "vertleft", "┤", "|" },
- { &fcs_chars.vertright, "vertright", "├", "|" },
- { &fcs_chars.verthoriz, "verthoriz", "┼", "+" },
- { &fcs_chars.fold, "fold", "·", "-" },
- { &fcs_chars.foldopen, "foldopen", "-", NULL },
- { &fcs_chars.foldclosed, "foldclose", "+", NULL },
- { &fcs_chars.foldsep, "foldsep", "│", "|" },
- { &fcs_chars.diff, "diff", "-", NULL },
- { &fcs_chars.msgsep, "msgsep", " ", NULL },
- { &fcs_chars.eob, "eob", "~", NULL },
- { &fcs_chars.lastline, "lastline", "@", NULL },
+ CHARSTAB_ENTRY(&fcs_chars.stl, "stl", " ", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.stlnc, "stlnc", " ", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.wbr, "wbr", " ", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.horiz, "horiz", "─", "-"),
+ CHARSTAB_ENTRY(&fcs_chars.horizup, "horizup", "┴", "-"),
+ CHARSTAB_ENTRY(&fcs_chars.horizdown, "horizdown", "┬", "-"),
+ CHARSTAB_ENTRY(&fcs_chars.vert, "vert", "│", "|"),
+ CHARSTAB_ENTRY(&fcs_chars.vertleft, "vertleft", "┤", "|"),
+ CHARSTAB_ENTRY(&fcs_chars.vertright, "vertright", "├", "|"),
+ CHARSTAB_ENTRY(&fcs_chars.verthoriz, "verthoriz", "┼", "+"),
+ CHARSTAB_ENTRY(&fcs_chars.fold, "fold", "·", "-"),
+ CHARSTAB_ENTRY(&fcs_chars.foldopen, "foldopen", "-", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.foldclosed, "foldclose", "+", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.foldsep, "foldsep", "│", "|"),
+ CHARSTAB_ENTRY(&fcs_chars.diff, "diff", "-", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.msgsep, "msgsep", " ", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.eob, "eob", "~", NULL),
+ CHARSTAB_ENTRY(&fcs_chars.lastline, "lastline", "@", NULL),
};
static lcs_chars_T lcs_chars;
static const struct chars_tab lcs_tab[] = {
- { &lcs_chars.eol, "eol", NULL, NULL },
- { &lcs_chars.ext, "extends", NULL, NULL },
- { &lcs_chars.nbsp, "nbsp", NULL, NULL },
- { &lcs_chars.prec, "precedes", NULL, NULL },
- { &lcs_chars.space, "space", NULL, NULL },
- { &lcs_chars.tab2, "tab", NULL, NULL },
- { &lcs_chars.lead, "lead", NULL, NULL },
- { &lcs_chars.trail, "trail", NULL, NULL },
- { &lcs_chars.conceal, "conceal", NULL, NULL },
- { NULL, "multispace", NULL, NULL },
- { NULL, "leadmultispace", NULL, NULL },
+ CHARSTAB_ENTRY(&lcs_chars.eol, "eol", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.ext, "extends", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.nbsp, "nbsp", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.prec, "precedes", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.space, "space", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.tab2, "tab", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.lead, "lead", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.trail, "trail", NULL, NULL),
+ CHARSTAB_ENTRY(&lcs_chars.conceal, "conceal", NULL, NULL),
+ CHARSTAB_ENTRY(NULL, "multispace", NULL, NULL),
+ CHARSTAB_ENTRY(NULL, "leadmultispace", NULL, NULL),
};
+#undef CHARSTAB_ENTRY
+
static char *field_value_err(char *errbuf, size_t errbuflen, const char *fmt, const char *field)
{
if (errbuf == NULL) {
@@ -2209,13 +2215,13 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
while (*p) {
int i;
for (i = 0; i < entries; i++) {
- const size_t len = strlen(tab[i].name);
- if (!(strncmp(p, tab[i].name, len) == 0 && p[len] == ':')) {
+ if (!(strncmp(p, tab[i].name.data,
+ tab[i].name.size) == 0 && p[tab[i].name.size] == ':')) {
continue;
}
- if (what == kListchars && strcmp(tab[i].name, "multispace") == 0) {
- const char *s = p + len + 1;
+ const char *s = p + tab[i].name.size + 1;
+ if (what == kListchars && strcmp(tab[i].name.data, "multispace") == 0) {
if (round == 0) {
// Get length of lcs-multispace string in the first round
last_multispace = p;
@@ -2225,7 +2231,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
if (c1 == 0) {
return field_value_err(errbuf, errbuflen,
e_wrong_character_width_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
multispace_len++;
}
@@ -2233,7 +2239,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
// lcs-multispace cannot be an empty string
return field_value_err(errbuf, errbuflen,
e_wrong_number_of_characters_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
p = s;
} else {
@@ -2249,8 +2255,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
break;
}
- if (what == kListchars && strcmp(tab[i].name, "leadmultispace") == 0) {
- const char *s = p + len + 1;
+ if (what == kListchars && strcmp(tab[i].name.data, "leadmultispace") == 0) {
if (round == 0) {
// get length of lcs-leadmultispace string in first round
last_lmultispace = p;
@@ -2260,7 +2265,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
if (c1 == 0) {
return field_value_err(errbuf, errbuflen,
e_wrong_character_width_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
lead_multispace_len++;
}
@@ -2268,7 +2273,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
// lcs-leadmultispace cannot be an empty string
return field_value_err(errbuf, errbuflen,
e_wrong_number_of_characters_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
p = s;
} else {
@@ -2284,17 +2289,16 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
break;
}
- const char *s = p + len + 1;
if (*s == NUL) {
return field_value_err(errbuf, errbuflen,
e_wrong_number_of_characters_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
schar_T c1 = get_encoded_char_adv(&s);
if (c1 == 0) {
return field_value_err(errbuf, errbuflen,
e_wrong_character_width_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
schar_T c2 = 0;
schar_T c3 = 0;
@@ -2302,20 +2306,20 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
if (*s == NUL) {
return field_value_err(errbuf, errbuflen,
e_wrong_number_of_characters_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
c2 = get_encoded_char_adv(&s);
if (c2 == 0) {
return field_value_err(errbuf, errbuflen,
e_wrong_character_width_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
if (!(*s == ',' || *s == NUL)) {
c3 = get_encoded_char_adv(&s);
if (c3 == 0) {
return field_value_err(errbuf, errbuflen,
e_wrong_character_width_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
}
}
@@ -2335,7 +2339,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
} else {
return field_value_err(errbuf, errbuflen,
e_wrong_number_of_characters_for_field_str,
- tab[i].name);
+ tab[i].name.data);
}
}
@@ -2366,22 +2370,22 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
/// 'fillchars' option.
char *get_fillchars_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
{
- if (idx >= (int)ARRAY_SIZE(fcs_tab)) {
+ if (idx < 0 || idx >= (int)ARRAY_SIZE(fcs_tab)) {
return NULL;
}
- return (char *)fcs_tab[idx].name;
+ return fcs_tab[idx].name.data;
}
/// Function given to ExpandGeneric() to obtain possible arguments of the
/// 'listchars' option.
char *get_listchars_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
{
- if (idx >= (int)ARRAY_SIZE(lcs_tab)) {
+ if (idx < 0 || idx >= (int)ARRAY_SIZE(lcs_tab)) {
return NULL;
}
- return (char *)lcs_tab[idx].name;
+ return lcs_tab[idx].name.data;
}
/// Check all global and local values of 'listchars' and 'fillchars'.
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index 434d4c8a6f..b8515fa3e2 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -772,8 +772,7 @@ void draw_tabline(void)
if (modified || wincount > 1) {
if (wincount > 1) {
- vim_snprintf(NameBuff, MAXPATHL, "%d", wincount);
- int len = (int)strlen(NameBuff);
+ int len = vim_snprintf(NameBuff, MAXPATHL, "%d", wincount);
if (col + len >= Columns - 3) {
break;
}
@@ -798,7 +797,8 @@ void draw_tabline(void)
len -= ptr2cells(p);
MB_PTR_ADV(p);
}
- len = MIN(len, Columns - col - 1);
+ int n = Columns - col - 1;
+ len = MIN(len, n);
grid_line_puts(col, p, -1, attr);
col += len;
@@ -832,7 +832,8 @@ void draw_tabline(void)
// Draw the 'showcmd' information if 'showcmdloc' == "tabline".
if (p_sc && *p_sloc == 't') {
- const int sc_width = MIN(10, (int)Columns - col - (tabcount > 1) * 3);
+ int n = Columns - col - (tabcount > 1) * 3;
+ const int sc_width = MIN(10, n);
if (sc_width > 0) {
grid_line_puts(Columns - sc_width - (tabcount > 1) * 2,
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 1c0d8c1027..fa2bfec138 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5243,11 +5243,13 @@ void win_free(win_T *wp, tabpage_T *tp)
// freed memory is re-used for another window.
FOR_ALL_BUFFERS(buf) {
WinInfo *wip_wp = NULL;
+ size_t pos_wip = kv_size(buf->b_wininfo);
size_t pos_null = kv_size(buf->b_wininfo);
for (size_t i = 0; i < kv_size(buf->b_wininfo); i++) {
WinInfo *wip = kv_A(buf->b_wininfo, i);
if (wip->wi_win == wp) {
wip_wp = wip;
+ pos_wip = i;
} else if (wip->wi_win == NULL) {
pos_null = i;
}
@@ -5255,11 +5257,12 @@ void win_free(win_T *wp, tabpage_T *tp)
if (wip_wp) {
wip_wp->wi_win = NULL;
- // If there already is an entry with "wi_win" set to NULL it
- // must be removed, it would never be used.
+ // If there already is an entry with "wi_win" set to NULL, only
+ // the first entry with NULL will ever be used, delete the other one.
if (pos_null < kv_size(buf->b_wininfo)) {
- free_wininfo(kv_A(buf->b_wininfo, pos_null), buf);
- kv_shift(buf->b_wininfo, pos_null, 1);
+ size_t pos_delete = MAX(pos_null, pos_wip);
+ free_wininfo(kv_A(buf->b_wininfo, pos_delete), buf);
+ kv_shift(buf->b_wininfo, pos_delete, 1);
}
}
}
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 078d581b6f..028f0beb38 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -506,6 +506,48 @@ describe('API/win', function()
assert_alive()
end)
+ describe('after closing', function()
+ local buf, win0, win1, win2
+
+ before_each(function()
+ win0 = api.nvim_get_current_win()
+ command('new')
+ buf = api.nvim_get_current_buf()
+ win1 = api.nvim_get_current_win()
+ command('set numberwidth=10')
+ command('split')
+ win2 = api.nvim_get_current_win()
+ command('set numberwidth=15')
+ command('enew')
+ api.nvim_set_current_win(win1)
+ command('normal ix')
+ command('enew')
+ api.nvim_set_current_win(win0)
+ eq(4, api.nvim_get_option_value('numberwidth', {}))
+ end)
+
+ -- at this point buffer `buf` is current in no windows. Closing shouldn't affect its defaults
+ it('0 windows', function()
+ api.nvim_set_current_buf(buf)
+ eq(10, api.nvim_get_option_value('numberwidth', {}))
+ end)
+
+ it('1 window', function()
+ api.nvim_win_close(win1, false)
+
+ api.nvim_set_current_buf(buf)
+ eq(10, api.nvim_get_option_value('numberwidth', {}))
+ end)
+
+ it('2 windows', function()
+ api.nvim_win_close(win1, false)
+ api.nvim_win_close(win2, false)
+
+ api.nvim_set_current_buf(buf)
+ eq(10, api.nvim_get_option_value('numberwidth', {}))
+ end)
+ end)
+
it('returns values for unset local options', function()
eq(-1, api.nvim_get_option_value('scrolloff', { win = 0, scope = 'local' }))
end)
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index e52a8991ce..80f4307d5b 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -369,6 +369,9 @@ describe('vim.diagnostic', function()
end)
it('handles one namespace clearing highlights while the other still has highlights', function()
+ exec_lua(function()
+ vim.diagnostic.config({ virtual_text = true })
+ end)
-- 1 Error (1)
-- 1 Warning (2)
-- 1 Warning (2) + 1 Warning (1)
@@ -443,6 +446,10 @@ describe('vim.diagnostic', function()
end)
it('does not display diagnostics when disabled', function()
+ exec_lua(function()
+ vim.diagnostic.config({ virtual_text = true })
+ end)
+
eq(
{ 0, 2 },
exec_lua(function()
@@ -916,6 +923,10 @@ describe('vim.diagnostic', function()
describe('reset()', function()
it('diagnostic count is 0 and displayed diagnostics are 0 after call', function()
+ exec_lua(function()
+ vim.diagnostic.config({ virtual_text = true })
+ end)
+
-- 1 Error (1)
-- 1 Warning (2)
-- 1 Warning (2) + 1 Warning (1)
@@ -2117,7 +2128,11 @@ describe('vim.diagnostic', function()
end)
it('can perform updates after insert_leave', function()
- exec_lua [[vim.api.nvim_set_current_buf( _G.diagnostic_bufnr)]]
+ exec_lua(function()
+ vim.diagnostic.config({ virtual_text = true })
+ vim.api.nvim_set_current_buf(_G.diagnostic_bufnr)
+ end)
+
api.nvim_input('o')
eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
@@ -2258,7 +2273,10 @@ describe('vim.diagnostic', function()
end)
it('can perform updates while in insert mode, if desired', function()
- exec_lua [[vim.api.nvim_set_current_buf( _G.diagnostic_bufnr)]]
+ exec_lua(function()
+ vim.diagnostic.config({ virtual_text = true })
+ vim.api.nvim_set_current_buf(_G.diagnostic_bufnr)
+ end)
api.nvim_input('o')
eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
@@ -2292,6 +2310,10 @@ describe('vim.diagnostic', function()
end)
it('can set diagnostics without displaying them', function()
+ exec_lua(function()
+ vim.diagnostic.config({ virtual_text = true })
+ end)
+
eq(
0,
exec_lua(function()
diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua
index d64c024d7f..b75ff75b05 100644
--- a/test/functional/lua/filetype_spec.lua
+++ b/test/functional/lua/filetype_spec.lua
@@ -119,7 +119,7 @@ describe('vim.filetype', function()
it('works with contents #22180', function()
eq(
- 'bash',
+ 'sh',
exec_lua(function()
-- Needs to be set so detect#sh doesn't fail
vim.g.ft_ignore_pat = '\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$'
diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua
index 310705fd97..8ca4bdc4f5 100644
--- a/test/functional/lua/thread_spec.lua
+++ b/test/functional/lua/thread_spec.lua
@@ -19,6 +19,26 @@ describe('thread', function()
screen = Screen.new(50, 10)
end)
+ it('handle non-string error', function()
+ exec_lua [[
+ local thread = vim.uv.new_thread(function()
+ error()
+ end)
+ vim.uv.thread_join(thread)
+ ]]
+
+ screen:expect([[
+ |
+ {1:~ }|*5
+ {3: }|
+ {9:Error in luv thread:} |
+ {9:[NULL]} |
+ {6:Press ENTER or type command to continue}^ |
+ ]])
+ feed('<cr>')
+ assert_alive()
+ end)
+
it('entry func is executed in protected mode', function()
exec_lua [[
local thread = vim.uv.new_thread(function()
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua
index 15ac9da657..4e90c2fd1b 100644
--- a/test/functional/plugin/lsp/completion_spec.lua
+++ b/test/functional/plugin/lsp/completion_spec.lua
@@ -216,6 +216,43 @@ describe('vim.lsp.completion: item conversion', function()
})
end)
+ it('uses filterText as word if label/newText would not match', function()
+ local items = {
+ {
+ filterText = '<module',
+ insertTextFormat = 2,
+ kind = 10,
+ label = 'module',
+ sortText = 'module',
+ textEdit = {
+ newText = '<module>$1</module>$0',
+ range = {
+ start = {
+ character = 0,
+ line = 0,
+ },
+ ['end'] = {
+ character = 0,
+ line = 0,
+ },
+ },
+ },
+ },
+ }
+ assert_completion_matches('<mo', items, {
+ {
+ abbr = 'module',
+ word = '<module',
+ },
+ })
+ assert_completion_matches('', items, {
+ {
+ abbr = 'module',
+ word = 'module',
+ },
+ })
+ end)
+
it('fuzzy matches on label when filterText is missing', function()
assert_completion_matches('fo', {
{ label = 'foo' },
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua
index 2d26d2c5e0..3eee9a6e07 100644
--- a/test/functional/ui/inccommand_user_spec.lua
+++ b/test/functional/ui/inccommand_user_spec.lua
@@ -253,6 +253,50 @@ describe("'inccommand' for user commands", function()
]]
end)
+ it("can preview 'nomodifiable' buffer", function()
+ exec_lua([[
+ vim.api.nvim_create_user_command("PreviewTest", function() end, {
+ preview = function(ev)
+ vim.bo.modifiable = true
+ vim.api.nvim_buf_set_lines(0, 0, -1, false, {"cats"})
+ return 2
+ end,
+ })
+ ]])
+ command('set inccommand=split')
+
+ command('set nomodifiable')
+ eq(false, api.nvim_get_option_value('modifiable', { buf = 0 }))
+
+ feed(':PreviewTest')
+
+ screen:expect([[
+ cats |
+ {1:~ }|*8
+ {3:[No Name] [+] }|
+ |
+ {1:~ }|*4
+ {2:[Preview] }|
+ :PreviewTest^ |
+ ]])
+ feed('<Esc>')
+ screen:expect([[
+ text on line 1 |
+ more text on line 2 |
+ oh no, even more text |
+ will the text ever stop |
+ oh well |
+ did the text stop |
+ why won't it stop |
+ make the text stop |
+ ^ |
+ {1:~ }|*7
+ |
+ ]])
+
+ eq(false, api.nvim_get_option_value('modifiable', { buf = 0 }))
+ end)
+
it('works with inccommand=nosplit', function()
command('set inccommand=nosplit')
feed(':Replace text cats')
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 6b07c66dc0..020603015f 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -128,9 +128,6 @@ func s:GetFilenameChecks() abort
\ 'ave': ['file.ave'],
\ 'awk': ['file.awk', 'file.gawk'],
\ 'b': ['file.mch', 'file.ref', 'file.imp'],
- \ 'bash': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases',
- \ '.bash-aliases', '.bash_history', '.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw',
- \ 'PKGBUILD', 'file.bash', 'file.bats', 'file.cygport'],
\ 'basic': ['file.bas', 'file.bi', 'file.bm'],
\ 'bass': ['file.bass'],
\ 'bc': ['file.bc'],
@@ -393,7 +390,7 @@ func s:GetFilenameChecks() abort
\ 'jovial': ['file.jov', 'file.j73', 'file.jovial'],
\ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'],
\ 'jq': ['file.jq'],
- \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock'],
+ \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock', '.swcrc'],
\ 'json5': ['file.json5'],
\ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock', expand("$HOME/.config/VSCodium/User/settings.json")],
\ 'jsonl': ['file.jsonl'],
@@ -686,10 +683,11 @@ func s:GetFilenameChecks() abort
\ 'services': ['/etc/services', 'any/etc/services'],
\ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'],
\ 'sexplib': ['file.sexp'],
- \ 'sh': ['/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf',
- \ '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', 'user-dirs.defaults', 'user-dirs.dirs',
- \ 'makepkg.conf', '.makepkg.conf', 'file.mdd', '.env', '.envrc', 'devscripts.conf', '.devscripts', 'file.lo',
- \ 'file.la', 'file.lai'],
+ \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history',
+ \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh',
+ \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile',
+ \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf',
+ \ '.devscripts', 'file.lo', 'file.la', 'file.lai'],
\ 'shaderslang': ['file.slang'],
\ 'sieve': ['file.siv', 'file.sieve'],
\ 'sil': ['file.sil'],
@@ -981,11 +979,11 @@ func s:GetScriptChecks() abort
\ 'clojure': [['#!/path/clojure']],
\ 'scala': [['#!/path/scala']],
\ 'sh': [['#!/path/sh'],
+ \ ['#!/path/bash'],
+ \ ['#!/path/bash2'],
\ ['#!/path/dash'],
\ ['#!/path/ksh'],
\ ['#!/path/ksh93']],
- \ 'bash': [['#!/path/bash'],
- \ ['#!/path/bash2']],
\ 'csh': [['#!/path/csh']],
\ 'tcsh': [['#!/path/tcsh']],
\ 'zsh': [['#!/path/zsh']],