0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

updated for version 7.0145

This commit is contained in:
Bram Moolenaar 2005-09-10 19:22:57 +00:00
parent 32330d3c67
commit 578b49e4f7
12 changed files with 692 additions and 335 deletions

View File

@ -1,8 +1,8 @@
" netrw.vim: Handles file transfer and remote directory listing across a network
" AUTOLOAD PORTION
" Last Change: Aug 19, 2005
" Date: Sep 09, 2005
" Version: 69
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" Version: 65
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
" Permission is hereby granted to use and distribute this code,
@ -17,7 +17,17 @@
" But be doers of the Word, and not only hearers, deluding your own selves {{{1
" (James 1:22 RSV)
" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
let s:keepcpo= &cpo
" Exception for &cp: {{{1
if &cp
finish
endif
if v:version < 700
echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw" | echohl None
finish
endif
let g:loaded_netrw = "v69"
let s:keepcpo = &cpo
set cpo&vim
" call Decho("doing autoload/netrw.vim")
@ -90,8 +100,10 @@ if !exists("g:netrw_sort_direction")
" alternative: reverse (z y x ...)
let g:netrw_sort_direction= "normal"
endif
if !exists("g:netrw_longlist") || g:netrw_longlist == 0
if !exists("g:netrw_longlist")
let g:netrw_longlist= 0
endif
if g:netrw_longlist == 0 || g:netrw_longlist == 2
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
else
let g:netrw_longlist= 1
@ -275,8 +287,9 @@ fun! netrw#NetRead(...)
" get name of a temporary file and set up shell-quoting character
let tmpfile= tempname()
let tmpfile= substitute(tmpfile,'\','/','ge')
if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
echohl Error | echo "***netrw*** your ".substitute(tmpfile,'[^/]\+$','','e')." directory is missing!"
echohl Error | echo "***netrw*** your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!"
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" call Dret("NetRead")
return
@ -661,11 +674,7 @@ fun! s:NetGetFile(readcmd, fname, method)
" call Dredir("ls!","starting buffer list")
" rename the current buffer to the temp file (ie. fname)
if v:version < 700
exe "file ".fname
else
keepalt exe "file ".fname
endif
" call Dredir("ls!","after renaming current buffer to <".fname.">")
" edit temporary file
@ -673,11 +682,7 @@ fun! s:NetGetFile(readcmd, fname, method)
" call Dredir("ls!","after editing temporary file")
" rename buffer back to remote filename
if v:version < 700
exe "file ".rfile
else
keepalt exe "file ".rfile
endif
" call Dredir("ls!","renaming buffer back to remote filename<".rfile.">")
let line1 = 1
let line2 = line("$")
@ -1015,7 +1020,8 @@ endfun
" g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted
" with the requested remote hostname first.
fun! s:NetBrowse(dirname)
" call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".g:netrw_longlist)
if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
" call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".w:netrw_longlist)
if exists("s:netrw_skipbrowse")
unlet s:netrw_skipbrowse
@ -1127,7 +1133,8 @@ fun! s:NetBrowse(dirname)
" call Decho("new path<".path.">")
" remote-read the requested file into current buffer
enew!
keepjumps keepalt enew!
set ma
" call Decho("exe file .method."://".user.machine."/".escape(path,s:netrw_cd_escape))
exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape)
exe "silent doau BufReadPre ".fname
@ -1138,7 +1145,7 @@ fun! s:NetBrowse(dirname)
" save certain window-oriented variables into buffer-oriented variables
call s:BufWinVars()
call s:NetOptionRestore()
setlocal nonu nomod noma
setlocal nomod
" call Dret("NetBrowse : file<".fname.">")
return
@ -1162,7 +1169,7 @@ fun! s:NetBrowse(dirname)
endif
else
" call Decho("generate a new buffer")
enew!
keepjumps keepalt enew!
endif
" rename file to reflect where its from
@ -1178,15 +1185,20 @@ fun! s:NetBrowse(dirname)
" set up buffer-local mappings
" call Decho("set up buffer-local mappings")
nnoremap <buffer> <silent> <cr> :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> <cr> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'../'))<cr>
nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
if w:netrw_longlist != 2
nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,expand("%"))<cr>
endif
nnoremap <buffer> <silent> Nb :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
nnoremap <buffer> <silent> NB :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(0)<cr>
nnoremap <buffer> <silent> i :call <SID>NetLongList(0)<cr>
nnoremap <buffer> <silent> o :call <SID>NetSplit(0)<cr>
nnoremap <buffer> <silent> O :call <SID>NetObtain()<cr>
nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,expand("%"))<cr>
nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
nnoremap <buffer> <silent> s :call <SID>NetSaveWordPosn()<bar>let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<bar>call <SID>NetRestoreWordPosn()<cr>
@ -1194,14 +1206,14 @@ fun! s:NetBrowse(dirname)
nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
nnoremap <buffer> <silent> v :call <SID>NetSplit(1)<cr>
nnoremap <buffer> <silent> x :exe "norm! 0"<bar>call <SID>NetBrowseX(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()),1)<cr>
nnoremap <buffer> <silent> <2-leftmouse> :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
exe 'nnoremap <buffer> <silent> <del> :exe "norm! 0"<bar>call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
nnoremap <buffer> <silent> x :call <SID>NetBrowseX(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()),1)<cr>
nnoremap <buffer> <silent> <2-leftmouse> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
exe 'nnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'vnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'nnoremap <buffer> <silent> d :call <SID>NetMakeDir("'.user.machine.'")<cr>'
exe 'nnoremap <buffer> <silent> D :exe "norm! 0"<bar>call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'nnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'vnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'nnoremap <buffer> <silent> R :exe "norm! 0"<bar>call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
exe 'nnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
nnoremap <buffer> ? :he netrw-browse-cmds<cr>
setlocal ma nonu nowrap
@ -1209,7 +1221,7 @@ fun! s:NetBrowse(dirname)
" Set up the banner
" call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method.">")
keepjumps put ='\" ==========================================================================='
keepjumps put ='\" Netrw Remote Directory Listing'
keepjumps put ='\" Netrw Remote Directory Listing (netrw '.g:loaded_netrw.')'
keepjumps put ='\" '.bufname
let w:netrw_bannercnt = 7
let sortby = g:netrw_sort_by
@ -1246,7 +1258,7 @@ fun! s:NetBrowse(dirname)
call s:NetBrowseFtpCmd(path,listcmd)
keepjumps 1d
if !g:netrw_longlist
if w:netrw_longlist == 0 || w:netrw_longlist == 2
" shorten the listing
" call Decho("generate short listing")
exe "keepjumps ".w:netrw_bannercnt
@ -1255,6 +1267,7 @@ fun! s:NetBrowse(dirname)
if g:netrw_ftp_browse_reject != ""
exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
endif
silent! keepjumps %s/\r$//e
" if there's no ../ listed, then put ./ and ../ in
let line1= line(".")
@ -1269,9 +1282,9 @@ fun! s:NetBrowse(dirname)
keepjumps norm! 0
" more cleanup
exe 'keepjumps silent! '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
endif
else
@ -1305,7 +1318,7 @@ fun! s:NetBrowse(dirname)
call s:NetrwListHide()
endif
if g:netrw_longlist
if w:netrw_longlist == 1
" do a long listing; these substitutions need to be done prior to sorting
" call Decho("manipulate long listing")
@ -1328,33 +1341,34 @@ fun! s:NetBrowse(dirname)
keepjumps norm! 0
endif
exe 'keepjumps silent '.w:netrw_bannercnt.',$s/ -> .*$//e'
exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
exe w:netrw_bannercnt
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
exe 'silent keepjumps '.w:netrw_bannercnt
endif
if line("$") >= w:netrw_bannercnt
if g:netrw_sort_by =~ "^n"
call s:SetSort()
if v:version < 700
exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()'
elseif g:netrw_sort_direction =~ 'n'
exe 'keepjumps silent '.w:netrw_bannercnt.',$sort'
if g:netrw_sort_direction =~ 'n'
exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
else
exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!'
exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
endif
exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
endif
if g:netrw_longlist
" shorten the list to keep its width <= 80 characters
exe "keepjumps silent ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
if w:netrw_longlist == 1
" shorten the list to keep its width <= winwidth characters
exe "silent keepjumps ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
endif
endif
endif
" cleanup any windows mess at end-of-line
keepjumps silent! %s/\r$//e
call s:NetrwWideListing()
if line("$") >= w:netrw_bannercnt
" place cursor on the top-left corner of the file listing
exe "keepjumps ".w:netrw_bannercnt
norm! 0
endif
call s:NetOptionRestore()
setlocal nomod noma nonu
@ -1412,7 +1426,19 @@ fun! s:NetGetWord()
" call Dfunc("NetGetWord() line#".line("."))
call s:UseBufWinVars()
" insure that w:netrw_longlist is set up
if !exists("w:netrw_longlist")
if exists("g:netrw_longlist")
let w:netrw_longlist= g:netrw_longlist
else
let w:netrw_longlist= 0
endif
endif
if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
" Active Banner support
" call Decho("active banner handling")
norm! 0
let dirname= "./"
let curline= getline(".")
if curline =~ '"\s*Sorted by\s'
@ -1431,14 +1457,40 @@ fun! s:NetGetWord()
let s:netrw_skipbrowse= 1
echo 'Pressing "a" also works'
elseif line("$") > w:netrw_bannercnt
exe w:netrw_bannercnt
exe 'silent keepjumps '.w:netrw_bannercnt
endif
else
elseif w:netrw_longlist == 0
" call Decho("thin column handling")
norm! 0
let dirname= getline(".")
if dirname =~ '\t'
let dirname= substitute(dirname,'\t.*$','','e')
elseif w:netrw_longlist == 1
" call Decho("long column handling")
norm! 0
let dirname= substitute(getline("."),'^\(\%(\S\+\s\)*\S\+\).\{-}$','\1','e')
else
" call Decho("obtain word from wide listing")
let dirname= getline(".")
if !exists("b:netrw_cpf")
let b:netrw_cpf= 0
exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
" call Decho("computed cpf")
endif
let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
" call Decho("virtcol=".virtcol(".")." cpf=".b:netrw_cpf." bannercnt=".w:netrw_bannercnt." filestart=".filestart)
" call Decho("1: dirname<".dirname.">")
if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif
" call Decho("2: dirname<".dirname.">")
let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e')
" call Decho("3: dirname<".dirname.">")
let dirname = substitute(dirname,'\s\+$','','e')
" call Decho("4: dirname<".dirname.">")
endif
" call Dret("NetGetWord <".dirname.">")
return dirname
endfun
@ -1646,7 +1698,7 @@ fun! s:NetBrowseX(fname,remote)
" create a local copy
let fname= tempname().".".exten
" call Decho("create a local copy of <".a:fname."> as <".fname.">")
exe "keepjumps silent bot 1new ".a:fname
exe "silent keepjumps bot 1new ".a:fname
set bh=delete
exe "w! ".fname
q
@ -1722,8 +1774,10 @@ fun! s:NetBrowseFtpCmd(path,cmd)
" ftp + <.netrc>: Method #2
if a:path != ""
put ='cd '.a:path
" call Decho("ftp: cd ".a:path)
endif
exe "put ='".a:cmd."'"
" call Decho("ftp: ".a:cmd)
" redraw!|call inputsave()|call input("Pausing...")|call inputrestore()
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
@ -1769,14 +1823,14 @@ fun! s:NetBrowseFtpCmd(path,cmd)
" cleanup for Windows
if has("win32") || has("win95") || has("win64") || has("win16")
keepjumps silent!! %s/\r$//e
silent! keepjumps! %s/\r$//e
endif
if a:cmd == "dir"
" infer directory/link based on the file permission string
keepjumps silent! g/d\%([-r][-w][-x]\)\{3}/s@$@/@
keepjumps silent! g/l\%([-r][-w][-x]\)\{3}/s/$/@/
if !g:netrw_longlist
exe "keepjumps silent! ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
if w:netrw_longlist == 0 || w:netrw_longlist == 2
exe "silent! keepjumps ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
endif
endif
@ -1814,9 +1868,9 @@ fun! s:NetrwListHide()
" Prune the list by hiding any files which match
" call Decho("pruning <".hide."> listhide<".listhide.">")
if g:netrw_hide == 1
exe 'keepjumps silent '.w:netrw_bannercnt.',$g~'.hide.'~d'
exe 'silent keepjumps '.w:netrw_bannercnt.',$g~'.hide.'~d'
elseif g:netrw_hide == 2
exe 'keepjumps silent '.w:netrw_bannercnt.',$v~'.hide.'~d'
exe 'silent keepjumps '.w:netrw_bannercnt.',$v~'.hide.'~d'
endif
endwhile
@ -1866,20 +1920,25 @@ endfun
" ---------------------------------------------------------------------
" NetLongList: {{{2
fun! s:NetLongList(mode)
" call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".g:netrw_longlist)
call netrw#NetSavePosn()
" call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".w:netrw_longlist)
let fname = s:NetGetWord()
let w:netrw_longlist = (w:netrw_longlist + 1) % 3
" call Decho("fname<".fname.">")
if g:netrw_longlist != 0
" turn long listing off
" call Decho("turn long listing off")
let g:netrw_longlist = 0
if w:netrw_longlist == 0
" use one column listing
" call Decho("use one column list")
let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
else
" turn long listing on
" call Decho("turn long listing on")
let g:netrw_longlist = 1
elseif w:netrw_longlist == 1
" use long list
" call Decho("use long list")
let g:netrw_list_cmd = g:netrw_list_cmd." -l"
else
" give wide list
" call Decho("use wide list")
let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
endif
setlocal ma
@ -1893,9 +1952,65 @@ fun! s:NetLongList(mode)
silent call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
endif
call netrw#NetRestorePosn()
" keep cursor on the filename
silent keepjumps $
if fname =~ '/$'
silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
else
silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
endif
" call Dret("NetLongList : g:netrw_longlist=".g:netrw_longlist)
" call Dret("NetLongList : w:netrw_longlist=".w:netrw_longlist)
endfun
" ---------------------------------------------------------------------
" NetrwWideListing: {{{2
fun! s:NetrwWideListing()
" call Dfunc("NetrwWideListing()")
if w:netrw_longlist == 2
" look for longest filename (cpf=characters per filename)
" cpf: characters per file
" fpl: files per line
" fpc: files per column
set ma
let b:netrw_cpf= 0
if line("$") >= w:netrw_bannercnt
exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
else
" call Dret("NetrwWideListing")
return
endif
" call Decho("max file strlen+1=".b:netrw_cpf)
let b:netrw_cpf= b:netrw_cpf + 1
" determine qty files per line (fpl)
let w:netrw_fpl= winwidth(0)/b:netrw_cpf
" call Decho("fpl= ".winwidth(0)."/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl)
" make wide display
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=printf("%-'.b:netrw_cpf.'s",submatch(0))/'
let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
let newcolstart = w:netrw_bannercnt + fpc
let newcolend = newcolstart + fpc - 1
" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]")
while line("$") >= newcolstart
if newcolend > line("$") | let newcolend= line("$") | endif
let newcolqty= newcolend - newcolstart
exe newcolstart
if newcolqty == 0
exe "silent keepjumps norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
else
exe "silent keepjumps norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
endif
exe "silent keepjumps ".newcolstart.','.newcolend.'d'
exe 'silent keepjumps '.w:netrw_bannercnt
endwhile
exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
set noma nomod
endif
" call Dret("NetrwWideListing")
endfun
" ---------------------------------------------------------------------
@ -2023,7 +2138,7 @@ fun! s:NetBookmarkDir(chg,curdir)
if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt
" looks like a "b" was pressed while in the banner region
if line("$") > w:netrw_bannercnt
exe w:netrw_bannercnt
exe 'silent keepjumps '.w:netrw_bannercnt
endif
echo ""
" call Dret("NetBookmarkDir - ignoring")
@ -2119,6 +2234,121 @@ fun! s:NetBookmarkDir(chg,curdir)
" call Dret("NetBookmarkDir")
endfun
" ---------------------------------------------------------------------
" NetObtain: obtain file under cursor (for remote browsing support) {{{2
fun! s:NetObtain()
if !exists("s:netrw_users_stl")
let s:netrw_users_stl= &stl
endif
let fname= expand("<cWORD>")
exe 'set stl=%f\ %h%m%r%=Obtaining\ '.escape(fname,' ')
redraw!
" call Dfunc("NetObtain() method=".w:netrw_method)
if exists("w:netrw_method") && w:netrw_method =~ '[235]'
if executable("ftp")
let curdir = expand("%")
let path = substitute(curdir,'ftp://[^/]\+/','','e')
let curline= line(".")
let endline= line("$")+1
set ma
keepjumps $
".........................................
if w:netrw_method == 2
" ftp + <.netrc>: Method #2
if path != ""
put ='cd '.path
" call Decho("ftp: cd ".path)
endif
put ='get '.fname
" call Decho("ftp: get ".fname)
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
else
" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
endif
".........................................
elseif w:netrw_method == 3
" ftp + machine,id,passwd,filename: Method #3
setlocal ff=unix
if exists("g:netrw_port") && g:netrw_port != ""
put ='open '.g:netrw_machine.' '.g:netrw_port
" call Decho('ftp: open '.g:netrw_machine.' '.g:netrw_port)
else
put ='open '.g:netrw_machine
" call Decho('ftp: open '.g:netrw_machine
endif
if exists("g:netrw_ftp") && g:netrw_ftp == 1
put =g:netrw_uid
put =g:netrw_passwd
" call Decho('ftp: g:netrw_uid')
" call Decho('ftp: g:netrw_passwd')
else
put ='user '.g:netrw_uid.' '.g:netrw_passwd
" call Decho('user '.g:netrw_uid.' '.g:netrw_passwd)
endif
if a:path != ""
put ='cd '.a:path
" call Decho('cd '.a:path)
endif
exe "put ='".a:cmd."'"
" call Decho("ftp: ".a:cmd)
" perform ftp:
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n"
".........................................
else
echo "***warning*** unable to comply with your request<" . choice . ">"
endif
" restore
exe "silent! ".endline.",$d"
exe "keepjumps ".curline
set noma nomod
else
if !exists("g:netrw_quiet")
echohl Error | echo "***netrw*** this system doesn't support ftp" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
" call Dret("NetObtain")
return
endif
".........................................
else
" scp: Method#4
if exists("g:netrw_port") && g:netrw_port != ""
let useport= " -P ".g:netrw_port
else
let useport= ""
endif
if g:netrw_cygwin == 1
let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." .")
exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." ."
else
" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." .")
exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." ."
endif
endif
" restore status line
let &stl= s:netrw_users_stl
redraw!
" call Dret("NetObtain")
endfun
" ==========================================
" Local Directory Browsing Support: {{{1
" ==========================================
@ -2138,6 +2368,7 @@ endfun
" ---------------------------------------------------------------------
" DirBrowse: supports local file/directory browsing {{{2
fun! netrw#DirBrowse(dirname)
if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
" call Dfunc("DirBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by)
" call Dredir("ls!")
@ -2181,18 +2412,10 @@ fun! netrw#DirBrowse(dirname)
" get cleared buffer
if bufnum < 0 || !bufexists(bufnum)
if v:version < 700
enew!
else
keepalt enew!
endif
keepjumps keepalt enew!
" call Decho("enew buffer")
else
if v:version < 700
exe "b ".bufnum
else
exe "keepalt b ".bufnum
endif
if exists("s:last_sort_by") && g:netrw_sort_by == s:last_sort_by
if getline(2) =~ '^" Directory Listing '
if !g:netrw_keepdir
@ -2246,11 +2469,7 @@ fun! netrw#DirBrowse(dirname)
" make this buffer not-a-file, modifiable, not line-numbered, etc
setlocal bh=hide bt=nofile nobl ma nonu
if v:version < 700
silent! %d
else
keepalt silent! %d
endif
" ---------------------------
" Perform Directory Listing:
@ -2260,18 +2479,23 @@ fun! netrw#DirBrowse(dirname)
" set up all the maps
" call Decho("Setting up local browser maps")
nnoremap <buffer> <silent> <cr> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> <cr> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> <c-l> :set ma<bar>%d<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<bar>redraw!<cr>
nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr>
nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
if w:netrw_longlist != 2
nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr>
endif
nnoremap <buffer> <silent> Nb :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> NB :<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr>
nnoremap <buffer> <silent> d :call <SID>NetMakeDir("")<cr>
nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(1)<cr>
nnoremap <buffer> <silent> i :call <SID>NetLongList(1)<cr>
nnoremap <buffer> <silent> o :call <SID>NetSplit(2)<cr>
nnoremap <buffer> <silent> p :exe "norm! 0"<bar>call <SID>LocalPreview(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),1))<cr>
nnoremap <buffer> <silent> O :call <SID>LocalObtain()<cr>
nnoremap <buffer> <silent> p :call <SID>LocalPreview(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),1))<cr>
nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
nnoremap <buffer> <silent> s :call <SID>NetSaveWordPosn()<bar>let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'<bar>exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<bar>call <SID>NetRestoreWordPosn()<cr>
@ -2279,15 +2503,15 @@ fun! netrw#DirBrowse(dirname)
nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
nnoremap <buffer> <silent> v :call <SID>NetSplit(3)<cr>
nnoremap <buffer> <silent> x :exe "norm! 0"<bar>call <SID>NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)<cr>
nnoremap <buffer> <silent> <2-leftmouse> :exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> x :call <SID>NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)"<cr>
nnoremap <buffer> <silent> <2-leftmouse> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
exe 'nnoremap <buffer> <silent> <del> :exe "norm! 0"<bar>call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
exe 'nnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
exe 'vnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
exe 'nnoremap <buffer> <silent> D :exe "norm! 0"<bar>call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
exe 'nnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
exe 'vnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
exe 'nnoremap <buffer> <silent> R :exe "norm! 0"<bar>call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
exe 'nnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
exe 'vnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetMakeDir("")<cr>'
nnoremap <buffer> ? :he netrw-dir<cr>
@ -2357,30 +2581,30 @@ fun! netrw#DirBrowse(dirname)
if g:netrw_sort_by =~ "^n"
call s:SetSort()
if v:version < 700
exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()'
elseif g:netrw_sort_direction =~ 'n'
exe 'keepjumps silent '.w:netrw_bannercnt.',$sort'
if g:netrw_sort_direction =~ 'n'
exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
else
exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!'
exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
endif
exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
else
if v:version < 700
exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()'
elseif g:netrw_sort_direction =~ 'n'
exe 'keepjumps silent '.w:netrw_bannercnt.',$sort'
if g:netrw_sort_direction =~ 'n'
exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
else
exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!'
exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
endif
exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
endif
endif
endif
call s:NetrwWideListing()
if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt
exe w:netrw_bannercnt
" place cursor on the top-left corner of the file listing
exe 'silent '.w:netrw_bannercnt
norm! 0
endif
" record previous current directory
@ -2427,6 +2651,7 @@ fun! s:LocalBrowseList()
" call Decho("filelist<".filelist.">")
endif
let filelist= substitute(filelist,'\n\{2,}','\n','ge')
let filelist= substitute(filelist,'\','/','ge')
" call Decho("dirname<".dirname.">")
" call Decho("dirnamelen<".dirnamelen.">")
@ -2453,14 +2678,10 @@ fun! s:LocalBrowseList()
" call Decho("filename<".filename.">")
" call Decho("pfile <".pfile.">")
if g:netrw_longlist
if w:netrw_longlist == 1
let sz = getfsize(filename)
if v:version <= 700
let fsz = strpart(" ",1,15-strlen(sz)).sz
let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
else
let pfile= printf('%-'.g:netrw_maxfilenamelen.'s%15d%s',pfile,sz,getftime(filename))
endif
" call Decho("sz=".sz." fsz=".fsz)
endif
@ -2490,7 +2711,7 @@ fun! s:LocalBrowseList()
endwhile
" cleanup any windows mess at end-of-line
keepjumps silent! %s/\r$//e
silent! keepjumps %s/\r$//e
setlocal ts=32
" call Dret("LocalBrowseList")
@ -2521,6 +2742,7 @@ fun! s:LocalBrowseChgDir(dirname,newdir,...)
" call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">")
" call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">")
exe "e! ".escape(dirname,s:netrw_cd_escape)
set ma nomod
endif
elseif newdir == './'
@ -2620,11 +2842,11 @@ fun! s:LocalBrowseRm(path) range
if errcode != 0
if has("unix")
" call Decho("3rd attempt to remove directory<".rmfile.">")
call system("rm ".rmfile)
call system("rm ".rmfile)
if v:shell_error != 0 && !exists("g:netrw_quiet")
echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
endif
elseif !exists("g:netrw_quiet")
echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
@ -2694,6 +2916,24 @@ fun! s:LocalBrowseRename(path) range
" call Dret("LocalBrowseRename")
endfun
" ---------------------------------------------------------------------
" LocalObtain: copy selected file to current working directory {{{2
fun! s:LocalObtain()
" call Dfunc("LocalObtain()")
if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
let fname= expand("<cWORD>")
let fcopy= readfile(b:netrw_curdir."/".fname,"b")
call writefile(fcopy,getcwd()."/".fname,"b")
elseif !exists("b:netrw_curdir")
echohl Error | echo "***netrw*** local browsing directory doesn't exist!"
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
else
echohl Error | echo "***netrw*** local browsing directory and current directory are identical"
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
" call Dret("LocalObtain")
endfun
" ---------------------------------------------------------------------
" LocalPreview: {{{2
fun! s:LocalPreview(path) range
@ -2778,7 +3018,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
elseif a:1 =~ '\*\*/' || a:indx < 0
" Nexplore Pexplore -or- Explore **/...
if has("path_extra") && v:version >= 700
if has("path_extra")
if !exists("w:netrw_explore_indx")
let w:netrw_explore_indx= 0
endif
@ -2804,8 +3044,8 @@ fun! netrw#Explore(indx,dosplit,style,...)
" NetrwStatusLine support
let w:netrw_explore_indx= indx
if !exists("s:netrw_explore_stl")
let s:netrw_explore_stl= &stl
if !exists("s:netrw_users_stl")
let s:netrw_users_stl= &stl
endif
set stl=%f\ %h%m%r%=%{NetrwStatusLine()}
" call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
@ -2832,9 +3072,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
" call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line)
else
if v:version < 700
echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for Exploring with **!" | echohl None
elseif !exists("g:netrw_quiet")
if !exists("g:netrw_quiet")
echohl WarningMsg | echo "***netrw*** your vim needs the +path_extra feature for Exploring with **!" | echohl None | echohl None
endif
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
@ -2854,7 +3092,8 @@ endfun
fun! NetrwStatusLine()
" let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr(".")." Xline#".w:netrw_explore_line." line#".line(".")
if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr(".") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list")
let &stl= s:netrw_explore_stl
" restore user's status line
let &stl= s:netrw_users_stl
if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
return ""
@ -3107,6 +3346,12 @@ fun! NetUserPass(...)
" call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
let g:netrw_passwd=a:2
endif
" surround password with double-quotes if it contains embedded blanks
if g:netrw_passwd !~ '^"' && g:netrw_passwd =~ ' '
let g:netrw_passwd= '"'.g:netrw_passwd.'"'
endif
" call Dret("NetUserPass")
endfun
@ -3158,27 +3403,26 @@ endfun
fun! s:NetOptionRestore()
" call Dfunc("NetOptionRestore()")
if !exists("w:netoptionsave")
" call Dret("NetOptionRestore : netoptionsave=".w:netoptionsave)
" call Dret("NetOptionRestore : w:netoptionsave doesn't exist")
return
endif
unlet w:netoptionsave
let &ai = w:aikeep
if has("netbeans_intg") || has("sun_workshop")
let &acd = w:acdkeep
if exists("w:aikeep")| let &ai= w:aikeep|endif
if (has("netbeans_intg") || has("sun_workshop")) && exists("w:acdkeep")
let &acd= w:acdkeep
unlet w:acdkeep
endif
let &cin = w:cinkeep
let &cino = w:cinokeep
let &com = w:comkeep
let &cpo = w:cpokeep
if exists("w:dirkeep")
exe "lcd ".w:dirkeep
endif
let &gd = w:gdkeep
let &report = w:repkeep
let &tw = w:twkeep
if exists("w:cinkeep") |let &cin = w:cinkeep |unlet w:cinkeep |endif
if exists("w:cinokeep")|let &cino = w:cinokeep|unlet w:cinokeep|endif
if exists("w:comkeep") |let &com = w:comkeep |unlet w:comkeep |endif
if exists("w:cpokeep") |let &cpo = w:cpokeep |unlet w:cpokeep |endif
if exists("w:dirkeep") |exe "lcd ".w:dirkeep |unlet w:dirkeep |endif
if exists("w:gdkeep") |let &gd = w:gdkeep |unlet w:gdkeep |endif
if exists("w:repkeep") |let &report = w:repkeep |unlet w:repkeep |endif
if exists("w:twkeep") |let &tw = w:twkeep |unlet w:twkeep |endif
if exists("w:swfkeep")
if &directory == ""
if &directory == "" && exists("w:swfkeep")
" user hasn't specified a swapfile directory;
" netrw will temporarily make the swapfile
" directory the current local one.
@ -3190,17 +3434,6 @@ fun! s:NetOptionRestore()
endif
unlet w:swfkeep
endif
unlet w:aikeep
unlet w:cinkeep
unlet w:cinokeep
unlet w:comkeep
unlet w:cpokeep
unlet w:gdkeep
unlet w:repkeep
unlet w:twkeep
if exists("w:dirkeep")
unlet w:dirkeep
endif
" call Dret("NetOptionRestore")
endfun
@ -3212,7 +3445,7 @@ endfun
" example and as a fix for a Windows 95 problem: in my
" experience, win95's ftp always dumped four blank lines
" at the end of the transfer.
if has("win95") && g:netrw_win95ftp
if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
fun! NetReadFixup(method, line1, line2)
" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
if method == 3 " ftp (no <.netrc>)
@ -3276,7 +3509,7 @@ endif
" front. An "*" pattern handles the default priority.
fun! s:SetSort()
" call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
if g:netrw_longlist
if w:netrw_longlist == 1
let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
else
let seqlist = g:netrw_sort_sequence
@ -3313,14 +3546,14 @@ fun! s:SetSort()
return
endif
if seq == '*'
exe 'keepjumps silent '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
else
exe 'keepjumps silent '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
endif
let priority = priority + 1
endwhile
exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e'
exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e'
" call Dret("SetSort")
endfun
@ -3366,6 +3599,7 @@ endfun
" UseBufWinVars() get around that.
fun! s:BufWinVars()
" call Dfunc("BufWinVars()")
if exists("w:netrw_longlist") |let b:netrw_longlist = w:netrw_longlist |endif
if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
@ -3383,6 +3617,7 @@ endfun
" Matching function to BufferWinVars()
fun! s:UseBufWinVars()
" call Dfunc("UseBufWinVars()")
if exists("b:netrw_longlist") && !exists("w:netrw_longlist") |let w:netrw_longlist = b:netrw_longlist |endif
if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif
if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif
if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2005 Sep 09
*eval.txt* For Vim version 7.0aa. Last change: 2005 Sep 10
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2957,6 +2957,21 @@ inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()*
Hitting <Enter> works like pressing the OK button. Hitting
<Esc> works like pressing the Cancel button.
inputlist({textlist}) *inputlist()*
{textlist} must be a list of strings. This list is displayed,
one string per line. The user will be prompted to enter a
number, which is returned.
The user can also select an item by clicking on it with the
mouse. For the first string 0 is returned. When clicking
above the first item a negative number is returned. When
clicking on the prompt one more than the length of {textlist}
is returned.
Make sure {textlist} has less then 'lines' entries, otherwise
it won't work. It's a good idea to put the entry number at
the start of the string. Example: >
let color = inputlist(['Select color:', '1. red',
\ '2. green', '3. blue'])
inputrestore() *inputrestore()*
Restore typeahead that was saved with a previous inputsave().
Should be called the same number of times inputsave() is
@ -4299,7 +4314,7 @@ taglist({expr}) *taglist()*
located by Vim. Refer to |tags-file-format| for the format of
the tags file generated by the different ctags tools.
*tagfiles*
*tagfiles()*
tagfiles() Returns a List with the file names used to search for tags for
the current buffer. This is the 'tags' option expanded.

View File

@ -1,4 +1,4 @@
*fold.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
*fold.txt* For Vim version 7.0aa. Last change: 2005 Sep 10
VIM REFERENCE MANUAL by Bram Moolenaar
@ -512,7 +512,8 @@ FOLDCOLUMN *fold-foldcolumn*
'foldcolumn' is a number, which sets the width for a column on the side of the
window to indicate folds. When it is zero, there is no foldcolumn. A normal
value is 4 or 5. The minimal useful value is 2. The maximum is 12.
value is 4 or 5. The minimal useful value is 2, although 1 still provides
some information. The maximum is 12.
An open fold is indicated with a column that has a '-' at the top and '|'
characters below it. This column stops where the open fold stops. When folds

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 7.0aa. Last change: 2005 Sep 01
*insert.txt* For Vim version 7.0aa. Last change: 2005 Sep 10
VIM REFERENCE MANUAL by Bram Moolenaar
@ -888,6 +888,7 @@ Completion is done by a function that can be defined by the user with the
'occultfunc' option. This is to be used for filetype-specific completion.
See the 'completefunc' help for how the function is called and an example.
For remarks about specific filetypes see |compl-occult-filetypes|.
*i_CTRL-X_CTRL-O*
CTRL-X CTRL-O Guess what kind of item is in front of the cursor and
@ -947,6 +948,37 @@ CTRL-P Find previous match for words that start with the
copy the words following the previous expansion in
other contexts unless a double CTRL-X is used.
Filetype-specific remarks for occult completion *compl-occult-filetypes*
C *ft-c-occult*
Completion requires a tags file. You should use Exuberant ctags, because it
adds extra information that is needed for completion. You can find it here:
http://ctags.sourceforge.net/
For version 5.5.4 you need to add a patch that adds the "typename:" field:
ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch
If you want to complete system functions you can do something like this. Use
ctags to generate a tags file for all the system header files: >
% ctags -R -f ~/.vim/systags /usr/include /usr/local/include
In your vimrc file add this tags file to the 'tags' option: >
set tags+=~/.vim/systags
When using CTRL-X CTRL-O after a name without any "." or "->" it is completed
from the tags file directly. This works for any identifier, also function
names. If you want to complete a local variable name, which does not appear
in the tags file, use CTRL-P instead.
When using CTRL-X CTRL-O after something that has "." or "->" Vim will attempt
to recognize the type of the variable and figure out what members it has.
This means only members valid for the variable will be listed.
Vim doesn't include a C compiler, only the most obviously formatted
declarations are recognized. Preprocessor stuff may cause confusion.
When the same structure name appears in multiple places all possible members
are included.
==============================================================================
8. Insert mode commands *inserting*

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 7.0aa. Last change: 2005 Sep 08
*options.txt* For Vim version 7.0aa. Last change: 2005 Sep 10
VIM REFERENCE MANUAL by Bram Moolenaar
@ -560,12 +560,20 @@ is entered, this is almost like having global options. If 's' and 'S' are not
present, the options are copied from the currently active buffer when the
buffer is created.
Not all options are supported in all versions. To test if option "foo" can be
used with ":set" use "exists('&foo')". This doesn't mean the value is
actually remembered and works. Some options are hidden, which means that you
can set them but the value is not remembered. To test if option "foo" is
really supported use "exists('+foo')".
Hidden options *hidden-options*
Not all options are supported in all versions. This depends on the supported
features and sometimes on the system. A remark about this is in curly braces
below. When an option is not supported it may still be set without getting an
error, this is called a hidden option. You can't get the value of a hidden
option though, it is not stored.
To test if option "foo" can be used with ":set" use something like this: >
if exists('&foo')
This also returns true for a hidden option. To test if option "foo" is really
supported use something like this: >
if exists('+foo')
<
*E355*
A jump table for the options with a short description can be found at |Q_op|.

View File

@ -1,4 +1,4 @@
*pi_netrw.txt* For Vim version 7.0. Last change: Aug 15, 2005
*pi_netrw.txt* For Vim version 7.0. Last change: Sep 07, 2005
VIM REFERENCE MANUAL by Charles E. Campbell, Jr.
@ -25,7 +25,7 @@
4. Transparent File Transfer............................|netrw-transparent|
5. Ex Commands..........................................|netrw-ex|
6. Variables and Options................................|netrw-var|
7. Directory Browser....................................|netrw-browse| {{{1
7. Directory Browsing...................................|netrw-browse| {{{1
Maps...............................................|netrw-maps|
Exploring..........................................|netrw-explore-cmds|
Quick Reference Commands Table.....................|netrw-browse-cmds|
@ -35,11 +35,12 @@
Refreshing The Listing.............................|netrw-ctrl-l|
Going Up...........................................|netrw--|
Browsing...........................................|netrw-cr|
Long Vs Short Listing..............................|netrw-i|
Obtaining A File...................................|netrw-O|
Thin, Long, and Wide Listings......................|netrw-i|
Making A New Directory.............................|netrw-d|
Deleting Files Or Directories......................|netrw-delete|
Renaming Files Or Directories......................|netrw-move|
Hiding Files Or Directories........................|g:netrw-a|
Hiding Files Or Directories........................|netrw-a|
Edit File Or Directory Hiding List.................|netrw-h|
Browsing With A Horizontally Split Window..........|netrw-o|
Preview Window.....................................|netrw-p|
@ -51,10 +52,10 @@
Browsing With A Vertically Split Window............|netrw-v|
Customizing Browsing With A User Function..........|netrw-x|
Making The Browsing Directory The Current Directory|netrw-c|
Bookmarking A Directory............................|netrw-b|
Changing To A Bookmarked Directory.................|netrw-B|
Bookmarking A Directory............................|netrw-b| |netrw-Nb|
Changing To A Bookmarked Directory.................|netrw-B| |netrw-NB|
Listing Bookmarks And History......................|netrw-q|
Improving Directory Browsing.......................|netrw-list-hack| }}}1
Improving Directory Browsing.......................|netrw-listhack| }}}1
8. Problems and Fixes...................................|netrw-problems|
9. Debugging............................................|netrw-debug|
10. History..............................................|netrw-history|
@ -193,8 +194,8 @@ file using root-relative paths, use the full path:
2. Network-Oriented File Transfer *netrw-xfer*
Network-oriented file transfer under Vim is implemented by a VimL-based script
(<netrw.vim>) using plugin techniques. It currently supports both reading
and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
(<netrw.vim>) using plugin techniques. It currently supports both reading and
writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
dav/cadaver, rsync, or sftp.
http is currently supported read-only via use of wget or fetch.
@ -205,24 +206,23 @@ FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
ex. vim ftp://hostname/path/to/file
<
The characters preceding the colon specify the protocol to use;
in the example, its ftp. The <netrw.vim> script then formulates
a command or a series of commands (typically ftp) which it issues
to an external program (ftp, scp, etc) which does the actual file
transfer/protocol. Files are read from/written to a temporary file
(under Unix/Linux, /tmp/...) which the <netrw.vim> script will
clean up.
The characters preceding the colon specify the protocol to use; in the
example, its ftp. The <netrw.vim> script then formulates a command or a
series of commands (typically ftp) which it issues to an external program
(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
from/written to a temporary file (under Unix/Linux, /tmp/...) which the
<netrw.vim> script will clean up.
One may modify any protocol's implementing external application
by setting a variable (ex. scp uses the variable g:netrw_scp_cmd,
which is defaulted to "scp -q").
One may modify any protocol's implementing external application by setting a
variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
"scp -q").
Ftp, an old protocol, seems to be blessed by numerous implementations.
Unfortunately, some implementations are noisy (ie., add junk to the end
of the file). Thus, concerned users may decide to write a NetReadFixup()
function that will clean up after reading with their ftp. Some Unix systems
(ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol
but is not noisy and more convenient, actually, for <netrw.vim> to use.
Unfortunately, some implementations are noisy (ie., add junk to the end of the
file). Thus, concerned users may decide to write a NetReadFixup() function
that will clean up after reading with their ftp. Some Unix systems (ie.,
FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
not noisy and more convenient, actually, for <netrw.vim> to use.
Consequently, if "fetch" is executable, it will be used to do reads for
ftp://... (and http://...) . See |netrw-var| for more about this.
@ -331,8 +331,8 @@ The script attempts to get passwords for ftp invisibly using |inputsecret()|,
a built-in Vim function. See |netrw-uidpass| for how to change the password
after one has set it.
Unfortunately there doesn't appear to be a way for netrw to feed a password
to scp. Thus every transfer via scp will require re-entry of the password.
Unfortunately there doesn't appear to be a way for netrw to feed a password to
scp. Thus every transfer via scp will require re-entry of the password.
==============================================================================
@ -340,8 +340,8 @@ to scp. Thus every transfer via scp will require re-entry of the password.
Network-oriented file transfers are available by default whenever
|'nocompatible'| mode is enabled. The <netrw.vim> file resides in your
system's vim-plugin directory and is sourced automatically whenever you
bring up vim.
system's vim-plugin directory and is sourced automatically whenever you bring
up vim.
==============================================================================
@ -480,12 +480,12 @@ variables listed below, and may be modified by the user.
-------------------------------------------------------------------------
<
*netrw-ftp*
The first two options both help with certain ftp's that give trouble otherwise.
In order to best understand how to use these options if ftp is giving you
troubles, a bit of discussion follows on how netrw does ftp reads.
The first two options both help with certain ftp's that give trouble
otherwise. In order to best understand how to use these options if ftp is
giving you troubles, a bit of discussion follows on how netrw does ftp reads.
The g:netrw_..._cmd variables specify the external program to use handle
the associated protocol (rcp, ftp, etc), plus any options.
The g:netrw_..._cmd variables specify the external program to use handle the
associated protocol (rcp, ftp, etc), plus any options.
The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with
whatever the current request is for a hostname.
@ -518,8 +518,8 @@ userid and password. The transferred file is put into a temporary file.
The temporary file is then read into the main editing session window that
requested it and the temporary file deleted.
If your ftp doesn't accept the "user" command and immediately just demands
a userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
If your ftp doesn't accept the "user" command and immediately just demands a
userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
*netrw-cadaver*
To handle the SSL certificate dialog for untrusted servers, one may pull
@ -546,12 +546,12 @@ messages) you may write a NetReadFixup(tmpfile) function:
endif
endfunction
>
The NetReadFixup() function will be called if it exists and thus allows
you to customize your reading process. As a further example, <netrw.vim>
contains just such a function to handle Windows 95 ftp. For whatever
reason, Windows 95's ftp dumps four blank lines at the end of a transfer,
and so it is desirable to automate their removal. Here's some code taken
from <netrw.vim> itself:
The NetReadFixup() function will be called if it exists and thus allows you to
customize your reading process. As a further example, <netrw.vim> contains
just such a function to handle Windows 95 ftp. For whatever reason, Windows
95's ftp dumps four blank lines at the end of a transfer, and so it is
desirable to automate their removal. Here's some code taken from <netrw.vim>
itself:
>
if has("win95") && g:netrw_win95ftp
fun! NetReadFixup(method, line1, line2)
@ -564,7 +564,7 @@ from <netrw.vim> itself:
>
==============================================================================
7. Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
7. Directory Browsing *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
MAPS *netrw-maps*
?................Help.......................................|netrw-help|
@ -731,7 +731,7 @@ NETRW BROWSER VARIABLES *netrw-browse-var*
INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro*
Netrw supports the browsing of directories on the local system and on remote
hosts, including generating listing directories, entering directories, editing
hosts, including listing files and directories, entering directories, editing
files therein, deleting files/directories, making new directories, and moving
(renaming) files and directories. The Netrw browser generally implements the
previous explorer maps and commands for remote directories, although details
@ -742,13 +742,15 @@ ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp
in its remote browsing. Any other protocol will be used for file transfers,
but otherwise the ssh protocol will be used to do remote directory browsing.
To enter the netrw directory browser, simply attempt to read a "file" with a
To use Netrw's remote directory browser, simply attempt to read a "file" with a
trailing slash and it will be interpreted as a request to list a directory:
vim [protocol]://[user@]hostname/path/
If you'd like to avoid entering the password in for directory listings, scp,
ssh interaction, etc, see |netrw-list-hack|.
For local directories, the trailing slash is not required.
If you'd like to avoid entering the password in for remote directory listings
with ssh or scp, see |netrw-listhack|.
*netrw-explore* *netrw-pexplore*
*netrw-hexplore* *netrw-sexplore*
@ -782,7 +784,8 @@ By default, these commands use the current file's directory. However, one
may explicitly provide a directory (path) to use.
(Following needs v7.0 or later) *netrw-starstar*
When Explore, Sexplore, Hexplore, or Vexplore are used like
When Explore, Sexplore, Hexplore, or Vexplore are used with a **,
such as:
>
:Explore **/filename_pattern
<
@ -796,7 +799,8 @@ The directory display is updated to show the subdirectory containing a
matching file. One may then proceed to the next (or previous) matching files'
directories by using Nexplore or Pexplore, respectively. If your console or
gui produces recognizable shift-up or shift-down sequences, then you'll likely
find the following mappings convenient:
find using shift-downarrow and shift-uparrow convenient. They're mapped by
netrw:
<s-down> == Nexplore, and
<s-up> == Pexplore.
@ -821,11 +825,12 @@ refresh a local directory by using ":e .".
GOING UP *netrw--*
To go up a directory, press - or his the <cr> when atop the ../ directory
To go up a directory, press - or press the <cr> when atop the ../ directory
entry in the listing.
Netrw will modify the command in |g:netrw_list_cmd| to perform the directory
listing operation. By default the command is:
Netrw will use the command in |g:netrw_list_cmd| to perform the directory
listing operation after changing HOSTNAME to the host specified by the
user-provided url. By default netrw provides the command as:
ssh HOSTNAME ls -FLa
@ -842,21 +847,49 @@ Hitting the <cr> (the return key) will select the file or directory.
Directories will themselves be listed, and files will be opened using the
protocol given in the original read request.
CAVEAT: There are three forms of listing (see |netrw-i|). Netrw assumes
that two or more spaces delimit filenames and directory names for the long
and wide listing formats. Thus, if your filename or directory name has two
or more spaces embedded in it, or any trailing spaces, then you'll need to
use the "thin" format to select it.
LONG VS SHORT LISTING *netrw-i*
OBTAINING A FILE *netrw-O*
When browsing a remote directory, one may obtain a file under the cursor (ie.
get a copy on your local machine, but not edit it) by pressing the O key.
Only ftp and scp are supported for this operation (but since these two are
available for browsing, that shouldn't be a problem).
THIN, LONG, AND WIDE LISTINGS *netrw-i*
The "i" map cycles between the thin, long, and wide listing formats.
The short listing format gives just the files' and directories' names.
The long listing is either based on the "ls" command via ssh for remote
directories or displays the filename, file size (in bytes), and the
time and date of last modification for local directories.
directories or displays the filename, file size (in bytes), and the time and
date of last modification for local directories. With the long listing
format, netrw is not able to recognize filenames which have trailing spaces.
Use the thin listing format for such files.
The wide listing format has a multi-column display of the various files in the
netrw current directory, rather like the Unix "ls" presents. In this mode the
"b" and "B" maps are not available; instead, use Nb (|netrw-Nb|) and NB
(|netrw-NB|). The wide listing format uses two or more contiguous spaces to
delineate filenames; when using that format, netrw won't be able to recognize
or use filenames which have two or more contiguous spaces embedded in the name
or any trailing spaces. The thin listing format will, however, work with such
files.
MAKING A NEW DIRECTORY *netrw-d*
With the "d" map one may make a new directory either remotely (which
depends on the global variable g:netrw_mkdir_cmd) or locally (which depends on
the global variable g:netrw_local_mkdir). Netrw will issue a request for the
new directory's name. A bare <CR> at that point will abort the making of the
With the "d" map one may make a new directory either remotely (which depends
on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
global variable g:netrw_local_mkdir). Netrw will issue a request for the new
directory's name. A bare <CR> at that point will abort the making of the
directory. Attempts to make a local directory that already exists (as either
a file or a directory) will be detected, reported on, and ignored.
@ -864,12 +897,12 @@ a file or a directory) will be detected, reported on, and ignored.
DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D*
Deleting/removing files and directories involves moving the cursor to the
file/directory to be deleted and pressing "D". Directories must be empty first
before they can be successfully removed. If the directory is a softlink to a
directory, then netrw will make two requests to remove the directory before
succeeding. Netrw will ask for confirmation before doing the removal(s).
You may select a range of lines with the "V" command (visual selection),
and then pressing "D".
file/directory to be deleted and pressing "D". Directories must be empty
first before they can be successfully removed. If the directory is a softlink
to a directory, then netrw will make two requests to remove the directory
before succeeding. Netrw will ask for confirmation before doing the
removal(s). You may select a range of lines with the "V" command (visual
selection), and then pressing "D".
The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used
to control the attempts to remove files and directories. The g:netrw_rm_cmd
@ -904,19 +937,19 @@ One may rename a block of files and directories by selecting them with
the V (|linewise-visual|).
HIDING FILES OR DIRECTORIES *g:netrw-a* *netrw-a*
HIDING FILES OR DIRECTORIES *netrw-a*
Netrw's browsing facility allows one to use the hiding list in one of
three ways: ignore it, hide files which match, and show only those files
which match. The "a" map allows the user to cycle about these three ways.
Netrw's browsing facility allows one to use the hiding list in one of three
ways: ignore it, hide files which match, and show only those files which
match. The "a" map allows the user to cycle about these three ways.
The g:netrw_list_hide variable holds a comma delimited list of patterns
(ex. \.obj) which specify the hiding list. (also see |netrw-h|) To
set the hiding list, use the <c-h> map. As an example, to hide files
which begin with a ".", one may use the <c-h> map to set the hiding
list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*' in
one's <.vimrc>). One may then use the "a" key to show all files,
hide matching files, or to show only the matching files.
The g:netrw_list_hide variable holds a comma delimited list of patterns (ex.
\.obj) which specify the hiding list. (also see |netrw-h|) To set the hiding
list, use the <c-h> map. As an example, to hide files which begin with a ".",
one may use the <c-h> map to set the hiding list to '^\..*' (or one may put
let g:netrw_list_hide= '^\..*' in one's <.vimrc>). One may then use the "a"
key to show all files, hide matching files, or to show only the matching
files.
EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* *netrw-edithide*
@ -924,7 +957,8 @@ EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* *netrw-edithide*
The "<ctrl-h>" map brings up a requestor allowing the user to change the
file/directory hiding list. The hiding list consists of one or more patterns
delimited by commas. Files and/or directories satisfying these patterns will
either be hidden (ie. not shown) or be the only ones displayed (see |netrw-a|).
either be hidden (ie. not shown) or be the only ones displayed (see
|netrw-a|).
BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz*
@ -933,9 +967,9 @@ Normally one enters a file or directory using the <cr>. However, the "o" map
allows one to open a new window to hold the new directory listing or file. A
horizontal split is used. (for vertical splitting, see |netrw-v|)
Normally, the o key splits the window horizontally with the new window
and cursor at the top. To change to splitting the window horizontally
with the new window and cursor at the bottom, have
Normally, the o key splits the window horizontally with the new window and
cursor at the top. To change to splitting the window horizontally with the
new window and cursor at the bottom, have
let g:netrw_alto = 1
@ -944,30 +978,30 @@ in your <.vimrc>.
PREVIEW WINDOW *netrw-p* *netrw-preview*
One may use a preview window (currently only for local browsing) by using
the "p" key when the cursor is atop the desired filename to be previewed.
One may use a preview window (currently only for local browsing) by using the
"p" key when the cursor is atop the desired filename to be previewed.
SELECTING SORTING STYLE *netrw-s* *netrw-sort*
One may select the sorting style by name, time, or (file) size. The
"s" map allows one to circulate amongst the three choices; the directory
listing will automatically be refreshed to reflect the selected style.
One may select the sorting style by name, time, or (file) size. The "s" map
allows one to circulate amongst the three choices; the directory listing will
automatically be refreshed to reflect the selected style.
EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence*
When "Sorted by" is name, one may specify priority via the sorting
sequence (g:netrw_sort_sequence). The sorting sequence typically
prioritizes the name-listing by suffix, although any pattern will do.
Patterns are delimited by commas. The default sorting sequence is:
When "Sorted by" is name, one may specify priority via the sorting sequence
(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
name-listing by suffix, although any pattern will do. Patterns are delimited
by commas. The default sorting sequence is:
>
[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$
<
The lone * is where all filenames not covered by one of the other
patterns will end up. One may change the sorting sequence by modifying
the g:netrw_sort_sequence variable (either manually or in your <.vimrc>)
or by using the "S" map.
The lone * is where all filenames not covered by one of the other patterns
will end up. One may change the sorting sequence by modifying the
g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
using the "S" map.
REVERSING SORTING ORDER *netrw-r* *netrw-reverse*
@ -994,13 +1028,13 @@ q map to list both the bookmarks and history. (see |netrw-q|)
BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v*
Normally one enters a file or directory using the <cr>. However, the "v"
map allows one to open a new window to hold the new directory listing or
file. A vertical split is used. (for horizontal splitting, see |netrw-o|)
Normally one enters a file or directory using the <cr>. However, the "v" map
allows one to open a new window to hold the new directory listing or file. A
vertical split is used. (for horizontal splitting, see |netrw-o|)
Normally, the v key splits the window vertically with the new window
and cursor at the left. To change to splitting the window vertically
with the new window and cursor at the right, have
Normally, the v key splits the window vertically with the new window and
cursor at the left. To change to splitting the window vertically with the new
window and cursor at the right, have
let g:netrw_altv = 1
@ -1019,9 +1053,9 @@ handler varies:
* otherwise the NetrwFileHandler plugin is used.
The file's suffix is used by these various approaches to determine an
appropriate application to use to "handle" these files. Such things
as OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript
(*.ps, *.eps) can be handled.
appropriate application to use to "handle" these files. Such things as
OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps,
*.eps) can be handled.
The NetrwFileHandler applies a user-defined function to a file, based on its
extension. Of course, the handler function must exist for it to be called!
@ -1046,12 +1080,12 @@ g:netrw_keepdir to 0 (say, in your <.vimrc>) will tell netrw to have the
currently browsed directory be the current directory.
With the default setting for g:netrw_keepdir, in order to make the two
directories the same, use the "c" map (just type c). That map will set
the current directory to the current browsing directory.
directories the same, use the "c" map (just type c). That map will set the
current directory to the current browsing directory.
BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks*
*netrw-Nb*
One may easily "bookmark" a directory by using >
{cnt}b
@ -1060,15 +1094,21 @@ Any count may be used. One may use viminfo's "!" option to retain bookmarks
between vim sessions. See |netrw-B| for how to return to a bookmark and
|netrw-q| for how to list them.
When wide listing is in use (see |netrw-i|), then the b map is not available;
instead, use {cnt}Nb.
CHANGING TO A BOOKMARKED DIRECTORY *netrw-B*
CHANGING TO A BOOKMARKED DIRECTORY *netrw-NB* *netrw-B*
To change directory back to a bookmarked directory, use
{cnt}B
Any count may be used to reference any of the bookmarks. See |netrw-b|
for how to bookmark a directory and |netrw-q| for how to list them.
Any count may be used to reference any of the bookmarks. See |netrw-b| on
how to bookmark a directory and |netrw-q| on how to list bookmarks.
When wide listing is in use (see |netrw-i|), then the B map is not available;
instead, use {cnt}NB.
LISTING BOOKMARKS AND HISTORY *netrw-q* *netrw-listbookmark*
@ -1077,7 +1117,7 @@ Pressing "q" will list the bookmarked directories and directory traversal
history (query). (see |netrw-b|, |netrw-B|, |netrw-u|, and |netrw-U|)
IMPROVING DIRECTORY BROWSING *netrw-list-hack*
IMPROVING DIRECTORY BROWSING *netrw-listhack*
Especially with the remote directory browser, constantly entering the password
is tedious.
@ -1095,9 +1135,9 @@ NETRW SETTINGS *netrw-settings*
With the NetrwSettings.vim plugin, >
:NetrwSettings
will bring up a window with the many variables that netrw uses for its
settings. You may change any of their values; when you save the file,
the settings therein will be used. One may also press "?" on any of
the lines for help on what each of the variables do.
settings. You may change any of their values; when you save the file, the
settings therein will be used. One may also press "?" on any of the lines for
help on what each of the variables do.
==============================================================================
@ -1217,9 +1257,21 @@ which is loaded automatically at startup (assuming :set nocp).
==============================================================================
10. History *netrw-history*
v64: * Browser functions now use NetOptionSave/Restore; in particular,
v69: * Bugfix: win95/98 machines were experiencing a
"E121: Undefined variable: g:netrw_win95ftp" message
v68: * double-click-leftmouse selects word under mouse
v67: * Passwords which contain blanks will now be surrounded by
double-quotes automatically (Yongwei)
v66: * Netrw now seems to work with a few more Windows situations
* O now obtains a file: remote browsing file -> local copy,
locally browsing file -> current directory (see :pwd)
* i now cycles between thin, long, and wide listing styles
* NB and Nb are maps that are always available; corresponding
B and b maps are only available when not using wide listing
in order to allow them to be used for motions
v65: * Browser functions now use NetOptionSave/Restore; in particular,
netrw now works around the report setting
* Bugfix - browsing a "/" directory (Unix) yielded buffers
v64: * Bugfix - browsing a "/" directory (Unix) yielded buffers
named "[Scratch]" instead of "/"
* Bugfix - remote browsing with ftp was omitting the ./ and ../
v63: * netrw now takes advantage of autoload (and requires 7.0)
@ -1366,7 +1418,7 @@ which is loaded automatically at startup (assuming :set nocp).
Vim editor by Bram Moolenaar (Thanks, Bram!)
dav support by C Campbell
fetch support by Bram Moolenaar and C Campbell
ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> - NOSPAM
ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
http support by Bram Moolenaar <bram@moolenaar.net>
rcp
rsync support by C Campbell (suggested by Erik Warendorph)
@ -1376,11 +1428,13 @@ which is loaded automatically at startup (assuming :set nocp).
inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, fetch,...
Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
fetch,...
Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
Erik Warendorph -- for several suggestions (g:netrw_..._cmd
variables, rsync etc)
Doug Claar -- modifications to test for success with ftp operation
Doug Claar -- modifications to test for success with ftp
operation
==============================================================================
vim:tw=78:ts=8:ft=help:norl:fdm=marker

View File

@ -4461,6 +4461,7 @@ compl-function insert.txt /*compl-function*
compl-generic insert.txt /*compl-generic*
compl-keyword insert.txt /*compl-keyword*
compl-occult insert.txt /*compl-occult*
compl-occult-filetypes insert.txt /*compl-occult-filetypes*
compl-spelling insert.txt /*compl-spelling*
compl-tag insert.txt /*compl-tag*
compl-vim insert.txt /*compl-vim*
@ -4961,6 +4962,7 @@ ft-aspperl-syntax syntax.txt /*ft-aspperl-syntax*
ft-aspvbs-syntax syntax.txt /*ft-aspvbs-syntax*
ft-bash-syntax syntax.txt /*ft-bash-syntax*
ft-basic-syntax syntax.txt /*ft-basic-syntax*
ft-c-occult insert.txt /*ft-c-occult*
ft-c-syntax syntax.txt /*ft-c-syntax*
ft-ch-syntax syntax.txt /*ft-ch-syntax*
ft-changelog-plugin filetype.txt /*ft-changelog-plugin*
@ -5077,7 +5079,6 @@ g'a motion.txt /*g'a*
g, motion.txt /*g,*
g0 motion.txt /*g0*
g8 various.txt /*g8*
g:netrw-a pi_netrw.txt /*g:netrw-a*
g:netrw_alto pi_netrw.txt /*g:netrw_alto*
g:netrw_altv pi_netrw.txt /*g:netrw_altv*
g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin*
@ -5291,6 +5292,7 @@ hebrew hebrew.txt /*hebrew*
hebrew.txt hebrew.txt /*hebrew.txt*
help various.txt /*help*
help-context help.txt /*help-context*
help-tags tags 1
help-translated various.txt /*help-translated*
help-xterm-window various.txt /*help-xterm-window*
help.txt help.txt /*help.txt*
@ -5298,6 +5300,7 @@ hex-editing tips.txt /*hex-editing*
hidden-buffer windows.txt /*hidden-buffer*
hidden-changed version5.txt /*hidden-changed*
hidden-menus gui.txt /*hidden-menus*
hidden-options options.txt /*hidden-options*
hidden-quit windows.txt /*hidden-quit*
highlight-args syntax.txt /*highlight-args*
highlight-changed version4.txt /*highlight-changed*
@ -5532,6 +5535,7 @@ inform.vim syntax.txt /*inform.vim*
initialization starting.txt /*initialization*
input() eval.txt /*input()*
inputdialog() eval.txt /*inputdialog()*
inputlist() eval.txt /*inputlist()*
inputrestore() eval.txt /*inputrestore()*
inputsave() eval.txt /*inputsave()*
inputsecret() eval.txt /*inputsecret()*
@ -5838,6 +5842,9 @@ netrw pi_netrw.txt /*netrw*
netrw-- pi_netrw.txt /*netrw--*
netrw-B pi_netrw.txt /*netrw-B*
netrw-D pi_netrw.txt /*netrw-D*
netrw-NB pi_netrw.txt /*netrw-NB*
netrw-Nb pi_netrw.txt /*netrw-Nb*
netrw-O pi_netrw.txt /*netrw-O*
netrw-R pi_netrw.txt /*netrw-R*
netrw-S pi_netrw.txt /*netrw-S*
netrw-U pi_netrw.txt /*netrw-U*
@ -5880,8 +5887,8 @@ netrw-history pi_netrw.txt /*netrw-history*
netrw-horiz pi_netrw.txt /*netrw-horiz*
netrw-i pi_netrw.txt /*netrw-i*
netrw-list pi_netrw.txt /*netrw-list*
netrw-list-hack pi_netrw.txt /*netrw-list-hack*
netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
netrw-listhack pi_netrw.txt /*netrw-listhack*
netrw-maps pi_netrw.txt /*netrw-maps*
netrw-move pi_netrw.txt /*netrw-move*
netrw-netrc pi_netrw.txt /*netrw-netrc*
@ -6719,6 +6726,7 @@ tag-search tagsrch.txt /*tag-search*
tag-security tagsrch.txt /*tag-security*
tag-skip-file tagsrch.txt /*tag-skip-file*
tag-stack tagsrch.txt /*tag-stack*
tagfiles() eval.txt /*tagfiles()*
taglist() eval.txt /*taglist()*
tags tagsrch.txt /*tags*
tags-and-searches tagsrch.txt /*tags-and-searches*

View File

@ -1,8 +1,7 @@
" netrw.vim: Handles file transfer and remote directory listing across a network
" PLUGIN PORTION
" Last Change: Aug 17, 2005
" Date: Sep 08, 2005
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" Version: 65a ASTRO-ONLY
" License: Vim License (see vim's :help license)
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
@ -21,17 +20,6 @@
" ---------------------------------------------------------------------
" Load Once: {{{1
if exists("g:loaded_netrw") || &cp
finish
endif
if v:version < 600
echoerr "***netrw*** doesn't support Vim version ".v:version
finish
endif
let g:loaded_netrw = "v65a"
if v:version < 700
let loaded_explorer = 1
endif
let s:keepcpo= &cpo
set cpo&vim
@ -138,7 +126,7 @@ endfun
" example and as a fix for a Windows 95 problem: in my
" experience, win95's ftp always dumped four blank lines
" at the end of the transfer.
if has("win95") && g:netrw_win95ftp
if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
fun! NetReadFixup(method, line1, line2)
" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
if method == 3 " ftp (no <.netrc>)

View File

@ -1,7 +1,7 @@
" Language : Netrw Remote-Directory Listing Syntax
" Maintainer : Charles E. Campbell, Jr.
" Last change: Sep 08, 2004
" Version : 5
" Last change: Aug 29, 2005
" Version : 7
" ---------------------------------------------------------------------
" Syntax Clearing: {{{1
@ -14,23 +14,30 @@ endif
" ---------------------------------------------------------------------
" Directory List Syntax Highlighting: {{{1
syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion
syn match netrwDir "^.*/\%(\t\|$\)" contains=netrwClassify
syn match netrwClassify "[*=|@/]\%(\t\|$\)"
syn match netrwSymLink "^.*@\%(\t\|$\)" contains=netrwClassify
syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify
syn match netrwDir "\.\{1,2}/" contains=netrwClassify
syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify
syn match netrwDir "^\S*/" contains=netrwClassify
syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify
syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify
syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained
syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup
syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite nextgroup=netrwHidePat
syn match netrwSlash contained "/"
syn match netrwHidePat contained "[^,]\+" skipwhite nextgroup=netrwHideSep
syn match netrwHideSep contained transparent "," skipwhite nextgroup=netrwHidePat
syn match netrwSortBy contained transparent "Sorted by" skipwhite nextgroup=netrwList
syn match netrwSortSeq contained transparent "Sort sequence:" skipwhite nextgroup=netrwList
syn match netrwList contained ".*$" contains=netrwComma
syn match netrwComma contained ","
syn region netrwQuickHelp contained matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend
syn match netrwHelpCmd contained "\S\ze:" skipwhite nextgroup=netrwCmdSep
syn match netrwCmdSep contained ":" nextgroup=netrwCmdNote
syn match netrwCmdNote contained ".\{-}\ze "
syn match netrwVersion contained "(netrw.*)"
syn match netrwSlash "/" contained
syn match netrwHidePat "[^,]\+" contained skipwhite nextgroup=netrwHideSep
syn match netrwHideSep "," contained transparent skipwhite nextgroup=netrwHidePat
syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
syn match netrwList ".*$" contained contains=netrwComma
syn match netrwComma "," contained
syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained
syn match netrwHelpCmd "\S\ze:" contained skipwhite nextgroup=netrwCmdSep
syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote
syn match netrwCmdNote ".\{-}\ze " contained
syn match netrwVersion "(netrw.*)" contained
" ---------------------------------------------------------------------
" Highlighting Links: {{{1
@ -45,6 +52,7 @@ if !exists("did_drchip_dbg_syntax")
hi link netrwList Statement
hi link netrwVersion Identifier
hi link netrwSymLink Special
hi link netrwExe PreProc
hi link netrwComma netrwComment
hi link netrwHide netrwComment

View File

@ -3861,6 +3861,9 @@ gui_do_scroll()
#endif
}
/* Make sure wp->w_leftcol and wp->w_skipcol are correct. */
validate_cursor();
curwin = save_wp;
curbuf = save_wp->w_buffer;
@ -3869,6 +3872,7 @@ gui_do_scroll()
* the status line!).
*/
if (old_topline != wp->w_topline
|| wp->w_redr_type != 0
#ifdef FEAT_DIFF
|| old_topfill != wp->w_topfill
#endif

View File

@ -2401,6 +2401,7 @@ fill_foldcolumn(p, wp, closed, lnum)
int i = 0;
int level;
int first_level;
int empty;
/* Init to all spaces. */
copy_spaces(p, (size_t)wp->w_p_fdc);
@ -2408,13 +2409,16 @@ fill_foldcolumn(p, wp, closed, lnum)
level = win_foldinfo.fi_level;
if (level > 0)
{
/* If there is only one column put more info in it. */
empty = (wp->w_p_fdc == 1) ? 0 : 1;
/* If the column is too narrow, we start at the lowest level that
* fits and use numbers to indicated the depth. */
first_level = level - wp->w_p_fdc - closed + 2;
first_level = level - wp->w_p_fdc - closed + 1 + empty;
if (first_level < 1)
first_level = 1;
for (i = 0; i + 1 < wp->w_p_fdc; ++i)
for (i = 0; i + empty < wp->w_p_fdc; ++i)
{
if (win_foldinfo.fi_lnum == lnum
&& first_level + i >= win_foldinfo.fi_low_level)

View File

@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 9)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 9, compiled "
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 10)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 10, compiled "