1
0
forked from aniani/vim

Update runtime files.

This commit is contained in:
Bram Moolenaar
2020-09-19 18:50:13 +02:00
parent a05e524f3a
commit 1d59aa1fdf
19 changed files with 557 additions and 201 deletions

100
.github/CODEOWNERS vendored
View File

@@ -3,22 +3,25 @@
# You can use github users with @user or email addresses # You can use github users with @user or email addresses
# These owners will be the default owners for everything in the repo. # These owners will be the default owners for everything in the repo.
* @brammool #* @brammool
# Order is important. The last matching pattern has the most precedence. # Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners # So if a pull request only touches javascript files, only these owners
# will be requested to review. # will be requested to review.
src/libvterm/* @leonerd src/iscygpty.* @k-takata
src/libvterm/ @leonerd
runtime/autoload/getscript.vim @cecamp runtime/autoload/getscript.vim @cecamp
runtime/autoload/netrw.vim @cecamp runtime/autoload/netrw.vim @cecamp
runtime/autoload/netrwFileHandlers.vim @cecamp runtime/autoload/netrwFileHandlers.vim @cecamp
runtime/autoload/netrwSettings.vim @cecamp runtime/autoload/netrwSettings.vim @cecamp
runtime/autoload/rubycomplete.vim @segfault @dkearns
runtime/autoload/tar.vim @cecamp runtime/autoload/tar.vim @cecamp
runtime/autoload/vimball.vim @cecamp runtime/autoload/vimball.vim @cecamp
runtime/autoload/zip.vim @cecamp runtime/autoload/zip.vim @cecamp
runtime/compiler/checkstyle.vim @dkearns runtime/compiler/checkstyle.vim @dkearns
runtime/compiler/cucumber.vim @tpope
runtime/compiler/dart.vim @dkearns runtime/compiler/dart.vim @dkearns
runtime/compiler/dart2js.vim @dkearns runtime/compiler/dart2js.vim @dkearns
runtime/compiler/dart2native.vim @dkearns runtime/compiler/dart2native.vim @dkearns
@@ -29,15 +32,20 @@ runtime/compiler/dartfmt.vim @dkearns
runtime/compiler/eruby.vim @dkearns runtime/compiler/eruby.vim @dkearns
runtime/compiler/gawk.vim @dkearns runtime/compiler/gawk.vim @dkearns
runtime/compiler/gjs.vim @dkearns runtime/compiler/gjs.vim @dkearns
runtime/compiler/haml.vim @tpope
runtime/compiler/javac.vim @dkearns runtime/compiler/javac.vim @dkearns
runtime/compiler/jest.vim @dkearns runtime/compiler/jest.vim @dkearns
runtime/compiler/jjs.vim @dkearns runtime/compiler/jjs.vim @dkearns
runtime/compiler/jshint.vim @dkearns runtime/compiler/jshint.vim @dkearns
runtime/compiler/jsonlint.vim @dkearns runtime/compiler/jsonlint.vim @dkearns
runtime/compiler/php.vim @dkearns runtime/compiler/php.vim @dkearns
runtime/compiler/rake.vim @tpope @dkearns
runtime/compiler/rhino.vim @dkearns runtime/compiler/rhino.vim @dkearns
runtime/compiler/rspec.vim @tpope @dkearns
runtime/compiler/rubocop.vim @dkearns runtime/compiler/rubocop.vim @dkearns
runtime/compiler/ruby.vim @tpope @dkearns
runtime/compiler/rubyunit.vim @dkearns runtime/compiler/rubyunit.vim @dkearns
runtime/compiler/sass.vim @tpope
runtime/compiler/se.vim @dkearns runtime/compiler/se.vim @dkearns
runtime/compiler/stylelint.vim @dkearns runtime/compiler/stylelint.vim @dkearns
runtime/compiler/tcl.vim @dkearns runtime/compiler/tcl.vim @dkearns
@@ -53,40 +61,92 @@ runtime/doc/pi_netrw.txt @cecamp
runtime/doc/pi_tar.txt @cecamp runtime/doc/pi_tar.txt @cecamp
runtime/doc/pi_vimball.txt @cecamp runtime/doc/pi_vimball.txt @cecamp
runtime/doc/pi_zip.txt @cecamp runtime/doc/pi_zip.txt @cecamp
runtime/ftplugin/bst.vim @tpope
runtime/ftplugin/css.vim @dkearns runtime/ftplugin/css.vim @dkearns
runtime/ftplugin/cucumber.vim @tpope
runtime/ftplugin/eiffel.vim @dkearns runtime/ftplugin/eiffel.vim @dkearns
runtime/ftplugin/eruby.vim @tpope @dkearns
runtime/ftplugin/git.vim @tpope
runtime/ftplugin/gitcommit.vim @tpope
runtime/ftplugin/gitconfig.vim @tpope
runtime/ftplugin/gitrebase.vim @tpope
runtime/ftplugin/gitsendemail.vim @tpope
runtime/ftplugin/haml.vim @tpope
runtime/ftplugin/hgcommit.vim @k-takata
runtime/ftplugin/javascript.vim @dkearns runtime/ftplugin/javascript.vim @dkearns
runtime/ftplugin/javascriptreact.vim @dkearns runtime/ftplugin/javascriptreact.vim @dkearns
runtime/ftplugin/liquid.vim @tpope
runtime/ftplugin/markdown.vim @tpope
runtime/ftplugin/matlab.vim @cecamp
runtime/ftplugin/nsis.vim @k-takata
runtime/ftplugin/pdf.vim @tpope
runtime/ftplugin/ruby.vim @tpope @dkearns
runtime/ftplugin/sass.vim @tpope
runtime/ftplugin/scss.vim @tpope
runtime/ftplugin/tmux.vim @ericpruitt
runtime/ftplugin/typescript.vim @dkearns runtime/ftplugin/typescript.vim @dkearns
runtime/ftplugin/typescriptreact.vim @dkearns runtime/ftplugin/typescriptreact.vim @dkearns
runtime/plugin/amiga.vim @cecamp runtime/indent/bst.vim @tpope
runtime/plugin/csh.vim @cecamp runtime/indent/cucumber.vim @tpope
runtime/plugin/dcl.vim @cecamp runtime/indent/dosbatch.vim @k-takata
runtime/plugin/exports.vim @cecamp runtime/indent/eruby.vim @tpope @dkearns
runtime/indent/gitconfig.vim @tpope
runtime/indent/haml.vim @tpope
runtime/indent/liquid.vim @tpope
runtime/indent/nsis.vim @k-takata
runtime/indent/ruby.vim @AndrewRadev @dkearns
runtime/indent/sass.vim @tpope
runtime/indent/scss.vim @tpope
runtime/indent/teraterm.vim @k-takata
runtime/plugin/getscriptPlugin.vim @cecamp runtime/plugin/getscriptPlugin.vim @cecamp
runtime/plugin/lex.vim @cecamp
runtime/plugin/lisp.vim @cecamp
runtime/plugin/logiPat.vim @cecamp runtime/plugin/logiPat.vim @cecamp
runtime/plugin/maple.vim @cecamp
runtime/plugin/netrw.vim @cecamp
runtime/plugin/netrwPlugin.vim @cecamp runtime/plugin/netrwPlugin.vim @cecamp
runtime/plugin/rpcgen.vim @cecamp
runtime/plugin/sh.vim @cecamp
runtime/plugin/sm.vim @cecamp
runtime/plugin/tags.vim @cecamp
runtime/plugin/tarPlugin.vim @cecamp runtime/plugin/tarPlugin.vim @cecamp
runtime/plugin/tex.vim @cecamp
runtime/plugin/vim.vim @cecamp
runtime/plugin/vimballPlugin.vim @cecamp runtime/plugin/vimballPlugin.vim @cecamp
runtime/plugin/wlmfilt.vim @cecamp
runtime/plugin/xmath.vim @cecamp
runtime/plugin/xxd.vim @cecamp
runtime/plugin/yacc.vim @cecamp
runtime/plugin/zipPlugin.vim @cecamp runtime/plugin/zipPlugin.vim @cecamp
runtime/syntax/amiga.vim @cecamp
runtime/syntax/bst.vim @tpope
runtime/syntax/csh.vim @cecamp
runtime/syntax/cucumber.vim @tpope
runtime/syntax/dcl.vim @cecamp
runtime/syntax/elmfilt.vim @cecamp
runtime/syntax/eruby.vim @tpope @dkearns
runtime/syntax/exports.vim @cecamp
runtime/syntax/git.vim @tpope
runtime/syntax/gitcommit.vim @tpope
runtime/syntax/gitconfig.vim @tpope
runtime/syntax/gitrebase.vim @tpope
runtime/syntax/haml.vim @tpope
runtime/syntax/hgcommit.vim @k-takata
runtime/syntax/lex.vim @cecamp
runtime/syntax/liquid.vim @tpope
runtime/syntax/lisp.vim @cecamp
runtime/syntax/lynx.vim @dkearns runtime/syntax/lynx.vim @dkearns
runtime/syntax/mailcap.vim @dkearns runtime/syntax/mailcap.vim @dkearns
runtime/syntax/make.vim @rohieb
runtime/syntax/make.vim @rohieb
runtime/syntax/maple.vim @cecamp
runtime/syntax/markdown.vim @tpope
runtime/syntax/netrw.vim @cecamp
runtime/syntax/nsis.vim @k-takata
runtime/syntax/pdf.vim @tpope
runtime/syntax/php.vim @TysonAndre
runtime/syntax/privoxy.vim @dkearns runtime/syntax/privoxy.vim @dkearns
runtime/syntax/rpcgen.vim @cecamp
runtime/syntax/ruby.vim @dkearns runtime/syntax/ruby.vim @dkearns
runtime/syntax/sass.vim @tpope
runtime/syntax/scss.vim @tpope
runtime/syntax/sh.vim @cecamp
runtime/syntax/sm.vim @cecamp
runtime/syntax/tags.vim @cecamp
runtime/syntax/teraterm.vim @k-takata
runtime/syntax/tex.vim @cecamp
runtime/syntax/tidy.vim @dkearns runtime/syntax/tidy.vim @dkearns
runtime/syntax/tmux.vim @ericpruitt
runtime/syntax/vim.vim @cecamp
runtime/syntax/wget.vim @dkearns runtime/syntax/wget.vim @dkearns
runtime/syntax/xbl.vim @dkearns runtime/syntax/xbl.vim @dkearns
runtime/syntax/xmath.vim @cecamp
runtime/syntax/xslt.vim @Boobies
runtime/syntax/xxd.vim @cecamp
runtime/syntax/yacc.vim @cecamp

View File

@@ -58,10 +58,10 @@ LangString str_desc_console ${LANG_ITALIAN} \
"Versione console di Vim (vim.exe)." "Versione console di Vim (vim.exe)."
LangString str_section_batch ${LANG_ITALIAN} \ LangString str_section_batch ${LANG_ITALIAN} \
"Crea file di invocazione (MS-DOS) .bat" "Crea file .bat"
LangString str_desc_batch ${LANG_ITALIAN} \ LangString str_desc_batch ${LANG_ITALIAN} \
"Crea file di invocazione .bat per varianti di Vim nella directory \ "Crea file .bat per varianti di Vim nella directory \
di Windows, per utilizzo da linea di comando (MS-DOS)." di Windows, per utilizzo da riga di comando."
LangString str_group_icons ${LANG_ITALIAN} \ LangString str_group_icons ${LANG_ITALIAN} \
"Crea icone per Vim" "Crea icone per Vim"

View File

@@ -1,7 +1,7 @@
" netrw.vim: Handles file transfer and remote directory listing across " netrw.vim: Handles file transfer and remote directory listing across
" AUTOLOAD SECTION " AUTOLOAD SECTION
" Date: Jan 07, 2020 " Date: Sep 18, 2020
" Version: 168 " Version: 170
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> " Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
@@ -43,7 +43,7 @@ if exists("s:needspatches")
endfor endfor
endif endif
let g:loaded_netrw = "v168" let g:loaded_netrw = "v170"
if !exists("s:NOTE") if !exists("s:NOTE")
let s:NOTE = 0 let s:NOTE = 0
let s:WARNING = 1 let s:WARNING = 1
@@ -86,7 +86,16 @@ fun! netrw#ErrorMsg(level,msg,errnum)
endif endif
" call Decho("level=".level,'~'.expand("<slnum>")) " call Decho("level=".level,'~'.expand("<slnum>"))
if g:netrw_use_errorwindow if g:netrw_use_errorwindow == 2 && (v:version > 802 || (v:version == 802 && has("patch486")))
" use popup window
if type(a:msg) == 3
let msg = [level]+a:msg
else
let msg= level.a:msg
endif
let s:popuperr_id = popup_beval(msg,{})
let s:popuperr_text= ""
elseif g:netrw_use_errorwindow
" (default) netrw creates a one-line window to show error/warning " (default) netrw creates a one-line window to show error/warning
" messages (reliably displayed) " messages (reliably displayed)
@@ -203,7 +212,11 @@ let g:netrw_localrmdiropt = ""
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" Default values for netrw's global protocol variables {{{2 " Default values for netrw's global protocol variables {{{2
call s:NetrwInit("g:netrw_use_errorwindow",1) if (v:version > 802 || (v:version == 802 && has("patch486"))) && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") && has("mouse")
call s:NetrwInit("g:netrw_use_errorwindow",2)
else
call s:NetrwInit("g:netrw_use_errorwindow",1)
endif
if !exists("g:netrw_dav_cmd") if !exists("g:netrw_dav_cmd")
if executable("cadaver") if executable("cadaver")
@@ -559,6 +572,7 @@ call s:NetrwInit("s:netrw_posn",'{}')
if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on")
" call Decho("installed beval events",'~'.expand("<slnum>")) " call Decho("installed beval events",'~'.expand("<slnum>"))
let &l:bexpr = "netrw#BalloonHelp()" let &l:bexpr = "netrw#BalloonHelp()"
" call Decho("&l:bexpr<".&l:bexpr."> buf#".bufnr())
au FileType netrw setl beval au FileType netrw setl beval
au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif
au VimEnter * let s:initbeval= &beval au VimEnter * let s:initbeval= &beval
@@ -591,7 +605,18 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_
if &ft != "netrw" if &ft != "netrw"
return "" return ""
endif endif
if !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval) if exists("s:popuperr_id") && popup_getpos(s:popuperr_id) != {}
" popup error window is still showing
" s:pouperr_id and s:popuperr_text are set up in netrw#ErrorMsg()
if exists("s:popuperr_text") && s:popuperr_text != "" && v:beval_text != s:popuperr_text
" text under mouse hasn't changed; only close window when it changes
call popup_close(s:popuperr_id)
unlet s:popuperr_text
else
let s:popuperr_text= v:beval_text
endif
let mesg= ""
elseif !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval)
let mesg= "" let mesg= ""
elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing" elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing"
let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file" let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file"
@@ -1247,6 +1272,10 @@ fun! netrw#Lexplore(count,rightside,...)
setlocal winfixwidth setlocal winfixwidth
let g:netrw_altv = keep_altv let g:netrw_altv = keep_altv
let t:netrw_lexbufnr = bufnr("%") let t:netrw_lexbufnr = bufnr("%")
" done to prevent build-up of hidden buffers due to quitting and re-invocation of :Lexplore.
" Since the intended use of :Lexplore is to have an always-present explorer window, the extra
" effort to mis-use :Lex is warranted.
set bh=wipe
" call Decho("let t:netrw_lexbufnr=".t:netrw_lexbufnr) " call Decho("let t:netrw_lexbufnr=".t:netrw_lexbufnr)
" call Decho("t:netrw_lexposn".(exists("t:netrw_lexposn")? string(t:netrw_lexposn) : " n/a")) " call Decho("t:netrw_lexposn".(exists("t:netrw_lexposn")? string(t:netrw_lexposn) : " n/a"))
if exists("t:netrw_lexposn") if exists("t:netrw_lexposn")
@@ -1908,7 +1937,7 @@ fun! s:NetrwRestoreSetting(keepvar,setting)
if type(a:setting) == 0 if type(a:setting) == 0
exe "let ".a:setting."= ".keepvarval exe "let ".a:setting."= ".keepvarval
elseif type(a:setting) == 1 elseif type(a:setting) == 1
exe "let ".a:setting."= '".keepvarval."'" exe "let ".a:setting."= '".substitute(keepvarval,"'","''","g")."'"
else else
call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105) call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105)
endif endif
@@ -3640,6 +3669,8 @@ fun! s:NetrwBookHistSave()
let savefile= s:NetrwHome()."/.netrwhist" let savefile= s:NetrwHome()."/.netrwhist"
" call Decho("savefile<".savefile.">",'~'.expand("<slnum>")) " call Decho("savefile<".savefile.">",'~'.expand("<slnum>"))
1split 1split
" setting up a new buffer which will become .netrwhist
call s:NetrwEnew() call s:NetrwEnew()
" call Decho("case g:netrw_use_noswf=".g:netrw_use_noswf.(exists("+acd")? " +acd" : " -acd"),'~'.expand("<slnum>")) " call Decho("case g:netrw_use_noswf=".g:netrw_use_noswf.(exists("+acd")? " +acd" : " -acd"),'~'.expand("<slnum>"))
if g:netrw_use_noswf if g:netrw_use_noswf
@@ -4722,7 +4753,7 @@ endfun
" "new directory name" is actually a file, " "new directory name" is actually a file,
" NetrwBrowseChgDir() edits the file. " NetrwBrowseChgDir() edits the file.
fun! s:NetrwBrowseChgDir(islocal,newdir,...) fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") " call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." win#".winnr()." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">")
" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
let ykeep= @@ let ykeep= @@
@@ -4751,13 +4782,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
let newdir = a:newdir let newdir = a:newdir
let dolockout = 0 let dolockout = 0
let dorestore = 1 let dorestore = 1
" call Decho("win#".winnr(),'~'.expand("<slnum>"))
" call Decho("dirname<".dirname.">",'~'.expand("<slnum>")) " call Decho("dirname<".dirname.">",'~'.expand("<slnum>"))
" call Decho("newdir<".newdir.">",'~'.expand("<slnum>")) " call Decho("newdir<".newdir.">",'~'.expand("<slnum>"))
" ignore <cr>s when done in the banner " ignore <cr>s when done in the banner
" call Decho('(s:NetrwBrowseChgDir) ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>")) " call Decho('(s:NetrwBrowseChgDir) ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>"))
if g:netrw_banner if g:netrw_banner
" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>")) " call Decho("win#".winnr()." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>"))
if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt
if getline(".") =~# 'Quick Help' if getline(".") =~# 'Quick Help'
" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
@@ -4794,7 +4826,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" ------------------------------ " ------------------------------
" NetrwBrowseChgDir: edit a file {{{3 " NetrwBrowseChgDir: edit a file {{{3
" ------------------------------ " ------------------------------
" call Decho('(s:NetrwBrowseChgDir) edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>")) " call Decho('edit-a-file: case "handling a file": win#'.winnr().' newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>"))
" save position for benefit of Rexplore " save position for benefit of Rexplore
let s:rexposn_{bufnr("%")}= winsaveview() let s:rexposn_{bufnr("%")}= winsaveview()
@@ -4829,7 +4861,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
NetrwKeepj call s:NetrwOptionsRestore("s:") NetrwKeepj call s:NetrwOptionsRestore("s:")
let curdir= b:netrw_curdir let curdir= b:netrw_curdir
if !exists("s:didsplit") if !exists("s:didsplit")
" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>")) " " call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr()." g:netrw_chgwin=".g:netrw_chgwin",'~'.expand("<slnum>"))
if type(g:netrw_browse_split) == 3 if type(g:netrw_browse_split) == 3
" open file in server " open file in server
" Note that g:netrw_browse_split is a List: [servername,tabnr,winnr] " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr]
@@ -4837,22 +4869,27 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
call s:NetrwServerEdit(a:islocal,dirname) call s:NetrwServerEdit(a:islocal,dirname)
" call Dret("s:NetrwBrowseChgDir") " call Dret("s:NetrwBrowseChgDir")
return return
elseif g:netrw_browse_split == 1 elseif g:netrw_browse_split == 1
" horizontally splitting the window first " horizontally splitting the window first
" call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("<slnum>")) " call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("<slnum>"))
keepalt new let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize
exe "keepalt ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s"
if !&ea if !&ea
keepalt wincmd _ keepalt wincmd _
endif endif
call s:SetRexDir(a:islocal,curdir) call s:SetRexDir(a:islocal,curdir)
elseif g:netrw_browse_split == 2 elseif g:netrw_browse_split == 2
" vertically splitting the window first " vertically splitting the window first
" call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>")) " call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>"))
keepalt rightb vert new let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize
exe "keepalt ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s"
if !&ea if !&ea
keepalt wincmd | keepalt wincmd |
endif endif
call s:SetRexDir(a:islocal,curdir) call s:SetRexDir(a:islocal,curdir)
elseif g:netrw_browse_split == 3 elseif g:netrw_browse_split == 3
" open file in new tab " open file in new tab
" call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>")) " call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>"))
@@ -4861,6 +4898,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
let b:netrw_curdir= getcwd() let b:netrw_curdir= getcwd()
endif endif
call s:SetRexDir(a:islocal,curdir) call s:SetRexDir(a:islocal,curdir)
elseif g:netrw_browse_split == 4 elseif g:netrw_browse_split == 4
" act like "P" (ie. open previous window) " act like "P" (ie. open previous window)
" call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>")) " call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>"))
@@ -4870,13 +4908,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
return return
endif endif
call s:SetRexDir(a:islocal,curdir) call s:SetRexDir(a:islocal,curdir)
else else
" handling a file, didn't split, so remove menu " handling a file, didn't split, so remove menu
" call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>")) " call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>"))
call s:NetrwMenu(0) call s:NetrwMenu(0)
" optional change to window " optional change to window
if g:netrw_chgwin >= 1 if g:netrw_chgwin >= 1
" call Decho("edit-a-file: changing window to #".g:netrw_chgwin,'~'.expand("<slnum>")) " call Decho("edit-a-file: changing window to #".g:netrw_chgwin.": (due to g:netrw_chgwin)",'~'.expand("<slnum>"))
if winnr("$")+1 == g:netrw_chgwin if winnr("$")+1 == g:netrw_chgwin
" if g:netrw_chgwin is set to one more than the last window, then " if g:netrw_chgwin is set to one more than the last window, then
" vertically split the last window to make that window available. " vertically split the last window to make that window available.
@@ -4889,19 +4928,26 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
endif endif
call s:SetRexDir(a:islocal,curdir) call s:SetRexDir(a:islocal,curdir)
endif endif
endif endif
" the point where netrw actually edits the (local) file " the point where netrw actually edits the (local) file
" if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will
" no keepalt to support :e # to return to a directory listing " no keepalt to support :e # to return to a directory listing
if !&mod
" if e the new file would fail due to &mod, then don't change any of the flags
let dolockout= 1
endif
if a:islocal if a:islocal
" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("<slnum>")) " call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("<slnum>"))
" some like c-^ to return to the last edited file " some like c-^ to return to the last edited file
" others like c-^ to return to the netrw buffer " others like c-^ to return to the netrw buffer
" Apr 30, 2020: used to have e! here. That can cause loss of a modified file,
" so emit error E37 instead.
if exists("g:netrw_altfile") && g:netrw_altfile if exists("g:netrw_altfile") && g:netrw_altfile
exe "NetrwKeepj keepalt e! ".fnameescape(dirname) exe "NetrwKeepj keepalt e ".fnameescape(dirname)
else else
exe "NetrwKeepj e! ".fnameescape(dirname) exe "NetrwKeepj e ".fnameescape(dirname)
endif endif
" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("<slnum>")) " call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("<slnum>"))
call s:NetrwCursor() call s:NetrwCursor()
@@ -4912,7 +4958,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
else else
" call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("<slnum>")) " call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("<slnum>"))
endif endif
let dolockout= 1
" handle g:Netrw_funcref -- call external-to-netrw functions " handle g:Netrw_funcref -- call external-to-netrw functions
" This code will handle g:Netrw_funcref as an individual function reference " This code will handle g:Netrw_funcref as an individual function reference
@@ -5376,16 +5421,6 @@ fun! netrw#BrowseX(fname,remote)
endif endif
let ret= v:shell_error let ret= v:shell_error
elseif has("unix") && executable("kfmclient") && s:CheckIfKde()
" 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("(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") elseif has("unix") && $DESKTOP_SESSION == "mate" && executable("atril")
" call Decho("(netrw#BrowseX) unix and atril",'~'.expand("<slnum>")) " call Decho("(netrw#BrowseX) unix and atril",'~'.expand("<slnum>"))
if a:fname =~ '^https\=://' if a:fname =~ '^https\=://'
@@ -5400,9 +5435,19 @@ fun! netrw#BrowseX(fname,remote)
endif endif
let ret= v:shell_error let ret= v:shell_error
elseif has("unix") && executable("kfmclient") && s:CheckIfKde()
" 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("(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") && executable("xdg-open") elseif has("unix") && executable("xdg-open")
" call Decho("(netrw#BrowseX) 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) call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir.'&')
let ret= v:shell_error let ret= v:shell_error
elseif has("macunix") && executable("open") elseif has("macunix") && executable("open")
@@ -6107,10 +6152,10 @@ fun! s:NetrwListHide()
" Duplicate characters don't matter. " Duplicate characters don't matter.
" Remove all such characters from the '/~@#...890' string. " Remove all such characters from the '/~@#...890' string.
" Use the first character left as a separator character. " Use the first character left as a separator character.
" call Decho("find a character not in the hide string to use as a separator") " call Decho("find a character not in the hide string to use as a separator",'~'.expand("<slnum>"))
let listhide= g:netrw_list_hide let listhide= g:netrw_list_hide
let sep = strpart(substitute('~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) let sep = strpart(substitute('~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
" call Decho("sep=".sep," (sep not in hide string)'~'.expand("<slnum>")) " call Decho("sep<".sep."> (sep not in hide string)",'~'.expand("<slnum>"))
while listhide != "" while listhide != ""
if listhide =~ ',' if listhide =~ ','
@@ -6120,7 +6165,7 @@ fun! s:NetrwListHide()
let hide = listhide let hide = listhide
let listhide = "" let listhide = ""
endif endif
" call Decho("..extracted from listhide: hide<".hide."> g:netrw_sort_by<".g:netrw_sort_by.'>','~'.expand("<slnum>")) " call Decho("..extracted pattern from listhide: hide<".hide."> g:netrw_sort_by<".g:netrw_sort_by.'>','~'.expand("<slnum>"))
if g:netrw_sort_by =~ '^[ts]' if g:netrw_sort_by =~ '^[ts]'
if hide =~ '^\^' if hide =~ '^\^'
" call Decho("..modify hide to handle a \"^...\" pattern",'~'.expand("<slnum>")) " call Decho("..modify hide to handle a \"^...\" pattern",'~'.expand("<slnum>"))
@@ -6132,7 +6177,7 @@ fun! s:NetrwListHide()
endif endif
" Prune the list by hiding any files which match " 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 if g:netrw_hide == 1
" call Decho("..hiding<".hide.">",'~'.expand("<slnum>")) " call Decho("..hiding<".hide.">",'~'.expand("<slnum>"))
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
@@ -9215,6 +9260,7 @@ endfun
" (full path directory with trailing slash returned) " (full path directory with trailing slash returned)
fun! s:NetrwTreeDir(islocal) fun! s:NetrwTreeDir(islocal)
" call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) " call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft)
" call Decho("Determine tree directory given current cursor position")
" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) " call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>"))
" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) " call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>"))
" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("<slnum>")) " call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("<slnum>"))
@@ -9320,7 +9366,6 @@ fun! s:NetrwTreeDisplay(dir,depth)
call setline(line("$")+1,a:depth.shortdir.'/') call setline(line("$")+1,a:depth.shortdir.'/')
endif endif
" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("<slnum>")) " call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("<slnum>"))
" append a / to dir if its missing one " append a / to dir if its missing one
let dir= a:dir let dir= a:dir
@@ -9334,7 +9379,7 @@ fun! s:NetrwTreeDisplay(dir,depth)
let listhide= split(g:netrw_list_hide,',') let listhide= split(g:netrw_list_hide,',')
" call Decho("listhide=".string(listhide)) " call Decho("listhide=".string(listhide))
for pat in listhide for pat in listhide
call filter(w:netrw_treedict[dir],'v:val !~ "'.pat.'"') call filter(w:netrw_treedict[dir],'v:val !~ "'.escape(pat,'\\').'"')
endfor endfor
elseif g:netrw_hide == 2 elseif g:netrw_hide == 2
@@ -9472,6 +9517,7 @@ fun! s:NetrwTreeListing(dirname)
" 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("<slnum>")) " 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("<slnum>"))
" display from treetop on down " display from treetop on down
" call Decho("(s:NetrwTreeListing) w:netrw_treetop<".w:netrw_treetop.">")
NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"") NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"")
" call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("<slnum>")) " call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("<slnum>"))
@@ -9742,7 +9788,7 @@ fun! s:PerformListing(islocal)
" Hiding... -or- Showing... {{{3 " Hiding... -or- Showing... {{{3
if g:netrw_banner if g:netrw_banner
" call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>")) " call Decho("--handle hiding/showing in banner (g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>"))
if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_list_hide != "" && g:netrw_hide
if g:netrw_hide == 1 if g:netrw_hide == 1
NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide
@@ -9795,7 +9841,7 @@ fun! s:PerformListing(islocal)
" 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("<slnum>")) " 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("<slnum>"))
if !g:netrw_banner || line("$") >= w:netrw_bannercnt if !g:netrw_banner || line("$") >= w:netrw_bannercnt
" call Decho("manipulate directory listing (hide)",'~'.expand("<slnum>")) " call Decho("manipulate directory listing (support hide)",'~'.expand("<slnum>"))
" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) " call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>"))
if g:netrw_hide && g:netrw_list_hide != "" if g:netrw_hide && g:netrw_list_hide != ""
NetrwKeepj call s:NetrwListHide() NetrwKeepj call s:NetrwListHide()
@@ -11808,7 +11854,7 @@ endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2
fun! s:NetrwEnew(...) fun! s:NetrwEnew(...)
" call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")." expand(%)<".expand("%").">") " 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("<slnum>")) " call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>"))
" grab a function-local-variable copy of buffer variables " grab a function-local-variable copy of buffer variables
@@ -11875,6 +11921,9 @@ fun! s:NetrwEnew(...)
endif endif
endif endif
endif endif
if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on")
let &l:bexpr = "netrw#BalloonHelp()"
endif
" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh." win#".winnr()." winnr($)#".winnr("$")) " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh." win#".winnr()." winnr($)#".winnr("$"))
endfun endfun
@@ -11934,6 +11983,7 @@ endfun
" -1=failed " -1=failed
fun! s:NetrwLcd(newdir) fun! s:NetrwLcd(newdir)
" call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)") " call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)")
" call Decho("changing local directory",'~'.expand("<slnum>"))
let err472= 0 let err472= 0
try try
@@ -11969,6 +12019,8 @@ fun! s:NetrwLcd(newdir)
return -1 return -1
endif endif
" call Decho("getcwd <".getcwd().">")
" call Decho("b:netrw_curdir<".b:netrw_curdir.">")
" call Dret("s:NetrwLcd 0") " call Dret("s:NetrwLcd 0")
return 0 return 0
endfun endfun

View File

@@ -1,8 +1,8 @@
" netrwFileHandlers: contains various extension-based file handlers for " netrwFileHandlers: contains various extension-based file handlers for
" netrw's browsers' x command ("eXecute launcher") " netrw's browsers' x command ("eXecute launcher")
" Author: Charles E. Campbell " Author: Charles E. Campbell
" Date: May 03, 2013 " Date: Sep 18, 2020
" Version: 11b ASTRO-ONLY " Version: 11
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
@@ -20,7 +20,7 @@
if exists("g:loaded_netrwFileHandlers") || &cp if exists("g:loaded_netrwFileHandlers") || &cp
finish finish
endif endif
let g:loaded_netrwFileHandlers= "v11b" let g:loaded_netrwFileHandlers= "v11"
if v:version < 702 if v:version < 702
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of netrwFileHandlers needs vim 7.2" echo "***warning*** this version of netrwFileHandlers needs vim 7.2"

View File

@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 8.2. Last change: 2020 Aug 09 *cmdline.txt* For Vim version 8.2. Last change: 2020 Sep 14
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -797,7 +797,7 @@ three lines: >
< <
Visual Mode and Range *v_:* Visual Mode and Range *v_:*
*:star-visual-range*
{Visual}: Starts a command-line with the Visual selected lines as a {Visual}: Starts a command-line with the Visual selected lines as a
range. The code `:'<,'>` is used for this range, which makes range. The code `:'<,'>` is used for this range, which makes
it possible to select a similar line from the command-line it possible to select a similar line from the command-line
@@ -873,34 +873,37 @@ it, no matter how many backslashes.
\\# \# \\# \#
Also see |`=|. Also see |`=|.
*:<cword>* *<cword>* *:<cWORD>* *<cWORD>* *E499* *E500*
*:<cexpr>* *<cexpr>* *:<cfile>* *<cfile>*
*:<afile>* *<afile>* *:<abuf>* *<abuf>*
*:<amatch>* *<amatch>* *:<stack>* *<stack>*
*:<sfile>* *<sfile>* *:<slnum>* *<slnum>*
*:<sflnum>* *<sflnum>* *E499* *E500*
Note: these are typed literally, they are not special keys! Note: these are typed literally, they are not special keys!
*:<cword>* *<cword>*
<cword> is replaced with the word under the cursor (like |star|) <cword> is replaced with the word under the cursor (like |star|)
*:<cWORD>* *<cWORD>*
<cWORD> is replaced with the WORD under the cursor (see |WORD|) <cWORD> is replaced with the WORD under the cursor (see |WORD|)
*:<cexpr>* *<cexpr>*
<cexpr> is replaced with the word under the cursor, including more <cexpr> is replaced with the word under the cursor, including more
to form a C expression. E.g., when the cursor is on "arg" to form a C expression. E.g., when the cursor is on "arg"
of "ptr->arg" then the result is "ptr->arg"; when the of "ptr->arg" then the result is "ptr->arg"; when the
cursor is on "]" of "list[idx]" then the result is cursor is on "]" of "list[idx]" then the result is
"list[idx]". This is used for |v:beval_text|. "list[idx]". This is used for |v:beval_text|.
*:<cfile>* *<cfile>*
<cfile> is replaced with the path name under the cursor (like what <cfile> is replaced with the path name under the cursor (like what
|gf| uses) |gf| uses)
*:<afile>* *<afile>*
<afile> When executing autocommands, is replaced with the file name <afile> When executing autocommands, is replaced with the file name
of the buffer being manipulated, or the file for a read or of the buffer being manipulated, or the file for a read or
write. *E495* write. *E495*
*:<abuf>* *<abuf>*
<abuf> When executing autocommands, is replaced with the currently <abuf> When executing autocommands, is replaced with the currently
effective buffer number (for ":r file" and ":so file" it is effective buffer number (for ":r file" and ":so file" it is
the current buffer, the file being read/sourced is not in a the current buffer, the file being read/sourced is not in a
buffer). *E496* buffer). *E496*
*:<amatch>* *<amatch>*
<amatch> When executing autocommands, is replaced with the match for <amatch> When executing autocommands, is replaced with the match for
which this autocommand was executed. *E497* which this autocommand was executed. *E497*
It differs from <afile> only when the file name isn't used It differs from <afile> only when the file name isn't used
to match with (for FileType, Syntax and SpellFileMissing to match with (for FileType, Syntax and SpellFileMissing
events). events).
*:<sfile>* *<sfile>*
<sfile> When executing a ":source" command, is replaced with the <sfile> When executing a ":source" command, is replaced with the
file name of the sourced file. *E498* file name of the sourced file. *E498*
When executing a function, is replaced with the call stack, When executing a function, is replaced with the call stack,
@@ -908,18 +911,24 @@ Note: these are typed literally, they are not special keys!
<stack> is preferred). <stack> is preferred).
Note that filename-modifiers are useless when <sfile> is Note that filename-modifiers are useless when <sfile> is
not used inside a script. not used inside a script.
*:<stack>* *<stack>*
<stack> is replaced with the call stack, using <stack> is replaced with the call stack, using
"function {function-name}[{lnum}]" for a function line "function {function-name}[{lnum}]" for a function line
and "script {file-name}[{lnum}]" for a script line, and and "script {file-name}[{lnum}]" for a script line, and
".." in between items. E.g.: ".." in between items. E.g.:
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]" "function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
*:<slnum>* *<slnum>*
<slnum> When executing a ":source" command, is replaced with the <slnum> When executing a ":source" command, is replaced with the
line number. *E842* line number. *E842*
When executing a function it's the line number relative to When executing a function it's the line number relative to
the start of the function. the start of the function.
*:<sflnum>* *<sflnum>*
<sflnum> When executing a script, is replaced with the line number. <sflnum> When executing a script, is replaced with the line number.
It differs from <slnum> in that <sflnum> is replaced with It differs from <slnum> in that <sflnum> is replaced with
the script line number in any situation. *E961* the script line number in any situation. *E961*
*:<client>* *<client>*
<client> is replaced with the {clinetid} of the last received
message in |server2client()|
*filename-modifiers* *filename-modifiers*
*:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S* *:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S*

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2020 Sep 06 *eval.txt* For Vim version 8.2. Last change: 2020 Sep 16
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4302,6 +4302,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
<afile> autocmd file name <afile> autocmd file name
<abuf> autocmd buffer number (as a String!) <abuf> autocmd buffer number (as a String!)
<amatch> autocmd matched name <amatch> autocmd matched name
<cexpr> C expression under the cursor
<sfile> sourced script file or function name <sfile> sourced script file or function name
<slnum> sourced script line number or function <slnum> sourced script line number or function
line number line number
@@ -4309,6 +4310,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
a function a function
<SID> "<SNR>123_" where "123" is the <SID> "<SNR>123_" where "123" is the
current script ID |<SID>| current script ID |<SID>|
<stack> call stack
<cword> word under the cursor <cword> word under the cursor
<cWORD> WORD under the cursor <cWORD> WORD under the cursor
<client> the {clientid} of the last received <client> the {clientid} of the last received
@@ -5489,7 +5491,7 @@ getmarklist([{expr}]) *getmarklist()*
local marks defined in buffer {expr}. For the use of {expr}, local marks defined in buffer {expr}. For the use of {expr},
see |bufname()|. see |bufname()|.
Each item in the retuned List is a |Dict| with the following: Each item in the returned List is a |Dict| with the following:
name - name of the mark prefixed by "'" name - name of the mark prefixed by "'"
pos - a |List| with the position of the mark: pos - a |List| with the position of the mark:
[bufnum, lnum, col, off] [bufnum, lnum, col, off]

View File

@@ -1,4 +1,4 @@
*insert.txt* For Vim version 8.2. Last change: 2020 Apr 30 *insert.txt* For Vim version 8.2. Last change: 2020 Sep 19
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1843,6 +1843,7 @@ a Append text after the cursor [count] times. If the
*A* *A*
A Append text at the end of the line [count] times. A Append text at the end of the line [count] times.
For using "A" in Visual block mode see |v_b_A|.
<insert> or *i* *insert* *<Insert>* <insert> or *i* *insert* *<Insert>*
i Insert text before the cursor [count] times. i Insert text before the cursor [count] times.
@@ -1855,6 +1856,7 @@ I Insert text before the first non-blank in the line
When the 'H' flag is present in 'cpoptions' and the When the 'H' flag is present in 'cpoptions' and the
line only contains blanks, insert start just before line only contains blanks, insert start just before
the last blank. the last blank.
For using "I" in Visual block mode see |v_b_I|.
*gI* *gI*
gI Insert text in column 1 [count] times. gI Insert text in column 1 [count] times.

View File

@@ -1,4 +1,4 @@
*map.txt* For Vim version 8.2. Last change: 2020 Sep 06 *map.txt* For Vim version 8.2. Last change: 2020 Sep 09
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1506,7 +1506,7 @@ The valid escape sequences are
<bang> (See the '-bang' attribute) Expands to a ! if the <bang> (See the '-bang' attribute) Expands to a ! if the
command was executed with a ! modifier, otherwise command was executed with a ! modifier, otherwise
expands to nothing. expands to nothing.
*<mods>* *:command-modifiers* *<mods>* *<q-mods>* *:command-modifiers*
<mods> The command modifiers, if specified. Otherwise, expands to <mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |:aboveleft|, |:belowright|, nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|, |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2020 Sep 06 *options.txt* For Vim version 8.2. Last change: 2020 Sep 15
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2806,7 +2806,10 @@ A jump table for the options with a short description can be found at |Q_op|.
'emoji' 'emo' boolean (default: on) 'emoji' 'emo' boolean (default: on)
global global
When on all Unicode emoji characters are considered to be full width. When on all Unicode emoji characters are considered to be full width.
This excludes "text emoji" characters, which are normally displayed as
single width. Unfortunately there is no good specification for this
and it has been determined on trial-and-error basis. Use the
|setcellwidths()| function to change the behavior.
*'encoding'* *'enc'* *E543* *'encoding'* *'enc'* *E543*
'encoding' 'enc' string (default: "latin1" or value from $LANG) 'encoding' 'enc' string (default: "latin1" or value from $LANG)
@@ -7288,8 +7291,8 @@ A jump table for the options with a short description can be found at |Q_op|.
N N Printer page number. (Only works in the 'printheader' option.) N N Printer page number. (Only works in the 'printheader' option.)
l N Line number. l N Line number.
L N Number of lines in buffer. L N Number of lines in buffer.
c N Column number. c N Column number (byte index).
v N Virtual column number. v N Virtual column number (screen column).
V N Virtual column number as -{num}. Not displayed if equal to 'c'. V N Virtual column number as -{num}. Not displayed if equal to 'c'.
p N Percentage through file in lines as in |CTRL-G|. p N Percentage through file in lines as in |CTRL-G|.
P S Percentage through file of displayed window. This is like the P S Percentage through file of displayed window. This is like the

View File

@@ -1,4 +1,4 @@
*pi_netrw.txt* For Vim version 8.2. Last change: 2020 Aug 15 *pi_netrw.txt* For Vim version 8.2. Last change: 2020 Sep 19
------------------------------------------------ ------------------------------------------------
NETRW REFERENCE MANUAL by Charles E. Campbell NETRW REFERENCE MANUAL by Charles E. Campbell
@@ -437,9 +437,13 @@ settings are described below, in |netrw-browser-options|, and in
*g:netrw_silent* =0 : transfers done normally *g:netrw_silent* =0 : transfers done normally
=1 : transfers done silently =1 : transfers done silently
*g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one *g:netrw_use_errorwindow* =2: messages from netrw will use a popup window
Move the mouse and pause to remove the popup window.
(default value if popup windows are availble)
=1 : messages from netrw will use a separate one
line window. This window provides reliable line window. This window provides reliable
delivery of messages. (default) delivery of messages.
(default value if popup windows are not availble)
=0 : messages from netrw will use echoerr ; =0 : messages from netrw will use echoerr ;
messages don't always seem to show up this messages don't always seem to show up this
way, but one doesn't have to quit the window. way, but one doesn't have to quit the window.
@@ -725,6 +729,8 @@ just as easily as if they were local files! >
See |netrw-activate| for more on how to encourage your vim to use plugins See |netrw-activate| for more on how to encourage your vim to use plugins
such as netrw. such as netrw.
For password-free use of scp:, see |netrw-ssh-hack|.
============================================================================== ==============================================================================
7. Ex Commands *netrw-ex* {{{1 7. Ex Commands *netrw-ex* {{{1
@@ -1080,7 +1086,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
a Cycles between normal display, |netrw-a| a Cycles between normal display, |netrw-a|
hiding (suppress display of files matching g:netrw_list_hide) hiding (suppress display of files matching g:netrw_list_hide)
and showing (display only files which match g:netrw_list_hide) and showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory |netrw-c| cd Make browsing directory the current directory |netrw-cd|
C Setting the editing window |netrw-C| C Setting the editing window |netrw-C|
d Make a directory |netrw-d| d Make a directory |netrw-d|
D Attempt to remove the file(s)/directory(ies) |netrw-D| D Attempt to remove the file(s)/directory(ies) |netrw-D|
@@ -2098,7 +2104,7 @@ 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 set Vim's notion of the current directory to netrw's current browsing
directory. directory.
*netrw-c* : This map's name has been changed from "c" to cd (see |netrw-cd|). |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. This change was done to allow for |netrw-cb| and |netrw-cB| maps.
Associated setting variable: |g:netrw_keepdir| Associated setting variable: |g:netrw_keepdir|
@@ -2753,7 +2759,7 @@ your browsing preferences. (see also: |netrw-settings|)
=0 keep the current directory the same as the =0 keep the current directory the same as the
browsing directory. browsing directory.
The current browsing directory is contained in The current browsing directory is contained in
b:netrw_curdir (also see |netrw-c|) b:netrw_curdir (also see |netrw-cd|)
*g:netrw_keepj* ="keepj" (default) netrw attempts to keep the *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the
|:jumps| table unaffected. |:jumps| table unaffected.
@@ -3054,7 +3060,7 @@ your browsing preferences. (see also: |netrw-settings|)
(see |netrw-c-tab|). (see |netrw-c-tab|).
*g:netrw_xstrlen* Controls how netrw computes string lengths, *g:netrw_xstrlen* Controls how netrw computes string lengths,
including multibyte characters' string including multi-byte characters' string
length. (thanks to N Weibull, T Mechelynck) length. (thanks to N Weibull, T Mechelynck)
=0: uses Vim's built-in strlen() =0: uses Vim's built-in strlen()
=1: number of codepoints (Latin a + combining =1: number of codepoints (Latin a + combining
@@ -3124,7 +3130,8 @@ a file using the local browser (by putting the cursor on it) and pressing
Related topics: Related topics:
* To see what the current directory is, use |:pwd| * To see what the current directory is, use |:pwd|
* To make the currently browsed directory the current directory, see |netrw-c| * To make the currently browsed directory the current directory, see
|netrw-cd|
* To automatically make the currently browsed directory the current * To automatically make the currently browsed directory the current
directory, see |g:netrw_keepdir|. directory, see |g:netrw_keepdir|.
@@ -3799,9 +3806,15 @@ netrw:
or or
http://vim.sourceforge.net/scripts/script.php?script_id=120 http://vim.sourceforge.net/scripts/script.php?script_id=120
Decho.vim is provided as a "vimball"; see |vimball-intro|. Decho.vim is provided as a "vimball"; see |vimball-intro|. You
should edit the Decho.vba.gz file and source it in: >
2. Edit the <netrw.vim> file by typing: > vim Decho.vba.gz
:so %
:q
<
2. To turn on debug tracing in netrw, then edit the <netrw.vim>
file by typing: >
vim netrw.vim vim netrw.vim
:DechoOn :DechoOn
@@ -3823,14 +3836,34 @@ netrw:
read/write your file over the network in a separate tab or read/write your file over the network in a separate tab or
server vim window. server vim window.
To save the file, use > Change the netrw.vimrc file to include the Decho plugin: >
set nocp
so $HOME/.vim/plugin/Decho.vim
so $HOME/.vim/plugin/netrwPlugin.vim
<
You should continue to run vim with >
vim -u netrw.vimrc --noplugins -i NONE [some path here]
<
to avoid entanglements with options and other plugins.
To save the file: under linux, the output will be in a separate
remote server window; in it, just save the file with >
:w! DBG
< Under a vim that doesn't support clientserver, your debugging
output will appear in another tab: >
:tabnext :tabnext
:set bt= :set bt=
:w! DBG :w! DBG
<
Furthermore, it'd be helpful if you would type >
< Furthermore, it'd be helpful if you would type >
:Dsep <command> :Dsep <command>
< where <command> is the command you're about to type next, < where <command> is the command you're about to type next,
thereby making it easier to associate which part of the thereby making it easier to associate which part of the
debugging trace is due to which command. debugging trace is due to which command.
@@ -3838,17 +3871,34 @@ netrw:
Please send that information to <netrw.vim>'s maintainer along 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 with the o/s you're using and the vim version that you're using
(see |:version|) (remove the embedded NOSPAM first) > (see |:version|) (remove the embedded NOSPAM first) >
NcampObell@SdrPchip.AorgM-NOSPAM NcampObell@SdrPchip.AorgM-NOSPAM
< <
============================================================================== ==============================================================================
12. History *netrw-history* {{{1 12. History *netrw-history* {{{1
v170: Mar 11, 2020 * (reported by Reiner Herrmann) netrw+tree
would not hide with the ^\..* pattern
correctly.
* (Marcin Szamotulski) NetrwOptionRestore
did not restore options correctly that
had a single quote in the option string.
Apr 13, 2020 * implemented error handling via popup
windows (see |popup_beval()|)
Apr 30, 2020 * (reported by Manatsu Takahashi) while
using Lexplore, a modified file could
be overwritten. Sol'n: will not overwrite,
but will emit an |E37| (although one cannot
add an ! to override)
Jun 07, 2020 * (reported by Jo Totland) repeatedly invoking
:Lexplore and quitting it left unused
hidden buffers. Netrw will now set netrw
buffers created by :Lexplore to |bh|=wipe.
v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x
(|netrw-x|) would throw an error when (|netrw-x|) would throw an error when
attempting to open a local directory. attempting to open a local directory.
v168: Dec 12, 2019 * scp timeout error message not reported, v168: Dec 12, 2019 * scp timeout error message not reported,
hopefully now fixed (Shane Xb Qian) hopefully now fixed (Shane Xb Qian)
v167: Nov 29, 2019 * netrw does a save&restore on @* and @+. v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
That causes problems with the clipboard. That causes problems with the clipboard.
Now restores occurs only if @* or @+ have Now restores occurs only if @* or @+ have
@@ -4306,4 +4356,4 @@ netrw:
============================================================================== ==============================================================================
Modelines: {{{1 Modelines: {{{1
vim:tw=78:ts=8:noet:ft=help:norl:fdm=marker vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker

View File

@@ -1,4 +1,4 @@
*popup.txt* For Vim version 8.2. Last change: 2020 Jul 27 *popup.txt* For Vim version 8.2. Last change: 2020 Sep 08
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -915,6 +915,12 @@ but since many keys start with an Esc character, there may be a delay before
Vim recognizes the Esc key. If you do use Esc, it is recommended to set the Vim recognizes the Esc key. If you do use Esc, it is recommended to set the
'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'. 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'.
*popup-filter-errors*
If the filter function can't be called, e.g. because the name is wrong, then
the popup is closed. If the filter causes an error then it is assumed to
return zero. If this happens three times in a row the popup is closed. If
the popup gives errors fewer than 10% of the calls then it won't be closed.
POPUP CALLBACK *popup-callback* POPUP CALLBACK *popup-callback*

View File

@@ -1975,6 +1975,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:<cWORD> cmdline.txt /*:<cWORD>* :<cWORD> cmdline.txt /*:<cWORD>*
:<cexpr> cmdline.txt /*:<cexpr>* :<cexpr> cmdline.txt /*:<cexpr>*
:<cfile> cmdline.txt /*:<cfile>* :<cfile> cmdline.txt /*:<cfile>*
:<client> cmdline.txt /*:<client>*
:<cword> cmdline.txt /*:<cword>* :<cword> cmdline.txt /*:<cword>*
:<sfile> cmdline.txt /*:<sfile>* :<sfile> cmdline.txt /*:<sfile>*
:<sflnum> cmdline.txt /*:<sflnum>* :<sflnum> cmdline.txt /*:<sflnum>*
@@ -3160,6 +3161,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:sta windows.txt /*:sta* :sta windows.txt /*:sta*
:stag windows.txt /*:stag* :stag windows.txt /*:stag*
:star repeat.txt /*:star* :star repeat.txt /*:star*
:star-visual-range cmdline.txt /*:star-visual-range*
:start insert.txt /*:start* :start insert.txt /*:start*
:startgreplace insert.txt /*:startgreplace* :startgreplace insert.txt /*:startgreplace*
:startinsert insert.txt /*:startinsert* :startinsert insert.txt /*:startinsert*
@@ -3614,6 +3616,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
<cexpr> cmdline.txt /*<cexpr>* <cexpr> cmdline.txt /*<cexpr>*
<cfile> cmdline.txt /*<cfile>* <cfile> cmdline.txt /*<cfile>*
<character> intro.txt /*<character>* <character> intro.txt /*<character>*
<client> cmdline.txt /*<client>*
<count> map.txt /*<count>* <count> map.txt /*<count>*
<cword> cmdline.txt /*<cword>* <cword> cmdline.txt /*<cword>*
<f-args> map.txt /*<f-args>* <f-args> map.txt /*<f-args>*
@@ -3643,6 +3646,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
<mods> map.txt /*<mods>* <mods> map.txt /*<mods>*
<nomodeline> autocmd.txt /*<nomodeline>* <nomodeline> autocmd.txt /*<nomodeline>*
<q-args> map.txt /*<q-args>* <q-args> map.txt /*<q-args>*
<q-mods> map.txt /*<q-mods>*
<range> map.txt /*<range>* <range> map.txt /*<range>*
<reg> map.txt /*<reg>* <reg> map.txt /*<reg>*
<register> map.txt /*<register>* <register> map.txt /*<register>*
@@ -7751,6 +7755,7 @@ matchaddpos() eval.txt /*matchaddpos()*
matcharg() eval.txt /*matcharg()* matcharg() eval.txt /*matcharg()*
matchdelete() eval.txt /*matchdelete()* matchdelete() eval.txt /*matchdelete()*
matchend() eval.txt /*matchend()* matchend() eval.txt /*matchend()*
matchfuzzy() eval.txt /*matchfuzzy()*
matchit-install usr_05.txt /*matchit-install* matchit-install usr_05.txt /*matchit-install*
matchlist() eval.txt /*matchlist()* matchlist() eval.txt /*matchlist()*
matchparen pi_paren.txt /*matchparen* matchparen pi_paren.txt /*matchparen*
@@ -7929,7 +7934,6 @@ netrw-browser-options pi_netrw.txt /*netrw-browser-options*
netrw-browser-settings pi_netrw.txt /*netrw-browser-settings* netrw-browser-settings pi_netrw.txt /*netrw-browser-settings*
netrw-browser-var pi_netrw.txt /*netrw-browser-var* netrw-browser-var pi_netrw.txt /*netrw-browser-var*
netrw-browsing pi_netrw.txt /*netrw-browsing* netrw-browsing pi_netrw.txt /*netrw-browsing*
netrw-c pi_netrw.txt /*netrw-c*
netrw-c-tab pi_netrw.txt /*netrw-c-tab* netrw-c-tab pi_netrw.txt /*netrw-c-tab*
netrw-cB pi_netrw.txt /*netrw-cB* netrw-cB pi_netrw.txt /*netrw-cB*
netrw-cadaver pi_netrw.txt /*netrw-cadaver* netrw-cadaver pi_netrw.txt /*netrw-cadaver*
@@ -8392,6 +8396,7 @@ popup-callback popup.txt /*popup-callback*
popup-close popup.txt /*popup-close* popup-close popup.txt /*popup-close*
popup-examples popup.txt /*popup-examples* popup-examples popup.txt /*popup-examples*
popup-filter popup.txt /*popup-filter* popup-filter popup.txt /*popup-filter*
popup-filter-errors popup.txt /*popup-filter-errors*
popup-filter-mode popup.txt /*popup-filter-mode* popup-filter-mode popup.txt /*popup-filter-mode*
popup-function-details popup.txt /*popup-function-details* popup-function-details popup.txt /*popup-function-details*
popup-functions popup.txt /*popup-functions* popup-functions popup.txt /*popup-functions*
@@ -10029,6 +10034,8 @@ vim.vim syntax.txt /*vim.vim*
vim7 version7.txt /*vim7* vim7 version7.txt /*vim7*
vim8 version8.txt /*vim8* vim8 version8.txt /*vim8*
vim9 vim9.txt /*vim9* vim9 vim9.txt /*vim9*
vim9-classes vim9.txt /*vim9-classes*
vim9-const vim9.txt /*vim9-const*
vim9-declaration vim9.txt /*vim9-declaration* vim9-declaration vim9.txt /*vim9-declaration*
vim9-declarations usr_46.txt /*vim9-declarations* vim9-declarations usr_46.txt /*vim9-declarations*
vim9-differences vim9.txt /*vim9-differences* vim9-differences vim9.txt /*vim9-differences*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2020 Sep 07 *todo.txt* For Vim version 8.2. Last change: 2020 Sep 19
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -40,24 +40,13 @@ browser use: https://github.com/vim/vim/issues/1234
Why does Test_invalid_sid() not work in the GUI? Why does Test_invalid_sid() not work in the GUI?
Making everything work: Add matchfuzzy() and matchfuzzypos() Yegappan, #6947
- Should :const work the same as in legacy script? should be ready now
Or should it work like in Typescript: only the variable is fixed, not the
value itself.
Then use ":const!" to also fix/lock the value?
Typescript uses "as const", which is weird.
Alternative: const var = <const>value
looks quite strange quite verbose
But can be used in several places:
SomeFunc(<const>[1, 2, 3])
In Vim this basically means "lock this value".
How about:
SomeFunc(<const>[[1], [2], [3]]) # are sub-lists immutable?
SomeFunc(<const>myList) # is myList mutable afterwards?
- Run the same tests in :def and Vim9 script, like in Test_expr7_not() Making everything work:
- :put with a "=" register argument doesn't work, need to find the expression - Fix memory leak in test_vim9_func (through compile_nested_function and
and compile it. (#6397) get_lambda_tv())
- Fix memory leaks in test_vim9_script
- At the Vim9 script level, keep script variables local to the block they are - At the Vim9 script level, keep script variables local to the block they are
declared in, like in Javascript (using :let). declared in, like in Javascript (using :let).
-> Need to remember what variables were declared and delete them when -> Need to remember what variables were declared and delete them when
@@ -80,6 +69,7 @@ Making everything work:
assertfail assertfail
unknown unknown
endassertfail E99:.*unknown endassertfail E99:.*unknown
- Run the same tests in :def and Vim9 script, like in Test_expr7_not()
- In autocmd: use legacy syntax, not whatever the current script uses? - In autocmd: use legacy syntax, not whatever the current script uses?
- need to check type when a declaration specifies a type: #6507 - need to check type when a declaration specifies a type: #6507
let nr: number = 'asdf' let nr: number = 'asdf'
@@ -87,6 +77,9 @@ Making everything work:
the script-local function, not a global one. the script-local function, not a global one.
- Make sure that where a callback is expected a function can be used (without - Make sure that where a callback is expected a function can be used (without
quotes). E.g. sort() and map(). Also at the script level. quotes). E.g. sort() and map(). Also at the script level.
- assignment to more complex lval: list[1][2][3] = 8
- ":put" with ISN_PUT does not handle range correctly, e.g. ":$-2put".
Add command to parse range at runtime?
- Make map() give an error if the resulting type is wrong. - Make map() give an error if the resulting type is wrong.
Add mapnew() to create a new List/Dict for the result, which can have a Add mapnew() to create a new List/Dict for the result, which can have a
different value type. different value type.
@@ -108,6 +101,9 @@ Making everything work:
- Test that a function defined inside a :def function is local to that - Test that a function defined inside a :def function is local to that
function, g: functions can be defined and script-local functions cannot be function, g: functions can be defined and script-local functions cannot be
defined. defined.
- Does this work already: can use func as reference:
def SomeFunc() ...
map(list, SomeFunc)
- Support passing v:none to use the default argument value. (#6504) - Support passing v:none to use the default argument value. (#6504)
- make 0 == 'string' fail on the script level, like inside :def. - make 0 == 'string' fail on the script level, like inside :def.
- Check that when using a user function name without prefix, it does not find - Check that when using a user function name without prefix, it does not find
@@ -123,10 +119,6 @@ Making everything work:
- Compile redir to local variable: var_redir_start(). - Compile redir to local variable: var_redir_start().
- Compile builtin functions that access local variables: - Compile builtin functions that access local variables:
islocked() islocked()
- possible memory leak in test_vim9_func through compile_nested_function.
- memory leaks in test_vim9_expr
- memory leaks in test_vim9_script
- memory leaks in test_vim9_cmd
- When evaluating constants for script variables, some functions could work: - When evaluating constants for script variables, some functions could work:
has('asdf'), len('string') has('asdf'), len('string')
- Implement "as Name" in "import Item as Name from ..." - Implement "as Name" in "import Item as Name from ..."
@@ -151,24 +143,23 @@ Also:
- Make Foo.Bar() work to call the dict function. (#5676) - Make Foo.Bar() work to call the dict function. (#5676)
- Error in any command in "vim9script" aborts sourcing. - Error in any command in "vim9script" aborts sourcing.
- Find a way to test expressions in legacy and Vim9 script without duplication - Find a way to test expressions in legacy and Vim9 script without duplication
- Fix memory leaks for test_vim9_disassemble, test_vim9_expr, test_vim9_script
- Test each level of expressions properly, with type checking - Test each level of expressions properly, with type checking
- Test try/catch and throw better, also nested. - Test try/catch and throw better, also nested.
Test return inside try/finally jumps to finally and then returns. Test return inside try/finally jumps to finally and then returns.
- can use func as reference:
def SomeFunc() ...
map(list, SomeFunc)
- Test: Function declared inside a :def function is local, disappears at the - Test: Function declared inside a :def function is local, disappears at the
end of the function. Unless g: is used, just like with variables. end of the function. Unless g: is used, just like with variables.
- implement :type - implement :type
- import type declaration? - import type declaration?
- implement class - Future work: See |vim9-classes|
- implement interface
- predefined class: Promise<T>
- implement enum - implement enum
- Make accessing varargs faster: arg[expr] - Make accessing varargs faster: arg[expr]
EVAL expr EVAL expr
LOADVARARG (varags idx) LOADVARARG (varags idx)
- Make debugging work - at least per function. Need to recompile a function
to step through it line-by-line? Evaluate the stack and variables on the
stack?
- Make profiling work - Add ISN_PROFILE instructions after every line?
- List commands when 'verbose' is set or :verbose is used.
Further improvements: Further improvements:
- compile options that are an expression, e.g. "expr:" in 'spellsuggest', - compile options that are an expression, e.g. "expr:" in 'spellsuggest',
'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert', 'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert',
@@ -292,7 +283,7 @@ Terminal emulator window:
Error numbers available: E653 Error numbers available: E653
Patch to implement the vimtutor with a plugin: #6414 Patch to implement the vimtutor with a plugin: #6414
Was originally writtten by Felipe Morales. Was originally written by Felipe Morales.
Remove SPACE_IN_FILENAME ? It is only used for completion. Remove SPACE_IN_FILENAME ? It is only used for completion.
@@ -303,6 +294,9 @@ with 'termguicolors'. #1740
Patch for blockwise paste reporting changes: #6660. Patch for blockwise paste reporting changes: #6660.
Expanding <mods> should put the tab number from cmdmod.tab before "tab".
Any way to convert "$" back by using a special value? (#6901)
Can we detect true color support? https://gist.github.com/XVilka/8346728 Can we detect true color support? https://gist.github.com/XVilka/8346728
Try setting a color then request the current color, like using t_u7. Try setting a color then request the current color, like using t_u7.
@@ -397,6 +391,9 @@ When 'fileignorecase' is set ":e testfile.c" works to edit TestFile.c, but
":find testfile.c" does not ignore case. ":find testfile.c" does not ignore case.
Might be related to #6088. Might be related to #6088.
Error for reverse range when using :vimgrep in file "[id-01] file.txt".
(#6919)
When changing the crypt key the buffer should be considered modified. When changing the crypt key the buffer should be considered modified.
Like when changing 'fileformat'. Save the old key in save_file_ff(). Like when changing 'fileformat'. Save the old key in save_file_ff().
(Ninu-Ciprian Marginean) (Ninu-Ciprian Marginean)
@@ -514,7 +511,7 @@ Better: use the "z" prefix. or ]t) and [t(.
Modeless selection doesn't work in gvim. (#4783) Modeless selection doesn't work in gvim. (#4783)
Caused by patch 8.1.1534. Caused by patch 8.1.1534.
Visual highlight not removed when 'dipslay' is "lastline" and line doesn't Visual highlight not removed when 'display' is "lastline" and line doesn't
fit. (Kevin Lawler, #4457) fit. (Kevin Lawler, #4457)
Current position in the changelist should be local to the buffer. (#2173) Current position in the changelist should be local to the buffer. (#2173)

View File

@@ -42445,7 +42445,7 @@ Files: src/filepath.c, src/testdir/test_fnamemodify.vim
Patch 8.2.0216 Patch 8.2.0216
Problem: Several Vim9 instructions are not tested. Problem: Several Vim9 instructions are not tested.
Solution: Add more tests. Fix :disassamble output. Make catch with pattern Solution: Add more tests. Fix :disassemble output. Make catch with pattern
work. work.
Files: src/testdir/test_vim9_script.vim, src/vim9execute.c, Files: src/testdir/test_vim9_script.vim, src/vim9execute.c,
src/vim9compile.c src/vim9compile.c
@@ -42665,7 +42665,7 @@ Solution: Change to int. (Mike Williams)
Files: src/vim9compile.c Files: src/vim9compile.c
Patch 8.2.0253 Patch 8.2.0253
Problem: Crash when using :disassamble without argument. (Dhiraj Mishra) Problem: Crash when using :disassemble without argument. (Dhiraj Mishra)
Solution: Check for missing argument. (Dominique Pellé, closes #5635, Solution: Check for missing argument. (Dominique Pellé, closes #5635,
closes #5637) closes #5637)
Files: src/vim9execute.c, src/testdir/test_vim9_disassemble.vim, Files: src/vim9execute.c, src/testdir/test_vim9_disassemble.vim,

View File

@@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2020 Sep 13 *vim9.txt* For Vim version 8.2. Last change: 2020 Sep 17
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -19,6 +19,7 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
3. New style functions |fast-functions| 3. New style functions |fast-functions|
4. Types |vim9-types| 4. Types |vim9-types|
5. Namespace, Import and Export |vim9script| 5. Namespace, Import and Export |vim9script|
6. Future work: classes |vim9-classes|
9. Rationale |vim9-rationale| 9. Rationale |vim9-rationale|
@@ -49,13 +50,14 @@ errors are handled.
The Vim9 script syntax and semantics are used in: The Vim9 script syntax and semantics are used in:
- a function defined with the `:def` command - a function defined with the `:def` command
- a script file where the first command is `vim9script` - a script file where the first command is `vim9script`
- an autocommand defined in the context of these - an autocommand defined in the context of the above
When using `:function` in a Vim9 script file the legacy syntax is used. When using `:function` in a Vim9 script file the legacy syntax is used.
However, this can be confusing and is therefore discouraged. However, this can be confusing and is therefore discouraged.
Vim9 script and legacy Vim script can be mixed. There is no requirement to Vim9 script and legacy Vim script can be mixed. There is no requirement to
rewrite old scripts, they keep working as before. rewrite old scripts, they keep working as before. You may want to use a few
`:def` functions for code that needs to be fast.
============================================================================== ==============================================================================
@@ -834,6 +836,8 @@ In case the name is ambiguous, another name can be specified: >
To import all exported items under a specific identifier: > To import all exported items under a specific identifier: >
import * as That from 'thatscript.vim' import * as That from 'thatscript.vim'
{not implemented yet: using "This as That"}
Then you can use "That.EXPORTED_CONST", "That.someValue", etc. You are free Then you can use "That.EXPORTED_CONST", "That.someValue", etc. You are free
to choose the name "That", but it is highly recommended to use the name of the to choose the name "That", but it is highly recommended to use the name of the
script file to avoid confusion. script file to avoid confusion.
@@ -900,6 +904,37 @@ If an `import` statement is used in legacy Vim script, the script-local "s:"
namespace will be used for the imported item, even when "s:" is not specified. namespace will be used for the imported item, even when "s:" is not specified.
==============================================================================
6. Future work: classes *vim9-classes*
Above "class" was mentioned a few times, but it has not been implemented yet.
Most of Vim9 script can be created without this funcionality, and since
implementing classes is going to be a lot of work, it is left for the future.
For now we'll just make sure classes can be added later.
Thoughts:
- `class` / `endclass`, everything in one file
- Class names are always CamelCase
- Single constructor
- Single inheritance with `class ThisClass extends BaseClass`
- `abstract class`
- `interface` (Abstract class without any implementation)
- `class SomeClass implements SomeInterface`
- Generics for class: `class <Tkey, Tentry>`
- Generics for function: `def <Tkey> GetLast(key: Tkey)`
Again, much of this is from TypeScript.
Some things that look like good additions:
- Use a class as an interface (like Dart)
- Extend a class with methods, using an import (like Dart)
An important class that will be provided is "Promise". Since Vim is single
threaded, connecting asynchronous operations is a natural way of allowing
plugins to do their work without blocking the user. It's a uniform way to
invoke callbacks and handle timeouts and errors.
============================================================================== ==============================================================================
9. Rationale *vim9-rationale* 9. Rationale *vim9-rationale*
@@ -933,36 +968,37 @@ instruction, at execution time the instruction would have to inspect the type
of the arguments and decide what kind of addition to do. And when the of the arguments and decide what kind of addition to do. And when the
type is dictionary throw an error. If the types are known to be numbers then type is dictionary throw an error. If the types are known to be numbers then
an "add number" instruction can be used, which is faster. The error can be an "add number" instruction can be used, which is faster. The error can be
given at compile time, no error handling is needed at runtime. given at compile time, no error handling is needed at runtime, adding two
numbers cannot fail.
The syntax for types is similar to Java, since it is easy to understand and The syntax for types is similar to Java, since it is easy to understand and
widely used. The type names are what were used in Vim before, with some widely used. The type names are what were used in Vim before, with some
additions such as "void" and "bool". additions such as "void" and "bool".
Compiling functions early ~ Removing clutter and weirdness ~
Functions are compiled when called or when `:defcompile` is used. Why not Once decided that `:def` functions have different syntax than legacy functions,
compile them early, so that syntax and type errors are reported early? we are free to add improvements to make the code more familiar for users who
know popular programming languages. In other words: remove weird things that
only Vim uses.
The functions can't be compiled right away when encountered, because there may We can also remove clutter, mainly things that were done to make Vim script
be forward references to functions defined later. Consider defining functions backwards compatible with good old Vi commands.
A, B and C, where A calls B, B calls C, and C calls A again. It's impossible
to reorder the functions to avoid forward references.
An alternative would be to first scan through the file to locate items and Examples:
figure out their type, so that forward references are found, and only then - Drop `:call` for calling a function and `:eval` for manipulating data.
execute the script and compile the functions. This means the script has to be - Drop using a leading backslash for line continuation, automatically figure
parsed twice, which is slower, and some conditions at the script level, such out where an expression ends.
as checking if a feature is supported, are hard to use. An attempt was made
to see if it works, but it turned out to be impossible to make work nicely.
It would be possible to compile all the functions at the end of the script. However, this does require that some things need to change:
The drawback is that if a function never gets called, the overhead of - Comments start with # instead of ", to avoid confusing them with strings.
compiling it counts anyway. Since startup speed is very important, in most - Ex command ranges need to be prefixed with a colon, to avoid confusion with
cases it's better to do it later and accept that syntax and type errors are expressions (single quote can be a string or a mark, "/" can be divide or a
only reported then. In case these errors should be found early, e.g. when search command, etc.).
testing, the `:defcompile` command will help out.
Goal is to limit the differences. A good criteria is that when the old syntax
is used you are very likely to get an error message.
TypeScript syntax and semantics ~ TypeScript syntax and semantics ~
@@ -992,16 +1028,23 @@ Vim9 script works like JavaScript/TypeScript, keep the value: >
... ...
let result = value || 0 # result == 44 let result = value || 0 # result == 44
Another reason why TypeScript can be used as an example for Vim9 script is the
mix of static typing (a variable always has a known value type) and dynamic
typing (a variable can have different types, this hanges at runtime). Since
legacy Vim script is dynamically typed and a lot of existing functionality
(esp. builtin functions) depends on that, while static typing allows for much
faster execution, we need to have this mix in Vim9 script.
There is no intention to completely match TypeScript syntax and semantics. We There is no intention to completely match TypeScript syntax and semantics. We
just want to take those parts that we can use for Vim and we expect Vim users just want to take those parts that we can use for Vim and we expect Vim users
will be happy with. TypeScript is a complex language with its own advantages will be happy with. TypeScript is a complex language with its own history,
and disadvantages. To get an idea of the disadvantages read the book: advantages and disadvantages. To get an idea of the disadvantages read the
"JavaScript: The Good Parts". Or find the article "TypeScript: the good book: "JavaScript: The Good Parts". Or find the article "TypeScript: the good
parts" and read the "Things to avoid" section. parts" and read the "Things to avoid" section.
People used to other languages (Java, Python, etc.) will also find things in People familiar with other languages (Java, Python, etc.) will also find
TypeScript that they do not like or do not understand. We'll try to avoid things in TypeScript that they do not like or do not understand. We'll try to
those things. avoid those things.
Specific items from TypeScript we avoid: Specific items from TypeScript we avoid:
- Overloading "+", using it both for addition and string concatenation. This - Overloading "+", using it both for addition and string concatenation. This
@@ -1054,24 +1097,56 @@ globally can be used, not the exported items. Alternatives considered:
Note that you can also use `:import` in legacy Vim script, see above. Note that you can also use `:import` in legacy Vim script, see above.
Classes ~ Compiling functions early ~
Functions are compiled when called or when `:defcompile` is used. Why not
compile them early, so that syntax and type errors are reported early?
The functions can't be compiled right away when encountered, because there may
be forward references to functions defined later. Consider defining functions
A, B and C, where A calls B, B calls C, and C calls A again. It's impossible
to reorder the functions to avoid forward references.
An alternative would be to first scan through the file to locate items and
figure out their type, so that forward references are found, and only then
execute the script and compile the functions. This means the script has to be
parsed twice, which is slower, and some conditions at the script level, such
as checking if a feature is supported, are hard to use. An attempt was made
to see if it works, but it turned out to be impossible to make work nicely.
It would be possible to compile all the functions at the end of the script.
The drawback is that if a function never gets called, the overhead of
compiling it counts anyway. Since startup speed is very important, in most
cases it's better to do it later and accept that syntax and type errors are
only reported then. In case these errors should be found early, e.g. when
testing, the `:defcompile` command will help out.
Why not use an embeded language? ~
Vim supports interfaces to Perl, Python, Lua, Tcl and a few others. But Vim supports interfaces to Perl, Python, Lua, Tcl and a few others. But
these interfaces have never become widespread. When Vim 9 was designed a these interfaces have never become widely used, for various reasons. When
decision was made to phase out these interfaces and concentrate on Vim script, Vim9 was designed a decision was made to make these interfaces lower priority
while encouraging plugin authors to write code in any language and run it as and concentrate on Vim script.
an external tool, using jobs and channels.
Still, using an external tool has disadvantages. An alternative is to convert Still, plugin writers may find other languages more familiar, want to use
existing libraries or see a performance benefit. We encourage plugin authors
to write code in any language and run it as an external tool, using jobs and
channels. We can try to make this easier somehow.
Using an external tool also has disadvantages. An alternative is to convert
the tool into Vim script. For that to be possible without too much the tool into Vim script. For that to be possible without too much
translation, and keeping the code fast at the same time, the constructs of the translation, and keeping the code fast at the same time, the constructs of the
tool need to be supported. Since most languages support classes the lack of tool need to be supported. Since most languages support classes the lack of
support for classes in Vim is then a problem. support for classes in Vim is then a problem.
Previously Vim supported a kind-of object oriented programming by adding
methods to a dictionary. With some care this could be made to work, but it Classes ~
does not look like real classes. On top of that, it's very slow, because of
the use of dictionaries. Vim supports a kind-of object oriented programming by adding methods to a
dictionary. With some care this can be made to work, but it does not look
like real classes. On top of that, it's quite slow, because of the use of
dictionaries.
The support of classes in Vim9 script is a "minimal common functionality" of The support of classes in Vim9 script is a "minimal common functionality" of
class support in most languages. It works much like Java, which is the most class support in most languages. It works much like Java, which is the most

View File

@@ -4,9 +4,9 @@
" Contributors: Edwin Fine <efine145_nospam01 at usa dot net> " Contributors: Edwin Fine <efine145_nospam01 at usa dot net>
" Pawel 'kTT' Salata <rockplayer.pl@gmail.com> " Pawel 'kTT' Salata <rockplayer.pl@gmail.com>
" Ricardo Catalinas Jiménez <jimenezrick@gmail.com> " Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
" Last Update: 2013-Jul-21 " Last Update: 2020-Jun-11
" License: Vim license " License: Vim license
" URL: https://github.com/hcs42/vim-erlang " URL: https://github.com/vim-erlang/vim-erlang-runtime
" Note About Usage: " Note About Usage:
" This indentation script works best with the Erlang syntax file created by " This indentation script works best with the Erlang syntax file created by
@@ -56,7 +56,8 @@ endfunction
" Line tokenizer library {{{1 " Line tokenizer library {{{1
" ====================== " ======================
" Indtokens are "indentation tokens". " Indtokens are "indentation tokens". See their exact format in the
" documentaiton of the s:GetTokensFromLine function.
" Purpose: " Purpose:
" Calculate the new virtual column after the given segment of a line. " Calculate the new virtual column after the given segment of a line.
@@ -119,9 +120,10 @@ endfunction
" Returns: " Returns:
" indtokens = [indtoken] " indtokens = [indtoken]
" indtoken = [token, vcol, col] " indtoken = [token, vcol, col]
" token = string (examples: 'begin', '<variable>', '}') " token = string (examples: 'begin', '<quoted_atom>', '}')
" vcol = integer (the virtual column of the first character of the token) " vcol = integer (the virtual column of the first character of the token;
" col = integer " counting starts from 0)
" col = integer (counting starts from 0)
function! s:GetTokensFromLine(line, string_continuation, atom_continuation, function! s:GetTokensFromLine(line, string_continuation, atom_continuation,
\tabstop) \tabstop)
@@ -386,9 +388,12 @@ endfunction
" lnum: integer " lnum: integer
" direction: 'up' | 'down' " direction: 'up' | 'down'
" Returns: " Returns:
" result: [] -- the result is an empty list if we hit the beginning or end " result: [[], 0, 0]
" of the file " -- the result is an empty list if we hit the beginning or end of
" | indtoken " the file
" | [indtoken, lnum, i]
" -- the content, lnum and token index of the next (or previous)
" indtoken
function! s:FindIndToken(lnum, dir) function! s:FindIndToken(lnum, dir)
let lnum = a:lnum let lnum = a:lnum
while 1 while 1
@@ -396,9 +401,12 @@ function! s:FindIndToken(lnum, dir)
let [lnum, indtokens] = s:TokenizeLine(lnum, a:dir) let [lnum, indtokens] = s:TokenizeLine(lnum, a:dir)
if lnum ==# 0 if lnum ==# 0
" We hit the beginning or end of the file " We hit the beginning or end of the file
return [] return [[], 0, 0]
elseif !empty(indtokens) elseif !empty(indtokens)
return indtokens[a:dir ==# 'up' ? -1 : 0] " We found a non-empty line. If we were moving up, we return the last
" token of this line. Otherwise we return the first token if this line.
let i = (a:dir ==# 'up' ? len(indtokens) - 1 : 0)
return [indtokens[i], lnum, i]
endif endif
endwhile endwhile
endfunction endfunction
@@ -417,7 +425,7 @@ function! s:PrevIndToken(lnum, i)
" If the current line has a previous token, return that " If the current line has a previous token, return that
if a:i > 0 if a:i > 0
return s:all_tokens[a:lnum][a:i - 1] return [s:all_tokens[a:lnum][a:i - 1], a:lnum, a:i - 1]
else else
return s:FindIndToken(a:lnum, 'up') return s:FindIndToken(a:lnum, 'up')
endif endif
@@ -437,7 +445,7 @@ function! s:NextIndToken(lnum, i)
" If the current line has a next token, return that " If the current line has a next token, return that
if len(s:all_tokens[a:lnum]) > a:i + 1 if len(s:all_tokens[a:lnum]) > a:i + 1
return s:all_tokens[a:lnum][a:i + 1] return [s:all_tokens[a:lnum][a:i + 1], a:lnum, a:i + 1]
else else
return s:FindIndToken(a:lnum, 'down') return s:FindIndToken(a:lnum, 'down')
endif endif
@@ -518,7 +526,9 @@ endfunction
" ok. % IsLineAtomContinuation = false " ok. % IsLineAtomContinuation = false
function! s:IsLineAtomContinuation(lnum) function! s:IsLineAtomContinuation(lnum)
if has('syntax_items') if has('syntax_items')
return synIDattr(synID(a:lnum, 1, 0), 'name') =~# '^erlangQuotedAtom' let syn_name = synIDattr(synID(a:lnum, 1, 0), 'name')
return syn_name =~# '^erlangQuotedAtom' ||
\ syn_name =~# '^erlangQuotedRecord'
else else
return 0 return 0
endif endif
@@ -535,7 +545,7 @@ endfunction
" is_standalone: bool " is_standalone: bool
function! s:IsCatchStandalone(lnum, i) function! s:IsCatchStandalone(lnum, i)
call s:Log(' IsCatchStandalone called: lnum=' . a:lnum . ', i=' . a:i) call s:Log(' IsCatchStandalone called: lnum=' . a:lnum . ', i=' . a:i)
let prev_indtoken = s:PrevIndToken(a:lnum, a:i) let [prev_indtoken, _, _] = s:PrevIndToken(a:lnum, a:i)
" If we hit the beginning of the file, it is not a catch in a try block " If we hit the beginning of the file, it is not a catch in a try block
if prev_indtoken == [] if prev_indtoken == []
@@ -544,7 +554,7 @@ function! s:IsCatchStandalone(lnum, i)
let prev_token = prev_indtoken[0] let prev_token = prev_indtoken[0]
if prev_token =~# '[A-Z_@0-9]' if prev_token =~# '^[A-Z_@0-9]'
let is_standalone = 0 let is_standalone = 0
elseif prev_token =~# '[a-z]' elseif prev_token =~# '[a-z]'
if index(['after', 'and', 'andalso', 'band', 'begin', 'bnot', 'bor', 'bsl', if index(['after', 'and', 'andalso', 'band', 'begin', 'bnot', 'bor', 'bsl',
@@ -659,11 +669,14 @@ endfunction
" stack: [token] " stack: [token]
" token: string " token: string
" stored_vcol: integer " stored_vcol: integer
" lnum: the line number of the "end of clause" mark (or 0 if we hit the
" beginning of the file)
" i: the index of the "end of clause" token within its own line
" Returns: " Returns:
" result: [should_return, indent] " result: [should_return, indent]
" should_return: bool -- if true, the caller should return `indent` to Vim " should_return: bool -- if true, the caller should return `indent` to Vim
" indent -- integer " indent -- integer
function! s:BeginningOfClauseFound(stack, token, stored_vcol) function! s:BeginningOfClauseFound(stack, token, stored_vcol, lnum, i)
if !empty(a:stack) && a:stack[0] ==# 'when' if !empty(a:stack) && a:stack[0] ==# 'when'
call s:Log(' BeginningOfClauseFound: "when" found in stack') call s:Log(' BeginningOfClauseFound: "when" found in stack')
call s:Pop(a:stack) call s:Pop(a:stack)
@@ -681,13 +694,45 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol)
return [1, a:stored_vcol + shiftwidth()] return [1, a:stored_vcol + shiftwidth()]
elseif a:stack[0] ==# ';' elseif a:stack[0] ==# ';'
call s:Pop(a:stack) call s:Pop(a:stack)
if empty(a:stack)
call s:Log(' Stack is ["->", ";"], so LTI is in a function head ' . if !empty(a:stack)
\'-> return')
return [0, a:stored_vcol]
else
return [1, s:UnexpectedToken(a:token, a:stack)] return [1, s:UnexpectedToken(a:token, a:stack)]
endif endif
if a:lnum ==# 0
" Set lnum and i to be NextIndToken-friendly
let lnum = 1
let i = -1
else
let lnum = a:lnum
let i = a:i
endif
" Are we after a "-spec func() ...;" clause?
let [next1_indtoken, next1_lnum, next1_i] = s:NextIndToken(lnum, i)
if !empty(next1_indtoken) && next1_indtoken[0] =~# '-'
let [next2_indtoken, next2_lnum, next2_i] =
\s:NextIndToken(next1_lnum, next1_i)
if !empty(next2_indtoken) && next2_indtoken[0] =~# 'spec'
let [next3_indtoken, next3_lnum, next3_i] =
\s:NextIndToken(next2_lnum, next2_i)
if !empty(next3_indtoken)
let [next4_indtoken, next4_lnum, next4_i] =
\s:NextIndToken(next3_lnum, next3_i)
if !empty(next4_indtoken)
" Yes, we are.
call s:Log(' Stack is ["->", ";"], so LTI is in a "-spec" ' .
\'attribute -> return')
return [1, next4_indtoken[1]]
endif
endif
endif
endif
call s:Log(' Stack is ["->", ";"], so LTI is in a function head ' .
\'-> return')
return [1, a:stored_vcol]
else else
return [1, s:UnexpectedToken(a:token, a:stack)] return [1, s:UnexpectedToken(a:token, a:stack)]
endif endif
@@ -714,7 +759,7 @@ function! s:SearchEndPair(lnum, curr_col)
return s:SearchPair( return s:SearchPair(
\ a:lnum, a:curr_col, \ a:lnum, a:curr_col,
\ '\C\<\%(case\|try\|begin\|receive\|if\)\>\|' . \ '\C\<\%(case\|try\|begin\|receive\|if\)\>\|' .
\ '\<fun\>\%(\s\|\n\|%.*$\)*(', \ '\<fun\>\%(\s\|\n\|%.*$\|[A-Z_@][a-zA-Z_@]*\)*(',
\ '', \ '',
\ '\<end\>') \ '\<end\>')
endfunction endfunction
@@ -756,7 +801,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
" Hit the start of the file " Hit the start of the file
if lnum ==# 0 if lnum ==# 0
let [ret, res] = s:BeginningOfClauseFound(stack, 'beginning_of_file', let [ret, res] = s:BeginningOfClauseFound(stack, 'beginning_of_file',
\stored_vcol) \stored_vcol, 0, 0)
if ret | return res | endif if ret | return res | endif
return 0 return 0
@@ -775,7 +820,8 @@ function! s:ErlangCalcIndent2(lnum, stack)
endif endif
if token ==# '<end_of_clause>' if token ==# '<end_of_clause>'
let [ret, res] = s:BeginningOfClauseFound(stack, token, stored_vcol) let [ret, res] = s:BeginningOfClauseFound(stack, token, stored_vcol,
\lnum, i)
if ret | return res | endif if ret | return res | endif
if stored_vcol ==# -1 if stored_vcol ==# -1
@@ -787,7 +833,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
endif endif
elseif stack == ['prev_term_plus'] elseif stack == ['prev_term_plus']
if token =~# '[a-zA-Z_@]' || if token =~# '[a-zA-Z_@#]' ||
\ token ==# '<string>' || token ==# '<string_start>' || \ token ==# '<string>' || token ==# '<string_start>' ||
\ token ==# '<quoted_atom>' || token ==# '<quoted_atom_start>' \ token ==# '<quoted_atom>' || token ==# '<quoted_atom_start>'
call s:Log(' previous token found: curr_vcol + plus = ' . call s:Log(' previous token found: curr_vcol + plus = ' .
@@ -917,9 +963,18 @@ function! s:ErlangCalcIndent2(lnum, stack)
if ret | return res | endif if ret | return res | endif
elseif token ==# 'fun' elseif token ==# 'fun'
let next_indtoken = s:NextIndToken(lnum, i) let [next_indtoken, next_lnum, next_i] = s:NextIndToken(lnum, i)
call s:Log(' Next indtoken = ' . string(next_indtoken)) call s:Log(' Next indtoken = ' . string(next_indtoken))
if !empty(next_indtoken) && next_indtoken[0] =~# '^[A-Z_@]'
" The "fun" is followed by a variable, so we might have a named fun:
" "fun Fun() -> ok end". Thus we take the next token to decide
" whether this is a function definition ("fun()") or just a function
" reference ("fun Mod:Fun").
let [next_indtoken, _, _] = s:NextIndToken(next_lnum, next_i)
call s:Log(' Next indtoken = ' . string(next_indtoken))
endif
if !empty(next_indtoken) && next_indtoken[0] ==# '(' if !empty(next_indtoken) && next_indtoken[0] ==# '('
" We have an anonymous function definition " We have an anonymous function definition
" (e.g. "fun () -> ok end") " (e.g. "fun () -> ok end")
@@ -1327,6 +1382,26 @@ function! ErlangIndent()
return -1 return -1
endif endif
" If the line starts with the comment, and so is the previous non-blank line
if currline =~# '^\s*%'
let lnum = prevnonblank(v:lnum - 1)
if lnum ==# 0
call s:Log('First non-empty line of the file -> return 0.')
return 0
else
let ml = matchlist(getline(lnum), '^\(\s*\)%')
" If the previous line also starts with a comment, then return the same
" indentation that line has. Otherwise exit from this special "if" and
" don't care that the current line is a comment.
if !empty(ml)
let new_col = s:CalcVCol(ml[1], 0, len(ml[1]) - 1, 0, &tabstop)
call s:Log('Comment line after another comment line -> ' .
\'use same indent: ' . new_col)
return new_col
endif
endif
endif
let ml = matchlist(currline, let ml = matchlist(currline,
\'^\(\s*\)\(\%(end\|of\|catch\|after\)\>\|[)\]}]\|>>\)') \'^\(\s*\)\(\%(end\|of\|catch\|after\)\>\|[)\]}]\|>>\)')
@@ -1381,6 +1456,24 @@ function! ErlangIndent()
endfunction endfunction
" ErlangShowTokensInLine functions {{{1
" ================================
" These functions are useful during development.
function! ErlangShowTokensInLine(line)
echo "Line: " . a:line
let indtokens = s:GetTokensFromLine(a:line, 0, 0, &tabstop)
echo "Tokens:"
for it in indtokens
echo it
endfor
endfunction
function! ErlangShowTokensInCurrentLine()
return ErlangShowTokensInLine(getline('.'))
endfunction
" Cleanup {{{1 " Cleanup {{{1
" ======= " =======

View File

@@ -20,7 +20,7 @@
if &cp || exists("g:loaded_netrwPlugin") if &cp || exists("g:loaded_netrwPlugin")
finish finish
endif endif
let g:loaded_netrwPlugin = "v168" let g:loaded_netrwPlugin = "v170"
let s:keepcpo = &cpo let s:keepcpo = &cpo
set cpo&vim set cpo&vim
"DechoRemOn "DechoRemOn

View File

@@ -2,7 +2,7 @@
" Language: Erlang (http://www.erlang.org) " Language: Erlang (http://www.erlang.org)
" Maintainer: Csaba Hoch <csaba.hoch@gmail.com> " Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
" Contributor: Adam Rutkowski <hq@mtod.org> " Contributor: Adam Rutkowski <hq@mtod.org>
" Last Update: 2019-Jun-18 " Last Update: 2020-May-26
" License: Vim license " License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime " URL: https://github.com/vim-erlang/vim-erlang-runtime
@@ -44,7 +44,7 @@ setlocal iskeyword+=$,@-@
" Comments " Comments
syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlangTodo syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlangTodo
syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)' contained syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|param\|private\|equiv\|spec\|throws\)' contained
syn match erlangCommentAnnotation /`[^']*'/ contained syn match erlangCommentAnnotation /`[^']*'/ contained
syn keyword erlangTodo TODO FIXME XXX contained syn keyword erlangTodo TODO FIXME XXX contained
@@ -92,7 +92,7 @@ syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary
" Constants and Directives " Constants and Directives
syn match erlangUnknownAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\l[[:alnum:]_@]*' contains=erlangComment syn match erlangUnknownAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\l[[:alnum:]_@]*' contains=erlangComment
syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\)\>' contains=erlangComment syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\|optional_callbacks\)\>' contains=erlangComment
syn match erlangInclude '^\s*-\%(\s\|\n\|%.*\n\)*\%(include\|include_lib\)\>' contains=erlangComment syn match erlangInclude '^\s*-\%(\s\|\n\|%.*\n\)*\%(include\|include_lib\)\>' contains=erlangComment
syn match erlangRecordDef '^\s*-\%(\s\|\n\|%.*\n\)*record\>' contains=erlangComment syn match erlangRecordDef '^\s*-\%(\s\|\n\|%.*\n\)*record\>' contains=erlangComment
syn match erlangDefine '^\s*-\%(\s\|\n\|%.*\n\)*\%(define\|undef\)\>' contains=erlangComment syn match erlangDefine '^\s*-\%(\s\|\n\|%.*\n\)*\%(define\|undef\)\>' contains=erlangComment

View File

@@ -105,7 +105,7 @@ if !exists("did_drchip_netrwlist_syntax")
" special syntax highlighting (see :he g:netrw_special_syntax) " special syntax highlighting (see :he g:netrw_special_syntax)
hi default link netrwCoreDump WarningMsg hi default link netrwCoreDump WarningMsg
hi default link netrwData DiffChange hi default link netrwData Folded
hi default link netrwHdr netrwPlain hi default link netrwHdr netrwPlain
hi default link netrwLex netrwPlain hi default link netrwLex netrwPlain
hi default link netrwLib DiffChange hi default link netrwLib DiffChange