annotate runtime/plugin/netrwPlugin.vim @ 5923:463ef551e9f6 v7.4.303

updated for version 7.4.303 Problem: When using double-width characters the text displayed on the command line is sometimes truncated. Solution: Reset the string lenght. (Nobuhiro Takasaki)
author Bram Moolenaar <bram@vim.org>
date Thu, 22 May 2014 16:05:19 +0200
parents 657ade71d395
children 16d26051085a
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
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3 " Date: Jan 22, 2014
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
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
23 let g:loaded_netrwPlugin = "v151"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
24 if v:version < 702
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
25 echohl WarningMsg
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
26 echo "***warning*** you need vim version 7.2 for this version of netrw"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
27 echohl None
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
28 finish
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
29 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
30 if v:version < 703 || (v:version == 703 && !has("patch465"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
31 echohl WarningMsg
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
32 echo "***warning*** this version of netrw needs vim 7.3.465 or later"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
33 echohl Normal
553
249173daa651 updated for version 7.0157
vimboss
parents: 534
diff changeset
34 finish
249173daa651 updated for version 7.0157
vimboss
parents: 534
diff changeset
35 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
36 let s:keepcpo = &cpo
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
37 set cpo&vim
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
38 "DechoRemOn
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
39
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
40 " ---------------------------------------------------------------------
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
41 " Public Interface: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
42
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
43 " Local Browsing Autocmds: {{{2
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
44 augroup FileExplorer
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
45 au!
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
46 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
47 au BufEnter * sil call s:LocalBrowse(expand("<amatch>"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
48 au VimEnter * sil call s:VimEnter(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
49 if has("win32") || has("win95") || has("win64") || has("win16")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
50 au BufEnter .* sil call s:LocalBrowse(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
51 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
52 augroup END
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
53
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
54 " Network Browsing Reading Writing: {{{2
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
55 augroup Network
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
56 au!
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
57 au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
58 au BufReadCmd ftp://*,rcp://*,scp://*,http://*,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>"))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
59 au FileReadCmd ftp://*,rcp://*,scp://*,http://*,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>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
60 au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
61 au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
62 try
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
63 au SourceCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
64 catch /^Vim\%((\a\+)\)\=:E216/
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
65 au SourcePre ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
66 endtry
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
67 augroup END
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
68
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
69 " Commands: :Nread, :Nwrite, :NetUserPass {{{2
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
70 com! -count=1 -nargs=* Nread call netrw#SavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#RestorePosn()
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
71 com! -range=% -nargs=* Nwrite call netrw#SavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#RestorePosn()
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
72 com! -nargs=* NetUserPass call NetUserPass(<f-args>)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
73 com! -nargs=* Nsource call netrw#SavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#RestorePosn()
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
74 com! -nargs=? Ntree call netrw#SetTreetop(<q-args>)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
75
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
76 " Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
77 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
78 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
79 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
80 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
81 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
82 com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
83 com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
84 com! -nargs=* -bar -complete=dir Lexplore call netrw#Lexplore(<q-args>)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
85
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
86 " Commands: NetrwSettings {{{2
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1118
diff changeset
87 com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings()
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
88 com! -bang NetrwClean call netrw#Clean(<bang>0)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
89
649
8157079cea85 updated for version 7.0191
vimboss
parents: 557
diff changeset
90 " Maps:
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
91 if !exists("g:netrw_nogx") && maparg('gx','n') == ""
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
92 if !hasmapto('<Plug>NetrwBrowseX')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
93 nmap <unique> gx <Plug>NetrwBrowseX
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
94 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
95 nno <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cfile>"),0)<cr>
649
8157079cea85 updated for version 7.0191
vimboss
parents: 557
diff changeset
96 endif
8157079cea85 updated for version 7.0191
vimboss
parents: 557
diff changeset
97
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
98 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
99 " LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
100 fun! s:LocalBrowse(dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
101 " Unfortunate interaction -- only DechoMsg debugging calls can be safely used here.
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
102 " Otherwise, the BufEnter event gets triggered when attempts to write to
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
103 " the DBG buffer are made.
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
104
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
105 if !exists("s:vimentered")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
106 " 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
107 " 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
108 " 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
109 " call Dret("s:LocalBrowse")
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
110 return
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
111 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
112
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
113 " call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered=".s:vimentered.")")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
114
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
115 if has("amiga")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
116 " The check against '' is made for the Amiga, where the empty
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
117 " string is the current directory and not checking would break
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
118 " things such as the help command.
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
119 " call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
120 if a:dirname != '' && isdirectory(a:dirname)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
121 sil! call netrw#LocalBrowseCheck(a:dirname)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
122 if exists("w:netrw_bannercnt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
123 exe w:netrw_bannercnt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
124 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
125 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
126
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 755
diff changeset
127 elseif isdirectory(a:dirname)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
128 " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
129 " call Dredir("LocalBrowse ft last set: ","verbose set ft")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
130 sil! call netrw#LocalBrowseCheck(a:dirname)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
131 if exists("w:netrw_bannercnt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
132 exe w:netrw_bannercnt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
133 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
134
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
135 else
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
136 " not a directory, ignore it
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
137 " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
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 " call Dret("s:LocalBrowse")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
141 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
142
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
143 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
144 " 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
145 " 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
146 " 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
147 " listing when appropriate.
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
148 " 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
149 " has already been called.
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
150 fun! s:VimEnter(dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
151 " 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
152 let curwin = winnr()
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
153 let s:vimentered = 1
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
154 windo call s:LocalBrowse(expand("%:p"))
2426
e52d87a2bb3e More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2420
diff changeset
155 exe curwin."wincmd w"
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
156 " call Dret("s:VimEnter")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
157 endfun
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
158
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
159 " ---------------------------------------------------------------------
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
160 " NetrwStatusLine: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
161 fun! NetrwStatusLine()
755
d01e3133478f updated for version 7.0224
vimboss
parents: 718
diff changeset
162 " 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
163 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
164 let &stl= s:netrw_explore_stl
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
165 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
166 if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
167 return ""
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
168 else
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
169 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
170 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
171 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
172
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
173 " ------------------------------------------------------------------------
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
174 " NetUserPass: set username and password for subsequent ftp transfer {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
175 " Usage: :call NetUserPass() -- will prompt for userid and password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
176 " :call NetUserPass("uid") -- will prompt for password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
177 " :call NetUserPass("uid","password") -- sets global userid and password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
178 fun! NetUserPass(...)
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
179
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
180 " get/set userid
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
181 if a:0 == 0
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
182 " call Dfunc("NetUserPass(a:0<".a:0.">)")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
183 if !exists("g:netrw_uid") || g:netrw_uid == ""
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
184 " via prompt
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
185 let g:netrw_uid= input('Enter username: ')
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
186 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
187 else " from command line
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
188 " call Dfunc("NetUserPass(a:1<".a:1.">) {")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
189 let g:netrw_uid= a:1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
190 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
191
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
192 " get password
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
193 if a:0 <= 1 " via prompt
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
194 " call Decho("a:0=".a:0." case <=1:")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
195 let g:netrw_passwd= inputsecret("Enter Password: ")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
196 else " from command line
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
197 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
198 let g:netrw_passwd=a:2
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
199 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
200 " call Dret("NetUserPass")
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
201 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
202
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
203 " ------------------------------------------------------------------------
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
204 " Modelines And Restoration: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
205 let &cpo= s:keepcpo
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
206 unlet s:keepcpo
c6296b0ad9ea updated for version 7.0151
vimboss
parents:
diff changeset
207 " vim:ts=8 fdm=marker