summaryrefslogtreecommitdiffstats
path: root/runtime/autoload
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
commit75a9fa68f6cdd6769813a8c5e055bfb00a08c089 (patch)
treedaf1676b4e5ea491b7a370467a24b8181cc21827 /runtime/autoload
parentAdding upstream version 2:9.1.0377. (diff)
downloadvim-75a9fa68f6cdd6769813a8c5e055bfb00a08c089.tar.xz
vim-75a9fa68f6cdd6769813a8c5e055bfb00a08c089.zip
Adding upstream version 2:9.1.0496.upstream/2%9.1.0496
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/ccomplete.vim4
-rw-r--r--runtime/autoload/dist/ft.vim36
-rw-r--r--runtime/autoload/dist/script.vim4
-rw-r--r--runtime/autoload/hare.vim26
-rw-r--r--runtime/autoload/netrw.vim165
-rw-r--r--runtime/autoload/netrwSettings.vim3
-rw-r--r--runtime/autoload/zig/fmt.vim100
-rw-r--r--runtime/autoload/zip.vim37
8 files changed, 149 insertions, 226 deletions
diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim
index 7096dcf..355f724 100644
--- a/runtime/autoload/ccomplete.vim
+++ b/runtime/autoload/ccomplete.vim
@@ -3,7 +3,7 @@ vim9script noclear
# Vim completion script
# Language: C
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2023 Aug 10
+# Last Change: 2024 Jun 06
# Rewritten in Vim9 script by github user lacygoill
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
@@ -210,7 +210,7 @@ export def Complete(findstart: bool, abase: string): any # {{{1
# Find the variable in the tags file(s)
var diclist: list<dict<any>> = taglist('^' .. items[0] .. '$')
# Remove members, these can't appear without something in front.
- ->filter((_, v: dict<string>): bool =>
+ ->filter((_, v: dict<any>): bool =>
v->has_key('kind') ? v.kind != 'm' : true)
res = []
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 4e7d517..bf9e32e 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -3,7 +3,7 @@ vim9script
# Vim functions for file type detection
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2024 Feb 18
+# Last Change: 2024 May 23
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
# These functions are moved here from runtime/filetype.vim to make startup
@@ -376,6 +376,32 @@ export def FTfs()
endif
enddef
+# Recursively search for Hare source files in a directory and any
+# subdirectories, up to a given depth.
+def IsHareModule(dir: string, depth: number): bool
+ if depth <= 0
+ return !empty(glob(dir .. '/*.ha'))
+ endif
+
+ return reduce(sort(glob(dir .. '/*', true, true),
+ (a, b) => isdirectory(a) - isdirectory(b)),
+ (acc, n) => acc
+ || n =~ '\.ha$'
+ || isdirectory(n)
+ && IsHareModule(n, depth - 1),
+ false)
+enddef
+
+# Determine if a README file exists within a Hare module and should be given the
+# Haredoc filetype.
+export def FTharedoc()
+ if exists('g:filetype_haredoc')
+ if IsHareModule('<afile>:h', get(g:, 'haredoc_search_depth', 1))
+ setf haredoc
+ endif
+ endif
+enddef
+
# Distinguish between HTML, XHTML and Django
export def FThtml()
var n = 1
@@ -406,14 +432,18 @@ export def FTidl()
setf idl
enddef
-# Distinguish between "default", Prolog and Cproto prototype file.
+# Distinguish between "default", Prolog, zsh module's C and Cproto prototype file.
export def ProtoCheck(default: string)
+ # zsh modules use '#include "*.pro"'
+ # https://github.com/zsh-users/zsh/blob/63f086d167960a27ecdbcb762179e2c2bf8a29f5/Src/Modules/example.c#L31
+ if getline(1) =~ '/* Generated automatically */'
+ setf c
# Cproto files have a comment in the first line and a function prototype in
# the second line, it always ends in ";". Indent files may also have
# comments, thus we can't match comments to see the difference.
# IDL files can have a single ';' in the second line, require at least one
# chacter before the ';'.
- if getline(2) =~ '.;$'
+ elseif getline(2) =~ '.;$'
setf cpp
else
# recognize Prolog by specific text in the first non-empty line
diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim
index f58899a..33ed7fd 100644
--- a/runtime/autoload/dist/script.vim
+++ b/runtime/autoload/dist/script.vim
@@ -229,6 +229,10 @@ export def Exe2filetype(name: string, line1: string): string
elseif name =~ '^execlineb\>'
return 'execline'
+ # Vim
+ elseif name =~ '^vim\>'
+ return 'vim'
+
endif
return ''
diff --git a/runtime/autoload/hare.vim b/runtime/autoload/hare.vim
new file mode 100644
index 0000000..c4581fc
--- /dev/null
+++ b/runtime/autoload/hare.vim
@@ -0,0 +1,26 @@
+" Vim autoload file.
+" Language: Hare
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Updated: 2024-05-10
+" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
+
+" Attempt to find the directory for a given Hare module.
+function hare#FindModule(str)
+ let path = substitute(trim(a:str, ':', 2), '::', '/', 'g')
+ let dir = finddir(path)
+ while !empty(path) && empty(dir)
+ let path = substitute(path, '/\?\h\w*$', '', '')
+ let dir = finddir(path)
+ endwhile
+ return dir
+endfunction
+
+" Return the value of HAREPATH if it exists. Otherwise use a reasonable default.
+function hare#GetPath()
+ if empty($HAREPATH)
+ return '/usr/src/hare/stdlib,/usr/src/hare/third-party'
+ endif
+ return substitute($HAREPATH, ':', ',', 'g')
+endfunction
+
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index e2152b0..d8de432 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -9,6 +9,12 @@
" 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)
" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
@@ -283,20 +289,15 @@ if !exists("g:netrw_scp_cmd")
if executable("scp")
call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
elseif executable("pscp")
- if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable('c:\private.ppk')
- call s:NetrwInit("g:netrw_scp_cmd", 'pscp -i c:\private.ppk')
- else
- call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q')
- endif
+ call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q')
else
call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
endif
endif
-
call s:NetrwInit("g:netrw_sftp_cmd" , "sftp")
call s:NetrwInit("g:netrw_ssh_cmd" , "ssh")
-if (has("win32") || has("win95") || has("win64") || has("win16"))
+if has("win32")
\ && exists("g:netrw_use_nt_rcp")
\ && g:netrw_use_nt_rcp
\ && executable( $SystemRoot .'/system32/rcp.exe')
@@ -311,12 +312,8 @@ endif
" Default values for netrw's global variables {{{2
" Cygwin Detection ------- {{{3
if !exists("g:netrw_cygwin")
- if has("win32") || has("win95") || has("win64") || has("win16")
- if has("win32unix") && &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
- let g:netrw_cygwin= 1
- else
- let g:netrw_cygwin= 0
- endif
+ if has("win32unix") && &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
+ let g:netrw_cygwin= 1
else
let g:netrw_cygwin= 0
endif
@@ -372,10 +369,6 @@ endif
call s:NetrwInit("g:netrw_keepdir",1)
if !exists("g:netrw_list_cmd")
if g:netrw_scp_cmd =~ '^pscp' && executable("pscp")
- if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk")
- " provide a pscp-based listing command
- let g:netrw_scp_cmd ="pscp -i C:\\private.ppk"
- endif
if exists("g:netrw_list_cmd_options")
let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME: ".g:netrw_list_cmd_options
else
@@ -403,7 +396,7 @@ if !exists("g:netrw_localcmdshell")
let g:netrw_localcmdshell= ""
endif
if !exists("g:netrw_localcopycmd")
- if has("win32") || has("win95") || has("win64") || has("win16")
+ if has("win32")
if g:netrw_cygwin
let g:netrw_localcopycmd= "cp"
else
@@ -417,7 +410,7 @@ if !exists("g:netrw_localcopycmd")
endif
endif
if !exists("g:netrw_localcopydircmd")
- if has("win32") || has("win95") || has("win64") || has("win16")
+ if has("win32")
if g:netrw_cygwin
let g:netrw_localcopydircmd = "cp"
let g:netrw_localcopydircmdopt= " -R"
@@ -439,7 +432,7 @@ if exists("g:netrw_local_mkdir")
let g:netrw_localmkdir= g:netrw_local_mkdir
call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87)
endif
-if has("win32") || has("win95") || has("win64") || has("win16")
+if has("win32")
if g:netrw_cygwin
call s:NetrwInit("g:netrw_localmkdir","mkdir")
else
@@ -455,7 +448,7 @@ if exists("g:netrw_local_movecmd")
call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88)
endif
if !exists("g:netrw_localmovecmd")
- if has("win32") || has("win95") || has("win64") || has("win16")
+ if has("win32")
if g:netrw_cygwin
let g:netrw_localmovecmd= "mv"
else
@@ -488,7 +481,7 @@ call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh
call s:NetrwInit("g:netrw_retmap" , 0)
if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
-elseif has("win32") || has("win95") || has("win64") || has("win16")
+elseif has("win32")
call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM")
else
call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
@@ -547,14 +540,13 @@ if !exists("g:netrw_xstrlen")
endif
endif
call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.")
-call s:NetrwInit("g:netrw_win95ftp",1)
call s:NetrwInit("g:netrw_winsize",50)
call s:NetrwInit("g:netrw_wiw",1)
if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif
" ---------------------------------------------------------------------
" Default values for netrw's script variables: {{{2
call s:NetrwInit("g:netrw_fname_escape",' ?&;%')
-if has("win32") || has("win95") || has("win64") || has("win16")
+if has("win32")
call s:NetrwInit("g:netrw_glob_escape",'*?`{[]$')
else
call s:NetrwInit("g:netrw_glob_escape",'*[]?`{~$\')
@@ -686,7 +678,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
" record current directory
let curdir = simplify(b:netrw_curdir)
let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
- if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !exists("g:netrw_cygwin") && has("win32")
let curdir= substitute(curdir,'\','/','g')
endif
" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("<slnum>"))
@@ -844,7 +836,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
" handle .../**/.../filepat
" call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("<slnum>"))
let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','')
- if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16")))
+ if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && has("win32"))
let b:netrw_curdir = prefixdir
else
let b:netrw_curdir= getcwd().'/'.prefixdir
@@ -881,7 +873,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
else
if dirname == ""
let dirname= getcwd()
- elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin
+ elseif has("win32") && !g:netrw_cygwin
" Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo',
" depending on whether backslashes have been converted to forward slashes by earlier code).
if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+'
@@ -1420,7 +1412,7 @@ fun! netrw#Obtain(islocal,fname,...)
" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>"))
if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
let topath= s:ComposePath(tgtdir,"")
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
" transfer files one at time
" call Decho("transfer files one at a time",'~'.expand("<slnum>"))
for fname in fnamelist
@@ -2301,7 +2293,7 @@ fun! netrw#NetRead(mode,...)
endif
" 'C' in 'C:\path\to\file' is handled as hostname on windows.
" This is workaround to avoid mis-handle windows local-path:
- if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if g:netrw_scp_cmd =~ '^scp' && has("win32")
let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '')
else
let tmpfile_get = tmpfile
@@ -3221,7 +3213,7 @@ fun! s:NetrwMethod(choice)
if exists("s:netrw_hup[host]")
call NetUserPass("ftp:".host)
- elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~# '-[sS]:'
+ elseif has("win32") && s:netrw_ftp_cmd =~# '-[sS]:'
" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>"))
" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("<slnum>"))
if g:netrw_ftp_cmd =~# '-[sS]:\S*MACHINE\>'
@@ -3336,38 +3328,6 @@ fun! s:NetrwMethod(choice)
" call Dret("s:NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port)
endfun
-" ------------------------------------------------------------------------
-" NetReadFixup: this sort of function is typically written by the user {{{2
-" to handle extra junk that their system's ftp dumps
-" into the transfer. This function is provided as an
-" example and as a fix for a Windows 95 problem: in my
-" experience, win95's ftp always dumped four blank lines
-" at the end of the transfer.
-if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
- fun! NetReadFixup(method, line1, line2)
-" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
-
- " sanity checks -- attempt to convert inputs to integers
- let method = a:method + 0
- let line1 = a:line1 + 0
- let line2 = a:line2 + 0
- if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0
-" call Dret("NetReadFixup")
- return
- endif
-
- if method == 3 " ftp (no <.netrc>)
- let fourblanklines= line2 - 3
- if fourblanklines >= line1
- exe "sil NetrwKeepj ".fourblanklines.",".line2."g/^\s*$/d"
- call histdel("/",-1)
- endif
- endif
-
-" call Dret("NetReadFixup")
- endfun
-endif
-
" ---------------------------------------------------------------------
" NetUserPass: set username and password for subsequent ftp transfer {{{2
" Usage: :call NetUserPass() -- will prompt for userid and password
@@ -3990,7 +3950,7 @@ fun! s:NetrwBrowse(islocal,dirname)
if b:netrw_curdir =~ '[/\\]$'
let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
endif
- if b:netrw_curdir =~ '\a:$' && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if b:netrw_curdir =~ '\a:$' && has("win32")
let b:netrw_curdir= b:netrw_curdir."/"
endif
if b:netrw_curdir == ''
@@ -4144,7 +4104,7 @@ fun! s:NetrwFile(fname)
let b:netrw_curdir= getcwd()
endif
- if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !exists("g:netrw_cygwin") && has("win32")
if fname =~ '^\' || fname =~ '^\a:\'
" windows, but full path given
let ret= fname
@@ -4864,7 +4824,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
call s:SavePosn(s:netrw_posn)
NetrwKeepj call s:NetrwOptionsSave("s:")
NetrwKeepj call s:NetrwOptionsSafe(a:islocal)
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
let dirname = substitute(b:netrw_curdir,'\\','/','ge')
else
let dirname = b:netrw_curdir
@@ -5111,7 +5071,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
endif
" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>"))
- elseif !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+ elseif !g:netrw_cygwin && has("win32")
" windows
if a:islocal
let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','')
@@ -5396,7 +5356,7 @@ fun! netrw#BrowseX(fname,remote)
" set up the filename
" (lower case the extension, make a local copy of a remote file)
let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
- if has("win32") || has("win95") || has("win64") || has("win16")
+ if has("win32")
let exten= substitute(exten,'^.*$','\L&\E','')
endif
if exten =~ "[\\/]"
@@ -5443,12 +5403,12 @@ fun! netrw#BrowseX(fname,remote)
" by default, g:netrw_suppress_gx_mesg is true
if g:netrw_suppress_gx_mesg
if &srr =~ "%s"
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
let redir= substitute(&srr,"%s","nul","")
else
let redir= substitute(&srr,"%s","/dev/null","")
endif
- elseif (has("win32") || has("win95") || has("win64") || has("win16"))
+ elseif has("win32")
let redir= &srr . "nul"
else
let redir= &srr . "/dev/null"
@@ -5491,7 +5451,7 @@ fun! netrw#BrowseX(fname,remote)
call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir)
let ret= v:shell_error
- elseif has("win32") || has("win64")
+ elseif has("win32")
" call Decho("(netrw#BrowseX) win".(has("win32")? "32" : "64"),'~'.expand("<slnum>"))
if executable("start")
call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1))
@@ -5766,6 +5726,9 @@ fun! s:NetrwEditFile(cmd,opt,fname)
exe "NetrwKeepj keepalt ".a:opt." ".a:cmd." ".fnameescape(a:fname)
else
" call Decho("exe NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname))
+ if a:cmd =~# 'e\%[new]!' && !&hidden && getbufvar(bufname('%'), '&modified', 0)
+ call setbufvar(bufname('%'), '&bufhidden', 'hide')
+ endif
exe "NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname)
endif
" call Dret("s:NetrwEditFile")
@@ -5836,16 +5799,20 @@ fun! s:NetrwGlob(direntry,expr,pare)
let filelist= w:netrw_treedict[a:direntry]
endif
let w:netrw_liststyle= keep_liststyle
- elseif v:version > 704 || (v:version == 704 && has("patch656"))
- let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1)
- if a:pare
- let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
- endif
else
- let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1)
- if a:pare
- let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
- endif
+ let path= s:ComposePath(fnameescape(a:direntry),a:expr)
+ if has("win32")
+ " escape [ so it is not detected as wildcard character, see :h wildcard
+ let path= substitute(path, '[', '[[]', 'g')
+ endif
+ if v:version > 704 || (v:version == 704 && has("patch656"))
+ let filelist= glob(path,0,1,1)
+ else
+ let filelist= glob(path,0,1)
+ endif
+ if a:pare
+ let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
+ endif
endif
" call Dret("s:NetrwGlob ".string(filelist))
return filelist
@@ -6006,7 +5973,7 @@ fun! s:NetrwHome()
" just pick the first directory
let home= substitute(&rtp,',.*$','','')
endif
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
let home= substitute(home,'/','\\','g')
endif
endif
@@ -7227,7 +7194,7 @@ fun! s:NetrwMarkFileCopy(islocal,...)
let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"s:ShellEscape(b:netrw_curdir.\"/\".v:val)"))
let tgt = s:ShellEscape(s:netrwmftgt)
endif
- if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !g:netrw_cygwin && has("win32")
let args= substitute(args,'/','\\','g')
let tgt = substitute(tgt, '/','\\','g')
endif
@@ -7241,7 +7208,7 @@ fun! s:NetrwMarkFileCopy(islocal,...)
" call Decho("args<".args."> is a directory",'~'.expand("<slnum>"))
let copycmd= g:netrw_localcopydircmd
" call Decho("using copydircmd<".copycmd.">",'~'.expand("<slnum>"))
- if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !g:netrw_cygwin && has("win32")
" window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's
" contents to a target. One must append the source directory name to the target to get xcopy to
" do the right thing.
@@ -7859,7 +7826,7 @@ fun! s:NetrwMarkFileMove(islocal)
endif
let tgt = s:ShellEscape(s:netrwmftgt)
" call Decho("tgt<".tgt.">",'~'.expand("<slnum>"))
- if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !g:netrw_cygwin && has("win32")
let tgt= substitute(tgt, '/','\\','g')
" call Decho("windows exception: tgt<".tgt.">",'~'.expand("<slnum>"))
if g:netrw_localmovecmd =~ '\s'
@@ -7880,7 +7847,7 @@ fun! s:NetrwMarkFileMove(islocal)
" Jul 19, 2022: fixing file move when g:netrw_keepdir is 1
let fname= b:netrw_curdir."/".fname
endif
- if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !g:netrw_cygwin && has("win32")
let fname= substitute(fname,'/','\\','g')
endif
" call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("<slnum>"))
@@ -10349,7 +10316,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
endif
" cleanup for Windows " {{{3
- if has("win32") || has("win95") || has("win64") || has("win16")
+ if has("win32")
sil! NetrwKeepj %s/\r$//e
NetrwKeepj call histdel("/",-1)
endif
@@ -10857,7 +10824,7 @@ fun! netrw#FileUrlEdit(fname)
let fname= substitute(fname,'^file://localhost/','file:///','')
" call Decho("fname<".fname.">",'~'.expand("<slnum>"))
endif
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
if fname =~ '^file:///\=\a[|:]/'
" call Decho('converting file:///\a|/ -to- file://\a:/','~'.expand("<slnum>"))
let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','')
@@ -10867,7 +10834,7 @@ fun! netrw#FileUrlEdit(fname)
let fname2396 = netrw#RFC2396(fname)
let fname2396e= fnameescape(fname2396)
let plainfname= substitute(fname2396,'file://\(.*\)','\1',"")
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
" call Decho("windows exception for plainfname",'~'.expand("<slnum>"))
if plainfname =~ '^/\+\a:'
" call Decho('removing leading "/"s','~'.expand("<slnum>"))
@@ -11079,7 +11046,7 @@ fun! s:LocalFastBrowser()
let s:netrw_events= 1
augroup AuNetrwEvent
au!
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
" call Decho("installing autocmd: ShellCmdPost",'~'.expand("<slnum>"))
au ShellCmdPost * call s:LocalBrowseRefresh()
else
@@ -11121,7 +11088,7 @@ fun! s:LocalListing()
let filelist = filelist + s:NetrwGlob(dirname,".*",0)
" call Decho("filelist=".string(filelist),'~'.expand("<slnum>"))
- if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if g:netrw_cygwin == 0 && has("win32")
" call Decho("filelist=".string(filelist),'~'.expand("<slnum>"))
elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/'
" include ../ in the glob() entry if its missing
@@ -11167,7 +11134,7 @@ fun! s:LocalListing()
let pfile= filename."/"
elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(s:NetrwFile(filename))
- if (has("win32") || has("win95") || has("win64") || has("win16"))
+ if has("win32")
if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$'
" indicate an executable
" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>"))
@@ -11501,7 +11468,7 @@ fun! s:NetrwLocalRmFile(path,fname,all)
if !all
echohl Statement
call inputsave()
- let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
+ let ok= input("Confirm *recursive* deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
if ok == ""
@@ -11514,7 +11481,7 @@ fun! s:NetrwLocalRmFile(path,fname,all)
let rmfile= substitute(rmfile,'[\/]$','','e')
if all || ok =~# 'y\%[es]' || ok == ""
- if delete(rmfile,"d")
+ if delete(rmfile,"rf")
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103)
endif
endif
@@ -11644,7 +11611,7 @@ endfun
" netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2
fun! netrw#WinPath(path)
" call Dfunc("netrw#WinPath(path<".a:path.">)")
- if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && has("win32")
" remove cygdrive prefix, if present
let path = substitute(a:path,g:netrw_cygdrive.'/\(.\)','\1:','')
" remove trailing slash (Win95)
@@ -11704,11 +11671,11 @@ fun! s:ComposePath(base,subdir)
endif
" COMBAK: test on windows with changing to root directory: :e C:/
- elseif a:subdir =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16"))
+ elseif a:subdir =~ '^\a:[/\\]\([^/\\]\|$\)' && has("win32")
" call Decho("windows",'~'.expand("<slnum>"))
let ret= a:subdir
- elseif a:base =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16"))
+ elseif a:base =~ '^\a:[/\\]\([^/\\]\|$\)' && has("win32")
" call Decho("windows",'~'.expand("<slnum>"))
if a:base =~ '[/\\]$'
let ret= a:base.a:subdir
@@ -11820,7 +11787,7 @@ fun! s:GetTempfile(fname)
" o/s dependencies
if g:netrw_cygwin != 0
let tmpfile = substitute(tmpfile,'^\(\a\):',g:netrw_cygdrive.'/\1','e')
- elseif has("win32") || has("win95") || has("win64") || has("win16")
+ elseif has("win32")
if !exists("+shellslash") || !&ssl
let tmpfile = substitute(tmpfile,'/','\','g')
endif
@@ -12036,7 +12003,7 @@ fun! s:NetrwDelete(path)
" call Dfunc("s:NetrwDelete(path<".a:path.">)")
let path = netrw#WinPath(a:path)
- if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+ if !g:netrw_cygwin && has("win32")
if exists("+shellslash")
let sskeep= &shellslash
setl noshellslash
@@ -12227,7 +12194,7 @@ fun! s:NetrwLcd(newdir)
" 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or
" forward slashes ('//Foo'), depending on whether backslashes have been converted to
" forward slashes by earlier code; so check for both.
- if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin
+ if has("win32") && !g:netrw_cygwin
if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+'
let dirname = '\'
exe 'NetrwKeepj sil lcd '.fnameescape(dirname)
@@ -12700,7 +12667,7 @@ endfun
" ---------------------------------------------------------------------
" s:ShellEscape: shellescape(), or special windows handling {{{2
fun! s:ShellEscape(s, ...)
- if (has('win32') || has('win64')) && $SHELL == '' && &shellslash
+ if has('win32') && $SHELL == '' && &shellslash
return printf('"%s"', substitute(a:s, '"', '""', 'g'))
endif
let f = a:0 > 0 ? a:1 : 0
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
index 5525c0d..3452602 100644
--- a/runtime/autoload/netrwSettings.vim
+++ b/runtime/autoload/netrwSettings.vim
@@ -3,6 +3,8 @@
" 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
@@ -91,7 +93,6 @@ fun! netrwSettings#NetrwSettings()
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
- put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
let s:netrw_xfer_stop= line(".")
put =''
put ='+ Netrw Messages'
diff --git a/runtime/autoload/zig/fmt.vim b/runtime/autoload/zig/fmt.vim
deleted file mode 100644
index b78c199..0000000
--- a/runtime/autoload/zig/fmt.vim
+++ /dev/null
@@ -1,100 +0,0 @@
-" Adapted from fatih/vim-go: autoload/go/fmt.vim
-"
-" Copyright 2011 The Go Authors. All rights reserved.
-" Use of this source code is governed by a BSD-style
-" license that can be found in the LICENSE file.
-"
-" Upstream: https://github.com/ziglang/zig.vim
-
-function! zig#fmt#Format() abort
- " Save cursor position and many other things.
- let view = winsaveview()
-
- if !executable('zig')
- echohl Error | echomsg "no zig binary found in PATH" | echohl None
- return
- endif
-
- let cmdline = 'zig fmt --stdin --ast-check'
- let current_buf = bufnr('')
-
- " The formatted code is output on stdout, the errors go on stderr.
- if exists('*systemlist')
- silent let out = systemlist(cmdline, current_buf)
- else
- silent let out = split(system(cmdline, current_buf))
- endif
- if len(out) == 1
- if out[0] == "error: unrecognized parameter: '--ast-check'"
- let cmdline = 'zig fmt --stdin'
- if exists('*systemlist')
- silent let out = systemlist(cmdline, current_buf)
- else
- silent let out = split(system(cmdline, current_buf))
- endif
- endif
- endif
- let err = v:shell_error
-
-
- if err == 0
- " remove undo point caused via BufWritePre.
- try | silent undojoin | catch | endtry
-
- " Replace the file content with the formatted version.
- if exists('*deletebufline')
- call deletebufline(current_buf, len(out), line('$'))
- else
- silent execute ':' . len(out) . ',' . line('$') . ' delete _'
- endif
- call setline(1, out)
-
- " No errors detected, close the loclist.
- call setloclist(0, [], 'r')
- lclose
- elseif get(g:, 'zig_fmt_parse_errors', 1)
- let errors = s:parse_errors(expand('%'), out)
-
- call setloclist(0, [], 'r', {
- \ 'title': 'Errors',
- \ 'items': errors,
- \ })
-
- let max_win_height = get(g:, 'zig_fmt_max_window_height', 5)
- " Prevent the loclist from becoming too long.
- let win_height = min([max_win_height, len(errors)])
- " Open the loclist, but only if there's at least one error to show.
- execute 'silent! lwindow ' . win_height
- endif
-
- call winrestview(view)
-
- if err != 0
- echohl Error | echomsg "zig fmt returned error" | echohl None
- return
- endif
-
- " Run the syntax highlighter on the updated content and recompute the folds if
- " needed.
- syntax sync fromstart
-endfunction
-
-" parse_errors parses the given errors and returns a list of parsed errors
-function! s:parse_errors(filename, lines) abort
- " list of errors to be put into location list
- let errors = []
- for line in a:lines
- let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
- if !empty(tokens)
- call add(errors,{
- \"filename": a:filename,
- \"lnum": tokens[2],
- \"col": tokens[3],
- \"text": tokens[4],
- \ })
- endif
- endfor
-
- return errors
-endfunction
-" vim: sw=2 ts=2 et
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index c0034f8..d0e706e 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -4,17 +4,18 @@
" Version: 33
" Maintainer: This runtime file is looking for a new maintainer.
" Former Maintainer: Charles E Campbell
+" Last Change:
+" 2024 Jun 16 by Vim Project: handle whitespace on Windows properly (#14998)
" License: Vim License (see vim's :help license)
-" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
-" Permission is hereby granted to use and distribute this code,
-" with or without modifications, provided that this copyright
-" notice is copied with it. Like anything else that's free,
-" zip.vim and zipPlugin.vim are provided *as is* and comes with
-" no warranty of any kind, either expressed or implied. By using
-" this plugin, you agree that in no event will the copyright
-" holder be liable for any damages resulting from the use
-" of this software.
-"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
+" Permission is hereby granted to use and distribute this code,
+" with or without modifications, provided that this copyright
+" notice is copied with it. Like anything else that's free,
+" zip.vim and zipPlugin.vim are provided *as is* and comes with
+" no warranty of any kind, either expressed or implied. By using
+" this plugin, you agree that in no event will the copyright
+" holder be liable for any damages resulting from the use
+" of this software.
" ---------------------------------------------------------------------
" Load Once: {{{1
@@ -214,7 +215,6 @@ endfun
" ---------------------------------------------------------------------
" zip#Read: {{{2
fun! zip#Read(fname,mode)
-" call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")")
let repkeep= &report
set report=10
@@ -226,15 +226,12 @@ fun! zip#Read(fname,mode)
let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','')
let fname = substitute(fname, '[', '[[]', 'g')
endif
-" call Decho("zipfile<".zipfile.">")
-" call Decho("fname <".fname.">")
" sanity check
if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','',''))
redraw!
echohl Error | echo "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program" | echohl None
" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let &report= repkeep
-" call Dret("zip#Write")
return
endif
@@ -242,10 +239,8 @@ fun! zip#Read(fname,mode)
" exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1)
" but allows zipfile://... entries in quickfix lists
let temp = tempname()
-" call Decho("using temp file<".temp.">")
let fn = expand('%:p')
- exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp
-" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp)
+ exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1).' > '.temp
sil exe 'keepalt file '.temp
sil keepj e!
sil exe 'keepalt file '.fnameescape(fn)
@@ -254,11 +249,9 @@ fun! zip#Read(fname,mode)
filetype detect
" cleanup
- " keepj 0d " used to be needed for the ...r! ... method
set nomod
let &report= repkeep
-" call Dret("zip#Read")
endfun
" ---------------------------------------------------------------------
@@ -422,7 +415,6 @@ endfun
" ---------------------------------------------------------------------
" s:Escape: {{{2
fun! s:Escape(fname,isfilt)
-" call Dfunc("QuoteFileDir(fname<".a:fname."> isfilt=".a:isfilt.")")
if exists("*shellescape")
if a:isfilt
let qnameq= shellescape(a:fname,1)
@@ -432,7 +424,10 @@ fun! s:Escape(fname,isfilt)
else
let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq
endif
-" call Dret("QuoteFileDir <".qnameq.">")
+ if exists("+shellslash") && &shellslash && &shell =~ "cmd.exe"
+ " renormalize directory separator on Windows
+ let qnameq=substitute(qnameq, '/', '\\', 'g')
+ endif
return qnameq
endfun