Mercurial > vim
comparison runtime/autoload/netrw.vim @ 799:6beb2c667935
updated for version 7.0b
author | vimboss |
---|---|
date | Fri, 24 Mar 2006 22:21:52 +0000 |
parents | f19994020dad |
children | 23f82b5d2814 |
comparison
equal
deleted
inserted
replaced
798:95dac6af3b3a | 799:6beb2c667935 |
---|---|
1 " netrw.vim: Handles file transfer and remote directory listing across a network | 1 " netrw.vim: Handles file transfer and remote directory listing across a network |
2 " AUTOLOAD PORTION | 2 " AUTOLOAD PORTION |
3 " Date: Mar 21, 2006 | 3 " Date: Mar 22, 2006 |
4 " Version: 82 | 4 " Version: 83 |
5 " Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> | 5 " Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> |
6 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim | 6 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim |
7 " Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 | 7 " Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 |
8 " Permission is hereby granted to use and distribute this code, | 8 " Permission is hereby granted to use and distribute this code, |
9 " with or without modifications, provided that this copyright | 9 " with or without modifications, provided that this copyright |
21 | 21 |
22 " Exception for &cp: {{{1 | 22 " Exception for &cp: {{{1 |
23 if &cp || exists("g:loaded_netrw") | 23 if &cp || exists("g:loaded_netrw") |
24 finish | 24 finish |
25 endif | 25 endif |
26 let g:loaded_netrw = "v82" | 26 let g:loaded_netrw = "v83" |
27 if v:version < 700 | 27 if v:version < 700 |
28 echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw" | echohl None | 28 echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw" | echohl None |
29 finish | 29 finish |
30 endif | 30 endif |
31 let s:keepcpo= &cpo | 31 let s:keepcpo= &cpo |
1278 exe 'file '.escape(bufname,s:netrw_cd_escape) | 1278 exe 'file '.escape(bufname,s:netrw_cd_escape) |
1279 " call Decho("renaming file to bufname<".bufname.">") | 1279 " call Decho("renaming file to bufname<".bufname.">") |
1280 setlocal bt=nofile nobl nonu noswf | 1280 setlocal bt=nofile nobl nonu noswf |
1281 if g:netrw_fastbrowse >= 1 | 1281 if g:netrw_fastbrowse >= 1 |
1282 setlocal bh=hide | 1282 setlocal bh=hide |
1283 else | |
1284 setlocal bh=delete | |
1283 endif | 1285 endif |
1284 | 1286 |
1285 " save current directory on directory history list | 1287 " save current directory on directory history list |
1286 call s:NetBookmarkDir(3,expand("%")) | 1288 call s:NetBookmarkDir(3,expand("%")) |
1287 | 1289 |
1506 " refresh the directory list | 1508 " refresh the directory list |
1507 " call Decho("refresh directory listing") | 1509 " call Decho("refresh directory listing") |
1508 setlocal ma nobl | 1510 setlocal ma nobl |
1509 if g:netrw_fastbrowse >= 1 | 1511 if g:netrw_fastbrowse >= 1 |
1510 setlocal bh=hide | 1512 setlocal bh=hide |
1513 else | |
1514 setlocal bh=delete | |
1511 endif | 1515 endif |
1512 %d | 1516 %d |
1513 | 1517 |
1514 elseif newdir == '../' | 1518 elseif newdir == '../' |
1515 " go up one directory | 1519 " go up one directory |
1536 endfun | 1540 endfun |
1537 | 1541 |
1538 " --------------------------------------------------------------------- | 1542 " --------------------------------------------------------------------- |
1539 " NetGetWord: it gets the directory named under the cursor {{{2 | 1543 " NetGetWord: it gets the directory named under the cursor {{{2 |
1540 fun! s:NetGetWord() | 1544 fun! s:NetGetWord() |
1541 " call Dfunc("NetGetWord() line#".line(".")) | 1545 " call Dfunc("NetGetWord() line#".line(".")." longlist=".g:netrw_longlist." virtcol=".virtcol(".")) |
1542 call s:UseBufWinVars() | 1546 call s:UseBufWinVars() |
1543 | 1547 |
1544 " insure that w:netrw_longlist is set up | 1548 " insure that w:netrw_longlist is set up |
1545 if !exists("w:netrw_longlist") | 1549 if !exists("w:netrw_longlist") |
1546 if exists("g:netrw_longlist") | 1550 if exists("g:netrw_longlist") |
1547 let w:netrw_longlist= g:netrw_longlist | 1551 let w:netrw_longlist= g:netrw_longlist |
1548 else | 1552 else |
1549 let w:netrw_longlist= 0 | 1553 let w:netrw_longlist= 0 |
1550 endif | 1554 endif |
1555 " call Decho("w:netrw_longlist=".w:netrw_longlist) | |
1551 endif | 1556 endif |
1552 | 1557 |
1553 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt | 1558 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt |
1554 " Active Banner support | 1559 " Active Banner support |
1555 " call Decho("active banner handling") | 1560 " call Decho("active banner handling") |
1594 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' | 1599 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' |
1595 " call Decho("computed cpf") | 1600 " call Decho("computed cpf") |
1596 endif | 1601 endif |
1597 | 1602 |
1598 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf | 1603 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf |
1599 " call Decho("virtcol=".virtcol(".")." cpf=".b:netrw_cpf." bannercnt=".w:netrw_bannercnt." filestart=".filestart) | 1604 " call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) |
1600 " call Decho("1: dirname<".dirname.">") | 1605 " call Decho("1: dirname<".dirname.">") |
1601 if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif | 1606 if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif |
1602 " call Decho("2: dirname<".dirname.">") | 1607 " call Decho("2: dirname<".dirname.">") |
1603 let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e') | 1608 let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e') |
1604 " call Decho("3: dirname<".dirname.">") | 1609 " call Decho("3: dirname<".dirname.">") |
1611 endfun | 1616 endfun |
1612 | 1617 |
1613 " --------------------------------------------------------------------- | 1618 " --------------------------------------------------------------------- |
1614 " NetBrowseRm: remove/delete a remote file or directory {{{2 | 1619 " NetBrowseRm: remove/delete a remote file or directory {{{2 |
1615 fun! s:NetBrowseRm(usrhost,path) range | 1620 fun! s:NetBrowseRm(usrhost,path) range |
1616 " call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">)") | 1621 " call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) |
1617 " call Decho("firstline=".a:firstline." lastline=".a:lastline) | 1622 " call Decho("firstline=".a:firstline." lastline=".a:lastline) |
1618 | 1623 |
1619 " preparation for removing multiple files/directories | 1624 " preparation for removing multiple files/directories |
1620 let ctr= a:firstline | 1625 let ctr= a:firstline |
1621 let all= 0 | 1626 let all= 0 |
1622 | 1627 |
1623 " remove multiple files and directories | 1628 " remove multiple files and directories |
1624 while ctr <= a:lastline | 1629 while ctr <= a:lastline |
1625 exe ctr | 1630 exe ctr |
1626 | 1631 |
1627 norm! 0 | |
1628 let rmfile= s:NetGetWord() | 1632 let rmfile= s:NetGetWord() |
1629 " call Decho("rmfile<".rmfile.">") | 1633 " call Decho("rmfile<".rmfile.">") |
1630 | 1634 |
1631 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') | 1635 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') |
1632 " attempt to remove file | 1636 " attempt to remove file |
2847 | 2851 |
2848 " make this buffer not-a-file, modifiable, not line-numbered, etc | 2852 " make this buffer not-a-file, modifiable, not line-numbered, etc |
2849 setlocal bt=nofile nobl ma nonu noswf nowrap | 2853 setlocal bt=nofile nobl ma nonu noswf nowrap |
2850 if g:netrw_fastbrowse >= 2 | 2854 if g:netrw_fastbrowse >= 2 |
2851 setlocal bh=hide | 2855 setlocal bh=hide |
2856 else | |
2857 setlocal bh=delete | |
2852 endif | 2858 endif |
2853 keepalt silent! %d | 2859 keepalt silent! %d |
2854 | 2860 |
2855 " --------------------------- | 2861 " --------------------------- |
2856 " Perform Directory Listing: | 2862 " Perform Directory Listing: |
3176 let curwin = winnr() | 3182 let curwin = winnr() |
3177 let ibl = 0 | 3183 let ibl = 0 |
3178 for ibuf in s:netrw_browselist | 3184 for ibuf in s:netrw_browselist |
3179 if bufwinnr(ibuf) == -1 | 3185 if bufwinnr(ibuf) == -1 |
3180 " call Decho("wiping buf#".ibuf) | 3186 " call Decho("wiping buf#".ibuf) |
3181 exe "bw ".ibuf | 3187 exe "silent! bw ".ibuf |
3182 call remove(s:netrw_browselist,ibl) | 3188 call remove(s:netrw_browselist,ibl) |
3183 " call Decho("browselist=".string(s:netrw_browselist)) | 3189 " call Decho("browselist=".string(s:netrw_browselist)) |
3184 continue | 3190 continue |
3185 else | 3191 else |
3186 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) | 3192 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) |
3896 return | 3902 return |
3897 endif | 3903 endif |
3898 | 3904 |
3899 " Get Temporary Filename | 3905 " Get Temporary Filename |
3900 let w:aikeep = &ai | 3906 let w:aikeep = &ai |
3901 " record autochdir setting and then insure its unset (tnx to David Fishburn) | 3907 " " netrw and the acd option do not work together properly |
3902 if &acd && (has("netbeans_intg") || has("sun_workshop")) | 3908 " if &acd && (has("netbeans_intg") || has("sun_workshop")) |
3903 set noacd | 3909 " set noacd |
3904 echohl Warning | echomsg "***warning*** directory browsing and the acd setting are incompatible" |echohl None | 3910 " echohl Warning | echomsg "***warning*** directory browsing and the acd setting are incompatible" |echohl None |
3905 endif | 3911 " endif |
3906 let w:fokeep = &fo | 3912 let w:fokeep = &fo |
3907 let w:aikeep = &ai | 3913 let w:aikeep = &ai |
3908 let w:cikeep = &ci | 3914 let w:cikeep = &ci |
3909 let w:cinkeep = &cin | 3915 let w:cinkeep = &cin |
3910 let w:cinokeep = &cino | 3916 let w:cinokeep = &cino |