From 89a9c159f23fb7b3e24e6d09068adfc24a73afcb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 29 Aug 2021 21:55:35 +0200 Subject: Update runtime files --- .github/workflows/codeql-analysis.yml | 2 +- CONTRIBUTING.md | 2 +- README.md | 14 +- README.txt | 12 +- README_VIM9.md | 2 +- nsis/lang/turkish.nsi | 14 +- pixmaps/gen-inline-pixbufs.sh | 6 +- runtime/autoload/netrw.vim | 293 +++++++++++++++------ runtime/autoload/netrwSettings.vim | 8 +- runtime/doc/eval.txt | 32 +-- runtime/doc/index.txt | 2 +- runtime/doc/insert.txt | 2 +- runtime/doc/options.txt | 15 +- runtime/doc/pi_netrw.txt | 84 +++++- runtime/doc/popup.txt | 25 +- runtime/doc/syntax.txt | 11 +- runtime/doc/tags | 5 + runtime/doc/term.txt | 38 ++- runtime/doc/terminal.txt | 28 +- runtime/doc/testing.txt | 24 +- runtime/doc/textprop.txt | 2 +- runtime/doc/todo.txt | 6 +- runtime/doc/version6.txt | 2 +- runtime/doc/vim9.txt | 15 +- runtime/filetype.vim | 2 +- runtime/ftplugin/scala.vim | 6 +- runtime/indent/scala.vim | 9 +- .../pack/dist/opt/termdebug/plugin/termdebug.vim | 6 +- runtime/plugin/netrwPlugin.vim | 28 +- runtime/syntax/cpp.vim | 21 +- runtime/syntax/gemtext.vim | 24 ++ runtime/syntax/scala.vim | 24 +- runtime/syntax/structurizr.vim | 76 ++++++ runtime/tutor/tutor | 10 +- runtime/tutor/tutor.utf-8 | 10 +- src/INSTALL | 1 + src/gvimtutor | 2 +- src/vimtutor | 26 +- vimtutor.bat | 2 +- 39 files changed, 649 insertions(+), 242 deletions(-) create mode 100644 runtime/syntax/gemtext.vim create mode 100644 runtime/syntax/structurizr.vim diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ef98000f89..482eb5c133 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,7 +38,7 @@ jobs: with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. + # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef518f8ccf..4918d5a8a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,7 +57,7 @@ If you find a problem with one of these files or have a suggestion for improvement, please first try to contact the maintainer directly. Look in the header of the file for the name and email address. -The maintainer will take care of issues and send updates to Bram for +The maintainer will take care of issues and send updates to Bram for distribution with Vim. If the maintainer does not respond, contact the vim-dev maillist. diff --git a/README.md b/README.md index 1cb89fc5e0..5c8403c3f9 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ This `README.md` file comes with the runtime archive. It includes the documentation, syntax files and other files that are used at runtime. To run Vim you must get either one of the binary archives or a source archive. Which one you need depends on the system you want to run it on and whether you -want or must compile it yourself. Check http://www.vim.org/download.php for +want or must compile it yourself. Check https://www.vim.org/download.php for an overview of currently available distributions. Some popular places to get the latest Vim: @@ -86,7 +86,7 @@ The Vim tutor is a one hour training course for beginners. Often it can be started as `vimtutor`. See `:help tutor` for more information. The best is to use `:help` in Vim. If you don't have an executable yet, read -[`runtime/doc/help.txt`](/runtime/doc/help.txt). +[`runtime/doc/help.txt`](/runtime/doc/help.txt). It contains pointers to the other documentation files. The User Manual reads like a book and is recommended to learn to use Vim. See `:help user-manual`. @@ -117,7 +117,7 @@ in Uganda. See [`runtime/doc/uganda.txt`](runtime/doc/uganda.txt). But at the same time donations increase Bram's motivation to keep working on Vim! For the most recent information about sponsoring look on the Vim web site: - http://www.vim.org/sponsor/ + https://www.vim.org/sponsor/ ## Contributing ## @@ -129,15 +129,15 @@ If you would like to help making Vim better, see the ## Information ## The latest news about Vim can be found on the Vim home page: - http://www.vim.org/ + https://www.vim.org/ If you have problems, have a look at the Vim documentation or tips: - http://www.vim.org/docs.php - http://vim.wikia.com/wiki/Vim_Tips_Wiki + https://www.vim.org/docs.php + https://vim.fandom.com/wiki/Vim_Tips_Wiki If you still have problems or any other questions, use one of the mailing lists to discuss them with Vim users and developers: - http://www.vim.org/maillist.php + https://www.vim.org/maillist.php If nothing else works, report bugs directly: Bram Moolenaar diff --git a/README.txt b/README.txt index ead022b42b..54f207c0d8 100644 --- a/README.txt +++ b/README.txt @@ -33,7 +33,7 @@ This README.txt file comes with the runtime archive. It includes the documentation, syntax files and other files that are used at runtime. To run Vim you must get either one of the binary archives or a source archive. Which one you need depends on the system you want to run it on and whether you -want or must compile it yourself. Check "http://www.vim.org/download.php" for +want or must compile it yourself. Check "https://www.vim.org/download.php" for an overview of currently available distributions. Some popular places to get the latest Vim: @@ -101,7 +101,7 @@ increase Bram's motivation to keep working on Vim! For the most recent information about sponsoring look on the Vim web site: - http://www.vim.org/sponsor/ + https://www.vim.org/sponsor/ CONTRIBUTING @@ -112,15 +112,15 @@ If you would like to help making Vim better, see the CONTRIBUTING.md file. INFORMATION The latest news about Vim can be found on the Vim home page: - http://www.vim.org/ + https://www.vim.org/ If you have problems, have a look at the Vim documentation or tips: - http://www.vim.org/docs.php - http://vim.wikia.com/wiki/Vim_Tips_Wiki + https://www.vim.org/docs.php + https://vim.fandom.com/wiki/Vim_Tips_Wiki If you still have problems or any other questions, use one of the mailing lists to discuss them with Vim users and developers: - http://www.vim.org/maillist.php + https://www.vim.org/maillist.php If nothing else works, report bugs directly: Bram Moolenaar diff --git a/README_VIM9.md b/README_VIM9.md index e4d2914f4d..b3ca49f091 100644 --- a/README_VIM9.md +++ b/README_VIM9.md @@ -337,7 +337,7 @@ let start = reltime() echo Python() echo 'Python: ' .. reltimestr(reltime(start)) bwipe! - + new call setline(1, range(100000)) let start = reltime() diff --git a/nsis/lang/turkish.nsi b/nsis/lang/turkish.nsi index 43cdb5201c..4c966c5034 100644 --- a/nsis/lang/turkish.nsi +++ b/nsis/lang/turkish.nsi @@ -10,7 +10,7 @@ LangString ^SetupCaption ${LANG_TURKISH} \ "$(^Name) Setup" LangString ^UninstallCaption ${LANG_TURKISH} \ "$(^Name) Uninstall" - + LangString str_show_readme ${LANG_TURKISH} \ "Kurulum bittikten sonra README dosyasını aç" @@ -23,7 +23,7 @@ LangString str_type_minimal ${LANG_TURKISH} \ LangString str_type_full ${LANG_TURKISH} \ "Tam" - + ############################################################################## # Section Titles & Description {{{1 ############################################################################## @@ -62,12 +62,12 @@ LangString str_section_start_menu ${LANG_TURKISH} \ "Başlat Menüsü - Programlar klasöründe" LangString str_desc_start_menu ${LANG_TURKISH} \ "Vim kısayolunu Başlat Menüsüne ekler." - + LangString str_section_edit_with ${LANG_TURKISH} \ "Vim ile Aç" LangString str_desc_edit_with ${LANG_TURKISH} \ "Vim'i $\"Birlikte aç$\" sağ tık menüsüne ekler." - + LangString str_section_vim_rc ${LANG_TURKISH} \ "Bir yapılandırma dosyası oluştur" LangString str_desc_vim_rc ${LANG_TURKISH} \ @@ -93,7 +93,7 @@ LangString str_desc_plugin_vim ${LANG_TURKISH} \ LangString str_section_vis_vim ${LANG_TURKISH} \ "VisVim eklentisi" LangString str_desc_vis_vim ${LANG_TURKISH} \ - "Microsoft Visual Studio entegrasyonu için VisVim eklentisi" + "Microsoft Visual Studio entegrasyonu için VisVim eklentisi" LangString str_section_nls ${LANG_TURKISH} \ "Ek dil desteği" @@ -129,14 +129,14 @@ LangString str_unsection_rootdir ${LANG_TURKISH} \ "Vim kök dizinini kaldır" LangString str_desc_rm_rootdir ${LANG_TURKISH} \ "Vim kök dizinini kaldırır. Bu dizin Vim yapılandırma dosyalarını içerir!" - + LangString str_msg_install_fail ${LANG_TURKISH} \ "Yükleme başarısız oldu. Yeniden deneyin." LangString str_msg_rm_exe_fail ${LANG_TURKISH} \ "$0 içindeki bazı dosyalar silinemedi!$\r$\n\ Bu dosyaları el ile kaldırmalısınız." - + LangString str_msg_uninstalling ${LANG_TURKISH} \ "Eski sürüm kaldırılıyor..." diff --git a/pixmaps/gen-inline-pixbufs.sh b/pixmaps/gen-inline-pixbufs.sh index 8e11a233ca..616c547df2 100644 --- a/pixmaps/gen-inline-pixbufs.sh +++ b/pixmaps/gen-inline-pixbufs.sh @@ -3,11 +3,9 @@ prefix=stock_ list= -for file in "$@" -do - name=`echo "$file" | sed 's|-|_|g; s|^.*/||; s|\..*$||'` +for file in "$@"; do + name=$(echo "$file" | sed 's|-|_|g; s|^.*/||; s|\..*$||') list="$list $prefix$name $file" done gdk-pixbuf-csource --raw --static --build-list $list - diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index d095f6dd81..5ea8319cf0 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Sep 18, 2020 -" Version: 170 +" Date: Aug 16, 2021 +" Version: 171 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 @@ -43,7 +43,7 @@ if exists("s:needspatches") endfor endif -let g:loaded_netrw = "v170" +let g:loaded_netrw = "v171" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -93,7 +93,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) else let msg= level.a:msg endif - let s:popuperr_id = popup_beval(msg,{}) + let s:popuperr_id = popup_atcursor(msg,{}) let s:popuperr_text= "" elseif g:netrw_use_errorwindow " (default) netrw creates a one-line window to show error/warning @@ -322,6 +322,7 @@ call s:NetrwInit("g:netrw_banner" , 1) call s:NetrwInit("g:netrw_browse_split", 0) call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro nornu") call s:NetrwInit("g:netrw_chgwin" , -1) +call s:NetrwInit("g:netrw_clipboard" , 1) call s:NetrwInit("g:netrw_compress" , "gzip") call s:NetrwInit("g:netrw_ctags" , "ctags") if exists("g:netrw_cursorline") && !exists("g:netrw_cursor") @@ -331,6 +332,7 @@ endif call s:NetrwInit("g:netrw_cursor" , 2) let s:netrw_usercul = &cursorline let s:netrw_usercuc = &cursorcolumn +"call Decho("(netrw) COMBAK: cuc=".&l:cuc." cul=".&l:cul." initialization of s:netrw_cu[cl]") call s:NetrwInit("g:netrw_cygdrive","/cygdrive") " Default values - d-g ---------- {{{3 call s:NetrwInit("s:didstarstar",0) @@ -703,7 +705,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif " save registers - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) save @* and @+",'~'.expand("")) sil! let keepregstar = @* sil! let keepregplus = @+ @@ -931,7 +933,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) restore @* and @+",'~'.expand("")) if @* != keepregstar | sil! let @* = keepregstar | endif if @+ != keepregplus | sil! let @+ = keepregplus | endif @@ -957,7 +959,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) restore @* and @+",'~'.expand("")) if @* != keepregstar | sil! let @* = keepregstar | endif if @+ != keepregplus | sil! let @+ = keepregplus | endif @@ -1013,7 +1015,7 @@ fun! netrw#Explore(indx,dosplit,style,...) catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) restore @* and @+",'~'.expand("")) if @* != keepregstar | sil! let @* = keepregstar | endif if @+ != keepregplus | sil! let @+ = keepregplus | endif @@ -1050,7 +1052,7 @@ fun! netrw#Explore(indx,dosplit,style,...) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) restore @* and @+",'~'.expand("")) if @* != keepregstar | sil! let @* = keepregstar | endif if @+ != keepregplus | sil! let @+ = keepregplus | endif @@ -1099,7 +1101,7 @@ fun! netrw#Explore(indx,dosplit,style,...) if !exists("g:netrw_quiet") keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) endif - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) restore @* and @+",'~'.expand("")) if @* != keepregstar | sil! let @* = keepregstar | endif if @+ != keepregplus | sil! let @+ = keepregplus | endif @@ -1173,7 +1175,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " there's no danger of a late FocusGained event on initialization. " Consequently, set s:netrw_events to 2. let s:netrw_events= 2 - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(netrw#Explore) restore @* and @+",'~'.expand("")) if @* != keepregstar | sil! let @* = keepregstar | endif if @+ != keepregplus | sil! let @+ = keepregplus | endif @@ -1641,7 +1643,8 @@ endfun fun! s:NetrwOptionsSave(vt) " call Dfunc("s:NetrwOptionsSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("")) -" 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("")) +" 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." hid=".&hid,'~'.expand("")) +" call Decho("(s:NetrwOptionsSave) lines=".&lines) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 @@ -1667,6 +1670,9 @@ fun! s:NetrwOptionsSave(vt) let {a:vt}netrw_cinokeep = &l:cino let {a:vt}netrw_comkeep = &l:com let {a:vt}netrw_cpokeep = &l:cpo + let {a:vt}netrw_cuckeep = &l:cuc + let {a:vt}netrw_culkeep = &l:cul +" call Decho("(s:NetrwOptionsSave) COMBAK: cuc=".&l:cuc." cul=".&l:cul) let {a:vt}netrw_diffkeep = &l:diff let {a:vt}netrw_fenkeep = &l:fen if !exists("g:netrw_ffkeep") || g:netrw_ffkeep @@ -1674,9 +1680,11 @@ fun! s:NetrwOptionsSave(vt) endif let {a:vt}netrw_fokeep = &l:fo " formatoptions let {a:vt}netrw_gdkeep = &l:gd " gdefault + let {a:vt}netrw_gokeep = &l:go " guioptions let {a:vt}netrw_hidkeep = &l:hidden let {a:vt}netrw_imkeep = &l:im let {a:vt}netrw_iskkeep = &l:isk + let {a:vt}netrw_lines = &lines let {a:vt}netrw_lskeep = &l:ls let {a:vt}netrw_makeep = &l:ma let {a:vt}netrw_magickeep = &l:magic @@ -1702,12 +1710,13 @@ fun! s:NetrwOptionsSave(vt) let {a:vt}netrw_dirkeep = getcwd() " call Decho("saving to ".a:vt."netrw_dirkeep<".{a:vt}netrw_dirkeep.">",'~'.expand("")) endif - if has("clipboard") + if has("clipboard") && g:netrw_clipboard sil! let {a:vt}netrw_starkeep = @* sil! let {a:vt}netrw_pluskeep = @+ endif sil! let {a:vt}netrw_slashkeep= @/ +" call Decho("(s:NetrwOptionsSave) lines=".&lines) " 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("")) " call Dret("s:NetrwOptionsSave : tab#".tabpagenr()." win#".winnr()) endfun @@ -1732,12 +1741,17 @@ fun! s:NetrwOptionsSafe(islocal) endif call s:NetrwSetSafeSetting("&l:ci",0) call s:NetrwSetSafeSetting("&l:cin",0) - call s:NetrwSetSafeSetting("&l:bh","hide") + if g:netrw_fastbrowse > a:islocal + call s:NetrwSetSafeSetting("&l:bh","hide") + else + call s:NetrwSetSafeSetting("&l:bh","delete") + endif call s:NetrwSetSafeSetting("&l:cino","") call s:NetrwSetSafeSetting("&l:com","") if &cpo =~ 'a' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'a','','g')) | endif if &cpo =~ 'A' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'A','','g')) | endif setl fo=nroql2 + call s:NetrwSetSafeSetting("&go","begmr") call s:NetrwSetSafeSetting("&l:hid",0) call s:NetrwSetSafeSetting("&l:im",0) setl isk+=@ isk+=* isk+=/ @@ -1751,7 +1765,10 @@ fun! s:NetrwOptionsSafe(islocal) call s:NetrwSetSafeSetting("&l:tw",0) call s:NetrwSetSafeSetting("&l:wig","") setl cedit& - call s:NetrwCursor() + + " set up cuc and cul based on g:netrw_cursor and listing style + " COMBAK -- cuc cul related + call s:NetrwCursor(0) " allow the user to override safe options " call Decho("ft<".&ft."> ei=".&ei,'~'.expand("")) @@ -1769,11 +1786,14 @@ endfun " s:NetrwOptionsRestore: restore options (based on prior s:NetrwOptionsSave) {{{2 fun! s:NetrwOptionsRestore(vt) " call Dfunc("s:NetrwOptionsRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) +" call Decho("(s:NetrwOptionsRestore) lines=".&lines) " 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("")) if !exists("{a:vt}netrw_optionsave") " call Decho("case ".a:vt."netrw_optionsave : doesn't exist",'~'.expand("")) -" 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("")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) +" call Decho("..doing filetype detect anyway") + filetype detect +" 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("")) +" call Decho("..ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist") return endif @@ -1790,41 +1810,53 @@ fun! s:NetrwOptionsRestore(vt) endif endif endif +" call Decho("(s:NetrwOptionsRestore) #1 lines=".&lines) call s:NetrwRestoreSetting(a:vt."netrw_aikeep","&l:ai") call s:NetrwRestoreSetting(a:vt."netrw_awkeep","&l:aw") call s:NetrwRestoreSetting(a:vt."netrw_blkeep","&l:bl") call s:NetrwRestoreSetting(a:vt."netrw_btkeep","&l:bt") call s:NetrwRestoreSetting(a:vt."netrw_bombkeep","&l:bomb") +" call Decho("(s:NetrwOptionsRestore) #2 lines=".&lines) call s:NetrwRestoreSetting(a:vt."netrw_cedit","&cedit") call s:NetrwRestoreSetting(a:vt."netrw_cikeep","&l:ci") call s:NetrwRestoreSetting(a:vt."netrw_cinkeep","&l:cin") call s:NetrwRestoreSetting(a:vt."netrw_cinokeep","&l:cino") call s:NetrwRestoreSetting(a:vt."netrw_comkeep","&l:com") +" call Decho("(s:NetrwOptionsRestore) #3 lines=".&lines) call s:NetrwRestoreSetting(a:vt."netrw_cpokeep","&l:cpo") call s:NetrwRestoreSetting(a:vt."netrw_diffkeep","&l:diff") call s:NetrwRestoreSetting(a:vt."netrw_fenkeep","&l:fen") if exists("g:netrw_ffkeep") && g:netrw_ffkeep call s:NetrwRestoreSetting(a:vt."netrw_ffkeep")","&l:ff") endif - call s:NetrwRestoreSetting(a:vt."netrw_fokeep","&l:fo") - call s:NetrwRestoreSetting(a:vt."netrw_gdkeep","&l:gd") - call s:NetrwRestoreSetting(a:vt."netrw_hidkeep","&l:hidden") - call s:NetrwRestoreSetting(a:vt."netrw_imkeep","&l:im") - call s:NetrwRestoreSetting(a:vt."netrw_iskkeep","&l:isk") - call s:NetrwRestoreSetting(a:vt."netrw_lskeep","&l:ls") - call s:NetrwRestoreSetting(a:vt."netrw_makeep","&l:ma") +" call Decho("(s:NetrwOptionsRestore) #4 lines=".&lines) + call s:NetrwRestoreSetting(a:vt."netrw_fokeep" ,"&l:fo") + call s:NetrwRestoreSetting(a:vt."netrw_gdkeep" ,"&l:gd") + call s:NetrwRestoreSetting(a:vt."netrw_gokeep" ,"&l:go") + call s:NetrwRestoreSetting(a:vt."netrw_hidkeep" ,"&l:hidden") +" call Decho("(s:NetrwOptionsRestore) #5 lines=".&lines) + call s:NetrwRestoreSetting(a:vt."netrw_imkeep" ,"&l:im") + call s:NetrwRestoreSetting(a:vt."netrw_iskkeep" ,"&l:isk") +" call Decho("(s:NetrwOptionsRestore) #6 lines=".&lines) + call s:NetrwRestoreSetting(a:vt."netrw_lines" ,"&lines") +" call Decho("(s:NetrwOptionsRestore) #7 lines=".&lines) + call s:NetrwRestoreSetting(a:vt."netrw_lskeep" ,"&l:ls") + call s:NetrwRestoreSetting(a:vt."netrw_makeep" ,"&l:ma") call s:NetrwRestoreSetting(a:vt."netrw_magickeep","&l:magic") - call s:NetrwRestoreSetting(a:vt."netrw_modkeep","&l:mod") - call s:NetrwRestoreSetting(a:vt."netrw_nukeep","&l:nu") - call s:NetrwRestoreSetting(a:vt."netrw_rnukeep","&l:rnu") - call s:NetrwRestoreSetting(a:vt."netrw_repkeep","&l:report") - call s:NetrwRestoreSetting(a:vt."netrw_rokeep","&l:ro") - call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel") + call s:NetrwRestoreSetting(a:vt."netrw_modkeep" ,"&l:mod") + call s:NetrwRestoreSetting(a:vt."netrw_nukeep" ,"&l:nu") +" call Decho("(s:NetrwOptionsRestore) #8 lines=".&lines) + call s:NetrwRestoreSetting(a:vt."netrw_rnukeep" ,"&l:rnu") + call s:NetrwRestoreSetting(a:vt."netrw_repkeep" ,"&l:report") + call s:NetrwRestoreSetting(a:vt."netrw_rokeep" ,"&l:ro") + call s:NetrwRestoreSetting(a:vt."netrw_selkeep" ,"&l:sel") +" call Decho("(s:NetrwOptionsRestore) #9 lines=".&lines) call s:NetrwRestoreSetting(a:vt."netrw_spellkeep","&l:spell") - call s:NetrwRestoreSetting(a:vt."netrw_twkeep","&l:tw") - call s:NetrwRestoreSetting(a:vt."netrw_wigkeep","&l:wig") - call s:NetrwRestoreSetting(a:vt."netrw_wrapkeep","&l:wrap") + call s:NetrwRestoreSetting(a:vt."netrw_twkeep" ,"&l:tw") + call s:NetrwRestoreSetting(a:vt."netrw_wigkeep" ,"&l:wig") + call s:NetrwRestoreSetting(a:vt."netrw_wrapkeep" ,"&l:wrap") call s:NetrwRestoreSetting(a:vt."netrw_writekeep","&l:write") +" call Decho("(s:NetrwOptionsRestore) #10 lines=".&lines) call s:NetrwRestoreSetting("s:yykeep","@@") " former problem: start with liststyle=0; press : result, following line resets l:ts. " Fixed; in s:PerformListing, when w:netrw_liststyle is s:LONGLIST, will use a printf to pad filename with spaces @@ -1855,7 +1887,7 @@ fun! s:NetrwOptionsRestore(vt) unlet {a:vt}netrw_dirkeep endif endif - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("has clipboard",'~'.expand("")) call s:NetrwRestoreSetting(a:vt."netrw_starkeep","@*") call s:NetrwRestoreSetting(a:vt."netrw_pluskeep","@+") @@ -1871,9 +1903,11 @@ fun! s:NetrwOptionsRestore(vt) " were having their filetype detect-generated settings overwritten by " NetrwOptionRestore. if &ft != "netrw" -" call Decho("filetype detect (ft=".&ft.")",'~'.expand("")) +" call Decho("before: filetype detect (ft=".&ft.")",'~'.expand("")) filetype detect +" call Decho("after : filetype detect (ft=".&ft.")",'~'.expand("")) endif +" call Decho("(s:NetrwOptionsRestore) lines=".&lines) " 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("")) " call Dret("s:NetrwOptionsRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun @@ -1923,7 +1957,7 @@ fun! s:NetrwRestoreSetting(keepvar,setting) " typically called from s:NetrwOptionsRestore " call s:NetrwRestoreSettings(keep-option-variable-name,'associated-option') " ex. call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel") - " Restores option (if different) from a keepvar + " Restores option (but only if different) from a:keepvar if exists(a:keepvar) exe "let keepvarval= ".a:keepvar exe "let setting= ".a:setting @@ -2845,14 +2879,16 @@ fun! netrw#SetTreetop(iscmd,...) " call Decho("inittreetop<".(exists("inittreetop")? inittreetop : "n/a").">") if (a:iscmd == 0 || a:1 == "") && exists("inittreetop") - let treedir= s:NetrwTreePath(inittreetop) + let treedir = s:NetrwTreePath(inittreetop) " call Decho("treedir<".treedir.">",'~'.expand("")) else if isdirectory(s:NetrwFile(a:1)) " call Decho("a:1<".a:1."> is a directory",'~'.expand("")) - let treedir= a:1 + let treedir = a:1 + let s:netrw_treetop = treedir elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') - let treedir= b:netrw_curdir."/".a:1 + let treedir = b:netrw_curdir."/".a:1 + let s:netrw_treetop = treedir " call Decho("a:1<".a:1."> is NOT a directory, using treedir<".treedir.">",'~'.expand("")) else " normally the cursor is left in the message window. @@ -2860,7 +2896,8 @@ fun! netrw#SetTreetop(iscmd,...) let netrwbuf= bufnr("%") call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95) exe bufwinnr(netrwbuf)."wincmd w" - let treedir= "." + let treedir = "." + let s:netrw_treetop = getcwd() endif endif " call Decho("treedir<".treedir.">",'~'.expand("")) @@ -4115,6 +4152,7 @@ fun! s:NetrwFileInfo(islocal,fname) elseif g:netrw_sizestyle =~# 'h' let lsopt= "-lsadh --si" endif +" call Decho("(s:NetrwFileInfo) lsopt<".lsopt.">") if (has("unix") || has("macunix")) && executable("/bin/ls") if getline(".") == "../" @@ -4176,9 +4214,10 @@ endfun " s:NetrwGetBuffer: [get a new|find an old netrw] buffer for a netrw listing {{{2 " returns 0=cleared buffer " 1=re-used buffer (buffer not cleared) +" Nov 09, 2020: tst952 shows that when user does :set hidden that NetrwGetBuffer will come up with a [No Name] buffer (hid fix) fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) -" 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,'~'.expand("")) +" 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." hid=".&hid,'~'.expand("")) " call Decho("netrwbuf dictionary=".(exists("s:netrwbuf")? string(s:netrwbuf) : 'n/a'),'~'.expand("")) " call Dredir("ls!","s:NetrwGetBuffer") let dirname= a:dirname @@ -4228,17 +4267,26 @@ fun! s:NetrwGetBuffer(islocal,dirname) endif " call Decho(" bufnum#".bufnum,'~'.expand("")) - " highjack the current buffer if - " it has the desired name - " it is empty -" call Decho("deciding if I can highjack the current buffer#".bufnr("%"),'~'.expand("")) -" call Decho("..dirname<".dirname.">",'~'.expand("")) -" call Decho("..bufname<".bufname("%").">",'~'.expand("")) -" call Decho("..getline($)<".getline("$").">",'~'.expand("")) - if dirname == bufname("%") && line("$") == 1 && getline("%") == "" + " highjack the current buffer + " IF the buffer already has the desired name + " AND it is empty + let curbuf = bufname("%") + if curbuf == '.' + let curbuf = getcwd() + endif +" call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)") +" call Decho("deciding if netrw may highjack the current buffer#".bufnr("%")."<".curbuf.">",'~'.expand("")) +" call Decho("..dirname<".dirname."> IF dirname == bufname",'~'.expand("")) +" call Decho("..curbuf<".curbuf.">",'~'.expand("")) +" call Decho("..line($)=".line("$")." AND this is 1",'~'.expand("")) +" call Decho("..getline(%)<".getline("%")."> AND this line is empty",'~'.expand("")) + if dirname == curbuf && line("$") == 1 && getline("%") == "" " call Dret("s:NetrwGetBuffer 0 : highjacking buffer#".bufnr("%")) return 0 + else " DEBUG +" call Decho("..did NOT highjack buffer",'~'.expand("")) endif + " Aug 14, 2021: was thinking about looking for a [No Name] buffer here and using it, but that might cause problems " get enew buffer and name it -or- re-use buffer {{{3 if bufnum < 0 " get enew buffer and name it @@ -4563,7 +4611,7 @@ fun! s:NetrwListStyle(islocal) " refresh the listing " call Decho("refresh the listing",'~'.expand("")) NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call s:NetrwCursor() + NetrwKeepj call s:NetrwCursor(0) " repoint t:netrw_lexbufnr if appropriate if exists("repointlexbufnr") @@ -4769,7 +4817,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif " call Decho("b:netrw_curdir<".b:netrw_curdir.">") - " NetrwBrowseChgDir: save options and initialize {{{3 + " NetrwBrowseChgDir; save options and initialize {{{3 " call Decho("saving options",'~'.expand("")) call s:SavePosn(s:netrw_posn) NetrwKeepj call s:NetrwOptionsSave("s:") @@ -4837,6 +4885,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' " call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("")) " call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("")) +" let newdir = s:NetrwTreePath(s:netrw_treetop) +" call Decho("edit-a-file: COMBAK why doesn't this recognize file1's directory???") let dirname= s:NetrwTreeDir(a:islocal) "COMBAK : not working for a symlink -- but what about a regular file? a directory? " call Decho("COMBAK : not working for a symlink -- but what about a regular file? a directory?") @@ -4950,7 +5000,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) exe "NetrwKeepj e ".fnameescape(dirname) endif " call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("")) - call s:NetrwCursor() + " COMBAK -- cuc cul related + call s:NetrwCursor(1) if &hidden || &bufhidden == "hide" " file came from vim's hidden storage. Don't "restore" options with it. let dorestore= 0 @@ -4971,8 +5022,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) elseif type(g:Netrw_funcref) == 3 " call Decho("edit-a-file: handling a list of g:Netrw_funcrefs",'~'.expand("")) for Fncref in g:Netrw_funcref - if type(FncRef) == 2 - NetrwKeepj call FncRef() + if type(Fncref) == 2 + NetrwKeepj call Fncref() endif endfor endif @@ -5264,6 +5315,12 @@ fun! netrw#BrowseX(fname,remote) endif " call Decho("not a local file nor a webpage request",'~'.expand("")) + if exists("g:netrw_browsex_viewer") && exists("g:netrw_browsex_support_remote") && !g:netrw_browsex_support_remote + let remote = a:remote + else + let remote = 0 + endif + let ykeep = @@ let screenposn = winsaveview() " call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("")) @@ -5308,9 +5365,9 @@ fun! netrw#BrowseX(fname,remote) endif " call Decho("exten<".exten.">",'~'.expand("")) - if a:remote == 1 + if remote == 1 " create a local copy -" call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">",'~'.expand("")) +" call Decho("remote: remote=".remote.": create a local copy of <".a:fname.">",'~'.expand("")) setl bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile @@ -5332,7 +5389,7 @@ fun! netrw#BrowseX(fname,remote) let fname= s:netrw_tmpfile endif else -" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("")) +" call Decho("local: remote=".remote.": handling local copy of <".a:fname.">",'~'.expand("")) let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" @@ -5426,8 +5483,8 @@ fun! netrw#BrowseX(fname,remote) 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 Decho("fname<".fname.">") +" call Decho("a:fname<".a:fname.">") call s:NetrwExe("sil! !gvim ".fname.' -c "keepj keepalt file '.fnameescape(a:fname).'"') else @@ -5475,12 +5532,12 @@ fun! netrw#BrowseX(fname,remote) " return to prior buffer (directory listing) " Feb 12, 2008: had to de-activiate removal of " temporary file because it wasn't getting seen. -" if a:remote == 1 && fname != a:fname +" if remote == 1 && fname != a:fname "" call Decho("deleting temporary file<".fname.">",'~'.expand("")) " call s:NetrwDelete(fname) " endif - if a:remote == 1 + if remote == 1 setl bh=delete bt=nofile if g:netrw_use_noswf setl noswf @@ -5539,7 +5596,7 @@ fun! s:NetrwBufRename(newname) let b:junk= 1 " call Decho("rename buffer: sil! keepj keepalt file ".fnameescape(a:newname),'~'.expand("")) exe 'sil! keepj keepalt file '.fnameescape(a:newname) -" call Dredir("ls!","s:NetrwBufRename (before bwipe)") +" call Dredir("ls!","s:NetrwBufRename (before bwipe)~".expand("")) let oldbufnr= bufnr(oldbufname) " call Decho("oldbufname<".oldbufname."> oldbufnr#".oldbufnr,'~'.expand("")) " call Decho("bufnr(%)=".bufnr("%"),'~'.expand("")) @@ -5548,6 +5605,9 @@ fun! s:NetrwBufRename(newname) exe "bwipe! ".oldbufnr " else " Decho " call Decho("did *not* bwipe buf#".oldbufnr,'~'.expand("")) +" call Decho("..reason: if oldbufname<".oldbufname."> is empty",'~'.expand(""))" +" call Decho("..reason: if oldbufnr#".oldbufnr." is -1",'~'.expand(""))" +" call Decho("..reason: if oldbufnr#".oldbufnr." != bufnr(%)#".bufnr("%"),'~'.expand(""))" endif " call Dredir("ls!","s:NetrwBufRename (after rename)") " else " Decho @@ -6536,7 +6596,7 @@ fun! s:NetrwMaps(islocal) if !hasmapto('NetrwRefresh') nmap NetrwRefresh endif - nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './')) + nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,(exists("w:netrw_liststyle") && exists("w:netrw_treetop") && w:netrw_liststyle == 3)? w:netrw_treetop : './')) if s:didstarstar || !mapcheck("","n") nnoremap :Nexplore endif @@ -8164,6 +8224,23 @@ fun! s:NetrwOpenFile(islocal) call inputsave() let fname= input("Enter filename: ") call inputrestore() +" call Decho("(s:NetrwOpenFile) fname<".fname.">",'~'.expand("")) + + " determine if Lexplore is in use + if exists("t:netrw_lexbufnr") + " check if t:netrw_lexbufnr refers to a netrw window +" call Decho("(s:netrwOpenFile) ..t:netrw_lexbufnr=".t:netrw_lexbufnr,'~'.expand("")) + let lexwinnr = bufwinnr(t:netrw_lexbufnr) + if lexwinnr != -1 && exists("g:netrw_chgwin") && g:netrw_chgwin != -1 +" call Decho("(s:netrwOpenFile) ..Lexplore in use",'~'.expand("")) + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" + exe "NetrwKeepj e ".fnameescape(fname) + let @@= ykeep +" call Dret("s:NetrwOpenFile : creating a file with Lexplore mode") + endif + endif + + " Does the filename contain a path? if fname !~ '[/\\]' if exists("b:netrw_curdir") if exists("g:netrw_quiet") @@ -8502,6 +8579,7 @@ fun! s:NetrwPrevWinOpen(islocal) let lastwinnr = winnr("$") let curword = s:NetrwGetWord() let choice = 0 + let s:prevwinopen= 1 " lets s:NetrwTreeDir() know that NetrwPrevWinOpen called it let s:treedir = s:NetrwTreeDir(a:islocal) let curdir = s:treedir " call Decho("winnr($)#".lastwinnr." curword<".curword.">",'~'.expand("")) @@ -8829,7 +8907,7 @@ fun! s:NetrwPreview(path) range " 0 : 1: top -- preview window is horizontally split off and on the top " 0 : 0: bot -- preview window is horizontally split off and on the bottom " - " Note that the file being previewed is already known to not be a directory, hence we can avoid doing a LocalBrowse() check via + " Note that the file being previewed is already known to not be a directory, hence we can avoid doing a LocalBrowseCheck() check via " the BufEnter event set up in netrwPlugin.vim " call Decho("exe ".(g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path),'~'.expand("")) let eikeep = &ei @@ -9264,14 +9342,20 @@ fun! s:NetrwTreeDir(islocal) " call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("")) " call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) " call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("")) +" call Decho("current line<".getline(".").">") - if exists("s:treedir") + if exists("s:treedir") && exists("s:prevwinopen") " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early +" call Decho('s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early') let treedir= s:treedir unlet s:treedir -" call Dret("s:NetrwTreeDir ".treedir) + unlet s:prevwinopen +" call Dret("s:NetrwTreeDir ".treedir.": early return since s:treedir existed previously") return treedir endif + if exists("s:prevwinopen") + unlet s:prevwinopen + endif if !exists("b:netrw_curdir") || b:netrw_curdir == "" let b:netrw_curdir= getcwd() @@ -9478,20 +9562,29 @@ endfun " Called by s:PerformListing() fun! s:NetrwTreeListing(dirname) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Dfunc("NetrwTreeListing() bufname<".expand("%").">") +" call Dfunc("s:NetrwTreeListing() bufname<".expand("%").">") " call Decho("curdir<".a:dirname.">",'~'.expand("")) " call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("")) " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) " update the treetop -" call Decho("update the treetop",'~'.expand("")) if !exists("w:netrw_treetop") +" call Decho("update the treetop (w:netrw_treetop doesn't exist yet)",'~'.expand("")) let w:netrw_treetop= a:dirname + let s:netrw_treetop= w:netrw_treetop " call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)",'~'.expand("")) elseif (w:netrw_treetop =~ ('^'.a:dirname) && s:Strlen(a:dirname) < s:Strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop) +" call Decho("update the treetop (override w:netrw_treetop with a:dirname<".a:dirname.">)",'~'.expand("")) let w:netrw_treetop= a:dirname + let s:netrw_treetop= w:netrw_treetop " call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)",'~'.expand("")) endif + if exists("w:netrw_treetop") + let s:netrw_treetop= w:netrw_treetop + else + let w:netrw_treetop= getcwd() + let s:netrw_treetop= w:netrw_treetop + endif if !exists("w:netrw_treedict") " insure that we have a treedict, albeit empty @@ -9529,7 +9622,7 @@ fun! s:NetrwTreeListing(dirname) exe "setl ".g:netrw_bufsettings -" call Dret("NetrwTreeListing : bufname<".expand("%").">") +" call Dret("s:NetrwTreeListing : bufname<".expand("%").">") return endif endfun @@ -9637,7 +9730,7 @@ fun! s:NetrwWideListing() let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("")) - if has("clipboard") + if has("clipboard") && g:netrw_clipboard " call Decho("(s:NetrwWideListing) save @* and @+",'~'.expand("")) sil! let keepregstar = @* sil! let keepregplus = @+ @@ -10683,7 +10776,7 @@ endfun " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) - " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(), + " This function is called by netrwPlugin.vim's s:LocalBrowseCheck(), s:NetrwRexplore(), " and by when atop a listed file/directory (via a buffer-local map) " " unfortunate interaction -- split window debugging can't be used here, must use @@ -10834,7 +10927,7 @@ endfun " Hiding a buffer means that it will be re-used when examined, hence "fast". " (re-using a buffer may not be as accurate) " -" s:netrw_events : doesn't exist, s:LocalFastBrowser() will install autocmds whena med or fast browsing +" s:netrw_events : doesn't exist, s:LocalFastBrowser() will install autocmds with medium-speed or fast browsing " =1: autocmds installed, but ignore next FocusGained event to avoid initial double-refresh of listing. " BufEnter may be first event, then a FocusGained event. Ignore the first FocusGained event. " If :Explore used: it sets s:netrw_events to 2, so no FocusGained events are ignored. @@ -10996,13 +11089,14 @@ fun! s:LocalListing() let sz= s:NetrwHumanReadable(sz) endif let longfile= printf("%-".(g:netrw_maxfilenamelen+1)."s",pfile) - let pfile = longfile.fsz." ".strftime(g:netrw_timefmt,getftime(filename)) + let pfile = longfile.sz." ".strftime(g:netrw_timefmt,getftime(filename)) " call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("")) endif 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("implementing g:netrw_sort_by=".g:netrw_sort_by." (time)") " call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("")) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t @@ -11012,6 +11106,7 @@ fun! s:LocalListing() elseif g:netrw_sort_by =~ "^s" " sort by size (handles file sizes up to 1 quintillion bytes, US) +" call Decho("implementing g:netrw_sort_by=".g:netrw_sort_by." (size)") " call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("")) let sz = getfsize(filename) if g:netrw_sizestyle =~# "[hH]" @@ -11024,6 +11119,7 @@ fun! s:LocalListing() else " sort by name +" call Decho("implementing g:netrw_sort_by=".g:netrw_sort_by." (name)") " call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("")) sil! NetrwKeepj put=pfile endif @@ -11746,19 +11842,32 @@ endfun " --------------------------------------------------------------------- " s:NetrwCursor: responsible for setting cursorline/cursorcolumn based upon g:netrw_cursor {{{2 -fun! s:NetrwCursor() +fun! s:NetrwCursor(editfile) if !exists("w:netrw_liststyle") let w:netrw_liststyle= g:netrw_liststyle endif " call Dfunc("s:NetrwCursor() ft<".&ft."> liststyle=".w:netrw_liststyle." g:netrw_cursor=".g:netrw_cursor." s:netrw_usercuc=".s:netrw_usercuc." s:netrw_usercul=".s:netrw_usercul) +" call Decho("(s:NetrwCursor) COMBAK: cuc=".&l:cuc." cul=".&l:cul) + if &ft != "netrw" " if the current window isn't a netrw directory listing window, then use user cursorline/column " settings. Affects when netrw is used to read/write a file using scp/ftp/etc. " call Decho("case ft!=netrw: use user cul,cuc",'~'.expand("")) - let &l:cursorline = s:netrw_usercul - let &l:cursorcolumn = s:netrw_usercuc + elseif g:netrw_cursor == 8 + if w:netrw_liststyle == s:WIDELIST + setl cursorline + setl cursorcolumn + else + setl cursorline + endif + elseif g:netrw_cursor == 7 + setl cursorline + elseif g:netrw_cursor == 6 + if w:netrw_liststyle == s:WIDELIST + setl cursorline + endif elseif g:netrw_cursor == 4 " all styles: cursorline, cursorcolumn " call Decho("case g:netrw_cursor==4: setl cul cuc",'~'.expand("")) @@ -11775,26 +11884,22 @@ fun! s:NetrwCursor() else " call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)",'~'.expand("")) setl cursorline - let &l:cursorcolumn = s:netrw_usercuc endif elseif g:netrw_cursor == 2 " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, user's cursorcolumn " call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)",'~'.expand("")) - let &l:cursorcolumn = s:netrw_usercuc setl cursorline elseif g:netrw_cursor == 1 " thin-long-tree: user's cursorline, user's cursorcolumn " wide : cursorline, user's cursorcolumn - let &l:cursorcolumn = s:netrw_usercuc if w:netrw_liststyle == s:WIDELIST " call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)",'~'.expand("")) setl cursorline else " call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)",'~'.expand("")) - let &l:cursorline = s:netrw_usercul endif else @@ -11804,6 +11909,7 @@ fun! s:NetrwCursor() let &l:cursorcolumn = s:netrw_usercuc endif +" call Decho("(s:NetrwCursor) COMBAK: cuc=".&l:cuc." cul=".&l:cul) " call Dret("s:NetrwCursor : l:cursorline=".&l:cursorline." l:cursorcolumn=".&l:cursorcolumn) endfun @@ -11817,6 +11923,7 @@ fun! s:RestoreCursorline() if exists("s:netrw_usercuc") let &l:cursorcolumn = s:netrw_usercuc endif +" call Decho("(s:RestoreCursorline) COMBAK: cuc=".&l:cuc." cul=".&l:cul) " call Dret("s:RestoreCursorline : restored cul=".&l:cursorline." cuc=".&l:cursorcolumn) endfun @@ -11851,12 +11958,38 @@ fun! s:NetrwDelete(path) return result endfun +" --------------------------------------------------------------------- +" s:NetrwBufRemover: removes a buffer that: {{{2s +" has buffer-id > 1 +" is unlisted +" is unnamed +" does not appear in any window +fun! s:NetrwBufRemover(bufid) +" call Dfunc("s:NetrwBufRemover(".a:bufid.")") +" call Decho("buf#".a:bufid." ".((a:bufid > 1)? ">" : "≯")." must be >1 for removal","~".expand("")) +" call Decho("buf#".a:bufid." is ".(buflisted(a:bufid)? "listed" : "unlisted"),"~".expand("")) +" call Decho("buf#".a:bufid." has name <".bufname(a:bufid).">","~".expand("")) +" call Decho("buf#".a:bufid." has winid#".bufwinid(a:bufid),"~".expand("")) + + if a:bufid > 1 && !buflisted(a:bufid) && bufname(a:bufid) == "" && bufwinid(a:bufid) == -1 +" call Decho("(s:NetrwBufRemover) removing buffer#".a:bufid,"~".expand("")) + exe "bd! ".a:bufid + endif + +" call Dret("s:NetrwBufRemover") +endfun + " --------------------------------------------------------------------- " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 fun! s:NetrwEnew(...) " call Dfunc("s:NetrwEnew() a:0=".a:0." win#".winnr()." winnr($)=".winnr("$")." bufnr($)=".bufnr("$")." expand(%)<".expand("%").">") " call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) + " Clean out the last buffer: + " Check if the last buffer has # > 1, is unlisted, is unnamed, and does not appear in a window + " If so, delete it. + call s:NetrwBufRemover(bufnr("$")) + " grab a function-local-variable copy of buffer variables " call Decho("make function-local copy of netrw variables",'~'.expand("")) if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index bed5cfc455..61c0ef739e 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,7 +1,7 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Nov 09, 2016 +" Date: Aug 12, 2021 " Maintainer: Charles E Campbell -" Version: 16 +" Version: 17 ASTRO-ONLY " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright @@ -19,7 +19,7 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v16" +let g:loaded_netrwSettings = "v17" if v:version < 700 echohl WarningMsg echo "***warning*** this version of netrwSettings needs vim 7.0" @@ -31,7 +31,7 @@ endif " NetrwSettings: {{{1 fun! netrwSettings#NetrwSettings() " this call is here largely just to insure that netrw has been loaded - call netrw#SavePosn() + call netrw#WinPath("") if !exists("g:loaded_netrw") echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None return diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 93ff4169f9..e1e9a1b472 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2021 Aug 13 +*eval.txt* For Vim version 8.2. Last change: 2021 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -8529,6 +8529,21 @@ pyxeval({expr}) *pyxeval()* < {only available when compiled with the |+python| or the |+python3| feature} +rand([{expr}]) *rand()* *random* + Return a pseudo-random Number generated with an xoshiro128** + algorithm using seed {expr}. The returned number is 32 bits, + also on 64 bits systems, for consistency. + {expr} can be initialized by |srand()| and will be updated by + rand(). If {expr} is omitted, an internal seed value is used + and updated. + + Examples: > + :echo rand() + :let seed = srand() + :echo rand(seed) + :echo rand(seed) % 16 " random number 0 - 15 +< + *E726* *E727* range({expr} [, {max} [, {stride}]]) *range()* Returns a |List| with Numbers: @@ -8552,21 +8567,6 @@ range({expr} [, {max} [, {stride}]]) *range()* GetExpr()->range() < -rand([{expr}]) *rand()* *random* - Return a pseudo-random Number generated with an xoshiro128** - algorithm using seed {expr}. The returned number is 32 bits, - also on 64 bits systems, for consistency. - {expr} can be initialized by |srand()| and will be updated by - rand(). If {expr} is omitted, an internal seed value is used - and updated. - - Examples: > - :echo rand() - :let seed = srand() - :echo rand(seed) - :echo rand(seed) % 16 " random number 0 - 15 -< - readblob({fname}) *readblob()* Read file {fname} in binary mode and return a |Blob|. When the file can't be opened an error message is given and diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 6fdfb854fc..683afe45de 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.2. Last change: 2021 Jun 19 +*index.txt* For Vim version 8.2. Last change: 2021 Aug 27 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 7f836e87ac..1caf08437f 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.2. Last change: 2021 Jul 31 +*insert.txt* For Vim version 8.2. Last change: 2021 Aug 27 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a181ecb0d8..26b6683fe5 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2021 Jul 22 +*options.txt* For Vim version 8.2. Last change: 2021 Aug 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -195,11 +195,18 @@ include the "|" in the option value, use "\|" instead. This example sets the This sets the 'titlestring' option to "hi" and 'iconstring' to "there": > :set titlestring=hi|set iconstring=there -Similarly, the double quote character starts a comment. To include the '"' in -the option value, use '\"' instead. This example sets the 'titlestring' -option to 'hi "there"': > +Similarly, in legacy script the double quote character starts a comment. To +include the '"' in the option value, use '\"' instead. This example sets the +'titlestring' option to 'hi "there"': > :set titlestring=hi\ \"there\" +In |Vim9| script it's simpler, comments start with a '#' character, and only +when preceded by white space. A backslash is needed less often: > + vim9script + set titlestring=hi\ "there" + set titlestring=hi#there# + set titlestring=hi\ \#there# + For Win32 backslashes in file names are mostly not removed. More precise: For options that expect a file name (those where environment variables are expanded) a backslash before a normal file name character is not removed. But diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 421b12f60d..c90e0bcccf 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 8.2. Last change: 2020 Sep 19 +*pi_netrw.txt* For Vim version 8.2. Last change: 2021 Aug 16 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -54,6 +54,7 @@ Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright* Browsing With A Horizontally Split Window...........|netrw-o| Browsing With A New Tab.............................|netrw-t| Browsing With A Vertically Split Window.............|netrw-v| + Change File Permission..............................|netrw-gp| Change Listing Style.(thin wide long tree)..........|netrw-i| Changing To A Bookmarked Directory..................|netrw-gb| Changing To A Predecessor Directory.................|netrw-u| @@ -1095,6 +1096,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 gf Force treatment as file |netrw-gf| gh Quick hide/unhide of dot-files |netrw-gh| gn Make top of tree the directory below the cursor |netrw-gn| + gp Change local-only file permissions |netrw-gp| i Cycle between thin, long, wide, and tree listings |netrw-i| I Toggle the displaying of the banner |netrw-I| mb Bookmark current directory |netrw-mb| @@ -1510,6 +1512,8 @@ Netrw determines which special handler by the following method: If g:netrw_browsex_viewer == '-', then netrwFileHandlers#Invoke() will be used instead (see |netrw_filehandler|). + If the viewer you wish to use does not support handling of a remote URL + directory, set |g:netrw_browsex_support_remote| to 0. * for Windows 32 or 64, the URL and FileProtocolHandler dlls are used. * for Gnome (with gnome-open): gnome-open is used. * for KDE (with kfmclient) : kfmclient is used @@ -2104,8 +2108,8 @@ the two directories the same, use the "cd" map (type cd). That map will set Vim's notion of the current directory to netrw's current browsing directory. -|netrw-cd|: This map's name was changed from "c" to cd (see |netrw-cd|). - This change was done to allow for |netrw-cb| and |netrw-cB| maps. +|netrw-cd| : This map's name was changed from "c" to cd (see |netrw-cd|). + This change was done to allow for |netrw-cb| and |netrw-cB| maps. Associated setting variable: |g:netrw_keepdir| @@ -2607,13 +2611,29 @@ your browsing preferences. (see also: |netrw-settings|) a script/function to handle the given extension. (see |netrw_filehandler|). + *g:netrw_browsex_support_remote* + specify if the specified viewer supports a + remote URL. (see |netrw-handler|). + *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME" Windows: "cacls FILENAME /e /p PERM" Used to change access permission for a file. + *g:netrw_clipboard* =1 + By default, netrw will attempt to insure that + the clipboard's values will remain unchanged. + However, some users report that they have + speed problems with this; consequently, this + option, when set to zero, lets such users + prevent netrw from saving and restoring the + clipboard (the latter is done only as needed). + That means that if the clipboard is changed + (inadvertently) by normal netrw operation that + it will not be restored to its prior state. + *g:netrw_compress* ="gzip" - Will compress marked files with this - command + Will compress marked files with this + command *g:Netrw_corehandler* Allows one to specify something additional to do when handling files via netrw's @@ -2639,12 +2659,23 @@ your browsing preferences. (see also: |netrw-settings|) =2 cul u-cuc cul u-cuc =3 cul u-cuc cul cuc =4 cul cuc cul cuc + =5 U-cul U-cuc U-cul U-cuc + =6 U-cul U-cuc cul U-cuc + =7 cul U-cuc cul U-cuc + =8 cul U-cuc cul cuc Where - u-cul : user's |'cursorline'| setting used - u-cuc : user's |'cursorcolumn'| setting used - cul : |'cursorline'| locally set - cuc : |'cursorcolumn'| locally set + u-cul : user's |'cursorline'| initial setting used + u-cuc : user's |'cursorcolumn'| initial setting used + U-cul : user's |'cursorline'| current setting used + U-cuc : user's |'cursorcolumn'| current setting used + cul : |'cursorline'| will be locally set + cuc : |'cursorcolumn'| will be locally set + + The "initial setting" means the values of + the |'cuc'| and |'cul'| settings in effect when + netrw last saw |g:netrw_cursor| >= 5 or when + netrw was initially run. *g:netrw_decompress* = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , @@ -2654,7 +2685,7 @@ your browsing preferences. (see also: |netrw-settings|) decompression programs. *g:netrw_dirhistmax* =10: controls maximum quantity of past - history. May be zero to supppress + history. May be zero to suppress history. (related: |netrw-qb| |netrw-u| |netrw-U|) @@ -3142,6 +3173,9 @@ To open a new file in netrw's current directory, press "%". This map will query the user for a new filename; an empty file by that name will be placed in the netrw's current directory (ie. b:netrw_curdir). +If Lexplore (|netrw-:Lexplore|) is in use, the new file will be generated +in the |g:netrw_chgwin| window. + Related topics: |netrw-d| @@ -3809,7 +3843,7 @@ netrw: Decho.vim is provided as a "vimball"; see |vimball-intro|. You should edit the Decho.vba.gz file and source it in: > - vim Decho.vba.gz + vim Decho.vba.gz :so % :q < @@ -3877,6 +3911,32 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe() + to allow |'bh'| to be set to delete when + rather than hide when g:netrw_fastbrowse + was zero. + * Installed |g:netrw_clipboard| setting + * Installed option bypass for |'guioptions'| + a/A settings + * Changed popup_beval() to |popup_atcursor|() + in netrw#ErrorMsg (lacygoill). Apparently + popup_beval doesn't reliably close the + popup when the mouse is moved. + * VimEnter() now using win_execute to examine + buffers for an attempt to open a directory. + Avoids issues with popups/terminal from + command line. (lacygoill) + Jun 28, 2021 * (zeertzjq) provided a patch for use of + xmap,xno instead of vmap,vno in + netrwPlugin.vim.