mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
parent
f5d1f0bf03
commit
d1a2523f6c
runtime
@ -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
|
||||||
|
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)
|
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"
|
||||||
@ -1212,6 +1237,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")
|
||||||
@ -1864,7 +1893,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
|
||||||
@ -3596,6 +3625,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
|
||||||
@ -4678,7 +4709,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= @@
|
||||||
@ -4707,13 +4738,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>"))
|
||||||
@ -4750,7 +4782,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()
|
||||||
@ -4785,7 +4817,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]
|
||||||
@ -4793,22 +4825,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>"))
|
||||||
@ -4817,6 +4854,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>"))
|
||||||
@ -4826,13 +4864,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.
|
||||||
@ -4845,19 +4884,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()
|
||||||
@ -4868,7 +4914,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
|
||||||
@ -5332,16 +5377,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\=://'
|
||||||
@ -5356,9 +5391,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")
|
||||||
@ -6053,10 +6098,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 =~ ','
|
||||||
@ -6066,7 +6111,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>"))
|
||||||
@ -6078,7 +6123,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'
|
||||||
@ -9161,6 +9206,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>"))
|
||||||
@ -9266,7 +9312,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
|
||||||
|
|
||||||
@ -9280,7 +9325,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
|
||||||
@ -9418,6 +9463,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>"))
|
||||||
|
|
||||||
@ -9678,7 +9724,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
|
||||||
@ -9731,7 +9777,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()
|
||||||
@ -11744,7 +11790,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
|
||||||
@ -11811,6 +11857,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
|
||||||
@ -11870,6 +11919,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
|
||||||
@ -11905,6 +11955,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
|
||||||
|
@ -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"
|
||||||
|
@ -758,7 +758,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
|
||||||
@ -830,34 +830,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>*
|
|
||||||
*:<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:
|
When executing a function, is replaced with:
|
||||||
@ -866,10 +869,12 @@ Note: these are typed literally, they are not special keys!
|
|||||||
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
|
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
|
||||||
Note that filename-modifiers are useless when <sfile> is
|
Note that filename-modifiers are useless when <sfile> is
|
||||||
used inside a function.
|
used inside a function.
|
||||||
|
*:<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*
|
||||||
|
@ -4638,7 +4638,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]
|
||||||
|
@ -1768,6 +1768,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.
|
||||||
@ -1780,6 +1781,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.
|
||||||
|
@ -1428,7 +1428,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|,
|
||||||
|
@ -2093,7 +2093,9 @@ 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.
|
||||||
|
|
||||||
*'encoding'* *'enc'* *E543*
|
*'encoding'* *'enc'* *E543*
|
||||||
'encoding' 'enc'
|
'encoding' 'enc'
|
||||||
@ -5903,8 +5905,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
|
||||||
|
@ -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|
|
||||||
@ -2752,7 +2758,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.
|
||||||
@ -3053,7 +3059,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
|
||||||
@ -3123,7 +3129,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|.
|
||||||
|
|
||||||
@ -3798,9 +3805,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
|
||||||
@ -3822,14 +3835,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.
|
||||||
@ -3837,17 +3870,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
|
||||||
@ -4305,4 +4355,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
|
||||||
|
@ -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
|
||||||
" =======
|
" =======
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user