aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/haskellcomplete.vim5
-rw-r--r--runtime/autoload/health/nvim.vim6
-rw-r--r--runtime/autoload/man.vim2
-rw-r--r--runtime/autoload/netrw.vim282
-rw-r--r--runtime/autoload/netrwSettings.vim2
-rw-r--r--runtime/autoload/netrw_gitignore.vim58
-rw-r--r--runtime/autoload/tar.vim277
-rw-r--r--runtime/doc/api.txt48
-rw-r--r--runtime/doc/diff.txt4
-rw-r--r--runtime/doc/editing.txt4
-rw-r--r--runtime/doc/eval.txt89
-rw-r--r--runtime/doc/index.txt1
-rw-r--r--runtime/doc/insert.txt6
-rw-r--r--runtime/doc/lsp.txt28
-rw-r--r--runtime/doc/options.txt31
-rw-r--r--runtime/doc/pi_netrw.txt50
-rw-r--r--runtime/doc/pi_tar.txt109
-rw-r--r--runtime/doc/starting.txt2
-rw-r--r--runtime/doc/syntax.txt2
-rw-r--r--runtime/doc/usr_41.txt1
-rw-r--r--runtime/doc/vim_diff.txt8
-rw-r--r--runtime/doc/windows.txt5
-rw-r--r--runtime/filetype.vim6
-rw-r--r--runtime/indent/tcl.vim4
-rw-r--r--runtime/lua/vim/lsp.lua58
-rw-r--r--runtime/lua/vim/lsp/buf.lua12
-rw-r--r--runtime/lua/vim/lsp/callbacks.lua4
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua22
-rw-r--r--runtime/lua/vim/lsp/handlers.lua8
-rw-r--r--runtime/lua/vim/lsp/log.lua12
-rw-r--r--runtime/lua/vim/lsp/protocol.lua2
-rw-r--r--runtime/lua/vim/lsp/rpc.lua5
-rw-r--r--runtime/lua/vim/lsp/util.lua84
-rw-r--r--runtime/lua/vim/treesitter.lua9
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua9
-rw-r--r--runtime/lua/vim/treesitter/language.lua4
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua62
-rw-r--r--runtime/lua/vim/treesitter/query.lua18
-rw-r--r--runtime/menu.vim4
-rw-r--r--runtime/plugin/netrwPlugin.vim8
-rw-r--r--runtime/plugin/tarPlugin.vim6
-rw-r--r--runtime/syntax/cabal.vim30
-rw-r--r--runtime/syntax/cabalconfig.vim30
-rw-r--r--runtime/syntax/cabalproject.vim28
-rw-r--r--runtime/syntax/haskell.vim89
-rw-r--r--runtime/syntax/netrw.vim4
46 files changed, 968 insertions, 570 deletions
diff --git a/runtime/autoload/haskellcomplete.vim b/runtime/autoload/haskellcomplete.vim
index 520ab93700..48fbac7f9f 100644
--- a/runtime/autoload/haskellcomplete.vim
+++ b/runtime/autoload/haskellcomplete.vim
@@ -2,7 +2,7 @@
" Language: Haskell
" Maintainer: Daniel Campoverde <alx@sillybytes.net>
" URL: https://github.com/alx741/haskellcomplete.vim
-" Last Change: 2018 Aug 26
+" Last Change: 2019 May 14
" Usage: setlocal omnifunc=haskellcomplete#Complete
@@ -63,6 +63,7 @@ function! haskellcomplete#Complete(findstart, base)
call add(l:matches, extension)
endif
endfor
+ let b:completingLangExtension = 0
return l:matches
endif
@@ -78,6 +79,7 @@ function! haskellcomplete#Complete(findstart, base)
call add(l:matches, flag)
endif
endfor
+ let b:completingOptionsGHC = 0
return l:matches
endif
@@ -93,6 +95,7 @@ function! haskellcomplete#Complete(findstart, base)
call add(l:matches, module)
endif
endfor
+ let b:completingModule = 0
return l:matches
endif
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 8b734bbb6f..0bb343e198 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -42,7 +42,7 @@ function! s:check_config() abort
endif
let writeable = v:true
- let shadafile = substitute(matchstr(
+ let shadafile = empty(&shada) ? &shada : substitute(matchstr(
\ split(&shada, ',')[-1], '^n.\+'), '^n', '', '')
let shadafile = empty(&shadafile) ? empty(shadafile) ?
\ stdpath('data').'/shada/main.shada' : expand(shadafile)
@@ -247,6 +247,10 @@ function! s:check_terminal() abort
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
if v:shell_error
+ \ && (!has('win32')
+ \ || empty(matchstr(out,
+ \ 'infocmp: couldn''t open terminfo file .\+'
+ \ ..'\%(conemu\|vtpcon\|win32con\)')))
call health#report_error('command failed: '.cmd."\n".out)
else
call health#report_info('key_backspace (kbs) terminfo entry: '
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index 78a86315a3..c629923cd3 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -51,7 +51,7 @@ function! man#open_page(count, mods, ...) abort
let [l:buf, l:save_tfu] = [bufnr(), &tagfunc]
try
- set tagfunc=man#goto_tag
+ setlocal tagfunc=man#goto_tag
let l:target = l:name . '(' . l:sect . ')'
if a:mods !~# 'tab' && s:find_man()
execute 'silent keepalt tag' l:target
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index b69ad7187a..7a799abb13 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,8 +1,8 @@
" netrw.vim: Handles file transfer and remote directory listing across
" AUTOLOAD SECTION
-" Date: Jul 16, 2019
-" Version: 165
-" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
+" Date: Jan 07, 2020
+" Version: 168
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
@@ -13,6 +13,10 @@
" 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.
+"
+" 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
@@ -39,7 +43,7 @@ if exists("s:needspatches")
endfor
endif
-let g:loaded_netrw = "v165"
+let g:loaded_netrw = "v168"
if !exists("s:NOTE")
let s:NOTE = 0
let s:WARNING = 1
@@ -64,7 +68,7 @@ setl cpo&vim
" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number)
" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number)
" (this function can optionally take a list of messages)
-" Mar 21, 2017 : max errnum currently is 105
+" Dec 2, 2019 : max errnum currently is 106
fun! netrw#ErrorMsg(level,msg,errnum)
" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
@@ -232,12 +236,12 @@ if !exists("g:netrw_ftp_options")
let g:netrw_ftp_options= "-i -n"
endif
if !exists("g:netrw_http_cmd")
- if executable("curl")
- let g:netrw_http_cmd = "curl"
- call s:NetrwInit("g:netrw_http_xcmd","-L -o")
- elseif executable("wget")
+ if executable("wget")
let g:netrw_http_cmd = "wget"
call s:NetrwInit("g:netrw_http_xcmd","-q -O")
+ elseif executable("curl")
+ let g:netrw_http_cmd = "curl"
+ call s:NetrwInit("g:netrw_http_xcmd","-L -o")
elseif executable("elinks")
let g:netrw_http_cmd = "elinks"
call s:NetrwInit("g:netrw_http_xcmd","-source >")
@@ -443,23 +447,9 @@ if !exists("g:netrw_localmovecmd")
let g:netrw_localmovecmd= ""
endif
endif
-if v:version < 704 || (v:version == 704 && !has("patch1107"))
- " 1109 provides for delete(tmpdir,"d") which is what will be used
- if exists("g:netrw_local_rmdir")
- let g:netrw_localrmdir= g:netrw_local_rmdir
- call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86)
- endif
- if has("win32") || has("win95") || has("win64") || has("win16")
- if g:netrw_cygwin
- call s:NetrwInit("g:netrw_localrmdir","rmdir")
- else
- let g:netrw_localrmdir = expand("$COMSPEC")
- let g:netrw_localrmdiropt= " /c rmdir"
- endif
- else
- call s:NetrwInit("g:netrw_localrmdir","rmdir")
- endif
-endif
+" following serves as an example for how to insert a version&patch specific test
+"if v:version < 704 || (v:version == 704 && !has("patch1107"))
+"endif
call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
" sanity checks
if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
@@ -1500,7 +1490,8 @@ fun! netrw#Obtain(islocal,fname,...)
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
- NetrwKeepj norm! 1Gdd
+ " Note: using "_dd to delete to the black hole register; avoids messing up @@
+ NetrwKeepj norm! 1G"_dd
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$"
@@ -1614,7 +1605,6 @@ fun! s:NetrwOptionsSave(vt)
let {a:vt}netrw_cpokeep = &l:cpo
let {a:vt}netrw_diffkeep = &l:diff
let {a:vt}netrw_fenkeep = &l:fen
-" call Decho("saving current settings: got here#1",'~'.expand("<slnum>"))
if !exists("g:netrw_ffkeep") || g:netrw_ffkeep
let {a:vt}netrw_ffkeep = &l:ff
endif
@@ -1633,7 +1623,6 @@ fun! s:NetrwOptionsSave(vt)
let {a:vt}netrw_rokeep = &l:ro
let {a:vt}netrw_selkeep = &l:sel
let {a:vt}netrw_spellkeep = &l:spell
-" call Decho("saving current settings: got here#2",'~'.expand("<slnum>"))
if !g:netrw_use_noswf
let {a:vt}netrw_swfkeep = &l:swf
endif
@@ -1647,6 +1636,7 @@ fun! s:NetrwOptionsSave(vt)
" call Decho("saving a few selected netrw-related variables",'~'.expand("<slnum>"))
if g:netrw_keepdir
let {a:vt}netrw_dirkeep = getcwd()
+" call Decho("saving to ".a:vt."netrw_dirkeep<".{a:vt}netrw_dirkeep.">",'~'.expand("<slnum>"))
endif
sil! let {a:vt}netrw_slashkeep= @/
@@ -1713,6 +1703,7 @@ fun! s:NetrwOptionsRestore(vt)
" call Dfunc("s:NetrwOptionsRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"))
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
if !exists("{a:vt}netrw_optionsave")
+" call Decho("case ".a:vt."netrw_optionsave : doesn't exist",'~'.expand("<slnum>"))
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
" call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist")
@@ -1854,7 +1845,7 @@ endfun
" Used by s:NetrwOptionsRestore() to restore each netrw-senstive setting
" keepvars are set up by s:NetrwOptionsSave
fun! s:NetrwRestoreSetting(keepvar,setting)
-"" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)")
+""" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)")
" typically called from s:NetrwOptionsRestore
" call s:NetrwRestoreSettings(keep-option-variable-name,'associated-option')
@@ -1869,7 +1860,7 @@ fun! s:NetrwRestoreSetting(keepvar,setting)
"" call Decho("fyi: a:setting<".a:setting."> setting<".setting.">")
if setting != keepvarval
-"" call Decho("restore setting<".a:setting."=".setting."> to keepvarval<".keepvarval.">")
+"" call Decho("restore setting<".a:setting."> (currently=".setting.") to keepvarval<".keepvarval.">")
if type(a:setting) == 0
exe "let ".a:setting."= ".keepvarval
elseif type(a:setting) == 1
@@ -2159,7 +2150,7 @@ fun! netrw#NetRead(mode,...)
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
- NetrwKeepj norm! 1Gdd
+ NetrwKeepj norm! 1G"_dd
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$"
@@ -2259,7 +2250,7 @@ fun! netrw#NetRead(mode,...)
NetrwKeepj put ='quit'
" perform cadaver operation:
- NetrwKeepj norm! 1Gdd
+ NetrwKeepj norm! 1G"_dd
call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd)
keepj bd!
endif
@@ -2575,7 +2566,7 @@ fun! netrw#NetWrite(...) range
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
- NetrwKeepj norm! 1Gdd
+ NetrwKeepj norm! 1G"_dd
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$"
@@ -2641,7 +2632,7 @@ fun! netrw#NetWrite(...) range
NetrwKeepj put ='put '.tmpfile.' '.netrw_fname
" perform cadaver operation:
- NetrwKeepj norm! 1Gdd
+ NetrwKeepj norm! 1G"_dd
call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd)
" remove enew buffer (quietly)
@@ -2827,7 +2818,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
" readcmd=='t': simply do nothing
if a:readcmd == 't'
" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
-" call Dret("NetrwGetFile : skip read of <".a:tfile.">")
+" call Dret("NetrwGetFile : skip read of tfile<".a:tfile.">")
return
endif
@@ -4323,7 +4314,7 @@ fun! s:NetrwGetWord()
let curline= getline('.')
if curline =~# '"\s*Sorted by\s'
- NetrwKeepj norm! s
+ NetrwKeepj norm! "_s
let s:netrw_skipbrowse= 1
echo 'Pressing "s" also works'
@@ -5158,17 +5149,31 @@ fun! s:NetrwBrowseUpDir(islocal)
endfun
" ---------------------------------------------------------------------
-" netrw#BrowseX: (implements "x") executes a special "viewer" script or program for the {{{2
+" netrw#BrowseX: (implements "x" and "gx") executes a special "viewer" script or program for the {{{2
" given filename; typically this means given their extension.
" 0=local, 1=remote
fun! netrw#BrowseX(fname,remote)
-" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")")
-
- " if its really just a local directory, then do a "gf" instead
- if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && a:fname =~ '/$' && a:fname !~ '^https\=:')
+ let use_ctrlo= 1
+" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.") implements x and gx maps")
+
+ if a:remote == 0 && isdirectory(a:fname)
+ " if its really just a local directory, then do a "gf" instead
+" call Decho("remote≡0 and a:fname<".a:fname."> ".(isdirectory(a:fname)? "is a directory" : "is not a directory"),'~'.expand("<slnum>"))
+" call Decho("..appears to be a local directory; using e ".a:fname." instead",'~'.expand("<slnum>"))
+ exe "e ".a:fname
+" call Dret("netrw#BrowseX")
+ return
+ elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$'
+ " remote directory, not a webpage access, looks like an attempt to do a directory listing
+" call Decho("remote≡1 and a:fname<".a:fname.">",'~'.expand("<slnum>"))
+" call Decho("..and fname ".((a:fname =~ '^https\=:')? 'matches' : 'does not match').'^https\=:','~'.expand("<slnum>"))
+" call Decho("..and fname ".((a:fname =~ '/$')? 'matches' : 'does not match').' /$','~'.expand("<slnum>"))
+" call Decho("..appears to be a remote directory listing request; using gf instead",'~'.expand("<slnum>"))
norm! gf
-" call Dret("(netrw#BrowseX) did gf instead")
+" call Dret("netrw#BrowseX")
+ return
endif
+" call Decho("not a local file nor a webpage request",'~'.expand("<slnum>"))
let ykeep = @@
let screenposn = winsaveview()
@@ -5266,10 +5271,9 @@ fun! netrw#BrowseX(fname,remote)
endif
" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("<slnum>"))
- " extract any viewing options. Assumes that they're set apart by quotes.
-" call Decho("extract any viewing options",'~'.expand("<slnum>"))
+ " extract any viewing options. Assumes that they're set apart by spaces.
if exists("g:netrw_browsex_viewer")
-" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
+" call Decho("extract any viewing options from g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
if g:netrw_browsex_viewer =~ '\s'
let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','')
let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." "
@@ -5292,16 +5296,16 @@ fun! netrw#BrowseX(fname,remote)
" execute the file handler
" call Decho("execute the file handler (if any)",'~'.expand("<slnum>"))
if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-'
-" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
let ret= netrwFileHandlers#Invoke(exten,fname)
elseif exists("g:netrw_browsex_viewer") && executable(viewer)
-" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir)
let ret= v:shell_error
elseif has("win32") || has("win64")
-" call Decho("win".(has("win32")? "32" : "64")",'~'.expand("<slnum>"))
+" 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))
elseif executable("rundll32")
@@ -5309,56 +5313,68 @@ fun! netrw#BrowseX(fname,remote)
else
call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
endif
- " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let ret= v:shell_error
elseif has("win32unix")
let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g')
-" call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>"))
if executable("start")
+" call Decho("(netrw#BrowseX) win32unix+start",'~'.expand("<slnum>"))
call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1))
elseif executable("rundll32")
+" call Decho("(netrw#BrowseX) win32unix+rundll32",'~'.expand("<slnum>"))
call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1))
elseif executable("cygstart")
+" call Decho("(netrw#BrowseX) win32unix+cygstart",'~'.expand("<slnum>"))
call s:NetrwExe('sil !cygstart '.s:ShellEscape(fname,1))
else
call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
endif
- " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let ret= v:shell_error
elseif has("unix") && executable("kfmclient") && s:CheckIfKde()
-" call Decho("unix and kfmclient",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) unix and kfmclient",'~'.expand("<slnum>"))
call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir)
let ret= v:shell_error
elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid")
-" call Decho("unix, exo-open, xdg-open",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) unix, exo-open, xdg-open",'~'.expand("<slnum>"))
call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir)
let ret= v:shell_error
elseif has("unix") && $DESKTOP_SESSION == "mate" && executable("atril")
-" call Decho("unix and atril",'~'.expand("<slnum>"))
- call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir)
+" call Decho("(netrw#BrowseX) unix and atril",'~'.expand("<slnum>"))
+ if a:fname =~ '^https\=://'
+ " atril does not appear to understand how to handle html -- so use gvim to edit the document
+ let use_ctrlo= 0
+" call Decho("(COMBAK) fname<".fname.">")
+" call Decho("(COMBAK) a:fname<".a:fname.">")
+ call s:NetrwExe("sil! !gvim ".fname.' -c "keepj keepalt file '.fnameescape(a:fname).'"')
+
+ else
+ call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir)
+ endif
let ret= v:shell_error
elseif has("unix") && executable("xdg-open")
-" call Decho("unix and xdg-open",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) unix and xdg-open",'~'.expand("<slnum>"))
call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir)
let ret= v:shell_error
elseif has("macunix") && executable("open")
-" call Decho("macunix and open",'~'.expand("<slnum>"))
+" call Decho("(netrw#BrowseX) macunix and open",'~'.expand("<slnum>"))
call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir)
let ret= v:shell_error
else
" netrwFileHandlers#Invoke() always returns 0
+" call Decho("(netrw#BrowseX) use netrwFileHandlers",'~'.expand("<slnum>"))
let ret= netrwFileHandlers#Invoke(exten,fname)
endif
" if unsuccessful, attempt netrwFileHandlers#Invoke()
if ret
+" call Decho("(netrw#BrowseX) ret=".ret," indicates unsuccessful thus far",'~'.expand("<slnum>"))
let ret= netrwFileHandlers#Invoke(exten,fname)
endif
@@ -5380,8 +5396,9 @@ fun! netrw#BrowseX(fname,remote)
if g:netrw_use_noswf
setl noswf
endif
- exe "sil! NetrwKeepj norm! \<c-o>"
-" redraw!
+ if use_ctrlo
+ exe "sil! NetrwKeepj norm! \<c-o>"
+ endif
endif
" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
call winrestview(screenposn)
@@ -5410,11 +5427,11 @@ endfun
" netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2
fun! netrw#BrowseXVis()
" call Dfunc("netrw#BrowseXVis()")
- let atkeep = @@
- norm! gvy
-" call Decho("@@<".@@.">",'~'.expand("<slnum>"))
- call netrw#BrowseX(@@,netrw#CheckIfRemote(@@))
- let @@ = atkeep
+ let akeep = @a
+ norm! gv"ay
+ let gxfile= @a
+ let @a = akeep
+ call netrw#BrowseX(gxfile,netrw#CheckIfRemote(gxfile))
" call Dret("netrw#BrowseXVis")
endfun
@@ -5764,22 +5781,7 @@ fun! s:NetrwHome()
if exists("g:netrw_home")
let home= expand(g:netrw_home)
else
- " go to vim plugin home
- for home in split(&rtp,',') + ['']
- if isdirectory(s:NetrwFile(home)) && filewritable(s:NetrwFile(home)) | break | endif
- let basehome= substitute(home,'[/\\]\.vim$','','')
- if isdirectory(s:NetrwFile(basehome)) && filewritable(s:NetrwFile(basehome))
- let home= basehome."/.vim"
- break
- endif
- endfor
- if home == ""
- " just pick the first directory
- let home= substitute(&rtp,',.*$','','')
- endif
- if (has("win32") || has("win95") || has("win64") || has("win16"))
- let home= substitute(home,'/','\\','g')
- endif
+ let home = stdpath('data')
endif
" insure that the home directory exists
if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home))
@@ -6039,13 +6041,12 @@ fun! s:NetrwSLeftrelease(islocal)
endfun
" ---------------------------------------------------------------------
-" s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
-" separated patterns given in g:netrw_list_hide
+" s:NetrwListHide: uses [range]g~...~d to delete files that match {{{2
+" comma-separated patterns given in g:netrw_list_hide
fun! s:NetrwListHide()
" call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">")
" call Decho("initial: ".string(getline(w:netrw_bannercnt,'$')))
let ykeep= @@
-" call DechoBuf(bufnr("%"),"COMBAK#3")
" find a character not in the "hide" string to use as a separator for :g and :v commands
" How-it-works: take the hiding command, convert it into a range.
@@ -6054,8 +6055,8 @@ fun! s:NetrwListHide()
" Use the first character left as a separator character.
" call Decho("find a character not in the hide string to use as a separator")
let listhide= g:netrw_list_hide
- let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
-" call Decho("sep=".sep,'~'.expand("<slnum>"))
+ let sep = strpart(substitute('~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
+" call Decho("sep=".sep," (sep not in hide string)'~'.expand("<slnum>"))
while listhide != ""
if listhide =~ ','
@@ -6065,10 +6066,19 @@ fun! s:NetrwListHide()
let hide = listhide
let listhide = ""
endif
-" call Decho("hide<".hide."> listhide<".listhide.'>','~'.expand("<slnum>"))
+" call Decho("..extracted from listhide: hide<".hide."> g:netrw_sort_by<".g:netrw_sort_by.'>','~'.expand("<slnum>"))
+ if g:netrw_sort_by =~ '^[ts]'
+ if hide =~ '^\^'
+" call Decho("..modify hide to handle a \"^...\" pattern",'~'.expand("<slnum>"))
+ let hide= substitute(hide,'^\^','^\(\\d\\+/\)','')
+ elseif hide =~ '^\\(\^'
+ let hide= substitute(hide,'^\\(\^','\\(^\\(\\d\\+/\\)','')
+ endif
+" call Decho("..hide<".hide."> listhide<".listhide.'>','~'.expand("<slnum>"))
+ endif
" Prune the list by hiding any files which match
-" call Decho("prune the list by hiding any files which ",((g:netrw_hide == 1)? "" : "don't")." match hide<".hide.">")
+" call Decho("..prune the list by hiding any files which ",((g:netrw_hide == 1)? "" : "don't")." match hide<".hide.">")
if g:netrw_hide == 1
" call Decho("..hiding<".hide.">",'~'.expand("<slnum>"))
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
@@ -6089,7 +6099,6 @@ fun! s:NetrwListHide()
" remove any blank lines that have somehow remained.
" This seems to happen under Windows.
exe 'sil! NetrwKeepj 1,$g@^\s*$@d'
-" call DechoBuf(bufnr("%"),"COMBAK#4")
let @@= ykeep
" call Dret("s:NetrwListHide")
@@ -6297,7 +6306,7 @@ fun! s:NetrwMaps(islocal)
" generate default <Plug> maps {{{3
if !hasmapto('<Plug>NetrwHide') |nmap <buffer> <silent> <nowait> a <Plug>NetrwHide_a|endif
- if !hasmapto('<Plug>NetrwBrowseUpDir') |nmap <buffer> <silent> <nowait> - <Plug>NetrwBrowseUpDir |endif
+ if !hasmapto('<Plug>NetrwBrowseUpDir') |nmap <buffer> <silent> <nowait> - <Plug>NetrwBrowseUpDir|endif
if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif
if !hasmapto('<Plug>NetrwBadd_cb') |nmap <buffer> <silent> <nowait> cb <Plug>NetrwBadd_cb|endif
if !hasmapto('<Plug>NetrwBadd_cB') |nmap <buffer> <silent> <nowait> cB <Plug>NetrwBadd_cB|endif
@@ -6614,9 +6623,9 @@ fun! s:NetrwMarkFiles(islocal,...)
while i <= a:0
if a:islocal
if v:version > 704 || (v:version == 704 && has("patch656"))
- let mffiles= glob(fnameescape(a:{i}),0,1,1)
+ let mffiles= glob(a:{i},0,1,1)
else
- let mffiles= glob(fnameescape(a:{i}),0,1)
+ let mffiles= glob(a:{i},0,1)
endif
else
let mffiles= [a:{i}]
@@ -6757,13 +6766,15 @@ fun! s:NetrwMarkFile(islocal,fname)
if index(s:netrwmarkfilelist,dname) == -1
" append new filename to global markfilelist
call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
-" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
+" call Decho("append filename<".a:fname."> to global s:markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
else
" remove new filename from global markfilelist
-" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>"))
+" call Decho("remove new filename from global s:markfilelist",'~'.expand("<slnum>"))
+" call Decho("..filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>"))
call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"')
-" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
+" call Decho("..ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
if s:netrwmarkfilelist == []
+" call Decho("s:netrwmarkfilelist is empty; unlet it",'~'.expand("<slnum>"))
unlet s:netrwmarkfilelist
endif
endif
@@ -6787,7 +6798,8 @@ fun! s:NetrwMarkFile(islocal,fname)
endif
endif
let @@= ykeep
-" call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">")
+" call Decho("s:netrwmarkfilelist[".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : "")."] (avail in all buffers)",'~'.expand("<slnum>"))
+" call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist")."> (buf#".curbufnr."list)")
endfun
" ---------------------------------------------------------------------
@@ -7078,17 +7090,8 @@ fun! s:NetrwMarkFileCopy(islocal,...)
" call Dret("s:NetrwMarkFileCopy : lcd failure")
return
endif
- if v:version < 704 || (v:version == 704 && !has("patch1107"))
- call s:NetrwExe("sil !".g:netrw_localrmdir.g:netrw_localrmdiropt." ".s:ShellEscape(tmpdir,1))
- if v:shell_error != 0
- call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80)
-" " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) )
- return
- endif
- else
- if delete(tmpdir,"d")
- call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
- endif
+ if delete(tmpdir,"d")
+ call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
endif
else
if s:NetrwLcd(curdir)
@@ -7542,8 +7545,9 @@ fun! s:NetrwMarkFileGrep(islocal)
let curdir = s:NetrwGetCurdir(a:islocal)
if exists("s:netrwmarkfilelist")
-" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
+" call Decho("using s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
+" call Decho("keeping copy of s:netrwmarkfilelist in function-local variable,'~'.expand("<slnum>"))"
call s:NetrwUnmarkAll()
else
" call Decho('no marked files, using "*"','~'.expand("<slnum>"))
@@ -7551,6 +7555,7 @@ fun! s:NetrwMarkFileGrep(islocal)
endif
" ask user for pattern
+" call Decho("ask user for search pattern",'~'.expand("<slnum>"))
call inputsave()
let pat= input("Enter pattern: ","")
call inputrestore()
@@ -8663,7 +8668,7 @@ fun! s:NetrwUpload(fname,tgt,...)
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
- NetrwKeepj norm! 1Gdd
+ NetrwKeepj norm! 1G"_dd
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
sil NetrwKeepj g/Local directory now/d
@@ -9501,15 +9506,19 @@ fun! s:NetrwWideListing()
" fpl: filenames per line
" fpc: filenames per column
setl ma noro
+ let keepa= @a
" call Decho("setl ma noro",'~'.expand("<slnum>"))
let b:netrw_cpf= 0
if line("$") >= w:netrw_bannercnt
+ " determine the maximum filename size; use that to set cpf
exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
NetrwKeepj call histdel("/",-1)
else
+ let @a= keepa
" call Dret("NetrwWideListing")
return
endif
+ " allow for two spaces to separate columns
let b:netrw_cpf= b:netrw_cpf + 2
" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>"))
@@ -9532,10 +9541,11 @@ fun! s:NetrwWideListing()
if newcolend > line("$") | let newcolend= line("$") | endif
let newcolqty= newcolend - newcolstart
exe newcolstart
+ " COMBAK: both of the visual-mode using lines below are problematic vis-a-vis @*
if newcolqty == 0
- exe "sil! NetrwKeepj norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
+ exe "sil! NetrwKeepj norm! 0\<c-v>$h\"ax".w:netrw_bannercnt."G$\"ap"
else
- exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
+ exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$h"ax'.w:netrw_bannercnt.'G$"ap'
endif
exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
exe 'sil! NetrwKeepj '.w:netrw_bannercnt
@@ -9546,6 +9556,7 @@ fun! s:NetrwWideListing()
exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>"
" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>"))
exe "setl ".g:netrw_bufsettings
+ let @a= keepa
" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
" call Dret("NetrwWideListing")
return
@@ -9743,6 +9754,7 @@ fun! s:PerformListing(islocal)
exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
endif
endif
+
" remove priority pattern prefix
" call Decho("remove priority pattern prefix",'~'.expand("<slnum>"))
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e'
@@ -9781,6 +9793,7 @@ fun! s:PerformListing(islocal)
" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("<slnum>"))
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
endif
+" call Decho("remove leading digits/ (sorting) information from listing",'~'.expand("<slnum>"))
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
NetrwKeepj call histdel("/",-1)
endif
@@ -9843,6 +9856,7 @@ fun! s:PerformListing(islocal)
" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>"))
exe "setl ts=".(g:netrw_maxfilenamelen+1)
endif
+" call Decho("PerformListing buffer:",'~'.expand("<slnum>"))
" call DechoBuf(bufnr("%"))
if exists("s:treecurpos")
@@ -10810,7 +10824,6 @@ fun! s:LocalListing()
for filename in filelist
" call Decho(" ",'~'.expand("<slnum>"))
" call Decho("for filename in filelist: filename<".filename.">",'~'.expand("<slnum>"))
-" call DechoBuf(bufnr("%"),"COMBAK#1")
if getftype(filename) == "link"
" indicate a symbolic link
@@ -10868,10 +10881,10 @@ fun! s:LocalListing()
if w:netrw_liststyle == s:LONGLIST
let sz = getfsize(filename)
+ let fsz = strpart(" ",1,15-strlen(sz)).sz
if g:netrw_sizestyle =~# "[hH]"
let sz= s:NetrwHumanReadable(sz)
endif
- let fsz = strpart(" ",1,15-strlen(sz)).sz
let longfile= printf("%-".(g:netrw_maxfilenamelen+1)."s",pfile)
let pfile = longfile.fsz." ".strftime(g:netrw_timefmt,getftime(filename))
" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>"))
@@ -10879,10 +10892,11 @@ fun! s:LocalListing()
if g:netrw_sort_by =~# "^t"
" sort by time (handles time up to 1 quintillion seconds, US)
+ " Decorate listing by prepending a timestamp/ . Sorting will then be done based on time.
" call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("<slnum>"))
let t = getftime(filename)
let ft = strpart("000000000000000000",1,18-strlen(t)).t
-" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'",'~'.expand("<slnum>"))
+" call Decho("exe NetrwKeepj put ='".ft.'/'.pfile."'",'~'.expand("<slnum>"))
let ftpfile= ft.'/'.pfile
sil! NetrwKeepj put=ftpfile
@@ -10903,7 +10917,7 @@ fun! s:LocalListing()
" call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("<slnum>"))
sil! NetrwKeepj put=pfile
endif
-" call DechoBuf(bufnr("%"),"COMBAK#2")
+" call DechoBuf(bufnr("%"),"bufnr(%)")
endfor
" cleanup any windows mess at end-of-line
@@ -10950,9 +10964,10 @@ fun! s:NetrwLocalRename(path) range
" call Dfunc("NetrwLocalRename(path<".a:path.">)")
" preparation for removing multiple files/directories
- let ykeep = @@
- let ctr = a:firstline
- let svpos = winsaveview()
+ let ykeep = @@
+ let ctr = a:firstline
+ let svpos = winsaveview()
+ let all = 0
" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" rename files given by the markfilelist
@@ -10980,6 +10995,23 @@ fun! s:NetrwLocalRename(path) range
let newname = substitute(oldname,subfrom,subto,'')
endif
endif
+ if !all && filereadable(newname)
+ call inputsave()
+ let response= input("File<".newname."> already exists; do you want to overwrite it? (y/all/n) ")
+ call inputrestore()
+ if response == "all"
+ let all= 1
+ elseif response != "y" && response != "yes"
+ " refresh the directory
+" call Decho("refresh the directory listing",'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
+ let @@= ykeep
+" call Dret("NetrwLocalRename")
+ return
+ endif
+ endif
call rename(oldname,newname)
endfor
call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
@@ -11003,14 +11035,14 @@ fun! s:NetrwLocalRename(path) range
NetrwKeepj norm! 0
let oldname= s:ComposePath(a:path,curword)
-" call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
+" call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
call inputsave()
let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
call inputrestore()
call rename(oldname,newname)
-" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
+" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
let ctr= ctr + 1
endwhile
@@ -11220,7 +11252,9 @@ fun! netrw#Expose(varname)
" call Dfunc("netrw#Expose(varname<".a:varname.">)")
if exists("s:".a:varname)
exe "let retval= s:".a:varname
+" call Decho("retval=".retval,'~'.expand("<slnum>"))
if exists("g:netrw_pchk")
+" call Decho("type(g:netrw_pchk=".g:netrw_pchk.")=".type(retval),'~'.expand("<slnum>"))
if type(retval) == 3
let retval = copy(retval)
let i = 0
@@ -11229,10 +11263,13 @@ fun! netrw#Expose(varname)
let i = i + 1
endwhile
endif
-" call Dret("netrw#Expose ".string(retval))
+" call Dret("netrw#Expose ".string(retval)),'~'.expand("<slnum>"))
return string(retval)
+ else
+" call Decho("g:netrw_pchk doesn't exist",'~'.expand("<slnum>"))
endif
else
+" call Decho("s:".a:varname." doesn't exist",'~'.expand("<slnum>"))
let retval= "n/a"
endif
@@ -11793,6 +11830,9 @@ fun! s:NetrwExe(cmd)
" call Decho("exe ".a:cmd,'~'.expand("<slnum>"))
exe a:cmd
endif
+ if v:shell_error
+ call netrw#ErrorMsg(s:WARNING,"shell signalled an error",106)
+ endif
" call Dret("s:NetrwExe : v:shell_error=".v:shell_error)
endfun
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
index 327db6a540..bed5cfc455 100644
--- a/runtime/autoload/netrwSettings.vim
+++ b/runtime/autoload/netrwSettings.vim
@@ -1,6 +1,6 @@
" netrwSettings.vim: makes netrw settings simpler
" Date: Nov 09, 2016
-" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Version: 16
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
diff --git a/runtime/autoload/netrw_gitignore.vim b/runtime/autoload/netrw_gitignore.vim
index da3f50bca0..1b55e2488a 100644
--- a/runtime/autoload/netrw_gitignore.vim
+++ b/runtime/autoload/netrw_gitignore.vim
@@ -18,61 +18,5 @@
" holder be liable for any damages resulting from the use
" of this software.
function! netrw_gitignore#Hide(...)
- let additional_files = a:000
-
- let default_files = ['.gitignore', '.git/info/exclude']
-
- " get existing global/system gitignore files
- let global_gitignore = expand(substitute(system("git config --global core.excludesfile"), '\n', '', 'g'))
- if global_gitignore !=# ''
- let default_files = add(default_files, global_gitignore)
- endif
- let system_gitignore = expand(substitute(system("git config --system core.excludesfile"), '\n', '', 'g'))
- if system_gitignore !=# ''
- let default_files = add(default_files, system_gitignore)
- endif
-
- " append additional files if given as function arguments
- if additional_files !=# []
- let files = extend(default_files, additional_files)
- else
- let files = default_files
- endif
-
- " keep only existing/readable files
- let gitignore_files = []
- for file in files
- if filereadable(file)
- let gitignore_files = add(gitignore_files, file)
- endif
- endfor
-
- " get contents of gitignore patterns from those files
- let gitignore_lines = []
- for file in gitignore_files
- for line in readfile(file)
- " filter empty lines and comments
- if line !~# '^#' && line !~# '^$'
- let gitignore_lines = add(gitignore_lines, line)
- endif
- endfor
- endfor
-
- " convert gitignore patterns to Netrw/Vim regex patterns
- let escaped_lines = []
- for line in gitignore_lines
- let escaped = line
- let escaped = substitute(escaped, '\*\*', '*', 'g')
- let escaped = substitute(escaped, '\.', '\\.', 'g')
- let escaped = substitute(escaped, '\$', '\\$', 'g')
- let escaped = substitute(escaped, '*', '.*', 'g')
- " correction: dot, dollar and asterisks chars shouldn't be escaped when
- " within regex matching groups.
- let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\.', '\.', 'g')
- let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\$', '\$', 'g')
- let escaped = substitute(escaped, '\(\[[^]]*\)\zs\.\*', '*', 'g')
- let escaped_lines = add(escaped_lines, escaped)
- endfor
-
- return join(escaped_lines, ',')
+ return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
endfunction
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index dc670dbd14..b6c4c660b8 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,13 +1,13 @@
" tar.vim: Handles browsing tarfiles
" AUTOLOAD PORTION
-" Date: Apr 17, 2013
-" Version: 29
-" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
-" License: Vim License (see vim's :help license)
+" Date: Jan 07, 2020
+" Version: 32
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" License: Vim License (see vim's :help license)
"
" Contains many ideas from Michael Toren's <tar.vim>
"
-" Copyright: Copyright (C) 2005-2011 Charles E. Campbell {{{1
+" Copyright: Copyright (C) 2005-2017 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,
@@ -22,7 +22,7 @@
if &cp || exists("g:loaded_tar")
finish
endif
-let g:loaded_tar= "v29"
+let g:loaded_tar= "v32"
if v:version < 702
echohl WarningMsg
echo "***warning*** this version of tar needs vim 7.2"
@@ -48,6 +48,9 @@ endif
if !exists("g:tar_writeoptions")
let g:tar_writeoptions= "uf"
endif
+if !exists("g:tar_delfile")
+ let g:tar_delfile="--delete -f"
+endif
if !exists("g:netrw_cygwin")
if has("win32") || has("win95") || has("win64") || has("win16")
if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
@@ -109,6 +112,7 @@ fun! tar#Browse(tarfile)
" sanity checks
if !executable(g:tar_cmd)
redraw!
+" call Decho('***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system')
echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
let &report= repkeep
" call Dret("tar#Browse")
@@ -119,6 +123,7 @@ fun! tar#Browse(tarfile)
if a:tarfile !~# '^\a\+://'
" if it's an url, don't complain, let url-handlers such as vim do its thing
redraw!
+" call Decho("***error*** (tar#Browse) File not readable<".a:tarfile.">")
echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
endif
let &report= repkeep
@@ -152,12 +157,29 @@ fun! tar#Browse(tarfile)
" assuming cygwin
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif
-
let curlast= line("$")
- if tarfile =~# '\.\(gz\|tgz\)$'
- let gzip_command = s:get_gzip_command(tarfile)
+
+ if tarfile =~# '\.\(gz\)$'
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
- exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+
+ elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzs\)$'
+ if has("unix") && executable("file")
+ let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2"
+ else
+ let filekind= ""
+ endif
+
+ if filekind =~ "bzip2"
+ exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ elseif filekind =~ "XZ"
+ exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ elseif filekind =~ "Zstandard"
+ exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ else
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ endif
+
elseif tarfile =~# '\.lrp'
" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
@@ -170,6 +192,8 @@ fun! tar#Browse(tarfile)
elseif tarfile =~# '\.\(xz\|txz\)$'
" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ elseif tarfile =~# '\.\(zst\|tzs\)$'
+ exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else
if tarfile =~ '^\s*-'
" A file name starting with a dash is taken as an option. Prepend ./ to avoid that.
@@ -184,7 +208,7 @@ fun! tar#Browse(tarfile)
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
return
endif
- if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
+ if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~# '\c\%(warning\|error\|inappropriate\|unrecognized\)')
redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
keepj sil! %d
@@ -197,8 +221,13 @@ fun! tar#Browse(tarfile)
return
endif
+ " set up maps supported for tar
setlocal noma nomod ro
- noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
+ noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
+ noremap <silent> <buffer> x :call tar#Extract()<cr>
+ if &mouse != ""
+ noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>TarBrowseSelect()<cr>
+ endif
let &report= repkeep
" call Dret("tar#Browse : b:tarfile<".b:tarfile.">")
@@ -235,7 +264,8 @@ fun! s:TarBrowseSelect()
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif
- new
+ " open a new window (tar#Read will read a file into it)
+ noswapfile new
if !exists("g:tar_nomax") || g:tar_nomax == 0
wincmd _
endif
@@ -267,7 +297,7 @@ fun! tar#Read(fname,mode)
if fname =~ '\.bz2$' && executable("bzcat")
let decmp= "|bzcat"
let doro = 1
- elseif fname =~ '\.gz$' && executable("zcat")
+ elseif fname =~ '\.t\=gz$' && executable("zcat")
let decmp= "|zcat"
let doro = 1
elseif fname =~ '\.lzma$' && executable("lzcat")
@@ -276,6 +306,9 @@ fun! tar#Read(fname,mode)
elseif fname =~ '\.xz$' && executable("xzcat")
let decmp= "|xzcat"
let doro = 1
+ elseif fname =~ '\.zst$' && executable("zstdcat")
+ let decmp= "|zstdcat"
+ let doro = 1
else
let decmp=""
let doro = 0
@@ -291,20 +324,31 @@ fun! tar#Read(fname,mode)
endif
if tarfile =~# '\.bz2$'
-" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
- elseif tarfile =~# '\.\(gz\|tgz\)$'
- let gzip_command = s:get_gzip_command(tarfile)
-" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
- exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ elseif tarfile =~# '\.\(gz\)$'
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+
+ elseif tarfile =~# '\(\.tgz\|\.tbz\|\.txz\)'
+ if has("unix") && executable("file")
+ let filekind= system("file ".shellescape(tarfile,1))
+ else
+ let filekind= ""
+ endif
+ if filekind =~ "bzip2"
+ exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ elseif filekind =~ "XZ"
+ exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ elseif filekind =~ "Zstandard"
+ exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ else
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ endif
+
elseif tarfile =~# '\.lrp$'
-" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lzma$'
-" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.\(xz\|txz\)$'
-" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
else
if tarfile =~ '^\s*-'
@@ -348,13 +392,14 @@ fun! tar#Write(fname)
" sanity checks
if !executable(g:tar_cmd)
redraw!
- echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
+" call Decho('***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system')
let &report= repkeep
" call Dret("tar#Write")
return
endif
if !exists("*mkdir")
redraw!
+" call Decho("***error*** (tar#Write) sorry, mkdir() doesn't work on your system")
echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None
let &report= repkeep
" call Dret("tar#Write")
@@ -375,6 +420,7 @@ fun! tar#Write(fname)
exe "cd ".fnameescape(tmpdir)
catch /^Vim\%((\a\+)\)\=:E344/
redraw!
+" call Decho("***error*** (tar#Write) cannot cd to temporary directory")
echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
let &report= repkeep
" call Dret("tar#Write")
@@ -393,8 +439,6 @@ fun! tar#Write(fname)
let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','')
let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
- let gzip_command = s:get_gzip_command(tarfile)
-
" handle compressed archives
if tarfile =~# '\.bz2'
call system("bzip2 -d -- ".shellescape(tarfile,0))
@@ -402,12 +446,12 @@ fun! tar#Write(fname)
let compress= "bzip2 -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.gz'
- call system(gzip_command . " -d -- ".shellescape(tarfile,0))
+ call system("gzip -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.gz','','e')
let compress= "gzip -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.tgz'
- call system(gzip_command . " -d -- ".shellescape(tarfile,0))
+ call system("gzip -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.tgz','.tar','e')
let compress= "gzip -- ".shellescape(tarfile,0)
let tgz = 1
@@ -417,6 +461,10 @@ fun! tar#Write(fname)
let tarfile = substitute(tarfile,'\.xz','','e')
let compress= "xz -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
+ elseif tarfile =~# '\.zst'
+ call system("zstd --decompress -- ".shellescape(tarfile,0))
+ let tarfile = substitute(tarfile,'\.zst','','e')
+ let compress= "zstd -- ".shellescape(tarfile,0)
elseif tarfile =~# '\.lzma'
call system("lzma -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.lzma','','e')
@@ -427,6 +475,7 @@ fun! tar#Write(fname)
if v:shell_error != 0
redraw!
+" call Decho("***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname)
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
else
@@ -459,10 +508,11 @@ fun! tar#Write(fname)
endif
" delete old file from tarfile
-" call Decho("system(".g:tar_cmd." --delete -f ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
- call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
+" call Decho("system(".g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
+ call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0
redraw!
+" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
else
@@ -471,6 +521,7 @@ fun! tar#Write(fname)
call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0
redraw!
+" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
elseif exists("compress")
" call Decho("call system(".compress.")")
@@ -486,11 +537,11 @@ fun! tar#Write(fname)
if s:tblfile_{winnr()} =~ '^\a\+://'
" call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">")
let tblfile= s:tblfile_{winnr()}
- 1split|enew
+ 1split|noswapfile enew
let binkeep= &l:binary
let eikeep = &ei
set binary ei=all
- exe "e! ".fnameescape(tarfile)
+ exe "noswapfile e! ".fnameescape(tarfile)
call netrw#NetWrite(tblfile)
let &ei = eikeep
let &l:binary = binkeep
@@ -524,7 +575,7 @@ fun! tar#Diff(userfname,fname)
" sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes)
diffthis
wincmd v
- exe "e ".fnameescape(fname)
+ exe "noswapfile e ".fnameescape(fname)
diffthis
else
redraw!
@@ -534,6 +585,141 @@ fun! tar#Diff(userfname,fname)
endfun
" ---------------------------------------------------------------------
+" tar#Extract: extract a file from a (possibly compressed) tar archive {{{2
+fun! tar#Extract()
+" call Dfunc("tar#Extract()")
+
+ let repkeep= &report
+ set report=10
+ let fname= getline(".")
+" call Decho("fname<".fname.">")
+
+ if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
+ redraw!
+ echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"'
+" call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"')
+ return
+ endif
+
+ " sanity check
+ if fname =~ '^"'
+ let &report= repkeep
+" call Dret("TarBrowseSelect")
+ return
+ endif
+
+ let tarball = expand("%")
+" call Decho("tarball<".tarball.">")
+ let tarbase = substitute(tarball,'\..*$','','')
+" call Decho("tarbase<".tarbase.">")
+
+ let extractcmd= netrw#WinPath(g:tar_extractcmd)
+ if filereadable(tarbase.".tar")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tgz")
+ let extractcmd= substitute(extractcmd,"-","-z","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tgz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd."t ".tarbase.".tgz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.gz")
+ let extractcmd= substitute(extractcmd,"-","-z","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tbz")
+ let extractcmd= substitute(extractcmd,"-","-j","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.bz2")
+ let extractcmd= substitute(extractcmd,"-","-j","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".txz")
+ let extractcmd= substitute(extractcmd,"-","-J","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.xz")
+ let extractcmd= substitute(extractcmd,"-","-J","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tzs")
+ let extractcmd= substitute(extractcmd,"-","--zstd","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzs ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.zst")
+ let extractcmd= substitute(extractcmd,"-","--zstd","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+ endif
+
+ " restore option
+ let &report= repkeep
+
+" call Dret("tar#Extract")
+endfun
+
+" ---------------------------------------------------------------------
" s:Rmdir: {{{2
fun! s:Rmdir(fname)
" call Dfunc("Rmdir(fname<".a:fname.">)")
@@ -587,10 +773,7 @@ fun! tar#Vimuntar(...)
" if necessary, decompress the tarball; then, extract it
if tartail =~ '\.tgz'
- let gzip_command = s:get_gzip_command(tarfile)
- if executable(gzip_command)
- silent exe "!" . gzip_command . " -d ".shellescape(tartail)
- elseif executable("gunzip")
+ if executable("gunzip")
silent exe "!gunzip ".shellescape(tartail)
elseif executable("gzip")
silent exe "!gzip -d ".shellescape(tartail)
@@ -628,28 +811,6 @@ fun! tar#Vimuntar(...)
" call Dret("tar#Vimuntar")
endfun
-func s:get_gzip_command(file)
- " Try using the "file" command to get the actual compression type, since
- " there is no standard way for the naming: ".tgz", ".tbz", ".txz", etc.
- " If the "file" command doesn't work fall back to just using the file name.
- if a:file =~# 'z$'
- let filetype = system('file ' . a:file)
- if filetype =~ 'bzip2 compressed' && executable('bzip2')
- return 'bzip2'
- endif
- if filetype =~ 'XZ compressed' && executable('xz')
- return 'xz'
- endif
- endif
- if a:file =~# 'bz2$'
- return 'bzip2'
- endif
- if a:file =~# 'xz$'
- return 'xz'
- endif
- return 'gzip'
-endfunc
-
" =====================================================================
" Modelines And Restoration: {{{1
let &cpo= s:keepcpo
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index dd3469372e..bd34411065 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1148,6 +1148,18 @@ nvim_load_context({dict}) *nvim_load_context()*
Parameters: ~
{dict} |Context| map.
+nvim_notify({msg}, {log_level}, {opts}) *nvim_notify()*
+ Notify the user with a message
+
+ Relays the call to vim.notify . By default forwards your
+ message in the echo area but can be overriden to trigger
+ desktop notifications.
+
+ Parameters: ~
+ {msg} Message to display to the user
+ {log_level} The log level
+ {opts} Reserved for future use.
+
nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
Open a new window.
@@ -1403,9 +1415,9 @@ nvim_put({lines}, {type}, {after}, {follow}) *nvim_put()*
• "c" |charwise| mode
• "l" |linewise| mode
• "" guess by contents, see |setreg()|
- {after} Insert after cursor (like |p|), or before (like
+ {after} If true insert after cursor (like |p|), or before (like
|P|).
- {follow} Place cursor at end of inserted text.
+ {follow} If true place cursor at end of inserted text.
*nvim_replace_termcodes()*
nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
@@ -1800,6 +1812,25 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• deleted_codeunits (if `utf_sizes` is
true)
+ • on_bytes: lua callback invoked on change.
+ This callback receives more granular
+ information about the change compared to
+ on_lines. Return`true`to detach. Args:
+ • the string "bytes"
+ • buffer handle
+ • b:changedtick
+ • start row of the changed text
+ (zero-indexed)
+ • start column of the changed text
+ • byte offset of the changed text (from
+ the start of the buffer)
+ • old end row of the changed text
+ • old end column of the changed text
+ • old end byte length of the changed text
+ • new end row of the changed text
+ • new end column of the changed text
+ • new end byte length of the changed text
+
• on_changedtick: Lua callback invoked on
changedtick increment without text
change. Args:
@@ -1812,6 +1843,12 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• the string "detach"
• buffer handle
+ • on_reload: Lua callback invoked on
+ reload. The entire buffer content should
+ be considered changed. Args:
+ • the string "detach"
+ • buffer handle
+
• utf_sizes: include UTF-32 and UTF-16 size
of the replaced region, as args to
`on_lines` .
@@ -2158,6 +2195,13 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
• hl_group : name of the highlight group used to
highlight this mark.
• virt_text : virtual text to link to this mark.
+ • virt_text_pos : positioning of virtual text.
+ Possible values:
+ • "eol": right after eol character (default)
+ • "overlay": display over the specified
+ column, without shifting the underlying
+ text.
+
• ephemeral : for use with
|nvim_set_decoration_provider| callbacks. The
mark will only be used for the current redraw
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
index 2a972483ff..3544882ceb 100644
--- a/runtime/doc/diff.txt
+++ b/runtime/doc/diff.txt
@@ -48,7 +48,7 @@ In each of the edited files these options are set:
'scrollbind' on
'cursorbind' on
'scrollopt' includes "hor"
- 'wrap' off
+ 'wrap' off, or leave as-is if 'diffopt' includes "followwrap"
'foldmethod' "diff"
'foldcolumn' value from 'diffopt', default is 2
@@ -132,7 +132,7 @@ Otherwise they are set to their default value:
'scrollbind' off
'cursorbind' off
'scrollopt' without "hor"
- 'wrap' on
+ 'wrap' on, or leave as-is if 'diffopt' includes "followwrap"
'foldmethod' "manual"
'foldcolumn' 0
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index ac398ec494..aa964a521f 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -90,7 +90,7 @@ g CTRL-G Prints the current position of the cursor in five
:buffers
:files
:ls List all the currently known file names. See
- 'windows.txt' |:files| |:buffers| |:ls|.
+ |windows.txt| |:files| |:buffers| |:ls|.
Vim will remember the full path name of a file name that you enter. In most
cases when the file name is displayed only the name you typed is shown, but
@@ -1190,7 +1190,7 @@ The syntax is best shown via some examples: >
< Open the browser in the C:/bar directory, with the current
buffer filename as default, and save the buffer under the
filename chosen.
-Also see the |'browsedir'| option.
+Also see the 'browsedir' option.
For versions of Vim where browsing is not supported, the command is executed
unmodified.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 384bdd63a4..be7c026f5a 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1541,7 +1541,10 @@ v:dying Normally zero. When a deadly signal is caught it's set to
VimLeave autocommands will not be executed.
*v:exiting* *exiting-variable*
-v:exiting Exit code, or |v:null| if not exiting. |VimLeave|
+v:exiting Exit code, or |v:null| before invoking the |VimLeavePre|
+ and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|.
+ Example: >
+ :au VimLeave * echo "Exit value is " .. v:exiting
*v:echospace* *echospace-variable*
v:echospace Number of screen cells that can be used for an `:echo` message
@@ -2074,6 +2077,8 @@ changenr() Number current change number
chanclose({id}[, {stream}]) Number Closes a channel or one of its streams
chansend({id}, {data}) Number Writes {data} to channel
char2nr({expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
+charidx({string}, {idx} [, {countcc}])
+ Number char index of byte {idx} in {string}
cindent({lnum}) Number C indent for line {lnum}
clearmatches([{win}]) none clear all matches
col({expr}) Number column nr of cursor or mark
@@ -3024,6 +3029,29 @@ char2nr({expr} [, {utf8}]) *char2nr()*
A combining character is a separate character.
|nr2char()| does the opposite.
+ *charidx()*
+charidx({string}, {idx} [, {countcc}])
+ Return the character index of the byte at {idx} in {string}.
+ The index of the first character is zero.
+ If there are no multibyte characters the returned value is
+ equal to {idx}.
+ When {countcc} is omitted or zero, then composing characters
+ are not counted separately, their byte length is added to the
+ preceding base character.
+ When {countcc} is set to 1, then composing characters are
+ counted as separate characters.
+ Returns -1 if the arguments are invalid or if {idx} is greater
+ than the index of the last byte in {string}. An error is
+ given if the first argument is not a string, the second
+ argument is not a number or when the third argument is present
+ and is not zero or one.
+ See |byteidx()| and |byteidxcomp()| for getting the byte index
+ from the character index.
+ Examples: >
+ echo charidx('áb́ć', 3) returns 1
+ echo charidx('áb́ć', 6, 1) returns 4
+ echo charidx('áb́ć', 16) returns -1
+
cindent({lnum}) *cindent()*
Get the amount of indent for line {lnum} according the C
indenting rules, as with 'cindent'.
@@ -4449,11 +4477,12 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
augroup autocmd groups
buffer buffer names
behave :behave suboptions
- cmdline |cmdline-completion|
+ cmdline |cmdline-completion| result
color color schemes
command Ex command (and arguments)
compiler compilers
cscope |:cscope| suboptions
+ diff_buffer |:diffget| and |:diffput| completion
dir directory names
environment environment variable names
event autocommand events
@@ -4481,14 +4510,19 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
user user names
var user variables
- If {pat} is an empty string then all matches are returned.
- Otherwise only items matching {pat} are returned. See
- |wildcards| for the use of special characters in {pat}.
+ If {pat} is an empty string, then all the matches are
+ returned. Otherwise only items matching {pat} are returned.
+ See |wildcards| for the use of special characters in {pat}.
If the optional {filtered} flag is set to 1, then 'wildignore'
is applied to filter the results. Otherwise all the matches
are returned. The 'wildignorecase' option always applies.
+ If {type} is "cmdline", then the |cmdline-completion| result is
+ returned. For example, to complete the possible values after
+ a ":call" command: >
+ echo getcompletion('call ', 'cmdline')
+<
If there are no matches, an empty list is returned. An
invalid value for {type} produces an error.
@@ -5091,6 +5125,8 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
iconv Can use |iconv()| for conversion.
+shellslash Can use backslashes in filenames (Windows)
clipboard |clipboard| provider is available.
+ fname_case Case in file names matters (for Darwin and MS-Windows
+ this is not present).
mac MacOS system.
nvim This is Nvim.
python2 Legacy Vim |python2| interface. |has-python|
@@ -5607,7 +5643,6 @@ jobstart({cmd}[, {opts}]) *jobstart()*
before invoking `on_stderr`. |channel-buffered|
stdout_buffered: (boolean) Collect data until EOF (stream
closed) before invoking `on_stdout`. |channel-buffered|
- TERM: (string) Sets the `pty` $TERM environment variable.
width: (number) Width of the `pty` terminal.
{opts} is passed as |self| dictionary to the callback; the
@@ -9771,15 +9806,49 @@ change their contents. Thus you can pass a |List| to a function and have the
function add an item to it. If you want to make sure the function cannot
change a |List| or |Dictionary| use |:lockvar|.
-When not using "...", the number of arguments in a function call must be equal
-to the number of named arguments. When using "...", the number of arguments
-may be larger.
-
It is also possible to define a function without any arguments. You must
still supply the () then.
It is allowed to define another function inside a function body.
+ *optional-function-argument*
+You can provide default values for positional named arguments. This makes
+them optional for function calls. When a positional argument is not
+specified at a call, the default expression is used to initialize it.
+This only works for functions declared with |function|, not for lambda
+expressions |expr-lambda|.
+
+Example: >
+ function Something(key, value = 10)
+ echo a:key .. ": " .. a:value
+ endfunction
+ call Something('empty') "empty: 10"
+ call Something('key', 20) "key: 20"
+
+The argument default expressions are evaluated at the time of the function
+call, not definition. Thus it is possible to use an expression which is
+invalid the moment the function is defined. The expressions are also only
+evaluated when arguments are not specified during a call.
+
+ *E989*
+Optional arguments with default expressions must occur after any mandatory
+arguments. You can use "..." after all optional named arguments.
+
+It is possible for later argument defaults to refer to prior arguments,
+but not the other way around. They must be prefixed with "a:", as with all
+arguments.
+
+Example that works: >
+ :function Okay(mandatory, optional = a:mandatory)
+ :endfunction
+Example that does NOT work: >
+ :function NoGood(first = a:second, second = 10)
+ :endfunction
+<
+When not using "...", the number of arguments in a function call must be equal
+to the number of mandatory named arguments. When using "...", the number of
+arguments may be larger.
+
*local-variables*
Inside a function local variables can be used. These will disappear when the
function returns. Global variables need to be accessed with "g:".
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 172821ac28..c824a9f9f6 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1144,6 +1144,7 @@ tag command action ~
|:bNext| :bN[ext] go to previous buffer in the buffer list
|:ball| :ba[ll] open a window for each buffer in the buffer list
|:badd| :bad[d] add buffer to the buffer list
+|:balt| :balt like ":badd" but also set the alternate file
|:bdelete| :bd[elete] remove a buffer from the buffer list
|:behave| :be[have] set mouse and selection behavior
|:belowright| :bel[owright] make split window appear right or below
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index c4b93a2a27..6902ed5fd4 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -287,8 +287,7 @@ character is written at the end of each line. Thus if you want to insert a
*i_CTRL-X* *insert_expand*
CTRL-X enters a sub-mode where several commands can be used. Most of these
-commands do keyword completion; see |ins-completion|. These are not available
-when Vim was compiled without the |+insert_expand| feature.
+commands do keyword completion; see |ins-completion|.
Two commands can be used to scroll the window up or down, without exiting
insert mode:
@@ -592,9 +591,6 @@ In Insert and Replace mode, there are several commands to complete part of a
keyword or line that has been typed. This is useful if you are using
complicated keywords (e.g., function names with capitals and underscores).
-These commands are not available when the |+insert_expand| feature was
-disabled at compile time.
-
Completion can be done for:
1. Whole lines |i_CTRL-X_CTRL-L|
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 06666c3a27..d2d88fb9ba 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -397,6 +397,11 @@ LSP HIGHLIGHT *lsp-highlight*
Reference Highlights:
+Highlight groups that are meant to be used by |vim.lsp.buf.document_highlight()|.
+
+You can see more about the differences in types here:
+https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight
+
*hl-LspReferenceText*
LspReferenceText used for highlighting "text" references
*hl-LspReferenceRead*
@@ -932,15 +937,21 @@ definition() *vim.lsp.buf.definition()*
Jumps to the definition of the symbol under the cursor.
document_highlight() *vim.lsp.buf.document_highlight()*
- Send request to server to resolve document highlights for the
- current text document position. This request can be associated
- to key mapping or to events such as `CursorHold` , eg:
+ Send request to the server to resolve document highlights for
+ the current text document position. This request can be
+ triggered by a key mapping or by events such as `CursorHold` ,
+ eg:
>
vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]]
vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]
vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
<
+ Note: Usage of |vim.lsp.buf.document_highlight()| requires the
+ following highlight groups to be defined or you won't be able
+ to see the actual highlights. |LspReferenceText|
+ |LspReferenceRead| |LspReferenceWrite|
+
document_symbol() *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix
window.
@@ -1307,6 +1318,17 @@ on_publish_diagnostics({_}, {_}, {params}, {client_id}, {_}, {config})
• Update diagnostics in InsertMode or wait
until InsertLeave
+reset({client_id}, {buffer_client_map}) *vim.lsp.diagnostic.reset()*
+ Clear diagnotics and diagnostic cache
+
+ Handles saving diagnostics from multiple clients in the same
+ buffer.
+
+ Parameters: ~
+ {client_id} number
+ {buffer_client_map} table map of buffers to active
+ clients
+
save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()*
Save diagnostics to the current buffer.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index a497efa47e..c4d5df84cf 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1971,6 +1971,8 @@ A jump table for the options with a short description can be found at |Q_op|.
foldcolumn:{n} Set the 'foldcolumn' option to {n} when
starting diff mode. Without this 2 is used.
+ followwrap Follow the 'wrap' option and leave as it is.
+
internal Use the internal diff library. This is
ignored when 'diffexpr' is set. *E960*
When running out of memory when writing a
@@ -4088,8 +4090,6 @@ A jump table for the options with a short description can be found at |Q_op|.
In the "popup" model the right mouse button produces a pop-up menu.
You need to define this first, see |popup-menu|.
- In a terminal the popup menu works if Vim is compiled with the
- |+insert_expand| option.
Note that you can further refine the meaning of buttons with mappings.
See |mouse-overview|. But mappings are NOT used for modeless selection.
@@ -4856,7 +4856,9 @@ A jump table for the options with a short description can be found at |Q_op|.
local to window
Number of lines to scroll with CTRL-U and CTRL-D commands. Will be
set to half the number of lines in the window when the window size
- changes. If you give a count to the CTRL-U or CTRL-D command it will
+ changes. This may happen when enabling the |status-line| or
+ 'tabline' option after setting the 'scroll' option.
+ If you give a count to the CTRL-U or CTRL-D command it will
be used as the new value for 'scroll'. Reset to half the window
height with ":set scroll=0".
@@ -6289,6 +6291,29 @@ A jump table for the options with a short description can be found at |Q_op|.
attributes instead of "cterm" attributes. |highlight-guifg|
Requires an ISO-8613-3 compatible terminal.
+ *'termpastefilter'* *'tpf'*
+'termpastefilter' 'tpf' string (default: "BS,HT,ESC,DEL")
+ global
+ A comma separated list of options for specifying control characters
+ to be removed from the text pasted into the terminal window. The
+ supported values are:
+
+ BS Backspace
+
+ HT TAB
+
+ FF Form feed
+
+ ESC Escape
+
+ DEL DEL
+
+ C0 Other control characters, excluding Line feed and
+ Carriage return < ' '
+
+ C1 Control characters 0x80...0x9F
+
+
*'terse'* *'noterse'*
'terse' boolean (default off)
global
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 9a75a95f23..7312ab721b 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -1,9 +1,9 @@
-*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Jul 17
+*pi_netrw.txt* For Vim version 8.2. Last change: 2020 Aug 15
------------------------------------------------
NETRW REFERENCE MANUAL by Charles E. Campbell
------------------------------------------------
-Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
+Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
(remove NOSPAM from Campbell's email first)
Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
@@ -1565,8 +1565,8 @@ So, for example: >
file.rcs,v -> NFH_rcsCOMMAv()
<
If more such translations are necessary, please send me email: >
- NdrOchip at ScampbellPfamily.AbizM - NOSPAM
-with a request.
+ NcampObell@SdrPchip.AorgM-NOSPAM
+with a request. (remove the embedded NOSPAM first)
Associated setting variable: |g:netrw_browsex_viewer|
@@ -2744,9 +2744,8 @@ your browsing preferences. (see also: |netrw-settings|)
*g:netrw_home* The home directory for where bookmarks and
history are saved (as .netrwbook and
.netrwhist).
- Netrw uses |expand()|on the string.
- default: the first directory on the
- |'runtimepath'|
+ Netrw uses |expand()| on the string.
+ default: stdpath('data') (see |stdpath()|)
*g:netrw_keepdir* =1 (default) keep current directory immune from
the browsing directory.
@@ -3054,7 +3053,7 @@ your browsing preferences. (see also: |netrw-settings|)
(see |netrw-c-tab|).
*g:netrw_xstrlen* Controls how netrw computes string lengths,
- including multi-byte characters' string
+ including multibyte characters' string
length. (thanks to N Weibull, T Mechelynck)
=0: uses Vim's built-in strlen()
=1: number of codepoints (Latin a + combining
@@ -3229,7 +3228,8 @@ If there are marked files: (see |netrw-mf|)
R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
<
This example will mark all *.c files and then rename them to *.cpp
- files.
+ files. Netrw will protect you from overwriting local files without
+ confirmation, but not remote ones.
The ctrl-X character has special meaning for renaming files: >
@@ -3512,7 +3512,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
- Click "Add..."
- Set External Editor (adjust path as needed, include
the quotes and !.! at the end):
- "c:\Program Files\Vim\vim70\gvim.exe" !.!
+ "c:\Program Files\Vim\vim82\gvim.exe" !.!
- Check that the filetype in the box below is
{asterisk}.{asterisk} (all files), or whatever types
you want (cec: change {asterisk} to * ; I had to
@@ -3762,8 +3762,8 @@ by obtaining a copy of the latest (often developmental) netrw at:
The <netrw.vim> script is typically installed on systems as something like:
>
- /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
- /usr/local/share/vim/vim7x/autoload/netrw.vim
+ /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
@@ -3836,12 +3836,30 @@ netrw:
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|) >
- NdrOchip at ScampbellPfamily.AbizM - NOSPAM
+ (see |:version|) (remove the embedded NOSPAM first) >
+ NcampObell@SdrPchip.AorgM-NOSPAM
<
==============================================================================
12. History *netrw-history* {{{1
+ 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
@@ -3852,6 +3870,8 @@ netrw:
* (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
@@ -4265,7 +4285,7 @@ netrw:
Vim editor by Bram Moolenaar (Thanks, Bram!)
dav support by C Campbell
fetch support by Bram Moolenaar and C Campbell
- ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
+ ftp support by C Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
http support by Bram Moolenaar <bram@moolenaar.net>
rcp
rsync support by C Campbell (suggested by Erik Warendorph)
diff --git a/runtime/doc/pi_tar.txt b/runtime/doc/pi_tar.txt
index 59b318b7fd..c6c0596ea0 100644
--- a/runtime/doc/pi_tar.txt
+++ b/runtime/doc/pi_tar.txt
@@ -1,12 +1,12 @@
-*pi_tar.txt* Nvim
+*pi_tar.txt* For Vim version 8.2. Last change: 2020 Jan 07
+====================+
| Tar File Interface |
+====================+
-Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
+Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
(remove NOSPAM from Campbell's email first)
-Copyright 2005-2012: *tar-copyright*
+Copyright 2005-2017: *tar-copyright*
The VIM LICENSE (see |copyright|) applies to the files in this
package, including tarPlugin.vim, tar.vim, and pi_tar.txt. Like
anything else that's except use "tar.vim" instead of "VIM". Like
@@ -104,48 +104,67 @@ Copyright 2005-2012: *tar-copyright*
==============================================================================
4. History *tar-history*
-
- v28 Jun 23, 2011 * a few more decompression options (tbz tb2 txz)
- v27 May 31, 2011 * moved cygwin detection before g:tar_copycmd handling
- * inserted additional |:keepj| modifiers
- * changed silent to sil! (|:silent|)
- v26 Aug 09, 2010 * uses buffer-local instead of window variables to hold
- tarfile name
- * inserted keepj before 0d to protect jump list
- v25 Jun 19, 2010 * (Jan Steffens) added support for xz compression
- v24 Apr 07, 2009 * :Untarvim command implemented
- Sep 28, 2009 * Added lzma support
- v22 Aug 08, 2008 * security fixes
- v16 Jun 06, 2008 * tarfile:: used instead of tarfile: when editing files
- inside tarballs. Fixes a problem with tarballs called
- things like c:\abc.tar. (tnx to Bill McCarthy)
- v14 May 09, 2008 * arno caught a security bug
- May 28, 2008 * various security improvements. Now requires patch 299
- which provides the fnameescape() function
- May 30, 2008 * allows one to view *.gz and *.bz2 files that are in
- *.tar files.
- v12 Sep 07, 2007 * &shq now used if not the empty string for g:tar_shq
- v10 May 02, 2006 * now using "redraw then echo" to show messages, instead
- of "echo and prompt user"
- v9 May 02, 2006 * improved detection of masquerading as tar file
- v8 May 02, 2006 * allows editing of files that merely masquerade as tar
- files
- v7 Mar 22, 2006 * work on making tar plugin work across network
- Mar 27, 2006 * g:tar_cmd now available for users to change the name
- of the tar program to be used. By default, of course,
- it's "tar".
- v6 Dec 21, 2005 * writing to files not in directories caused problems -
- fixed (pointed out by Christian Robinson)
- v5 Nov 22, 2005 * report option workaround installed
- v3 Sep 16, 2005 * handles writing files in an archive back to the
- archive
- Oct 18, 2005 * <amatch> used instead of <afile> in autocmds
- Oct 18, 2005 * handles writing to compressed archives
- Nov 03, 2005 * handles writing tarfiles across a network using
- netrw#NetWrite()
- v2 * converted to use Vim7's new autoload feature by
- Bram Moolenaar
- v1 (original) * Michael Toren (see http://michael.toren.net/code/)
+ v31 Apr 02, 2017 * (klartext) reported that browsing encrypted
+ files in a zip archive created unencrypted
+ swap files. I am applying a similar fix
+ used on zip.vim to tar.vim: new buffers
+ are opened with |:noswapfile|.
+ May 16, 2017 * When the mouse option isn't empty, the
+ leftmouse can be used to select a file
+ in the tar-file listing.
+ v30 Apr 22, 2014 * .tgz files are ambiguous: they may have been
+ compressed with either gzip or bzip2. Tar.vim
+ disambiguates by using unix's "file" command.
+ Feb 18, 2016 * Changed =~ to =~# where appropriate
+ Feb 18, 2017 * Now also permits xz decompression
+ v28 Jun 23, 2011 * a few more decompression options (tbz tb2 txz)
+ v27 May 31, 2011 * moved cygwin detection before g:tar_copycmd
+ handling
+ * inserted additional |:keepj| modifiers
+ * changed silent to sil! (|:silent|)
+ v26 Aug 09, 2010 * uses buffer-local instead of window variables
+ to hold tarfile name
+ * inserted keepj before 0d to protect jump list
+ v25 Jun 19, 2010 * (Jan Steffens) added support for xz
+ compression
+ v24 Apr 07, 2009 * :Untarvim command implemented
+ Sep 28, 2009 * Added lzma support
+ v22 Aug 08, 2008 * security fixes
+ v16 Jun 06, 2008 * tarfile:: used instead of tarfile: when
+ editing files inside tarballs. Fixes a
+ problem with tarballs called things like
+ c:\abc.tar. (tnx to Bill McCarthy)
+ v14 May 09, 2008 * arno caught a security bug
+ May 28, 2008 * various security improvements. Now requires
+ patch 299 which provides the fnameescape()
+ function
+ May 30, 2008 * allows one to view *.gz and *.bz2 files that
+ are in *.tar files.
+ v12 Sep 07, 2007 * &shq now used if not the empty string for
+ g:tar_shq
+ v10 May 02, 2006 * now using "redraw then echo" to show messages,
+ instead of "echo and prompt user"
+ v9 May 02, 2006 * improved detection of masquerading as tar file
+ v8 May 02, 2006 * allows editing of files that merely masquerade
+ as tar files
+ v7 Mar 22, 2006 * work on making tar plugin work across network
+ Mar 27, 2006 * g:tar_cmd now available for users to change
+ the name of the tar program to be used. By
+ default, of course, it's "tar".
+ v6 Dec 21, 2005 * writing to files not in directories caused
+ problems - fixed (pointed out by
+ Christian Robinson)
+ v5 Nov 22, 2005 * report option workaround installed
+ v3 Sep 16, 2005 * handles writing files in an archive back to
+ the archive
+ Oct 18, 2005 * <amatch> used instead of <afile> in autocmds
+ Oct 18, 2005 * handles writing to compressed archives
+ Nov 03, 2005 * handles writing tarfiles across a network
+ using netrw#NetWrite()
+ v2 * converted to use Vim7's new autoload feature
+ by Bram Moolenaar
+ v1 (original) * Michael Toren
+ (see http://michael.toren.net/code/)
==============================================================================
vim:tw=78:ts=8:noet:ft=help
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 4a99aa47bf..d3647246fa 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -106,8 +106,6 @@ argument.
This can be used to find out where time is spent while loading
your |config|, plugins and opening the first file.
When {fname} already exists new messages are appended.
- (Only available when compiled with the |+startuptime|
- feature).
*-+*
+[num] The cursor will be positioned on line "num" for the first
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 7da886dabd..b45e9ed450 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1715,7 +1715,7 @@ There are several html preprocessor languages out there. html.vim has been
written such that it should be trivial to include it. To do so add the
following two lines to the syntax coloring file for that language
(the example comes from the asp.vim file):
-
+>
runtime! syntax/html.vim
syn cluster htmlPreproc add=asp
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index e92e464c6a..63c899da0c 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -613,6 +613,7 @@ String manipulation: *string-functions*
iconv() convert text from one encoding to another
byteidx() byte index of a character in a string
byteidxcomp() like byteidx() but count composing characters
+ charidx() character index of a byte in a string
repeat() repeat a string multiple times
eval() evaluate a string expression
execute() execute an Ex command and get the output
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 808af5f544..0c1e216164 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -144,7 +144,6 @@ Command-line highlighting:
removed in the future).
Commands:
- |:autocmd| accepts the `++once` flag
|:checkhealth|
|:drop| is always available
|:Man| is available by default, with many improvements such as completion
@@ -157,8 +156,6 @@ Events:
|TermOpen|
|UIEnter|
|UILeave|
- |VimResume|
- |VimSuspend|
|WinClosed|
Functions:
@@ -195,11 +192,10 @@ Options:
'cpoptions' flags: |cpo-_|
'display' flags: "msgsep" minimizes scrolling when showing messages
'guicursor' works in the terminal
- 'fillchars' flags: "msgsep" (see 'display'), "eob" for |hl-EndOfBuffer|
- marker, "foldopen", "foldsep", "foldclose"
+ 'fillchars' flags: "msgsep" (see 'display'), "foldopen", "foldsep",
+ "foldclose"
'foldcolumn' supports up to 9 dynamic/fixed columns
'inccommand' shows interactive results for |:substitute|-like commands
- 'listchars' local to window
'pumblend' pseudo-transparent popupmenu
'scrollback'
'signcolumn' supports up to 9 dynamic/fixed columns
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 2c3ffcbe9a..35efb1bbce 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -1039,6 +1039,11 @@ list of buffers. |unlisted-buffer|
line when the buffer is first entered. Note that other
commands after the + will be ignored.
+ *:balt*
+:balt [+lnum] {fname}
+ Like `:badd` and also set the alternate file for the current
+ window to {fname}.
+
:[N]bd[elete][!] *:bd* *:bdel* *:bdelete* *E516*
:bd[elete][!] [N]
Unload buffer [N] (default: current buffer) and delete it from
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 53fd66c4df..6a13e67ac5 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -212,6 +212,9 @@ au BufNewFile,BufRead *.bc setf bc
" BDF font
au BufNewFile,BufRead *.bdf setf bdf
+" Beancount
+au BufNewFile,BufRead *.beancount setf beancount
+
" BibTeX bibliography database file
au BufNewFile,BufRead *.bib setf bib
@@ -1491,6 +1494,9 @@ au BufNewFile,BufRead *.sdl,*.pr setf sdl
" sed
au BufNewFile,BufRead *.sed setf sed
+" svelte
+au BufNewFile,BufRead *.svelte setf svelte
+
" Sieve (RFC 3028, 5228)
au BufNewFile,BufRead *.siv,*.sieve setf sieve
diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim
index d77081841d..eafb8dd568 100644
--- a/runtime/indent/tcl.vim
+++ b/runtime/indent/tcl.vim
@@ -1,8 +1,8 @@
" Vim indent file
" Language: Tcl
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Update: Chris Heithoff <chrisheithoff@gmail.com>
-" Latest Revision: 2018-12-05
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2018-12-05
if exists("b:did_indent")
finish
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index a6f118abde..841c365cbe 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -16,10 +16,7 @@ local validate = vim.validate
local lsp = {
protocol = protocol;
- -- TODO(tjdevries): Add in the warning that `callbacks` is no longer supported.
- -- util.warn_once("vim.lsp.callbacks is deprecated. Use vim.lsp.handlers instead.")
handlers = default_handlers;
- callbacks = default_handlers;
buf = require'vim.lsp.buf';
diagnostic = require'vim.lsp.diagnostic';
@@ -219,8 +216,6 @@ local function validate_client_config(config)
}
validate {
root_dir = { config.root_dir, is_dir, "directory" };
- -- TODO(remove-callbacks)
- callbacks = { config.callbacks, "t", true };
handlers = { config.handlers, "t", true };
capabilities = { config.capabilities, "t", true };
cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), "directory" };
@@ -235,13 +230,6 @@ local function validate_client_config(config)
flags = { config.flags, "t", true };
}
- -- TODO(remove-callbacks)
- if config.handlers and config.callbacks then
- error(debug.traceback(
- "Unable to configure LSP with both 'config.handlers' and 'config.callbacks'. Use 'config.handlers' exclusively."
- ))
- end
-
local cmd, cmd_args = lsp._cmd_parts(config.cmd)
local offset_encoding = valid_encodings.UTF16
if config.offset_encoding then
@@ -473,8 +461,7 @@ function lsp.start_client(config)
local client_id = next_client_id()
- -- TODO(remove-callbacks)
- local handlers = config.handlers or config.callbacks or {}
+ local handlers = config.handlers or {}
local name = config.name or tostring(client_id)
local log_prefix = string.format("LSP[%s]", name)
@@ -548,19 +535,20 @@ function lsp.start_client(config)
function dispatch.on_exit(code, signal)
active_clients[client_id] = nil
uninitialized_clients[client_id] = nil
- local active_buffers = {}
- for bufnr, client_ids in pairs(all_buffer_active_clients) do
- if client_ids[client_id] then
- table.insert(active_buffers, bufnr)
- end
+
+ lsp.diagnostic.reset(client_id, all_buffer_active_clients)
+ all_client_active_buffers[client_id] = nil
+ for _, client_ids in pairs(all_buffer_active_clients) do
client_ids[client_id] = nil
end
- -- Buffer level cleanup
- vim.schedule(function()
- for _, bufnr in ipairs(active_buffers) do
- lsp.diagnostic.clear(bufnr)
- end
- end)
+
+ if code ~= 0 or (signal ~= 0 and signal ~= 15) then
+ local msg = string.format("Client %s quit with exit code %s and signal %s", client_id, code, signal)
+ vim.schedule(function()
+ vim.notify(msg, vim.log.levels.WARN)
+ end)
+ end
+
if config.on_exit then
pcall(config.on_exit, code, signal, client_id)
end
@@ -579,8 +567,6 @@ function lsp.start_client(config)
offset_encoding = offset_encoding;
config = config;
- -- TODO(remove-callbacks)
- callbacks = handlers;
handlers = handlers;
-- for $/progress report
messages = { name = name, messages = {}, progress = {}, status = {} }
@@ -751,6 +737,13 @@ function lsp.start_client(config)
---
--@param force (bool, optional)
function client.stop(force)
+
+ lsp.diagnostic.reset(client_id, all_buffer_active_clients)
+ all_client_active_buffers[client_id] = nil
+ for _, client_ids in pairs(all_buffer_active_clients) do
+ client_ids[client_id] = nil
+ end
+
local handle = rpc.handle
if handle:is_closing() then
return
@@ -1016,23 +1009,12 @@ end
function lsp.stop_client(client_id, force)
local ids = type(client_id) == 'table' and client_id or {client_id}
for _, id in ipairs(ids) do
- local resolved_client_id
if type(id) == 'table' and id.stop ~= nil then
id.stop(force)
- resolved_client_id = id.id
elseif active_clients[id] then
active_clients[id].stop(force)
- resolved_client_id = id
elseif uninitialized_clients[id] then
uninitialized_clients[id].stop(true)
- resolved_client_id = id
- end
- if resolved_client_id then
- local client_buffers = lsp.get_buffers_by_client_id(resolved_client_id)
- for idx = 1, #client_buffers do
- lsp.diagnostic.clear(client_buffers[idx], resolved_client_id)
- end
- all_client_active_buffers[resolved_client_id] = nil
end
end
end
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 00219b6d98..31116985e2 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -310,15 +310,21 @@ function M.workspace_symbol(query)
request('workspace/symbol', params)
end
---- Send request to server to resolve document highlights for the
---- current text document position. This request can be associated
---- to key mapping or to events such as `CursorHold`, eg:
+--- Send request to the server to resolve document highlights for the current
+--- text document position. This request can be triggered by a key mapping or
+--- by events such as `CursorHold`, eg:
---
--- <pre>
--- vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]]
--- vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]
--- vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
--- </pre>
+---
+--- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups
+--- to be defined or you won't be able to see the actual highlights.
+--- |LspReferenceText|
+--- |LspReferenceRead|
+--- |LspReferenceWrite|
function M.document_highlight()
local params = util.make_position_params()
request('textDocument/documentHighlight', params)
diff --git a/runtime/lua/vim/lsp/callbacks.lua b/runtime/lua/vim/lsp/callbacks.lua
deleted file mode 100644
index 1da92b900d..0000000000
--- a/runtime/lua/vim/lsp/callbacks.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-local util = require 'vim.lsp.util'
-
-util._warn_once("require('vim.lsp.callbacks') is deprecated. Use vim.lsp.handlers instead.")
-return require('vim.lsp.handlers')
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index a625098bab..a1f24706c0 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -264,10 +264,14 @@ local function set_diagnostic_cache(diagnostics, bufnr, client_id)
-- The diagnostic's severity. Can be omitted. If omitted it is up to the
-- client to interpret diagnostics as error, warning, info or hint.
-- TODO: Replace this with server-specific heuristics to infer severity.
+ local buf_line_count = vim.api.nvim_buf_line_count(bufnr)
for _, diagnostic in ipairs(diagnostics) do
if diagnostic.severity == nil then
diagnostic.severity = DiagnosticSeverity.Error
end
+ -- Account for servers that place diagnostics on terminating newline
+ local start = diagnostic.range.start
+ start.line = math.min(start.line, buf_line_count - 1)
end
diagnostic_cache[bufnr][client_id] = diagnostics
@@ -1158,6 +1162,24 @@ local loclist_type_map = {
[DiagnosticSeverity.Hint] = 'I',
}
+
+--- Clear diagnotics and diagnostic cache
+---
+--- Handles saving diagnostics from multiple clients in the same buffer.
+---@param client_id number
+---@param buffer_client_map table map of buffers to active clients
+function M.reset(client_id, buffer_client_map)
+ buffer_client_map = vim.deepcopy(buffer_client_map)
+ vim.schedule(function()
+ for bufnr, client_ids in pairs(buffer_client_map) do
+ if client_ids[client_id] then
+ clear_diagnostic_cache(bufnr, client_id)
+ M.clear(bufnr, client_id)
+ end
+ end
+ end)
+end
+
--- Sets the location list
---@param opts table|nil Configuration table. Keys:
--- - {open_loclist}: (boolean, default true)
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 7eac3febd9..0cf80e1443 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -13,7 +13,7 @@ local M = {}
--- Writes to error buffer.
--@param ... (table of strings) Will be concatenated before being written
local function err_message(...)
- api.nvim_err_writeln(table.concat(vim.tbl_flatten{...}))
+ vim.notify(table.concat(vim.tbl_flatten{...}), vim.log.levels.ERROR)
api.nvim_command("redraw")
end
@@ -26,7 +26,7 @@ end
-- @msg of type ProgressParams
-- Basically a token of type number/string
-local function progress_callback(_, _, params, client_id)
+local function progress_handler(_, _, params, client_id)
local client = vim.lsp.get_client_by_id(client_id)
local client_name = client and client.name or string.format("id=%d", client_id)
if not client then
@@ -62,7 +62,7 @@ local function progress_callback(_, _, params, client_id)
end
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress
-M['$/progress'] = progress_callback
+M['$/progress'] = progress_handler
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create
M['window/workDoneProgress/create'] = function(_, _, params, client_id)
@@ -409,7 +409,7 @@ for k, fn in pairs(M) do
})
if err then
- error(tostring(err))
+ return err_message(tostring(err))
end
return fn(err, method, params, client_id, bufnr, config)
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index b6e91e37b9..331e980e67 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -10,13 +10,7 @@ local log = {}
-- Can be used to lookup the number from the name or the name from the number.
-- Levels by name: 'trace', 'debug', 'info', 'warn', 'error'
-- Level numbers begin with 'trace' at 0
-log.levels = {
- TRACE = 0;
- DEBUG = 1;
- INFO = 2;
- WARN = 3;
- ERROR = 4;
-}
+log.levels = vim.log.levels
-- Default log level is warn.
local current_log_level = log.levels.WARN
@@ -38,6 +32,8 @@ do
vim.fn.mkdir(vim.fn.stdpath('cache'), "p")
local logfile = assert(io.open(logfilename, "a+"))
+ -- Start message for logging
+ logfile:write(string.format("[ START ] %s ] LSP logging initiated\n", os.date(log_date_format)))
for level, levelnr in pairs(log.levels) do
-- Also export the log level on the root object.
log[level] = levelnr
@@ -74,8 +70,6 @@ do
logfile:flush()
end
end
- -- Add some space to make it easier to distinguish different neovim runs.
- logfile:write("\n")
end
-- This is put here on purpose after the loop above so that it doesn't
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 3e111c154a..388f65c180 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -938,7 +938,7 @@ function protocol.resolve_capabilities(server_capabilities)
text_document_did_change = textDocumentSync;
text_document_will_save = false;
text_document_will_save_wait_until = false;
- text_document_save = false;
+ text_document_save = true;
text_document_save_include_text = false;
}
elseif type(textDocumentSync) == 'table' then
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 90f51dfc5a..4e2dd7c8e8 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -376,6 +376,9 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
spawn_params.env = env_merge(extra_spawn_params.env)
end
handle, pid = uv.spawn(cmd, spawn_params, onexit)
+ if handle == nil then
+ error(string.format("start `%s` failed: %s", cmd, pid))
+ end
end
--@private
@@ -386,7 +389,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
--@returns true if the payload could be scheduled, false if the main event-loop is in the process of closing.
local function encode_and_send(payload)
local _ = log.debug() and log.debug("rpc.send.payload", payload)
- if handle:is_closing() then return false end
+ if handle == nil or handle:is_closing() then return false end
-- TODO(ashkan) remove this once we have a Lua json_encode
schedule(function()
local encoded = assert(json_encode(payload))
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index e33e0109b6..6fb9f09c99 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -18,14 +18,6 @@ end
local M = {}
--- TODO(remove-callbacks)
-M.diagnostics_by_buf = setmetatable({}, {
- __index = function(_, bufnr)
- warn_once("diagnostics_by_buf is deprecated. Use 'vim.lsp.diagnostic.get'")
- return vim.lsp.diagnostic.get(bufnr)
- end
-})
-
--@private
local function split_lines(value)
return split(value, '\n', true)
@@ -211,7 +203,7 @@ function M.apply_text_edits(text_edits, bufnr)
local lines = api.nvim_buf_get_lines(bufnr, start_line, finish_line + 1, false)
local fix_eol = api.nvim_buf_get_option(bufnr, 'fixeol')
local set_eol = fix_eol and api.nvim_buf_line_count(bufnr) <= finish_line + 1
- if set_eol and #lines[#lines] ~= 0 then
+ if set_eol and (#lines == 0 or #lines[#lines] ~= 0) then
table.insert(lines, '')
end
@@ -726,7 +718,7 @@ function M.focusable_float(unique_name, fn)
local bufnr = api.nvim_get_current_buf()
do
local win = find_window_by_var(unique_name, bufnr)
- if win and api.nvim_win_is_valid(win) and not vim.fn.pumvisible() then
+ if win and api.nvim_win_is_valid(win) and vim.fn.pumvisible() == 0 then
api.nvim_set_current_win(win)
api.nvim_command("stopinsert")
return
@@ -1027,78 +1019,6 @@ function M.open_floating_preview(contents, filetype, opts)
return floating_bufnr, floating_winnr
end
--- TODO(remove-callbacks)
-do
- --@deprecated
- function M.get_severity_highlight_name(severity)
- warn_once("vim.lsp.util.get_severity_highlight_name is deprecated.")
- return vim.lsp.diagnostic._get_severity_highlight_name(severity)
- end
-
- --@deprecated
- function M.buf_clear_diagnostics(bufnr, client_id)
- warn_once("buf_clear_diagnostics is deprecated. Use vim.lsp.diagnostic.clear")
- return vim.lsp.diagnostic.clear(bufnr, client_id)
- end
-
- --@deprecated
- function M.get_line_diagnostics()
- warn_once("get_line_diagnostics is deprecated. Use vim.lsp.diagnostic.get_line_diagnostics")
-
- local bufnr = api.nvim_get_current_buf()
- local line_nr = api.nvim_win_get_cursor(0)[1] - 1
-
- return vim.lsp.diagnostic.get_line_diagnostics(bufnr, line_nr)
- end
-
- --@deprecated
- function M.show_line_diagnostics()
- warn_once("show_line_diagnostics is deprecated. Use vim.lsp.diagnostic.show_line_diagnostics")
-
- local bufnr = api.nvim_get_current_buf()
- local line_nr = api.nvim_win_get_cursor(0)[1] - 1
-
- return vim.lsp.diagnostic.show_line_diagnostics(bufnr, line_nr)
- end
-
- --@deprecated
- function M.buf_diagnostics_save_positions(bufnr, diagnostics, client_id)
- warn_once("buf_diagnostics_save_positions is deprecated. Use vim.lsp.diagnostic.save")
- return vim.lsp.diagnostic.save(diagnostics, bufnr, client_id)
- end
-
- --@deprecated
- function M.buf_diagnostics_get_positions(bufnr, client_id)
- warn_once("buf_diagnostics_get_positions is deprecated. Use vim.lsp.diagnostic.get")
- return vim.lsp.diagnostic.get(bufnr, client_id)
- end
-
- --@deprecated
- function M.buf_diagnostics_underline(bufnr, diagnostics, client_id)
- warn_once("buf_diagnostics_underline is deprecated. Use 'vim.lsp.diagnostic.set_underline'")
- return vim.lsp.diagnostic.set_underline(diagnostics, bufnr, client_id)
- end
-
- --@deprecated
- function M.buf_diagnostics_virtual_text(bufnr, diagnostics, client_id)
- warn_once("buf_diagnostics_virtual_text is deprecated. Use 'vim.lsp.diagnostic.set_virtual_text'")
- return vim.lsp.diagnostic.set_virtual_text(diagnostics, bufnr, client_id)
- end
-
- --@deprecated
- function M.buf_diagnostics_signs(bufnr, diagnostics, client_id)
- warn_once("buf_diagnostics_signs is deprecated. Use 'vim.lsp.diagnostic.set_signs'")
- return vim.lsp.diagnostic.set_signs(diagnostics, bufnr, client_id)
- end
-
- --@deprecated
- function M.buf_diagnostics_count(kind, client_id)
- warn_once("buf_diagnostics_count is deprecated. Use 'vim.lsp.diagnostic.get_count'")
- return vim.lsp.diagnostic.get_count(vim.api.nvim_get_current_buf(), client_id, kind)
- end
-
-end
-
do --[[ References ]]
local reference_ns = api.nvim_create_namespace("vim_lsp_references")
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 38ac182e32..3af66b134c 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -44,13 +44,18 @@ function M._create_parser(bufnr, lang, opts)
self:_on_bytes(...)
end
- local function detach_cb()
+ local function detach_cb(_, ...)
if parsers[bufnr] == self then
parsers[bufnr] = nil
end
+ self:_on_detach(...)
end
- a.nvim_buf_attach(self:source(), false, {on_bytes=bytes_cb, on_detach=detach_cb, preview=true})
+ local function reload_cb(_, ...)
+ self:_on_reload(...)
+ end
+
+ a.nvim_buf_attach(self:source(), false, {on_bytes=bytes_cb, on_detach=detach_cb, on_reload=reload_cb, preview=true})
self:parse()
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 275e960e28..6b833c6d35 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -113,8 +113,9 @@ function TSHighlighter.new(tree, opts)
opts = opts or {}
self.tree = tree
tree:register_cbs {
- on_changedtree = function(...) self:on_changedtree(...) end,
- on_bytes = function(...) self:on_bytes(...) end
+ on_changedtree = function(...) self:on_changedtree(...) end;
+ on_bytes = function(...) self:on_bytes(...) end;
+ on_detach = function(...) self:on_detach(...) end;
}
self.bufnr = tree:source()
@@ -176,6 +177,10 @@ function TSHighlighter:on_bytes(_, _, start_row, _, _, _, _, _, new_end)
a.nvim__buf_redraw_range(self.bufnr, start_row, start_row + new_end + 1)
end
+function TSHighlighter:on_detach()
+ self:destroy()
+end
+
function TSHighlighter:on_changedtree(changes)
for _, ch in ipairs(changes or {}) do
a.nvim__buf_redraw_range(self.bufnr, ch[1], ch[3]+1)
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index d60cd2d0c7..eed28e0e41 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -2,12 +2,12 @@ local a = vim.api
local M = {}
---- Asserts that the provided language is installed, and optionnaly provide a path for the parser
+--- Asserts that the provided language is installed, and optionally provide a path for the parser
--
-- Parsers are searched in the `parser` runtime directory.
--
-- @param lang The language the parser should parse
--- @param path Optionnal path the parser is located at
+-- @param path Optional path the parser is located at
-- @param silent Don't throw an error if language not found
function M.require_language(lang, path, silent)
if vim._ts_has_language(lang) then
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index c864fe5878..4168c1e365 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -6,14 +6,14 @@ local LanguageTree = {}
LanguageTree.__index = LanguageTree
-- Represents a single treesitter parser for a language.
--- The language can contain child languages with in it's range,
+-- The language can contain child languages with in its range,
-- hence the tree.
--
-- @param source Can be a bufnr or a string of text to parse
-- @param lang The language this tree represents
-- @param opts Options table
--- @param opts.queries A table of language to injection query strings
--- This is useful for overridding the built in runtime file
+-- @param opts.queries A table of language to injection query strings.
+-- This is useful for overriding the built-in runtime file
-- searching for the injection language query per language.
function LanguageTree.new(source, lang, opts)
language.require_language(lang)
@@ -21,8 +21,8 @@ function LanguageTree.new(source, lang, opts)
local custom_queries = opts.queries or {}
local self = setmetatable({
- _source=source,
- _lang=lang,
+ _source = source,
+ _lang = lang,
_children = {},
_regions = {},
_trees = {},
@@ -35,6 +35,7 @@ function LanguageTree.new(source, lang, opts)
_callbacks = {
changedtree = {},
bytes = {},
+ detach = {},
child_added = {},
child_removed = {}
},
@@ -44,12 +45,17 @@ function LanguageTree.new(source, lang, opts)
return self
end
--- Invalidates this parser and all it's children
-function LanguageTree:invalidate()
+-- Invalidates this parser and all its children
+function LanguageTree:invalidate(reload)
self._valid = false
+ -- buffer was reloaded, reparse all trees
+ if reload then
+ self._trees = {}
+ end
+
for _, child in ipairs(self._children) do
- child:invalidate()
+ child:invalidate(reload)
end
end
@@ -97,7 +103,7 @@ function LanguageTree:parse()
self._trees = {}
-- If there are no ranges, set to an empty list
- -- so the included ranges in the parser ar cleared.
+ -- so the included ranges in the parser are cleared.
if self._regions and #self._regions > 0 then
for i, ranges in ipairs(self._regions) do
local old_tree = old_trees[i]
@@ -214,7 +220,7 @@ function LanguageTree:remove_child(lang)
end
end
--- Destroys this language tree and all it's children.
+-- Destroys this language tree and all its children.
-- Any cleanup logic should be performed here.
-- Note, this DOES NOT remove this tree from a parent.
-- `remove_child` must be called on the parent to remove it.
@@ -241,19 +247,19 @@ end
--
-- Note, this call invalidates the tree and requires it to be parsed again.
--
--- @param regions A list of regions this tree should manange and parse.
+-- @param regions A list of regions this tree should manage and parse.
function LanguageTree:set_included_regions(regions)
- -- Transform the tables from 4 element long to 6 element long (with byte offset)
- for _, region in ipairs(regions) do
- for i, range in ipairs(region) do
- if type(range) == "table" and #range == 4 then
- -- TODO(vigoux): I don't think string parsers are useful for now
- if type(self._source) == "number" then
+ -- TODO(vigoux): I don't think string parsers are useful for now
+ if type(self._source) == "number" then
+ -- Transform the tables from 4 element long to 6 element long (with byte offset)
+ for _, region in ipairs(regions) do
+ for i, range in ipairs(region) do
+ if type(range) == "table" and #range == 4 then
local start_row, start_col, end_row, end_col = unpack(range)
-- Easy case, this is a buffer parser
-- TODO(vigoux): proper byte computation here, and account for EOL ?
- local start_byte = a.nvim_buf_get_offset(self.bufnr, start_row) + start_col
- local end_byte = a.nvim_buf_get_offset(self.bufnr, end_row) + end_col
+ local start_byte = a.nvim_buf_get_offset(self._source, start_row) + start_col
+ local end_byte = a.nvim_buf_get_offset(self._source, end_row) + end_col
region[i] = { start_row, start_col, start_byte, end_row, end_col, end_byte }
end
@@ -397,14 +403,24 @@ function LanguageTree:_on_bytes(bufnr, changed_tick,
new_row, new_col, new_byte)
end
+function LanguageTree:_on_reload()
+ self:invalidate(true)
+end
+
+
+function LanguageTree:_on_detach(...)
+ self:invalidate(true)
+ self:_do_callback('detach', ...)
+end
+
--- Registers callbacks for the parser
-- @param cbs An `nvim_buf_attach`-like table argument with the following keys :
-- `on_bytes` : see `nvim_buf_attach`, but this will be called _after_ the parsers callback.
--- `on_changedtree` : a callback that will be called everytime the tree has syntactical changes.
+-- `on_changedtree` : a callback that will be called every time the tree has syntactical changes.
-- it will only be passed one argument, that is a table of the ranges (as node ranges) that
-- changed.
-- `on_child_added` : emitted when a child is added to the tree.
--- `on_child_removed` : emitted when a child is remvoed from the tree.
+-- `on_child_removed` : emitted when a child is removed from the tree.
function LanguageTree:register_cbs(cbs)
if not cbs then return end
@@ -416,6 +432,10 @@ function LanguageTree:register_cbs(cbs)
table.insert(self._callbacks.bytes, cbs.on_bytes)
end
+ if cbs.on_detach then
+ table.insert(self._callbacks.detach, cbs.on_detach)
+ end
+
if cbs.on_child_added then
table.insert(self._callbacks.child_added, cbs.on_child_added)
end
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index e49f54681d..8b94348994 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -111,7 +111,7 @@ end
--- Gets the text corresponding to a given node
-- @param node the node
--- @param bufnr the buffer from which the node in extracted.
+-- @param bufnr the buffer from which the node is extracted.
function M.get_node_text(node, source)
local start_row, start_col, start_byte = node:start()
local end_row, end_col, end_byte = node:end_()
@@ -215,10 +215,10 @@ predicate_handlers["vim-match?"] = predicate_handlers["match?"]
local directive_handlers = {
["set!"] = function(_, _, _, pred, metadata)
if #pred == 4 then
- -- (set! @capture "key" "value")
+ -- (#set! @capture "key" "value")
metadata[pred[2]][pred[3]] = pred[4]
else
- -- (set! "key" "value")
+ -- (#set! "key" "value")
metadata[pred[2]] = pred[3]
end
end,
@@ -245,7 +245,7 @@ local directive_handlers = {
end
}
---- Adds a new predicates to be used in queries
+--- Adds a new predicate to be used in queries
--
-- @param name the name of the predicate, without leading #
-- @param handler the handler function to be used
@@ -355,10 +355,10 @@ end
--- Iterates of the captures of self on a given range.
--
--- @param node The node under witch the search will occur
+-- @param node The node under which the search will occur
-- @param buffer The source buffer to search
-- @param start The starting line of the search
--- @param stop The stoping line of the search (end-exclusive)
+-- @param stop The stopping line of the search (end-exclusive)
--
-- @returns The matching capture id
-- @returns The captured node
@@ -388,12 +388,12 @@ function Query:iter_captures(node, source, start, stop)
return iter
end
---- Iterates of the matches of self on a given range.
+--- Iterates the matches of self on a given range.
--
--- @param node The node under witch the search will occur
+-- @param node The node under which the search will occur
-- @param buffer The source buffer to search
-- @param start The starting line of the search
--- @param stop The stoping line of the search (end-exclusive)
+-- @param stop The stopping line of the search (end-exclusive)
--
-- @returns The matching pattern id
-- @returns The matching match
diff --git a/runtime/menu.vim b/runtime/menu.vim
index 3756787e7f..cd56eb5583 100644
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -356,8 +356,8 @@ func! s:SetupColorSchemes() abort
let s:did_setup_color_schemes = 1
let n = globpath(&runtimepath, "colors/*.vim", 1, 1)
- let n += globpath(&runtimepath, "pack/*/start/*/colors/*.vim", 1, 1)
- let n += globpath(&runtimepath, "pack/*/opt/*/colors/*.vim", 1, 1)
+ let n += globpath(&packpath, "pack/*/start/*/colors/*.vim", 1, 1)
+ let n += globpath(&packpath, "pack/*/opt/*/colors/*.vim", 1, 1)
" Ignore case for VMS and windows, sort on name
let names = sort(map(n, 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1)
diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim
index 2d67f6a4e4..87302cf23b 100644
--- a/runtime/plugin/netrwPlugin.vim
+++ b/runtime/plugin/netrwPlugin.vim
@@ -1,7 +1,7 @@
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
" PLUGIN SECTION
-" Date: Feb 08, 2016
-" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
+" Date: Feb 08, 2016 - Jan 07, 2020
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
@@ -20,7 +20,7 @@
if &cp || exists("g:loaded_netrwPlugin")
finish
endif
-let g:loaded_netrwPlugin = "v165"
+let g:loaded_netrwPlugin = "v168"
let s:keepcpo = &cpo
set cpo&vim
"DechoRemOn
@@ -81,7 +81,7 @@ if !exists("g:netrw_nogx")
if !hasmapto('<Plug>NetrwBrowseX')
nmap <unique> gx <Plug>NetrwBrowseX
endif
- nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr>
+ nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr>
endif
if maparg('gx','v') == ""
if !hasmapto('<Plug>NetrwBrowseXVis')
diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim
index 6d9e6bd540..d55492a93e 100644
--- a/runtime/plugin/tarPlugin.vim
+++ b/runtime/plugin/tarPlugin.vim
@@ -14,7 +14,7 @@
if &cp || exists("g:loaded_tarPlugin")
finish
endif
-let g:loaded_tarPlugin = "v29"
+let g:loaded_tarPlugin = "v32"
let s:keepcpo = &cpo
set cpo&vim
@@ -39,11 +39,13 @@ augroup tar
au BufReadCmd *.lrp call tar#Browse(expand("<amatch>"))
au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>"))
au BufReadCmd *.tar.Z call tar#Browse(expand("<amatch>"))
- au BufReadCmd *.tgz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.tbz call tar#Browse(expand("<amatch>"))
+ au BufReadCmd *.tgz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>"))
au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.txz call tar#Browse(expand("<amatch>"))
+ au BufReadCmd *.tar.zst call tar#Browse(expand("<amatch>"))
+ au BufReadCmd *.tzs call tar#Browse(expand("<amatch>"))
augroup END
com! -nargs=? -complete=file Vimuntar call tar#Vimuntar(<q-args>)
diff --git a/runtime/syntax/cabal.vim b/runtime/syntax/cabal.vim
index 8af47d4042..92e6b8331e 100644
--- a/runtime/syntax/cabal.vim
+++ b/runtime/syntax/cabal.vim
@@ -4,7 +4,7 @@
" Maintainer: Marcin Szamotulski <profunctor@pm.me>
" Previous Maintainer: Vincent Berthoux <twinside@gmail.com>
" File Types: .cabal
-" Last Change: 15 May 2018
+" Last Change: 21 Nov 2020
" v1.5: Incorporated changes from
" https://github.com/sdiehl/haskell-vim-proto/blob/master/vim/syntax/cabal.vim
" Use `syn keyword` instead of `syn match`.
@@ -62,11 +62,12 @@ syn keyword cabalCategory contained
\ source-repository
\ flag
\ custom-setup
+ \ common
syn match cabalCategoryTitle contained /[^{]*\ze{\?/
syn match cabalCategoryRegion
\ contains=cabalCategory,cabalCategoryTitle
\ nextgroup=cabalCategory skipwhite
- \ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|custom-setup\)\+\s*\%(.*$\|$\)/
+ \ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|custom-setup\|common\)\+\s*\%(.*$\|$\)/
syn keyword cabalTruth true false
" cabalStatementRegion which limits the scope of cabalStatement keywords, this
@@ -76,10 +77,14 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ default-language
\ default-extensions
\ author
+ \ autogen-modules
+ \ asm-sources
+ \ asm-options
\ branch
\ bug-reports
\ build-depends
\ build-tools
+ \ build-tools-depends
\ build-type
\ buildable
\ c-sources
@@ -87,32 +92,46 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ category
\ cc-options
\ copyright
+ \ cmm-sources
+ \ cmm-options
\ cpp-options
+ \ cxx-sources
\ data-dir
\ data-files
\ default
+ \ default-extensions
\ description
\ executable
\ exposed-modules
\ exposed
\ extensions
- \ extra-tmp-files
+ \ extra-bundled-libraries
\ extra-doc-files
+ \ extra-dynamic-library-flavours
+ \ extra-framework-dirs
+ \ extra-ghci-libraries
\ extra-lib-dirs
\ extra-libraries
+ \ extra-library-flavours
\ extra-source-files
- \ exta-tmp-files
+ \ extra-tmp-files
\ for example
\ frameworks
\ ghc-options
\ ghc-prof-options
\ ghc-shared-options
+ \ ghcjs-options
+ \ ghcjs-prof-options
+ \ ghcjs-shared-options
\ homepage
+ \ hs-source-dir
\ hs-source-dirs
\ hugs-options
+ \ import
\ include-dirs
\ includes
\ install-includes
+ \ js-sources
\ ld-options
\ license
\ license-file
@@ -120,10 +139,13 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ main-is
\ maintainer
\ manual
+ \ mixins
\ module
\ name
\ nhc98-options
\ other-extensions
+ \ other-language
+ \ other-languages
\ other-modules
\ package-url
\ pkgconfig-depends
diff --git a/runtime/syntax/cabalconfig.vim b/runtime/syntax/cabalconfig.vim
new file mode 100644
index 0000000000..0165725c06
--- /dev/null
+++ b/runtime/syntax/cabalconfig.vim
@@ -0,0 +1,30 @@
+" Vim syntax file
+" Language: Cabal Config
+" Maintainer: profunctor@pm.me
+" Last Change: Marcin Szamotulski
+" Original Author: Marcin Szamotulski
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match CabalConfigSection /^\S[[:alpha:]]\+\%(-[[:alpha:]]\+\)*[^:]*$/
+syn region CabalConfigRegion matchgroup=CabalConfigKey start=/^\s*[[:alpha:]]\+\%(-[[:alpha:]]\+\)*:/ matchgroup=NONE end=/$/ contains=CabalConfigSeparator,CabalConfigKeyword,CabalConfigPath keepend
+syn match CabalConfigComment /^\s*--.*$/
+syn match CabalConfigValue /.*$/ contained
+syn match CabalConfigKey /[[:alpha:]]\+\%(-[[:alpha:]]\+\)*\ze:/
+syn keyword CabalConfigSeparator : contained
+syn match CabalConfigVariable /\$[[:alpha:]]\+/
+syn keyword CabalConfigKeyword True False ghc
+syn match CabalConfigPath /\%([[:alpha:]]\+:\)\?\%(\/[[:print:]]\+\)\+/
+
+hi def link CabalConfigComment Comment
+hi def link CabalConfigSection Title
+hi def link CabalConfigKey Statement
+hi def link CabalConfigSeparator NonText
+hi def link CabalConfigValue Normal
+hi def link CabalConfigVariable Identifier
+hi def link CabalConfigKeyword Keyword
+hi def link CabalConfigPath Directory
+
+let b:current_syntax = "cabal.config"
diff --git a/runtime/syntax/cabalproject.vim b/runtime/syntax/cabalproject.vim
new file mode 100644
index 0000000000..12143b9ee9
--- /dev/null
+++ b/runtime/syntax/cabalproject.vim
@@ -0,0 +1,28 @@
+" Vim syntax file
+" Language: Cabal Project
+" Maintainer: profunctor@pm.me
+" Last Change: Marcin Szamotulski
+" Original Author: Marcin Szamotulski
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match CabalProjectComment /^\s*--.*/ contains=@Spell
+syn match CabalProjectField /^\w\%(\w\|-\)\+/ contains=@NoSpell
+
+syn keyword CabalProjectBoolean true false True False
+syn keyword CabalProjectCompiler ghc ghcjs jhc lhc uhc haskell-suite
+syn match CabalProjectNat /\<\d\+\>/
+syn keyword CabalProjectJobs $ncpus
+syn keyword CabalProjectProfilingLevel default none exported-functions toplevel-functions all-functions
+
+hi def link CabalProjectComment Comment
+hi def link CabalProjectField Statement
+hi def link CabalProjectBoolean Boolean
+hi def link CabalProjectCompiler Identifier
+hi def link CabalProjectNat Number
+hi def link CabalProjectJobs Number
+hi def link CabalProjectProfilingLevel Statement
+
+let b:current_syntax = "cabal.project"
diff --git a/runtime/syntax/haskell.vim b/runtime/syntax/haskell.vim
index e5128a12ab..1b70b9344a 100644
--- a/runtime/syntax/haskell.vim
+++ b/runtime/syntax/haskell.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Haskell
" Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org>
-" Last Change: 2018 Mar 29 by Marcin Szamotulski
+" Last Change: 2020 Oct 4 by Marcin Szamotulski <profunctor@pm.me>
" Original Author: John Williams <jrw@pobox.com>
"
" Thanks to Ryan Crumley for suggestions and John Meacham for
@@ -38,8 +38,8 @@ if exists("b:current_syntax")
endif
" (Qualified) identifiers (no default highlighting)
-syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell
-syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell
+syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell
+syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell
" Infix operators--most punctuation characters and any (qualified) identifier
" enclosed in `backquotes`. An operator starting with : is a constructor,
@@ -49,8 +49,11 @@ syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`"
syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`"
+" (Non-qualified) identifiers which start with # are labels
+syn match hsLabel "#[a-z][a-zA-Z0-9_']*\>"
+
" Reserved symbols--cannot be overloaded.
-syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}"
+syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|{\|}"
" Strings and constants
syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
@@ -62,37 +65,41 @@ syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hs
syn match hsNumber "\v<[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*>|<0[oO]_*%(_*[0-7])*>|<0[bB]_*[01]%(_*[01])*>"
syn match hsFloat "\v<[0-9]%(_*[0-9])*\.[0-9]%(_*[0-9])*%(_*[eE][-+]?[0-9]%(_*[0-9])*)?>|<[0-9]%(_*[0-9])*_*[eE][-+]?[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*\.[0-9a-fA-F]%(_*[0-9a-fA-F])*%(_*[pP][-+]?[0-9]%(_*[0-9])*)?>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*_*[pP][-+]?[0-9]%(_*[0-9])*>"
-" Keyword definitions. These must be patterns instead of keywords
-" because otherwise they would match as keywords at the start of a
-" "literate" comment (see lhs.vim).
-syn match hsModule "\<module\>"
-syn match hsImport "\<import\>.*"he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment,@NoSpell
-syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" contains=@NoSpell
-syn match hsInfix "\<\(infix\|infixl\|infixr\)\>"
-syn match hsStructure "\<\(class\|data\|deriving\|instance\|default\|where\)\>"
-syn match hsTypedef "\<\(type\|newtype\)\>"
-syn match hsStatement "\<\(do\|case\|of\|let\|in\)\>"
-syn match hsConditional "\<\(if\|then\|else\)\>"
+" Keyword definitions.
+syn keyword hsModule module
+syn match hsImportGroup "\<import\>.*" contains=hsImport,hsImportModuleName,hsImportMod,hsLineComment,hsBlockComment,hsImportList,@NoSpell nextgroup=hsImport
+syn keyword hsImport import contained nextgroup=hsImportModuleName
+syn match hsImportModuleName '\<[A-Z][A-Za-z.]*' contained
+syn region hsImportList start='(' skip='([^)]\{-})' end=')' keepend contained contains=ConId,VarId,hsDelimiter,hsBlockComment,hsTypedef,@NoSpell
+
+syn keyword hsImportMod contained as qualified hiding
+syn keyword hsInfix infix infixl infixr
+syn keyword hsStructure class data deriving instance default where
+syn keyword hsTypedef type
+syn keyword hsNewtypedef newtype
+syn keyword hsTypeFam family
+syn keyword hsStatement mdo do case of let in
+syn keyword hsConditional if then else
" Not real keywords, but close.
if exists("hs_highlight_boolean")
" Boolean constants from the standard prelude.
- syn match hsBoolean "\<\(True\|False\)\>"
+ syn keyword hsBoolean True False
endif
if exists("hs_highlight_types")
" Primitive types from the standard prelude and libraries.
- syn match hsType "\<\(Int\|Integer\|Char\|Bool\|Float\|Double\|IO\|Void\|Addr\|Array\|String\)\>"
+ syn keyword hsType Int Integer Char Bool Float Double IO Void Addr Array String
endif
if exists("hs_highlight_more_types")
" Types from the standard prelude libraries.
- syn match hsType "\<\(Maybe\|Either\|Ratio\|Complex\|Ordering\|IOError\|IOResult\|ExitCode\)\>"
- syn match hsMaybe "\<Nothing\>"
- syn match hsExitCode "\<\(ExitSuccess\)\>"
- syn match hsOrdering "\<\(GT\|LT\|EQ\)\>"
+ syn keyword hsType Maybe Either Ratio Complex Ordering IOError IOResult ExitCode
+ syn keyword hsMaybe Nothing
+ syn keyword hsExitCode ExitSuccess
+ syn keyword hsOrdering GT LT EQ
endif
if exists("hs_highlight_debug")
" Debugging functions from the standard prelude.
- syn match hsDebug "\<\(undefined\|error\|trace\)\>"
+ syn keyword hsDebug undefined error trace
endif
@@ -133,12 +140,14 @@ hi def link hsImportMod hsImport
hi def link hsInfix PreProc
hi def link hsStructure Structure
hi def link hsStatement Statement
-hi def link hsConditional Conditional
-hi def link hsSpecialChar SpecialChar
+hi def link hsConditional Conditional
+hi def link hsSpecialChar SpecialChar
hi def link hsTypedef Typedef
+hi def link hsNewtypedef Typedef
hi def link hsVarSym hsOperator
hi def link hsConSym hsOperator
hi def link hsOperator Operator
+hi def link hsTypeFam Structure
if exists("hs_highlight_delimiters")
" Some people find this highlighting distracting.
hi def link hsDelimiter Delimiter
@@ -160,22 +169,22 @@ hi def link hsMaybe hsEnumConst
hi def link hsOrdering hsEnumConst
hi def link hsEnumConst Constant
hi def link hsDebug Debug
-
-hi def link cCppString hsString
-hi def link cCommentStart hsComment
-hi def link cCommentError hsError
-hi def link cCommentStartError hsError
-hi def link cInclude Include
-hi def link cPreProc PreProc
-hi def link cDefine Macro
-hi def link cIncluded hsString
-hi def link cError Error
-hi def link cPreCondit PreCondit
-hi def link cComment Comment
-hi def link cCppSkip cCppOut
-hi def link cCppOut2 cCppOut
-hi def link cCppOut Comment
-
+hi def link hsLabel Special
+
+hi def link cCppString hsString
+hi def link cCommentStart hsComment
+hi def link cCommentError hsError
+hi def link cCommentStartError hsError
+hi def link cInclude Include
+hi def link cPreProc PreProc
+hi def link cDefine Macro
+hi def link cIncluded hsString
+hi def link cError Error
+hi def link cPreCondit PreCondit
+hi def link cComment Comment
+hi def link cCppSkip cCppOut
+hi def link cCppOut2 cCppOut
+hi def link cCppOut Comment
let b:current_syntax = "haskell"
diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim
index c4d3cf5fda..83ae17445d 100644
--- a/runtime/syntax/netrw.vim
+++ b/runtime/syntax/netrw.vim
@@ -1,7 +1,7 @@
" Language : Netrw Listing Syntax
" Maintainer : Charles E. Campbell
-" Last change: Oct 31, 2016
-" Version : 20 NOT RELEASED
+" Last change: Nov 07, 2019
+" Version : 20
" ---------------------------------------------------------------------
if exists("b:current_syntax")
finish