Mercurial > vim
comparison runtime/plugin/netrwPlugin.vim @ 1118:2b8ff9e3c520
updated for version 7.1a
author | vimboss |
---|---|
date | Sat, 05 May 2007 17:10:09 +0000 |
parents | d01e3133478f |
children | 46bbe11644e0 |
comparison
equal
deleted
inserted
replaced
1117:a13e4b242735 | 1118:2b8ff9e3c520 |
---|---|
1 " netrwPlugin.vim: Handles file transfer and remote directory listing across a network | 1 " netrwPlugin.vim: Handles file transfer and remote directory listing across a network |
2 " PLUGIN PORTION | 2 " PLUGIN SECTION |
3 " Date: Oct 27, 2005 | 3 " Date: Jan 05, 2007 |
4 " Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> | 4 " Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> |
5 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim | 5 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim |
6 " Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 | 6 " Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 |
7 " Permission is hereby granted to use and distribute this code, | 7 " Permission is hereby granted to use and distribute this code, |
8 " with or without modifications, provided that this copyright | 8 " with or without modifications, provided that this copyright |
9 " notice is copied with it. Like anything else that's free, | 9 " notice is copied with it. Like anything else that's free, |
17 " (James 1:22 RSV) | 17 " (James 1:22 RSV) |
18 " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | 18 " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
19 | 19 |
20 " --------------------------------------------------------------------- | 20 " --------------------------------------------------------------------- |
21 " Load Once: {{{1 | 21 " Load Once: {{{1 |
22 if exists("g:loaded_netrw") | 22 if &cp || exists("g:loaded_netrwPlugin") |
23 finish | 23 finish |
24 endif | 24 endif |
25 let g:loaded_netrwPlugin = 1 | |
26 let s:keepcpo = &cpo | |
25 if v:version < 700 | 27 if v:version < 700 |
26 echohl WarningMsg | echo "***netrw*** you need vim version 7.0 for this version of netrw" | echohl None | 28 echohl WarningMsg | echo "***netrw*** you need vim version 7.0 for this version of netrw" | echohl None |
27 finish | 29 finish |
28 endif | 30 endif |
29 let s:keepcpo= &cpo | 31 let s:keepcpo= &cpo |
34 | 36 |
35 " Local Browsing: {{{2 | 37 " Local Browsing: {{{2 |
36 augroup FileExplorer | 38 augroup FileExplorer |
37 au! | 39 au! |
38 au BufEnter * silent! call s:LocalBrowse(expand("<amatch>")) | 40 au BufEnter * silent! call s:LocalBrowse(expand("<amatch>")) |
41 if has("win32") || has("win95") || has("win64") || has("win16") | |
42 au BufEnter .* silent! call s:LocalBrowse(expand("<amatch>")) | |
43 endif | |
39 augroup END | 44 augroup END |
40 | 45 |
41 " Network Browsing Reading Writing: {{{2 | 46 " Network Browsing Reading Writing: {{{2 |
42 augroup Network | 47 augroup Network |
43 au! | 48 au! |
49 endif | 54 endif |
50 au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe '2Nread "'.expand("<amatch>").'"'|exe "silent doau BufReadPost ".expand("<amatch>") | 55 au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe '2Nread "'.expand("<amatch>").'"'|exe "silent doau BufReadPost ".expand("<amatch>") |
51 au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("<amatch>")|exe 'Nread "' .expand("<amatch>").'"'|exe "silent doau FileReadPost ".expand("<amatch>") | 56 au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("<amatch>")|exe 'Nread "' .expand("<amatch>").'"'|exe "silent doau FileReadPost ".expand("<amatch>") |
52 au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe 'Nwrite "' .expand("<amatch>").'"'|exe "silent doau BufWritePost ".expand("<amatch>") | 57 au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe 'Nwrite "' .expand("<amatch>").'"'|exe "silent doau BufWritePost ".expand("<amatch>") |
53 au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("<amatch>")|exe "'[,']".'Nwrite "' .expand("<amatch>").'"'|exe "silent doau FileWritePost ".expand("<amatch>") | 58 au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("<amatch>")|exe "'[,']".'Nwrite "' .expand("<amatch>").'"'|exe "silent doau FileWritePost ".expand("<amatch>") |
59 try | |
60 au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("<amatch>").'"' | |
61 catch /^Vim\%((\a\+)\)\=:E216/ | |
62 au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("<amatch>").'"' | |
63 endtry | |
54 augroup END | 64 augroup END |
55 | 65 |
56 " Commands: :Nread, :Nwrite, :NetUserPass {{{2 | 66 " Commands: :Nread, :Nwrite, :NetUserPass {{{2 |
57 com! -count=1 -nargs=* Nread call netrw#NetSavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#NetRestorePosn() | 67 com! -count=1 -nargs=* Nread call netrw#NetSavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#NetRestorePosn() |
58 com! -range=% -nargs=* Nwrite call netrw#NetSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetRestorePosn() | 68 com! -range=% -nargs=* Nwrite call netrw#NetSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetRestorePosn() |
59 com! -nargs=* NetUserPass call NetUserPass(<f-args>) | 69 com! -nargs=* NetUserPass call NetUserPass(<f-args>) |
60 com! -nargs=+ Ncopy call netrw#NetObtain(<f-args>) | 70 com! -nargs=+ Ncopy call netrw#NetObtain(<f-args>) |
71 com! -nargs=* Nsource call netrw#NetSavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#NetRestorePosn() | |
61 | 72 |
62 " Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2 | 73 " Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2 |
63 com! -nargs=? -bar -bang -count=0 Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>) | 74 com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>) |
64 com! -nargs=? -bar -bang -count=0 Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>) | 75 com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>) |
65 com! -nargs=? -bar -bang -count=0 Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>) | 76 com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>) |
66 com! -nargs=? -bar -bang -count=0 Vexplore call netrw#Explore(<count>,1,4+<bang>0,<q-args>) | 77 com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<count>,1,4+<bang>0,<q-args>) |
67 com! -nargs=? -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>) | 78 com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>) |
68 com! -nargs=? -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>) | 79 com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>) |
80 com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>) | |
69 | 81 |
70 " Commands: NetrwSettings {{{2 | 82 " Commands: NetrwSettings {{{2 |
71 com! -nargs=0 NetrwSettings :call netrwSettings#NetrwSettings() | 83 com! -nargs=0 NetrwSettings :call netrwSettings#NetrwSettings() |
72 | 84 |
73 " Maps: | 85 " Maps: |
74 if !hasmapto('<Plug>NetrwBrowseX') | 86 if !exists("g:netrw_nogx") && maparg('g','n') == "" |
75 nmap <unique> gx <Plug>NetrwBrowseX | 87 if !hasmapto('<Plug>NetrwBrowseX') |
88 nmap <unique> gx <Plug>NetrwBrowseX | |
89 endif | |
90 nno <silent> <Plug>NetrwBrowseX :call netrw#NetBrowseX(expand("<cWORD>"),0)<cr> | |
76 endif | 91 endif |
77 nno <silent> <Plug>NetrwBrowseX :call netrw#NetBrowseX(expand("<cWORD>"),0)<cr> | |
78 | 92 |
79 " --------------------------------------------------------------------- | 93 " --------------------------------------------------------------------- |
80 " LocalBrowse: {{{2 | 94 " LocalBrowse: {{{2 |
81 fun! s:LocalBrowse(dirname) | 95 fun! s:LocalBrowse(dirname) |
82 " unfortunate interaction -- debugging calls can't be used here; | 96 " unfortunate interaction -- debugging calls can't be used here; |
83 " the BufEnter event causes triggering when attempts to write to | 97 " the BufEnter event causes triggering when attempts to write to |
84 " the DBG buffer are made. | 98 " the DBG buffer are made. |
85 if isdirectory(a:dirname) | 99 " echomsg "dirname<".a:dirname.">" |
86 silent! call netrw#DirBrowse(a:dirname) | 100 if has("amiga") |
101 " The check against '' is made for the Amiga, where the empty | |
102 " string is the current directory and not checking would break | |
103 " things such as the help command. | |
104 if a:dirname != '' && isdirectory(a:dirname) | |
105 silent! call netrw#LocalBrowseCheck(a:dirname) | |
106 endif | |
107 elseif isdirectory(a:dirname) | |
108 " echomsg "dirname<".dirname."> isdir" | |
109 silent! call netrw#LocalBrowseCheck(a:dirname) | |
87 endif | 110 endif |
88 " not a directory, ignore it | 111 " not a directory, ignore it |
89 endfun | 112 endfun |
90 | 113 |
91 " --------------------------------------------------------------------- | 114 " --------------------------------------------------------------------- |