annotate runtime/plugin/netrwPlugin.vim @ 10019:782a8070c3a6 v7.4.2282

commit https://github.com/vim/vim/commit/0abe0522d0e52b50c6eab52323be558eb56fe95e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 28 16:53:12 2016 +0200 patch 7.4.2282 Problem: When a child process is very fast waiting 10 msec for it is noticeable. (Ramel Eshed) Solution: Start waiting for 1 msec and gradually increase.
author Christian Brabandt <cb@256bit.org>
date Sun, 28 Aug 2016 17:00:07 +0200
parents 0bdeaf7092bc
children 65d7fd8381a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
1 " netrwPlugin.vim: Handles file transfer and remote directory listing across a network
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
2 " PLUGIN SECTION
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3 " Date: Feb 08, 2016
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
5 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6 " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
7 " Permission is hereby granted to use and distribute this code,
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
8 " with or without modifications, provided that this copyright
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
9 " notice is copied with it. Like anything else that's free,
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
10 " netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
11 " *as is* and comes with no warranty of any kind, either
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
12 " expressed or implied. By using this plugin, you agree that
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
13 " in no event will the copyright holder be liable for any damages
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
14 " resulting from the use of this software.
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
15 "
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
16 " But be doers of the Word, and not only hearers, deluding your own selves {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
17 " (James 1:22 RSV)
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
18 " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
19 " Load Once: {{{1
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
20 if &cp || exists("g:loaded_netrwPlugin")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
21 finish
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
22 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
23 let g:loaded_netrwPlugin = "v156"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
24 let s:keepcpo = &cpo
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
25 set cpo&vim
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
26 "DechoRemOn
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
27
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
28 " ---------------------------------------------------------------------
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
29 " Public Interface: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
30
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
31 " Local Browsing Autocmds: {{{2
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
32 augroup FileExplorer
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
33 au!
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
34 au BufLeave * if &ft != "netrw"|let w:netrw_prvfile= expand("%:p")|endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
35 au BufEnter * sil call s:LocalBrowse(expand("<amatch>"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
36 au VimEnter * sil call s:VimEnter(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
37 if has("win32") || has("win95") || has("win64") || has("win16")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
38 au BufEnter .* sil call s:LocalBrowse(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
39 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
40 augroup END
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
41
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
42 " Network Browsing Reading Writing: {{{2
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
43 augroup Network
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
44 au!
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
45 au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
46 au BufReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
47 au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
48 au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
49 au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
50 try
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
51 au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
52 catch /^Vim\%((\a\+)\)\=:E216/
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
53 au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
54 endtry
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
55 augroup END
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
56
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
57 " Commands: :Nread, :Nwrite, :NetUserPass {{{2
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
58 com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
59 com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
60 com! -nargs=* NetUserPass call NetUserPass(<f-args>)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
61 com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
62 com! -nargs=? Ntree call netrw#SetTreetop(<q-args>)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
63
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
64 " Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
65 com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
66 com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
67 com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
68 com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<count>,1,4+<bang>0,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
69 com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
70 com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
71 com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
72 com! -nargs=* -bar -bang -count=0 -complete=dir Lexplore call netrw#Lexplore(<count>,<bang>0,<q-args>)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
73
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
74 " Commands: NetrwSettings {{{2
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1118
diff changeset
75 com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings()
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
76 com! -bang NetrwClean call netrw#Clean(<bang>0)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
77
649
8157079cea85 updated for version 7.0191
vimboss
parents: 557
diff changeset
78 " Maps:
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
79 if !exists("g:netrw_nogx")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
80 if maparg('gx','n') == ""
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
81 if !hasmapto('<Plug>NetrwBrowseX')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
82 nmap <unique> gx <Plug>NetrwBrowseX
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
83 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
84 nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr>
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
85 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
86 if maparg('gx','v') == ""
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
87 if !hasmapto('<Plug>NetrwBrowseXVis')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
88 vmap <unique> gx <Plug>NetrwBrowseXVis
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
89 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
90 vno <silent> <Plug>NetrwBrowseXVis :<c-u>call netrw#BrowseXVis()<cr>
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
91 endif
649
8157079cea85 updated for version 7.0191
vimboss
parents: 557
diff changeset
92 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
93 if exists("g:netrw_usetab") && g:netrw_usetab
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
94 if maparg('<c-tab>','n') == ""
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
95 nmap <unique> <c-tab> <Plug>NetrwShrink
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
96 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
97 nno <silent> <Plug>NetrwShrink :call netrw#Shrink()<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
98 endif
649
8157079cea85 updated for version 7.0191
vimboss
parents: 557
diff changeset
99
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
100 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
101 " LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
102 fun! s:LocalBrowse(dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
103 " Unfortunate interaction -- only DechoMsg debugging calls can be safely used here.
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
104 " Otherwise, the BufEnter event gets triggered when attempts to write to
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
105 " the DBG buffer are made.
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
106
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
107 if !exists("s:vimentered")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
108 " If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will,
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
109 " and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined.
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
110 " call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered doesn't exist)")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
111 " call Dret("s:LocalBrowse")
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
112 return
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
113 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
114
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
115 " call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered=".s:vimentered.")")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
116
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
117 if has("amiga")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
118 " The check against '' is made for the Amiga, where the empty
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
119 " string is the current directory and not checking would break
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
120 " things such as the help command.
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
121 " call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
122 if a:dirname != '' && isdirectory(a:dirname)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
123 sil! call netrw#LocalBrowseCheck(a:dirname)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
124 if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
125 exe w:netrw_bannercnt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
126 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
127 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
128
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
129 elseif isdirectory(a:dirname)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
130 " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
131 " call Dredir("LocalBrowse ft last set: ","verbose set ft")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
132 " call Decho("(s:LocalBrowse) COMBAK#23: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col("."))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
133 sil! call netrw#LocalBrowseCheck(a:dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
134 " call Decho("(s:LocalBrowse) COMBAK#24: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col("."))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
135 if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
136 exe w:netrw_bannercnt
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
137 " call Decho("(s:LocalBrowse) COMBAK#25: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col("."))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
138 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
139
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
140 else
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
141 " not a directory, ignore it
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
142 " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
143 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
144 " call Decho("(s:LocalBrowse) COMBAK#26: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col("."))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
145
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
146 " call Dret("s:LocalBrowse")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
147 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
148
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
149 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
150 " s:VimEnter: after all vim startup stuff is done, this function is called. {{{2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
151 " Its purpose: to look over all windows and run s:LocalBrowse() on
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
152 " them, which checks if they're directories and will create a directory
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
153 " listing when appropriate.
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
154 " It also sets s:vimentered, letting s:LocalBrowse() know that s:VimEnter()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
155 " has already been called.
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
156 fun! s:VimEnter(dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
157 " call Dfunc("s:VimEnter(dirname<".a:dirname.">) expand(%)<".expand("%").">")
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
158 let curwin = winnr()
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
159 let s:vimentered = 1
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
160 windo call s:LocalBrowse(expand("%:p"))
2426
e52d87a2bb3e More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2420
diff changeset
161 exe curwin."wincmd w"
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
162 " call Dret("s:VimEnter")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
163 endfun
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
164
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
165 " ---------------------------------------------------------------------
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
166 " NetrwStatusLine: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
167 fun! NetrwStatusLine()
755
d01e3133478f updated for version 7.0224
vimboss
parents: 718
diff changeset
168 " let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".")
d01e3133478f updated for version 7.0224
vimboss
parents: 718
diff changeset
169 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")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
170 let &stl= s:netrw_explore_stl
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
171 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
172 if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
173 return ""
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
174 else
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
175 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
176 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
177 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
178
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
179 " ------------------------------------------------------------------------
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
180 " NetUserPass: set username and password for subsequent ftp transfer {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
181 " Usage: :call NetUserPass() -- will prompt for userid and password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
182 " :call NetUserPass("uid") -- will prompt for password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
183 " :call NetUserPass("uid","password") -- sets global userid and password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
184 fun! NetUserPass(...)
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
185
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
186 " get/set userid
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
187 if a:0 == 0
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
188 " call Dfunc("NetUserPass(a:0<".a:0.">)")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
189 if !exists("g:netrw_uid") || g:netrw_uid == ""
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
190 " via prompt
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
191 let g:netrw_uid= input('Enter username: ')
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
192 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
193 else " from command line
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
194 " call Dfunc("NetUserPass(a:1<".a:1.">) {")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
195 let g:netrw_uid= a:1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
196 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
197
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
198 " get password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
199 if a:0 <= 1 " via prompt
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
200 " call Decho("a:0=".a:0." case <=1:")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
201 let g:netrw_passwd= inputsecret("Enter Password: ")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
202 else " from command line
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
203 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
204 let g:netrw_passwd=a:2
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
205 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
206 " call Dret("NetUserPass")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
207 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
208
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
209 " ------------------------------------------------------------------------
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
210 " Modelines And Restoration: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
211 let &cpo= s:keepcpo
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
212 unlet s:keepcpo
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
213 " vim:ts=8 fdm=marker