annotate runtime/autoload/netrw.vim @ 2040:70c67b1bb1f1 v7.2.329

updated for version 7.2.329 Problem: "g_" doesn't position cursor correctly when in Visual mode and 'selection' is "exclusive". (Ben Fritz) Solution: Call adjust_for_sel().
author Bram Moolenaar <bram@zimbu.org>
date Tue, 12 Jan 2010 15:42:37 +0100
parents 7bc41231fbc7
children f63ace015c63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1 " netrw.vim: Handles file transfer and remote directory listing across
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2 " AUTOLOAD SECTION
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3 " Date: Dec 28, 2009
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4 " Version: 136
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5 " Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
6 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7 " Copyright: Copyright (C) 1999-2009 Charles E. Campbell, Jr. {{{1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8 " Permission is hereby granted to use and distribute this code,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
9 " with or without modifications, provided that this copyright
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
10 " notice is copied with it. Like anything else that's free,
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
11 " netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12 " *as is* and come with no warranty of any kind, either
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
13 " expressed or implied. By using this plugin, you agree that
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
14 " in no event will the copyright holder be liable for any damages
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
15 " resulting from the use of this software.
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
16 "redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
17 "
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
18 " But be doers of the Word, and not only hearers, deluding your own selves {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
19 " (James 1:22 RSV)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
20 " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
21 " Load Once: {{{1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
22 if &cp || exists("g:loaded_netrw")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
23 finish
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
24 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
25 let g:loaded_netrw = "v136"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
26 if v:version < 702
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
27 echohl WarningMsg
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
28 echo "***warning*** this version of netrw needs vim 7.2"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
29 echohl Normal
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
30 finish
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
31 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
32 if !exists("s:NOTE")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
33 let s:NOTE = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
34 let s:WARNING = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
35 let s:ERROR = 2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
36 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
37
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
38 " sanity checks
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
39 if v:version < 700
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
40 call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
41 finish
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
42 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
43
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
44 let s:keepcpo= &cpo
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
45 setlocal cpo&vim
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
46 "DechoTabOn
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
47 "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
48
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
49 " ======================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
50 " Netrw Variables: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
51 " ======================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
52
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
53 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
54 " NetrwInit: initializes variables if they haven't been defined {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
55 " Loosely, varname = value.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
56 fun s:NetrwInit(varname,value)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
57 if !exists(a:varname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
58 if type(a:value) == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
59 exe "let ".a:varname."=".a:value
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
60 elseif type(a:value) == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
61 exe "let ".a:varname."="."'".a:value."'"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
62 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
63 exe "let ".a:varname."=".a:value
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
64 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
65 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
66 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
67
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
68 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
69 " Netrw Constants: {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
70 call s:NetrwInit("g:netrw_dirhist_cnt",0)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
71 if !exists("s:LONGLIST")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
72 call s:NetrwInit("s:THINLIST",0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
73 call s:NetrwInit("s:LONGLIST",1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
74 call s:NetrwInit("s:WIDELIST",2)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
75 call s:NetrwInit("s:TREELIST",3)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
76 call s:NetrwInit("s:MAXLIST" ,4)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
77 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
78
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
79 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
80 " Default values for netrw's global protocol variables {{{2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
81 if !exists("g:netrw_dav_cmd")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
82 if executable("cadaver")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
83 let g:netrw_dav_cmd = "cadaver"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
84 elseif executable("curl")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
85 let g:netrw_dav_cmd = "curl"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
86 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
87 let g:netrw_dav_cmd = ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
88 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
89 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
90 if !exists("g:netrw_fetch_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
91 if executable("fetch")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
92 let g:netrw_fetch_cmd = "fetch -o"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
93 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
94 let g:netrw_fetch_cmd = ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
95 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
96 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
97 if !exists("g:netrw_ftp_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
98 let g:netrw_ftp_cmd = "ftp"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
99 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
100 if !exists("g:netrw_http_cmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
101 if executable("elinks")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
102 let g:netrw_http_cmd = "elinks"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
103 call s:NetrwInit("g:netrw_http_xcmd","-source >")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
104 elseif executable("links")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
105 let g:netrw_http_cmd = "links"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
106 call s:NetrwInit("g:netrw_http_xcmd","-source >")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
107 elseif executable("curl")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
108 let g:netrw_http_cmd = "curl"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
109 call s:NetrwInit("g:netrw_http_xcmd","-o")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
110 elseif executable("wget")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
111 let g:netrw_http_cmd = "wget"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
112 call s:NetrwInit("g:netrw_http_xcmd","-q -O")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
113 elseif executable("fetch")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
114 let g:netrw_http_cmd = "fetch"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
115 call s:NetrwInit("g:netrw_http_xcmd","-o")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
116 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
117 let g:netrw_http_cmd = ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
118 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
119 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
120 call s:NetrwInit("g:netrw_rcp_cmd" , "rcp")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
121 call s:NetrwInit("g:netrw_rsync_cmd", "rsync")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
122 call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
123 call s:NetrwInit("g:netrw_sftp_cmd" , "sftp")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
124 call s:NetrwInit("g:netrw_ssh_cmd" , "ssh")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
125
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
126 if (has("win32") || has("win95") || has("win64") || has("win16"))
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
127 \ && exists("g:netrw_use_nt_rcp")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
128 \ && g:netrw_use_nt_rcp
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
129 \ && executable( $SystemRoot .'/system32/rcp.exe')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
130 let s:netrw_has_nt_rcp = 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
131 let s:netrw_rcpmode = '-b'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
132 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
133 let s:netrw_has_nt_rcp = 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
134 let s:netrw_rcpmode = ''
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
135 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
136
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
137 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
138 " Default values for netrw's global variables {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
139 " Cygwin Detection ------- {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
140 if !exists("g:netrw_cygwin")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
141 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
142 if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
143 let g:netrw_cygwin= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
144 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
145 let g:netrw_cygwin= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
146 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
147 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
148 let g:netrw_cygwin= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
149 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
150 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
151 " Default values - a-c ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
152 call s:NetrwInit("g:netrw_alto" , &sb)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
153 call s:NetrwInit("g:netrw_altv" , &spr)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
154 call s:NetrwInit("g:netrw_banner" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
155 call s:NetrwInit("g:netrw_browse_split", 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
156 call s:NetrwInit("g:netrw_chgwin" , -1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
157 call s:NetrwInit("g:netrw_compress" , "gzip")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
158 call s:NetrwInit("g:netrw_ctags" , "ctags")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
159 if !exists("g:netrw_cursorline")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
160 let g:netrw_cursorline= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
161 let s:netrw_usercul = &cursorline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
162 let s:netrw_usercuc = &cursorcolumn
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
163 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
164 " Default values - d-g ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
165 call s:NetrwInit("g:netrw_dirhist_cnt" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
166 call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf"}')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
167 call s:NetrwInit("g:netrw_dirhistmax" , 10)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
168 call s:NetrwInit("g:netrw_fastbrowse" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
169 call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
170 if !exists("g:netrw_ftp_list_cmd")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
171 if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
172 let g:netrw_ftp_list_cmd = "ls -lF"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
173 let g:netrw_ftp_timelist_cmd = "ls -tlF"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
174 let g:netrw_ftp_sizelist_cmd = "ls -slF"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
175 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
176 let g:netrw_ftp_list_cmd = "dir"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
177 let g:netrw_ftp_timelist_cmd = "dir"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
178 let g:netrw_ftp_sizelist_cmd = "dir"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
179 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
180 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
181 call s:NetrwInit("g:netrw_ftpmode",'binary')
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
182 " Default values - h-lh ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
183 call s:NetrwInit("g:netrw_hide",1)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
184 if !exists("g:netrw_ignorenetrc")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
185 if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
186 let g:netrw_ignorenetrc= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
187 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
188 let g:netrw_ignorenetrc= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
189 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
190 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
191 call s:NetrwInit("g:netrw_keepdir",1)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
192 if !exists("g:netrw_list_cmd")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
193 if g:netrw_scp_cmd =~ '^pscp' && executable("pscp")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
194 " provide a 'pscp' listing command
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
195 if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
196 let g:netrw_scp_cmd ="pscp -i C:\\private.ppk"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
197 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
198 let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
199 elseif executable(g:netrw_ssh_cmd)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
200 " provide a default listing command
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
201 let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
202 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
203 " call Decho(g:netrw_ssh_cmd." is not executable")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
204 let g:netrw_list_cmd= ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
205 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
206 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
207 call s:NetrwInit("g:netrw_list_hide","")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
208 " Default values - lh-lz ---------- {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
209 if !exists("g:netrw_localcopycmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
210 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
211 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
212 let g:netrw_localcopycmd= "cp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
213 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
214 let g:netrw_localcopycmd= "copy"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
215 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
216 elseif has("unix") || has("macunix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
217 let g:netrw_localcopycmd= "cp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
218 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
219 let g:netrw_localcopycmd= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
220 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
221 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
222 call s:NetrwInit("g:netrw_local_mkdir","mkdir")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
223 if !exists("g:netrw_localmovecmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
224 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
225 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
226 let g:netrw_localmovecmd= "mv"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
227 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
228 let g:netrw_localmovecmd= "move"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
229 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
230 elseif has("unix") || has("macunix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
231 let g:netrw_localmovecmd= "mv"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
232 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
233 let g:netrw_localmovecmd= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
234 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
235 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
236 call s:NetrwInit("g:netrw_local_rmdir", "rmdir")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
237 call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
238 " sanity checks
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
239 if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
240 let g:netrw_liststyle= s:THINLIST
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
241 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
242 if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
243 let g:netrw_list_cmd= g:netrw_list_cmd." -l"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
244 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
245 " Default values - m-r ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
246 call s:NetrwInit("g:netrw_markfileesc" , '*./[\~')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
247 call s:NetrwInit("g:netrw_maxfilenamelen", 32)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
248 call s:NetrwInit("g:netrw_menu" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
249 call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
250 call s:NetrwInit("g:netrw_mousemaps" , (exists("&mouse") && &mouse =~ '[anh]'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
251 call s:NetrwInit("g:netrw_retmap" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
252 if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
253 call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
254 elseif has("win32") || has("win95") || has("win64") || has("win16")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
255 call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
256 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
257 call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
258 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
259 call s:NetrwInit("g:netrw_preview" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
260 call s:NetrwInit("g:netrw_scpport" , "-P")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
261 call s:NetrwInit("g:netrw_sshport" , "-p")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
262 call s:NetrwInit("g:netrw_rename_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mv")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
263 call s:NetrwInit("g:netrw_rm_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
264 call s:NetrwInit("g:netrw_rmdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
265 call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
266 " Default values - s ---------- {{{3
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
267 " g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
268 call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\<Char-0x01>" : "\<Char-0xff>")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
269 call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "silent " : "")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
270 call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
271 call s:NetrwInit("g:netrw_sort_options" , "")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
272 call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
273 if !exists("g:netrw_sort_sequence")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
274 if has("unix")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
275 let g:netrw_sort_sequence= '[\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
276 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
277 let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
278 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
279 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
280 call s:NetrwInit("g:netrw_special_syntax" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
281 call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
282 call s:NetrwInit("g:netrw_use_noswf" , 0)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
283 " Default values - t-w ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
284 call s:NetrwInit("g:netrw_timefmt","%c")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
285 call s:NetrwInit("g:netrw_xstrlen",0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
286 call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
287 call s:NetrwInit("g:netrw_use_errorwindow",1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
288 call s:NetrwInit("g:netrw_win95ftp",1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
289 call s:NetrwInit("g:netrw_winsize","")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
290 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
291 " Default values for netrw's script variables: {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
292 call s:NetrwInit("g:netrw_fname_escape",' ?&;%')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
293 call s:NetrwInit("g:netrw_glob_escape",'[]*?`{~$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
294 call s:NetrwInit("g:netrw_tmpfile_escape",' &;')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
295 call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
296
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
297 " BufEnter event ignored by decho when following variable is true
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
298 " Has a side effect that doau BufReadPost doesn't work, so
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
299 " files read by network transfer aren't appropriately highlighted.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
300 "let g:decho_bufenter = 1 "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
301
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
302 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
303 " Netrw Utility Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
304 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
305
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
306 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
307 " s:NetrwOptionSave: save options and set to "standard" form {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
308 " 06/08/07 : removed call to NetrwSafeOptions(), either placed
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
309 " immediately after NetrwOptionSave() calls in NetRead
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
310 " and NetWrite, or after the s:NetrwEnew() call in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
311 " NetrwBrowse.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
312 " vt: normally its "w:" or "s:" (a variable type)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
313 fun! s:NetrwOptionSave(vt)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
314 " call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
315
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
316 " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
317 if !exists("{a:vt}netrw_optionsave")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
318 let {a:vt}netrw_optionsave= 1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
319 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
320 " call Dret("s:NetrwOptionSave : options already saved")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
321 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
322 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
323 " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
324
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
325 " Save current settings and current directory
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
326 let s:yykeep = @@
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
327 if exists("&l:acd")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
328 let {a:vt}netrw_acdkeep = &l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
329 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
330 let {a:vt}netrw_aikeep = &l:ai
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
331 let {a:vt}netrw_awkeep = &l:aw
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
332 let {a:vt}netrw_cikeep = &l:ci
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
333 let {a:vt}netrw_cinkeep = &l:cin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
334 let {a:vt}netrw_cinokeep = &l:cino
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
335 let {a:vt}netrw_comkeep = &l:com
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
336 let {a:vt}netrw_cpokeep = &l:cpo
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
337 if g:netrw_keepdir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
338 let {a:vt}netrw_dirkeep = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
339 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
340 let {a:vt}netrw_fokeep = &l:fo " formatoptions
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
341 let {a:vt}netrw_gdkeep = &l:gd " gdefault
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
342 let {a:vt}netrw_hidkeep = &l:hidden
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
343 let {a:vt}netrw_magickeep = &l:magic
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
344 let {a:vt}netrw_repkeep = &l:report
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
345 let {a:vt}netrw_spellkeep = &l:spell
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
346 let {a:vt}netrw_twkeep = &l:tw " textwidth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
347 let {a:vt}netrw_wigkeep = &l:wig " wildignore
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
348 if has("win32") && !has("win95")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
349 let {a:vt}netrw_swfkeep = &l:swf " swapfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
350 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
351 if &go =~ 'a' | silent! let {a:vt}netrw_regstar = @* | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
352 silent! let {a:vt}netrw_regslash= @/
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
353
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
354 " call Dret("s:NetrwOptionSave : win#".winnr()." buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
355 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
356
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
357 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
358 " s:NetrwOptionRestore: restore options {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
359 fun! s:NetrwOptionRestore(vt)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
360 " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")." winnr($)=".winnr("$"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
361 if !exists("{a:vt}netrw_optionsave")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
362 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
363 " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
364 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
365 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
366 unlet {a:vt}netrw_optionsave
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
367
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
368 if exists("&acd")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
369 if exists("{a:vt}netrw_acdkeep")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
370 " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
371 let curdir = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
372 let &l:acd = {a:vt}netrw_acdkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
373 unlet {a:vt}netrw_acdkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
374 if &l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
375 " call Decho("exe keepjumps lcd ".fnameescape(curdir)) " NOTE: was g:netrw_fname_escape for some reason
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
376 try
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
377 if !exists("&l:acd") && !&l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
378 exe 'keepjumps lcd '.fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
379 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
380 catch /^Vim\%((\a\+)\)\=:E472/
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
381 call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".curdir."> (permissions?)",61)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
382 endtry
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
383 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
384 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
385 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
386 if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
387 if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
388 if exists("{a:vt}netrw_cikeep") |let &l:ci = {a:vt}netrw_cikeep |unlet {a:vt}netrw_cikeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
389 if exists("{a:vt}netrw_cinkeep") |let &l:cin = {a:vt}netrw_cinkeep |unlet {a:vt}netrw_cinkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
390 if exists("{a:vt}netrw_cinokeep") |let &l:cino = {a:vt}netrw_cinokeep |unlet {a:vt}netrw_cinokeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
391 if exists("{a:vt}netrw_comkeep") |let &l:com = {a:vt}netrw_comkeep |unlet {a:vt}netrw_comkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
392 if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
393 if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
394 let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
395 if exists("{a:vt}netrw_dirkeep") |exe "keepjumps lcd ".fnameescape(dirkeep)|unlet {a:vt}netrw_dirkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
396 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
397 if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
398 if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
399 if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
400 if exists("{a:vt}netrw_magic") |let &l:magic = {a:vt}netrw_magic |unlet {a:vt}netrw_magic |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
401 if exists("{a:vt}netrw_repkeep") |let &l:report = {a:vt}netrw_repkeep |unlet {a:vt}netrw_repkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
402 if exists("{a:vt}netrw_spellkeep")|let &l:spell = {a:vt}netrw_spellkeep |unlet {a:vt}netrw_spellkeep|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
403 if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
404 if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
405 if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
406 if exists("{a:vt}netrw_swfkeep")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
407 if &directory == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
408 " user hasn't specified a swapfile directory;
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
409 " netrw will temporarily set the swapfile directory
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
410 " to the current directory as returned by getcwd().
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
411 let &l:directory = getcwd()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
412 silent! let &l:swf = {a:vt}netrw_swfkeep
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
413 setlocal directory=
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
414 unlet {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
415 elseif &l:swf != {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
416 " following line causes a Press ENTER in windows -- can't seem to work around it!!!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
417 silent! let &l:swf= {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
418 unlet {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
419 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
420 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
421 if exists("{a:vt}netrw_regstar") |silent! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
422 if exists("{a:vt}netrw_regslash")|silent! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
423
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
424 " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
425 " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
426 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
427 " call Dret("s:NetrwOptionRestore : win#".winnr()." buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
428 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
429
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
430 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
431 " s:NetrwSafeOptions: sets options to help netrw do its job {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
432 fun! s:NetrwSafeOptions()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
433 " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
434 " call Decho("win#".winnr()."'s ft=".&ft)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
435 setlocal cino=
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
436 setlocal com=
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
437 setlocal cpo-=aA
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
438 if exists("&acd") | setlocal noacd | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
439 setlocal nocin noai noci magic nospell nohid wig= noaw
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
440 setlocal fo=nroql2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
441 setlocal tw=0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
442 setlocal report=10000
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
443 setlocal isk+=@ isk+=* isk+=/
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
444 if g:netrw_use_noswf && has("win32") && !has("win95")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
445 setlocal noswf
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
446 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
447
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
448 " allow the user to override safe options
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
449 if &ft == "netrw"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
450 silent keepalt keepjumps doau FileType netrw
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
451 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
452
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
453 " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
454 " call Dret("s:NetrwSafeOptions")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
455 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
456
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
457 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
458 " netrw#NetrwClean: remove netrw {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
459 " supports :NetrwClean -- remove netrw from first directory on runtimepath
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
460 " :NetrwClean! -- remove netrw from all directories on runtimepath
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
461 fun! netrw#NetrwClean(sys)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
462 " call Dfunc("netrw#NetrwClean(sys=".a:sys.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
463
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
464 if a:sys
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
465 let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
466 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
467 let choice= confirm("Remove personal copy of netrw?","&Yes\n&No")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
468 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
469 " call Decho("choice=".choice)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
470 let diddel= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
471 let diddir= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
472
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
473 if choice == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
474 for dir in split(&rtp,',')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
475 if filereadable(dir."/plugin/netrwPlugin.vim")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
476 " call Decho("removing netrw-related files from ".dir)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
477 if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
478 if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
479 if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
480 if s:NetrwDelete(dir."/autoload/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrw.vim",55) |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
481 if s:NetrwDelete(dir."/syntax/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrw.vim",55) |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
482 if s:NetrwDelete(dir."/syntax/netrwlist.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrwlist.vim",55) |endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
483 let diddir= dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
484 let diddel= diddel + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
485 if !a:sys|break|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
486 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
487 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
488 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
489
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
490 echohl WarningMsg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
491 if diddel == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
492 echomsg "netrw is either not installed or not removable"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
493 elseif diddel == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
494 echomsg "removed one copy of netrw from <".diddir.">"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
495 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
496 echomsg "removed ".diddel." copies of netrw"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
497 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
498 echohl None
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
499
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
500 " call Dret("netrw#NetrwClean")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
501 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
502
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
503 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
504 " netrw#Nread: {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
505 fun! netrw#Nread(mode,fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
506 " call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
507 call netrw#NetrwSavePosn()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
508 call netrw#NetRead(a:mode,a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
509 call netrw#NetrwRestorePosn()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
510 " call Dret("netrw#Nread")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
511 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
512
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
513 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
514 " Netrw Transfer Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
515 " ===============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
516
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
517 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
518 " netrw#NetRead: responsible for reading a file over the net {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
519 " mode: =0 read remote file and insert before current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
520 " =1 read remote file and insert after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
521 " =2 replace with remote file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
522 " =3 obtain file, but leave in temporary format
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
523 fun! netrw#NetRead(mode,...)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
524 " call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
525
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
526 " NetRead: save options {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
527 call s:NetrwOptionSave("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
528 call s:NetrwSafeOptions()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
529
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
530 " NetRead: interpret mode into a readcmd {{{3
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
531 if a:mode == 0 " read remote file before current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
532 let readcmd = "0r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
533 elseif a:mode == 1 " read file after current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
534 let readcmd = "r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
535 elseif a:mode == 2 " replace with remote file
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
536 let readcmd = "%r"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
537 elseif a:mode == 3 " skip read of file (leave as temporary)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
538 let readcmd = "t"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
539 else
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
540 exe a:mode
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
541 let readcmd = "r"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
542 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
543 let ichoice = (a:0 == 0)? 0 : 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
544 " call Decho("readcmd<".readcmd."> ichoice=".ichoice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
545
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
546 " NetRead: get temporary filename {{{3
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
547 let tmpfile= s:GetTempfile("")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
548 if tmpfile == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
549 " call Dret("netrw#NetRead : unable to get a tempfile!")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
550 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
551 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
552
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
553 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
554
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
555 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
556 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
557 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
558 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
559 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
560
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
561 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
562 exe "let choice= a:" . ichoice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
563 " call Decho("no lastfile: choice<" . choice . ">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
564
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
565 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
566 " give help
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
567 echomsg 'NetRead Usage:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
568 echomsg ':Nread machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
569 echomsg ':Nread "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
570 echomsg ':Nread "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
571 echomsg ':Nread dav://machine[:port]/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
572 echomsg ':Nread fetch://machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
573 echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
574 echomsg ':Nread http://[user@]machine/path uses http wget'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
575 echomsg ':Nread rcp://[user@]machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
576 echomsg ':Nread rsync://machine[:port]/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
577 echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
578 echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
579 sleep 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
580 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
581
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
582 elseif match(choice,'^"') != -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
583 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
584 " call Decho("reconstructing choice")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
585 if match(choice,'"$') != -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
586 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
587 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
588 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
589 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
590 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
591 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
592
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
593 while match(choice,'"$') == -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
594 let wholechoice = wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
595 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
596 if ichoice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
597 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
598 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
599 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
600 " call Dret("netrw#NetRead :2 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
601 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
602 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
603 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
604 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
605 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
606 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
607 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
608 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
609
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
610 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
611 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
612
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
613 " NetRead: Determine method of read (ftp, rcp, etc) {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
614 call s:NetrwMethod(choice)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
615 if !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
616 " call Dfunc("netrw#NetRead : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
617 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
618 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
619 let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
620
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
621 " Check if NetrwBrowse() should be handling this request
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
622 " call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
623 if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://'
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
624 " call Decho("yes, choice matches '^.*[\/]$'")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
625 keepjumps call s:NetrwBrowse(0,choice)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
626 " call Dret("netrw#NetRead :3 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
627 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
628 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
629
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
630 " ============
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
631 " NetRead: Perform Protocol-Based Read {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
632 " ===========================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
633 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
634 echo "(netrw) Processing your read request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
635 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
636
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
637 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
638 " NetRead: (rcp) NetRead Method #1 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
639 if b:netrw_method == 1 " read with rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
640 " call Decho("read via rcp (method #1)")
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
641 " ER: nothing done with g:netrw_uid yet?
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
642 " ER: on Win2K" rcp machine[.user]:file tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
643 " ER: if machine contains '.' adding .user is required (use $USERNAME)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
644 " ER: the tmpfile is full path: rcp sees C:\... as host C
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
645 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
646 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
647 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
648 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
649 " Any way needed it machine contains a '.'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
650 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
651 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
652 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
653 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
654 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
655 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
656 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
657 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
658 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
659 " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
660 exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
661 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
662 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
663
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
664 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
665 " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
666 elseif b:netrw_method == 2 " read with ftp + <.netrc>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
667 " call Decho("read via ftp+.netrc (method #2)")
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
668 let netrw_fname= b:netrw_fname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
669 call s:SaveBufVars()|new|call s:RestoreBufVars()
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
670 let filtbuf= bufnr("%")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
671 setlocal ff=unix
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
672 put =g:netrw_ftpmode
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
673 " call Decho("filter input: ".getline(line("$")))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
674 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
675 put =g:netrw_ftpextracmd
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
676 " call Decho("filter input: ".getline(line("$")))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
677 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
678 call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
679 " call Decho("filter input: ".getline(line("$")))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
680 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
681 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine." ".g:netrw_port,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
682 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine." ".g:netrw_port,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
683 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
684 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
685 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
686 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
687 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
688 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
689 let debugkeep = &debug
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
690 setlocal debug=msg
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
691 call netrw#ErrorMsg(s:ERROR,getline(1),4)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
692 let &debug = debugkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
693 endif
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
694 call s:SaveBufVars()
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
695 bd!
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
696 if bufname("%") == "" && getline("$") == "" && line('$') == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
697 " needed when one sources a file in a nolbl setting window via ftp
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
698 q!
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
699 endif
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
700 call s:RestoreBufVars()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
701 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
702 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
703
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
704 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
705 " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
706 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
707 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
708 " call Decho("read via ftp+mipf (method #3)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
709 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
710 call s:SaveBufVars()|new|call s:RestoreBufVars()
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
711 let filtbuf= bufnr("%")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
712 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
713 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
714 put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
715 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
716 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
717 put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
718 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
719 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
720
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
721 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
722 put =g:netrw_uid
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
723 " call Decho("filter input: ".getline('.'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
724 put ='\"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
725 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
726 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
727 put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
728 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
729 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
730
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
731 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
732 put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
733 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
734 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
735 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
736 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
737 " call Decho("filter input: ".getline('.'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
738 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
739 put ='get \"'.netrw_fname.'\" '.tmpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
740 " call Decho("filter input: ".getline('.'))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
741
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
742 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
743 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
744 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
745 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
746 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
747 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
748 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
749 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
750 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
751 " call Decho("error<".getline(1).">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
752 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
753 call netrw#ErrorMsg(s:ERROR,getline(1),5)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
754 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
755 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
756 call s:SaveBufVars()|bd!|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
757 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
758 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
759
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
760 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
761 " NetRead: (scp) NetRead Method #4 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
762 elseif b:netrw_method == 4 " read with scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
763 " call Decho("read via scp (method #4)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
764 if exists("g:netrw_port") && g:netrw_port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
765 let useport= " ".g:netrw_scpport." ".g:netrw_port
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
766 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
767 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
768 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
769 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
770 exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
771 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
772 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
773
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
774 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
775 " NetRead: (http) NetRead Method #5 (wget) {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
776 elseif b:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
777 " call Decho("read via http (method #5)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
778 if g:netrw_http_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
779 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
780 call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
781 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
782 " call Dret("netrw#NetRead :4 getcwd<".getcwd().">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
783 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
784 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
785
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
786 if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
787 " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
788 " call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
789 if exists("g:netrw_http_xcmd")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
790 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
791 exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
792 else
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
793 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
794 exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
795 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
796 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
797
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
798 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
799 " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
800 " call Decho(("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
801 let netrw_html= substitute(b:netrw_fname,"#.*$","","")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
802 let netrw_tag = substitute(b:netrw_fname,"^.*#","","")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
803 " call Decho("netrw_html<".netrw_html.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
804 " call Decho("netrw_tag <".netrw_tag.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
805 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
806 exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
807 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
808 " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
809 exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
810 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
811 let b:netrw_lastfile = choice
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
812 setlocal ro
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
813
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
814 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
815 " NetRead: (dav) NetRead Method #6 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
816 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
817 " call Decho("read via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
818
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
819 if !executable(g:netrw_dav_cmd)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
820 call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
821 " call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
822 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
823 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
824 if g:netrw_dav_cmd =~ "curl"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
825 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
826 exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
827 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
828 " Construct execution string (four lines) which will be passed through filter
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
829 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
830 new
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
831 setlocal ff=unix
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
832 if exists("g:netrw_port") && g:netrw_port != ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
833 put ='open '.g:netrw_machine.' '.g:netrw_port
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
834 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
835 put ='open '.g:netrw_machine
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
836 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
837 put ='user '.g:netrw_uid.' '.s:netrw_passwd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
838 put ='get '.netrw_fname.' '.tmpfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
839 put ='quit'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
840
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
841 " perform cadaver operation:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
842 norm! 1Gdd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
843 " call Decho("executing: %!".g:netrw_dav_cmd)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
844 exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
845 bd!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
846 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
847 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
848 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
849
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
850 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
851 " NetRead: (rsync) NetRead Method #7 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
852 elseif b:netrw_method == 7
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
853 " call Decho("read via rsync (method #7)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
854 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
855 exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
856 let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
857 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
858
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
859 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
860 " NetRead: (fetch) NetRead Method #8 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
861 " fetch://[user@]host[:http]/path
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
862 elseif b:netrw_method == 8
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
863 " call Decho("read via fetch (method #8)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
864 if g:netrw_fetch_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
865 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
866 call netrw#ErrorMsg(s:ERROR,"fetch command not available",7)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
867 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
868 " call Dret("NetRead")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
869 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
870 if exists("g:netrw_option") && g:netrw_option == ":http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
871 let netrw_option= "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
872 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
873 let netrw_option= "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
874 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
875 " call Decho("read via fetch for ".netrw_option)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
876
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
877 if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
878 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
879 exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
880 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
881 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
882 exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
883 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
884
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
885 let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
886 let b:netrw_lastfile = choice
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
887 setlocal ro
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
888
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
889 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
890 " NetRead: (sftp) NetRead Method #9 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
891 elseif b:netrw_method == 9
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
892 " call Decho("read via sftp (method #9)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
893 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
894 exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
895 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
896 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
897
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
898 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
899 " NetRead: Complain {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
900 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
901 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
902 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
903 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
904
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
905 " NetRead: cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
906 if exists("b:netrw_method")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
907 " call Decho("cleanup b:netrw_method and b:netrw_fname")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
908 unlet b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
909 unlet b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
910 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
911 if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
912 " call Decho("cleanup by deleting tmpfile<".tmpfile.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
913 call s:NetrwDelete(tmpfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
914 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
915 call s:NetrwOptionRestore("w:")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
916
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
917 " call Dret("netrw#NetRead :5 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
918 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
919
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
920 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
921 " netrw#NetWrite: responsible for writing a file over the net {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
922 fun! netrw#NetWrite(...) range
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
923 " call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
924
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
925 " NetWrite: option handling {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
926 let mod= 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
927 call s:NetrwOptionSave("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
928 call s:NetrwSafeOptions()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
929
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
930 " NetWrite: Get Temporary Filename {{{3
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
931 let tmpfile= s:GetTempfile("")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
932 if tmpfile == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
933 " call Dret("netrw#NetWrite : unable to get a tempfile!")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
934 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
935 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
936
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
937 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
938 let ichoice = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
939 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
940 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
941 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
942
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
943 let curbufname= expand("%")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
944 " call Decho("curbufname<".curbufname.">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
945 if &binary
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
946 " For binary writes, always write entire file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
947 " (line numbers don't really make sense for that).
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
948 " Also supports the writing of tar and zip files.
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
949 " call Decho("(write entire file) silent exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
950 silent exe "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
951 elseif g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
952 " write (selected portion of) file to temporary
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
953 let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
954 " call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
955 silent exe a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
956 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
957 " write (selected portion of) file to temporary
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
958 " call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
959 silent exe a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
960 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
961
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
962 if curbufname == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
963 " if the file is [No Name], and one attempts to Nwrite it, the buffer takes
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
964 " on the temporary file's name. Deletion of the temporary file during
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
965 " cleanup then causes an error message.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
966 0file!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
967 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
968
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
969 " NetWrite: while choice loop: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
970 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
971
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
972 " Process arguments: {{{4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
973 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
974 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
975 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
976 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
977 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
978 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
979 exe "let choice= a:" . ichoice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
980
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
981 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
982 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
983 echomsg 'NetWrite Usage:"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
984 echomsg ':Nwrite machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
985 echomsg ':Nwrite "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
986 echomsg ':Nwrite "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
987 echomsg ':Nwrite dav://[user@]machine/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
988 echomsg ':Nwrite fetch://[user@]machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
989 echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
990 echomsg ':Nwrite rcp://machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
991 echomsg ':Nwrite rsync://[user@]machine/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
992 echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
993 echomsg ':Nwrite sftp://[user@]machine/path uses sftp'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
994 sleep 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
995 break
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
996
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
997 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
998 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
999 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1000 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1001 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1002 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1003 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1004 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1005
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1006 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1007 let wholechoice= wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1008 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1009 if choice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1010 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1011 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1012 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1013 " call Dret("netrw#NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1014 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1015 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1016 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1017 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1018 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1019 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1020 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1021 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1022 let ichoice= ichoice + 1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1023 " call Decho("choice<" . choice . "> ichoice=".ichoice)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1024
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1025 " Determine method of write (ftp, rcp, etc) {{{4
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1026 call s:NetrwMethod(choice)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1027 if !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1028 " call Dfunc("netrw#NetWrite : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1029 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1030 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1031
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1032 " =============
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1033 " NetWrite: Perform Protocol-Based Write {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1034 " ============================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1035 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1036 echo "(netrw) Processing your write request..."
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1037 " call Decho("(netrw) Processing your write request...")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1038 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1039
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1040 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1041 " NetWrite: (rcp) NetWrite Method #1 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1042 if b:netrw_method == 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1043 " call Decho("write via rcp (method #1)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1044 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1045 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1046 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1047 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1048 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1049 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1050 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1051 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1052 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1053 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1054 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1055 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1056 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1057 " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1058 exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1059 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1060
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1061 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1062 " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1063 elseif b:netrw_method == 2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1064 " call Decho("write via ftp+.netrc (method #2)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1065 let netrw_fname = b:netrw_fname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1066
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1067 " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1068 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1069 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1070 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1071 enew
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1072
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1073 " call Decho("filter input window#".winnr())
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1074 setlocal ff=unix
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1075 put =g:netrw_ftpmode
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1076 " call Decho("filter input: ".getline('$'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1077 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1078 put =g:netrw_ftpextracmd
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1079 " call Decho("filter input: ".getline("$"))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1080 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1081 call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"')
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1082 " call Decho("filter input: ".getline("$"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1083 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1084 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1085 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1086 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1087 " call Decho("filter input window#".winnr())
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1088 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1089 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1090 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1091 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1092 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1093 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1094 call netrw#ErrorMsg(s:ERROR,getline(1),14)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1095 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1096 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1097 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1098
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1099 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1100 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1101 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1102 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1103 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1104
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1105 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1106
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1107 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1108 " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1109 elseif b:netrw_method == 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1110 " Construct execution string (three or more lines) which will be passed through filter
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1111 " call Decho("read via ftp+mipf (method #3)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1112 let netrw_fname = b:netrw_fname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1113 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1114
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1115 " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1116 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1117 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1118 enew
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1119 setlocal ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1120
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1121 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1122 put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1123 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1124 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1125 put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1126 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1127 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1128 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1129 put =g:netrw_uid
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1130 " call Decho("filter input: ".getline('.'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1131 put ='\"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1132 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1133 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1134 put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1135 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1136 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1137 put =g:netrw_ftpmode
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1138 " call Decho("filter input: ".getline('$'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1139 if exists("g:netrw_ftpextracmd")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1140 put =g:netrw_ftpextracmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1141 " call Decho("filter input: ".getline("$"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1142 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1143 put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1144 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1145 " save choice/id/password for future use
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1146 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1147
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1148 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1149 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1150 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1151 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1152 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1153 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1154 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1155 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1156 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1157 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1158 call netrw#ErrorMsg(s:ERROR,getline(1),15)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1159 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1160 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1161 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1162
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1163 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1164 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1165 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1166 let &l:bh= bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1167 exe filtbuf."bw!"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1168
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1169 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1170 " NetWrite: (scp) NetWrite Method #4 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1171 elseif b:netrw_method == 4
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1172 " call Decho("write via scp (method #4)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1173 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1174 let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1175 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1176 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1177 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1178 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1179 exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1180 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1181
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1182 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1183 " NetWrite: (http) NetWrite Method #5 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1184 elseif b:netrw_method == 5
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1185 " call Decho("write via http (method #5)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1186 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1187 call netrw#ErrorMsg(s:ERROR,"currently <netrw.vim> does not support writing using http:",16)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1188 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1189
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1190 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1191 " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1192 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1193 " call Decho("write via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1194
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1195 " Construct execution string (four lines) which will be passed through filter
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1196 let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1197 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1198
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1199 " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1200 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1201 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1202 enew
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1203
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1204 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1205 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1206 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1207 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1208 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1209 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1210 if exists("g:netrw_uid") && exists("s:netrw_passwd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1211 put ='user '.g:netrw_uid.' '.s:netrw_passwd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1212 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1213 put ='put '.tmpfile.' '.netrw_fname
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1214
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1215 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1216 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1217 " call Decho("executing: %!".g:netrw_dav_cmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1218 exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1219
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1220 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1221 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1222 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1223 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1224 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1225
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1226 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1227
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1228 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1229 " NetWrite: (rsync) NetWrite Method #7 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1230 elseif b:netrw_method == 7
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1231 " call Decho("write via rsync (method #7)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1232 " call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1233 exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1234 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1235
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1236 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1237 " NetWrite: (sftp) NetWrite Method #9 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1238 elseif b:netrw_method == 9
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1239 " call Decho("read via sftp (method #9)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1240 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1241 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1242 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1243 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1244 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1245 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1246
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1247 " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1248 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1249 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1250 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1251 enew
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1252
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1253 setlocal ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1254 call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1255 " call Decho("filter input: ".getline('.'))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1256 " call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1257 exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1258 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1259 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1260 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1261 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1262 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1263
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1264 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1265 " NetWrite: Complain {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1266 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1267 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1268 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1269 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1270
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1271 " NetWrite: Cleanup: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1272 " call Decho("cleanup")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1273 if s:FileReadable(tmpfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1274 " call Decho("tmpfile<".tmpfile."> readable, will now delete it")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1275 call s:NetrwDelete(tmpfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1276 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1277 call s:NetrwOptionRestore("w:")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1278
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1279 if a:firstline == 1 && a:lastline == line("$")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1280 " restore modifiability; usually equivalent to set nomod
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1281 let &mod= mod
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1282 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1283
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1284 " restore equalalways
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1285 " call Dret("netrw#NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1286 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1287
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1288 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1289 " netrw#NetSource: source a remotely hosted vim script {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1290 " uses NetRead to get a copy of the file into a temporarily file,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1291 " then sources that file,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1292 " then removes that file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1293 fun! netrw#NetSource(...)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1294 " call Dfunc("netrw#NetSource() a:0=".a:0)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1295 if a:0 > 0 && a:1 == '?'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1296 " give help
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1297 echomsg 'NetSource Usage:'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1298 echomsg ':Nsource dav://machine[:port]/path uses cadaver'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1299 echomsg ':Nsource fetch://machine/path uses fetch'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1300 echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1301 echomsg ':Nsource http://[user@]machine/path uses http wget'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1302 echomsg ':Nsource rcp://[user@]machine/path uses rcp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1303 echomsg ':Nsource rsync://machine[:port]/path uses rsync'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1304 echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1305 echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1306 sleep 4
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1307 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1308 let i= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1309 while i <= a:0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1310 call netrw#NetRead(3,a:{i})
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1311 " call Decho("(netrw#NetSource) s:netread_tmpfile<".s:netrw_tmpfile.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1312 if s:FileReadable(s:netrw_tmpfile)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1313 " call Decho("(netrw#NetSource) exe so ".fnameescape(s:netrw_tmpfile))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1314 exe "so ".fnameescape(s:netrw_tmpfile)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1315 " call Decho("(netrw#NetSource) delete(".s:netrw_tmpfile.")")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1316 call delete(s:netrw_tmpfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1317 unlet s:netrw_tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1318 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1319 call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1320 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1321 let i= i + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1322 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1323 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1324 " call Dret("netrw#NetSource")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1325 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1326
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1327 " ===========================================
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1328 " s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1329 " readcmd == %r : replace buffer with newly read file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1330 " == 0r : read file at top of buffer
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1331 " == r : read file after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1332 " == t : leave file in temporary form (ie. don't read into buffer)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1333 fun! s:NetrwGetFile(readcmd, tfile, method)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1334 " call Dfunc("NetrwGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1335
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1336 " readcmd=='t': simply do nothing
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1337 if a:readcmd == 't'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1338 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1339 " call Dret("NetrwGetFile : skip read of <".a:tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1340 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1341 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1342
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1343 " get name of remote filename (ie. url and all)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1344 let rfile= bufname("%")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1345 " call Decho("rfile<".rfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1346
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1347 if exists("*NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1348 " for the use of NetReadFixup (not otherwise used internally)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1349 let line2= line("$")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1350 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1351
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1352 if a:readcmd[0] == '%'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1353 " get file into buffer
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1354 " call Decho("get file into buffer")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1355
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1356 " rename the current buffer to the temp file (ie. tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1357 if g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1358 let tfile= substitute(a:tfile,'/cygdrive/\(.\)','\1:','')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1359 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1360 let tfile= a:tfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1361 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1362 " call Decho("exe silent! keepalt file ".fnameescape(tfile))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1363 exe "silent! keepalt file ".fnameescape(tfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1364
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1365 " edit temporary file (ie. read the temporary file in)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1366 if rfile =~ '\.zip$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1367 " call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1368 call zip#Browse(tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1369 elseif rfile =~ '\.tar$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1370 " call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1371 call tar#Browse(tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1372 elseif rfile =~ '\.tar\.gz'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1373 " call Decho("handling remote gzip-compressed tar file")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1374 call tar#Browse(tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1375 elseif rfile =~ '\.tar\.bz2'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1376 " call Decho("handling remote bz2-compressed tar file")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1377 call tar#Browse(tfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1378 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1379 " call Decho("edit temporary file")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1380 e!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1381 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1382
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1383 " rename buffer back to remote filename
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1384 " call Decho("exe silent! keepalt file ".fnameescape(rfile))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1385 exe "silent! keepalt file ".fnameescape(rfile)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1386 filetype detect
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1387 " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1388 let line1 = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1389 let line2 = line("$")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1390
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1391 elseif s:FileReadable(a:tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1392 " read file after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1393 " call Decho("read file<".a:tfile."> after current line")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1394 let curline = line(".")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1395 let lastline= line("$")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1396 " call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1397 exe a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1398 let line1= curline + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1399 let line2= line("$") - lastline + 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1400
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1401 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1402 " not readable
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1403 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1404 " call Decho("tfile<".a:tfile."> not readable")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1405 call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1406 " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1407 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1408 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1409
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1410 " User-provided (ie. optional) fix-it-up command
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1411 if exists("*NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1412 " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1413 call NetReadFixup(a:method, line1, line2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1414 " else " Decho
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1415 " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")")
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1416 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1417
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1418 if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1419 " update the Buffers menu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1420 call s:UpdateBuffersMenu()
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1421 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1422
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1423 " call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile))
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1424
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1425 " make sure file is being displayed
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1426 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1427
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1428 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1429 " call Dret("NetrwGetFile")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1430 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1431
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1432 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1433 " s:NetrwMethod: determine method of transfer {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1434 " Input:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1435 " choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1436 " Output:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1437 " b:netrw_method= 1: rcp
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1438 " 2: ftp + <.netrc>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1439 " 3: ftp + machine, id, password, and [path]filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1440 " 4: scp
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1441 " 5: http (wget)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1442 " 6: dav
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1443 " 7: rsync
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1444 " 8: fetch
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1445 " 9: sftp
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1446 " g:netrw_machine= hostname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1447 " b:netrw_fname = filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1448 " g:netrw_port = optional port number (for ftp)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1449 " g:netrw_choice = copy of input url (choice)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1450 fun! s:NetrwMethod(choice)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1451 " call Dfunc("NetrwMethod(a:choice<".a:choice.">)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1452
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1453 " record current g:netrw_machine, if any
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1454 " curmachine used if protocol == ftp and no .netrc
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1455 if exists("g:netrw_machine")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1456 let curmachine= g:netrw_machine
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1457 " call Decho("curmachine<".curmachine.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1458 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1459 let curmachine= "N O T A HOST"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1460 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1461
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1462 " initialization
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1463 let b:netrw_method = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1464 let g:netrw_machine = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1465 let b:netrw_fname = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1466 let g:netrw_port = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1467 let g:netrw_choice = a:choice
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1468
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1469 " Patterns:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1470 " mipf : a:machine a:id password filename Use ftp
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1471 " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1472 " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1473 " rcpurm : rcp://[user@]host/filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1474 " rcphf : [user@]host:filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1475 " scpurm : scp://[user@]host[[#:]port]/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1476 " httpurm : http://[user@]host/filename Use wget
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1477 " davurm : dav[s]://host[:port]/path Use cadaver/curl
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1478 " rsyncurm : rsync://host[:port]/path Use rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1479 " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1480 " sftpurm : sftp://[user@]host/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1481 let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1482 let mf = '^\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1483 let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1484 let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1485 let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1486 let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1487 let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1488 let davurm = '^davs\=://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1489 let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1490 let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1491 let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1492
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1493 " call Decho("determine method:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1494 " Determine Method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1495 " rcp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1496 if match(a:choice,rcpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1497 " call Decho("rcp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1498 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1499 let userid = substitute(a:choice,rcpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1500 let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1501 let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1502 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1503 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1504 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1505
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1506 " scp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1507 elseif match(a:choice,scpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1508 " call Decho("scp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1509 let b:netrw_method = 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1510 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1511 let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1512 let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1513
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1514 " http://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1515 elseif match(a:choice,httpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1516 " call Decho("http://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1517 let b:netrw_method = 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1518 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1519 let b:netrw_fname = substitute(a:choice,httpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1520
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1521 " dav://hostname[:port]/..path-to-file..
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1522 elseif match(a:choice,davurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1523 " call Decho("dav://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1524 let b:netrw_method= 6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1525 if a:choice =~ '^s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1526 let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1527 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1528 let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1529 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1530 let b:netrw_fname = substitute(a:choice,davurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1531
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1532 " rsync://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1533 elseif match(a:choice,rsyncurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1534 " call Decho("rsync://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1535 let b:netrw_method = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1536 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1537 let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1538
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1539 " ftp://[user@]hostname[[:#]port]/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1540 elseif match(a:choice,ftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1541 " call Decho("ftp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1542 let userid = substitute(a:choice,ftpurm,'\2',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1543 let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1544 let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1545 let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1546 " call Decho("g:netrw_machine<".g:netrw_machine.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1547 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1548 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1549 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1550 if exists("s:netrw_passwd") && curmachine != g:netrw_machine
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1551 " if there's a change in hostname, require password re-entry
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1552 unlet s:netrw_passwd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1553 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1554 if exists("g:netrw_uid") && exists("s:netrw_passwd")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1555 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1556 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1557 if s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1558 let b:netrw_method= 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1559 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1560 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1561 call NetUserPass()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1562 elseif !exists("s:netrw_passwd") || s:netrw_passwd == ""
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1563 call NetUserPass(g:netrw_uid)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1564 " else just use current g:netrw_uid and s:netrw_passwd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1565 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1566 let b:netrw_method= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1567 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1568 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1569
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1570 elseif match(a:choice,fetchurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1571 " call Decho("fetch://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1572 let b:netrw_method = 8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1573 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1574 let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1575 let b:netrw_option = substitute(a:choice,fetchurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1576 let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1577
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1578 " Issue an ftp : "machine id password [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1579 elseif match(a:choice,mipf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1580 " call Decho("(ftp) host id pass file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1581 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1582 let g:netrw_machine = substitute(a:choice,mipf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1583 let g:netrw_uid = substitute(a:choice,mipf,'\2',"")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1584 let s:netrw_passwd = substitute(a:choice,mipf,'\3',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1585 let b:netrw_fname = substitute(a:choice,mipf,'\4',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1586
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1587 " Issue an ftp: "hostname [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1588 elseif match(a:choice,mf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1589 " call Decho("(ftp) host file")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1590 if exists("g:netrw_uid") && exists("s:netrw_passwd")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1591 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1592 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1593 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1594
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1595 elseif s:FileReadable(expand("$HOME/.netrc"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1596 let b:netrw_method = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1597 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1598 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1599 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1600
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1601 " sftp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1602 elseif match(a:choice,sftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1603 " call Decho("sftp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1604 let b:netrw_method = 9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1605 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1606 let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1607
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1608 " Issue an rcp: hostname:filename" (this one should be last)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1609 elseif match(a:choice,rcphf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1610 " call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1611 let b:netrw_method = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1612 let userid = substitute(a:choice,rcphf,'\2',"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1613 let g:netrw_machine = substitute(a:choice,rcphf,'\3',"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1614 let b:netrw_fname = substitute(a:choice,rcphf,'\4',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1615 " call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1616 " call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1617 " call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1618 " call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1619 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1620 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1621 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1622
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1623 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1624 if !exists("g:netrw_quiet")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1625 call netrw#ErrorMsg(s:WARNING,"cannot determine method (format: protocol://[user@]hostname[:port]/[path])",45)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1626 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1627 let b:netrw_method = -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1628 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1629
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1630 " remove any leading [:#] from port number
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1631 if g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1632 let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1633 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1634
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1635 " call Decho("a:choice <".a:choice.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1636 " call Decho("b:netrw_method <".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1637 " call Decho("g:netrw_machine<".g:netrw_machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1638 " call Decho("g:netrw_port <".g:netrw_port.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1639 " if exists("g:netrw_uid") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1640 " call Decho("g:netrw_uid <".g:netrw_uid.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1641 " endif "Decho
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1642 " if exists("s:netrw_passwd") "Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1643 " call Decho("s:netrw_passwd <".s:netrw_passwd.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1644 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1645 " call Decho("b:netrw_fname <".b:netrw_fname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1646 " call Dret("NetrwMethod : b:netrw_method=".b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1647 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1648
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1649 " ------------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1650 " NetReadFixup: this sort of function is typically written by the user {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1651 " to handle extra junk that their system's ftp dumps
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1652 " into the transfer. This function is provided as an
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1653 " example and as a fix for a Windows 95 problem: in my
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1654 " experience, win95's ftp always dumped four blank lines
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1655 " at the end of the transfer.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1656 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1657 fun! NetReadFixup(method, line1, line2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1658 " call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1659
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1660 " sanity checks -- attempt to convert inputs to integers
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1661 let method = a:method + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1662 let line1 = a:line1 + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1663 let line2 = a:line2 + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1664 if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1665 " call Dret("NetReadFixup")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1666 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1667 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1668
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1669 if method == 3 " ftp (no <.netrc>)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1670 let fourblanklines= line2 - 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1671 if fourblanklines >= line1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1672 exe "silent ".fourblanklines.",".line2."g/^\s*$/d"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1673 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1674 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1675 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1676
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1677 " call Dret("NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1678 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1679 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1680
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1681 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1682 " NetUserPass: set username and password for subsequent ftp transfer {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1683 " Usage: :call NetUserPass() -- will prompt for userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1684 " :call NetUserPass("uid") -- will prompt for password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1685 " :call NetUserPass("uid","password") -- sets global userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1686 fun! NetUserPass(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1687
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1688 " get/set userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1689 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1690 " call Dfunc("NetUserPass(a:0<".a:0.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1691 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1692 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1693 let g:netrw_uid= input('Enter username: ')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1694 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1695 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1696 " call Dfunc("NetUserPass(a:1<".a:1.">) {")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1697 let g:netrw_uid= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1698 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1699
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1700 " get password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1701 if a:0 <= 1 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1702 " call Decho("a:0=".a:0." case <=1:")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1703 let s:netrw_passwd= inputsecret("Enter Password: ")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1704 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1705 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1706 let s:netrw_passwd=a:2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1707 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1708
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1709 " call Dret("NetUserPass")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1710 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1711
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1712 " ===========================================
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1713 " Shared Browsing Support: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1714 " ===========================================
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1715
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1716 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1717 " s:BrowserMaps: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1718 fun! s:BrowserMaps(islocal)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1719 " call Dfunc("s:BrowserMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1720 if a:islocal
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1721 " call Decho("make local maps")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1722 nnoremap <buffer> <silent> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1723 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,'../'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1724 nnoremap <buffer> <silent> a :call <SID>NetrwHide(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1725 nnoremap <buffer> <silent> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1726 nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1727 nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1728 nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1729 nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1730 nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1731 nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1732 nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1733 nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1734 nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1735 nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1736 nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1737 nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1738 nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1739 nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1740 nnoremap <buffer> <silent> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1741 nnoremap <buffer> <silent> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1742 nnoremap <buffer> <silent> gh :<c-u>call <SID>NetrwHidden(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1743 nnoremap <buffer> <silent> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1744 nnoremap <buffer> <silent> c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1745 nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1746 nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1747 nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1748 nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1749 nnoremap <buffer> <silent> o :call <SID>NetrwSplit(3)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1750 nnoremap <buffer> <silent> O :call <SID>NetrwObtain(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1751 nnoremap <buffer> <silent> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1752 nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1753 nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1754 nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1755 nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1756 nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1757 nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(1)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1758 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1759 nnoremap <buffer> <silent> t :call <SID>NetrwSplit(4)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1760 nnoremap <buffer> <silent> T :call <SID>NetrwSplit(4)<bar>norm! gT<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1761 nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1762 nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1763 nnoremap <buffer> <silent> v :call <SID>NetrwSplit(5)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1764 nnoremap <buffer> <silent> x :call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1765 nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1766 if !hasmapto('<Plug>NetrwHideEdit')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1767 nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1768 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1769 nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1770 if !hasmapto('<Plug>NetrwRefresh')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1771 nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1772 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1773 nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1774 if s:didstarstar || !mapcheck("<s-down>","n")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1775 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1776 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1777 if s:didstarstar || !mapcheck("<s-up>","n")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1778 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1779 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1780 let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1781 if g:netrw_mousemaps == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1782 nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call <SID>NetrwLeftmouse(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1783 nnoremap <buffer> <silent> <middlemouse> <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1784 nnoremap <buffer> <silent> <s-leftmouse> <leftmouse>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1785 exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1786 exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1787 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1788 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1789 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1790 exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1791 exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1792 exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1793 exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1794 exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetrwMakeDir("")<cr>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1795 nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1796
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1797 else " remote
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1798 " call Decho("make remote maps")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1799 call s:RemotePathAnalysis(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1800 nnoremap <buffer> <silent> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1801 nnoremap <buffer> <silent> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1802 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'../'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1803 nnoremap <buffer> <silent> a :call <SID>NetrwHide(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1804 nnoremap <buffer> <silent> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1805 nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1806 nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1807 nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1808 nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1809 nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1810 nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1811 nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1812 nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1813 nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1814 nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1815 nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1816 nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1817 nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1818 nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1819 nnoremap <buffer> <silent> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1820 nnoremap <buffer> <silent> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_cur)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1821 nnoremap <buffer> <silent> gh :<c-u>call <SID>NetrwHidden(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1822 nnoremap <buffer> <silent> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1823 nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1824 nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1825 nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1826 nnoremap <buffer> <silent> o :call <SID>NetrwSplit(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1827 nnoremap <buffer> <silent> O :call <SID>NetrwObtain(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1828 nnoremap <buffer> <silent> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1829 nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1830 nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1831 nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1832 nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1833 nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1834 nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(0)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1835 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1836 nnoremap <buffer> <silent> t :call <SID>NetrwSplit(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1837 nnoremap <buffer> <silent> T :call <SID>NetrwSplit(1)<bar>norm! gT<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1838 nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1839 nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1840 nnoremap <buffer> <silent> v :call <SID>NetrwSplit(2)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1841 nnoremap <buffer> <silent> x :call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1842 nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(0)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1843 if !hasmapto('<Plug>NetrwHideEdit')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1844 nmap <buffer> <c-h> <Plug>NetrwHideEdit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1845 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1846 nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1847 if !hasmapto('<Plug>NetrwRefresh')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1848 nmap <buffer> <c-l> <Plug>NetrwRefresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1849 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1850
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1851 let mapsafepath = escape(s:path, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1852 let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1853
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1854 nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1855 if g:netrw_mousemaps == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1856 nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call <SID>NetrwLeftmouse(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1857 nnoremap <buffer> <silent> <middlemouse> <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1858 nnoremap <buffer> <silent> <s-leftmouse> <leftmouse>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1859 exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1860 exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1861 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1862 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1863 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1864 exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1865 exe 'nnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1866 exe 'vnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1867 exe 'nnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1868 exe 'vnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1869 nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1870 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1871 call s:SetRexDir(a:islocal,b:netrw_curdir)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1872 " call Dret("s:BrowserMaps")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1873 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1874
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1875 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1876 " s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1877 fun! s:ExplorePatHls(pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1878 " call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1879 let repat= substitute(a:pattern,'^**/\{1,2}','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1880 " call Decho("repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1881 let repat= escape(repat,'][.\')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1882 " call Decho("repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1883 let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1884 " call Dret("s:ExplorePatHls repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1885 return repat
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1886 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1887
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1888 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1889 " s:NetrwBookHistHandler: {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1890 " 0: (user: <mb>) bookmark current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1891 " 1: (user: <gb>) change to the bookmarked directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1892 " 2: (user: <qb>) list bookmarks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1893 " 3: (browsing) record current directory history
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1894 " 4: (user: <u>) go up (previous) bookmark
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1895 " 5: (user: <U>) go down (next) bookmark
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1896 " 6: (user: <mB>) delete bookmark
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1897 fun! s:NetrwBookHistHandler(chg,curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1898 " call Dfunc("NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1899
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1900 if a:chg == 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1901 " bookmark the current directory
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1902 " call Decho("(user: <b>) bookmark the current directory")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1903 if !exists("g:netrw_bookmarklist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1904 let g:netrw_bookmarklist= []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1905 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1906 if index(g:netrw_bookmarklist,a:curdir) == -1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1907 " curdir not currently in g:netrw_bookmarklist, so include it
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1908 call add(g:netrw_bookmarklist,a:curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1909 call sort(g:netrw_bookmarklist)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1910 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1911 echo "bookmarked the current directory"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1912
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1913 elseif a:chg == 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1914 " change to the bookmarked directory
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1915 " call Decho("(user: <".v:count."mb>) change to the bookmarked directory")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1916 if exists("g:netrw_bookmarklist[v:count-1]")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1917 exe "e ".fnameescape(g:netrw_bookmarklist[v:count-1])
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1918 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1919 echomsg "Sorry, bookmark#".v:count." doesn't exist!"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1920 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1921
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1922 elseif a:chg == 2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1923 " redraw!
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1924 let didwork= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1925 " list user's bookmarks
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1926 " call Decho("(user: <q>) list user's bookmarks")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1927 if exists("g:netrw_bookmarklist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1928 " call Decho('list '.len(g:netrw_bookmarklist).' bookmarks')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1929 let cnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1930 for bmd in g:netrw_bookmarklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1931 " call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1])
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1932 echo "Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1933 let didwork = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1934 let cnt = cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1935 endfor
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1936 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1937
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1938 " list directory history
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1939 let cnt = g:netrw_dirhist_cnt
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1940 let first = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1941 let histcnt = 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1942 while ( first || cnt != g:netrw_dirhist_cnt )
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1943 " call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1944 let histcnt= histcnt + 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1945 if exists("g:netrw_dirhist_{cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1946 " call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt})
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1947 echo "Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1948 let didwork= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1949 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1950 let first = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1951 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1952 if cnt < 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1953 let cnt= cnt + g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1954 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1955 endwhile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1956 if didwork
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1957 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1958 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1959
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1960 elseif a:chg == 3
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1961 " saves most recently visited directories (when they differ)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1962 " call Decho("(browsing) record curdir history")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1963 if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1964 let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1965 let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1966 " call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1967 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1968
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1969 elseif a:chg == 4
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1970 " u: change to the previous directory stored on the history list
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1971 " call Decho("(user: <u>) chg to prev dir from history")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1972 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1973 if g:netrw_dirhist_cnt < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1974 let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1975 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1976 if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1977 " call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1978 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1979 setlocal ma noro
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1980 " call Decho("setlocal ma noro")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1981 %d
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1982 setlocal nomod
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1983 " call Decho("setlocal nomod")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1984 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1985 " " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1986 exe "e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1987 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1988 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1989 echo "Sorry, no predecessor directory exists yet"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1990 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1991
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1992 elseif a:chg == 5
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1993 " U: change to the subsequent directory stored on the history list
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1994 " call Decho("(user: <U>) chg to next dir from history")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1995 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1996 if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1997 " call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1998 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1999 setlocal ma noro
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2000 " call Decho("setlocal ma noro")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2001 %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2002 " call Decho("removed all lines from buffer (%d)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2003 setlocal nomod
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2004 " call Decho("setlocal nomod")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2005 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2006 " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2007 exe "e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2008 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2009 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2010 if g:netrw_dirhist_cnt < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2011 let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2012 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2013 echo "Sorry, no successor directory exists yet"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2014 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2015
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2016 elseif a:chg == 6
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2017 " delete the v:count'th bookmark
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2018 " call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2019 let savefile= s:NetrwHome()."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2020 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2021 call s:NetrwBookHistSave() " done here to merge bookmarks first
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2022 call delete(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2023 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2024 call remove(g:netrw_bookmarklist,v:count-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2025 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2026 call s:NetrwBookmarkMenu()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2027 " call Dret("NetrwBookHistHandler")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2028 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2029
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2030 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2031 " s:NetrwBookHistRead: this function reads bookmarks and history {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2032 " Sister function: s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2033 fun! s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2034 " call Dfunc("s:NetrwBookHistRead()")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2035 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2036 let home = s:NetrwHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2037 let savefile= home."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2038 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2039 " call Decho("sourcing .netrwbook")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2040 exe "so ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2041 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2042 let savefile= home."/.netrwhist"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2043 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2044 " call Decho("sourcing .netrwhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2045 exe "so ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2046 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2047 let s:netrw_initbookhist= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2048 au VimLeave * call s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2049 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2050 " call Dret("s:NetrwBookHistRead")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2051 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2052
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2053 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2054 " s:NetrwBookHistSave: this function saves bookmarks and history {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2055 " Sister function: s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2056 " I used to do this via viminfo but that appears to
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2057 " be unreliable for long-term storage
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2058 " COMBAK: does $HOME work under windows???
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2059 fun! s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2060 " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2061 let savefile= s:NetrwHome()."/.netrwhist"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2062 1split
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2063 call s:NetrwEnew()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2064 setlocal cino= com= cpo-=aA fo=nroql2 tw=0 report=10000 noswf
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2065 setlocal nocin noai noci magic nospell nohid wig= noaw
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2066 setlocal ma noro write
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2067 if exists("&acd") | setlocal noacd | endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2068 silent %d
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2069
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2070 " save .netrwhist -- no attempt to merge
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2071 silent! file .netrwhist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2072 call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2073 call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2074 let lastline = line("$")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2075 let cnt = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2076 while cnt <= g:netrw_dirhist_cnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2077 call setline((cnt+lastline),'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2078 let cnt= cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2079 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2080 exe "silent! w! ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2081
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2082 silent %d
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2083 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2084 " merge and write .netrwbook
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2085 let savefile= s:NetrwHome()."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2086
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2087 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2088 let booklist= deepcopy(g:netrw_bookmarklist)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2089 exe "silent so ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2090 for bdm in booklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2091 if index(g:netrw_bookmarklist,bdm) == -1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2092 call add(g:netrw_bookmarklist,bdm)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2093 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2094 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2095 call sort(g:netrw_bookmarklist)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2096 exe "silent! w! ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2097 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2098
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2099 " construct and save .netrwbook
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2100 call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2101 exe "silent! w! ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2102 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2103 let bgone= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2104 q!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2105 exe bgone."bwipe!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2106
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2107 " call Dret("s:NetrwBookHistSave")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2108 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2109
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2110 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2111 " s:NetrwBrowse: This function uses the command in g:netrw_list_cmd to provide a {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2112 " list of the contents of a local or remote directory. It is assumed that the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2113 " g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2114 " with the requested remote hostname first.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2115 fun! s:NetrwBrowse(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2116 if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2117 " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2118 " call Decho("tab#".tabpagenr()." win#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2119 " call Dredir("ls!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2120 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2121 call s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2122 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2123 " call FOTEST(7)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2124
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2125 " simplify the dirname (especially for ".."s in dirnames)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2126 if a:dirname !~ '^\a\+://'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2127 let dirname= simplify(a:dirname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2128 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2129 let dirname= a:dirname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2130 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2131 " call FOTEST(8)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2132
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2133 if exists("s:netrw_skipbrowse")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2134 unlet s:netrw_skipbrowse
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2135 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2136 " call Dret("s:NetrwBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2137 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2138 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2139 if !exists("*shellescape")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2140 call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2141 " call Dret("s:NetrwBrowse : missing shellescape()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2142 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2143 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2144 if !exists("*fnameescape")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2145 call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2146 " call Dret("s:NetrwBrowse : missing fnameescape()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2147 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2148 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2149
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2150 call s:NetrwOptionSave("w:")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2151 " call FOTEST(9)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2152
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2153 " re-instate any marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2154 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2155 " call Decho("clearing marked files")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2156 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2157 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2158 " call FOTEST(10)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2159
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2160 if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2161 " call Decho("handle w:netrw_acdkeep:")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2162 " call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2163 exe 'keepjumps lcd '.fnameescape(dirname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2164 call s:NetrwSafeOptions()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2165 " call Decho("getcwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2166
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2167 elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2168 " looks like a regular file, attempt transfer
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2169 " call Decho("attempt transfer as regular file<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2170
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2171 " remove any filetype indicator from end of dirname, except for the {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2172 " "this is a directory" indicator (/).
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2173 " There shouldn't be one of those here, anyway.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2174 let path= substitute(dirname,'[*=@|]\r\=$','','e')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2175 " call Decho("new path<".path.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2176 call s:RemotePathAnalysis(dirname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2177
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2178 " remote-read the requested file into current buffer {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2179 mark '
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2180 call s:NetrwEnew(dirname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2181 call s:NetrwSafeOptions()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2182 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2183 " call Decho("setlocal ma noro")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2184 let b:netrw_curdir= dirname
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2185 " call Decho("exe silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)." (bt=".&bt.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2186 exe "silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2187 exe "silent keepalt doau BufReadPre ".fnameescape(s:fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2188 silent call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2189 if s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2190 " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2191 exe "silent keepalt doau BufReadPost ".fnameescape(s:fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2192 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2193
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2194 " save certain window-oriented variables into buffer-oriented variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2195 call s:SetBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2196 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2197 setlocal ma nomod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2198
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2199 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2200 " call Dret("s:NetrwBrowse : file<".s:fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2201 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2202 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2203 " call FOTEST(11)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2204
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2205 " use buffer-oriented WinVars if buffer ones exist but window ones don't {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2206 call s:UseBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2207
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2208 " set up some variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2209 let b:netrw_browser_active = 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2210 let dirname = dirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2211 let s:last_sort_by = g:netrw_sort_by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2212
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2213 " set up menu {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2214 call s:NetrwMenu(1)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2215 " call FOTEST(12)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2216
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2217 " set up buffer {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2218 let reusing= s:NetrwGetBuffer(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2219 " maintain markfile highlighting
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2220 if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2221 " call Decho("bufnr(%)=".bufnr('%'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2222 " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2223 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2224 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2225 " call Decho("2match none")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2226 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2227 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2228 if reusing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2229 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2230 setlocal noma nomod nowrap
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2231 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2232 " call Dret("s:NetrwBrowse : re-using buffer")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2233 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2234 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2235 "" call FOTEST(13) " PROBLEM WITH LISTING
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2236
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2237 " set b:netrw_curdir to the new directory name {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2238 " call Decho("set b:netrw_curdir to the new directory name:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2239 let b:netrw_curdir= dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2240 if b:netrw_curdir =~ '[/\\]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2241 let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2242 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2243 if b:netrw_curdir == ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2244 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2245 " On the Amiga, the empty string connotes the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2246 let b:netrw_curdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2247 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2248 " under unix, when the root directory is encountered, the result
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2249 " from the preceding substitute is an empty string.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2250 let b:netrw_curdir= '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2251 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2252 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2253 if !a:islocal && b:netrw_curdir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2254 let b:netrw_curdir= b:netrw_curdir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2255 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2256 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2257 "" call FOTEST(14) " PROBLEM WITH LISTING
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2258
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2259 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2260 " (local only) {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2261 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2262 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2263 " call Decho("local only:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2264
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2265 " Set up ShellCmdPost handling. Append current buffer to browselist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2266 call s:LocalFastBrowser()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2267
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2268 " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2269 if !g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2270 " call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2271 " call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2272 if !exists("&l:acd") || !&l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2273 " call Decho('exe keepjumps lcd '.fnameescape(b:netrw_curdir))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2274 try
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2275 exe 'keepjumps lcd '.fnameescape(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2276 catch /^Vim\%((\a\+)\)\=:E472/
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2277 call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".b:netrw_curdir."> (permissions?)",61)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2278 if exists("w:netrw_prvdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2279 let b:netrw_curdir= w:netrw_prvdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2280 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2281 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2282 setlocal noma nomod nowrap
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2283 let b:netrw_curdir= dirname
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2284 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2285 " call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2286 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2287 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2288 endtry
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2289 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2290 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2291
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2292 " --------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2293 " remote handling: {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2294 " --------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2295 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2296 " call Decho("remote only:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2297
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2298 " analyze dirname and g:netrw_list_cmd {{{4
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2299 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2300 if dirname =~ "^NetrwTreeListing\>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2301 let dirname= b:netrw_curdir
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2302 " call Decho("(dirname was ".dirname.") dirname<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2303 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2304 let dirname= substitute(b:netrw_curdir,'\\','/','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2305 if dirname !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2306 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2307 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2308 let b:netrw_curdir = dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2309 " call Decho("(liststyle is TREELIST) dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2310 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2311 let dirname = substitute(dirname,'\\','/','g')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2312 " call Decho("(normal) dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2313 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2314
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2315 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2316 if dirname !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2317 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2318 call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2319 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2320 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2321 setlocal noma nomod nowrap
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2322 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2323 " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2324 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2325 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2326 let b:netrw_curdir= dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2327 " call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2328 endif " (additional remote handling)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2329 "" call FOTEST(15) " PROBLEM WITH LISTING
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2330
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2331 " -----------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2332 " Directory Listing: {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2333 " -----------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2334 call s:BrowserMaps(a:islocal)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2335 "" call FOTEST(16) " PROBLEM WITH LISTING
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2336 call s:PerformListing(a:islocal)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2337 " call FOTEST(17)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2338
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2339 " The s:LocalBrowseShellCmdRefresh() function is called by an autocmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2340 " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed).
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2341 " However, s:NetrwBrowse() causes the ShellCmdPost event itself to fire once; setting
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2342 " the variable below avoids that second refresh of the screen. The s:LocalBrowseShellCmdRefresh()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2343 " function gets called due to that autocmd; it notices that the following variable is set
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2344 " and skips the refresh and sets s:locbrowseshellcmd to zero. Oct 13, 2008
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2345 let s:locbrowseshellcmd= 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2346
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2347 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2348 " call Dret("s:NetrwBrowse : did PerformListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2349 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2350 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2351
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2352 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2353 " s:NetrwFileInfo: supports qf (query for file information) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2354 fun! s:NetrwFileInfo(islocal,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2355 " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2356 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2357 if (has("unix") || has("macunix")) && executable("/bin/ls")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2358 if exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2359 " call Decho('using ls with b:netrw_curdir<'.b:netrw_curdir.'>')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2360 if b:netrw_curdir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2361 echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2362 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2363 echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2364 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2365 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2366 " call Decho('using ls '.a:fname." using cwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2367 echo system("/bin/ls -lsad ".shellescape(a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2368 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2369 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2370 " use vim functions to return information about file below cursor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2371 " call Decho("using vim functions to query for file info")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2372 if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2373 let fname= substitute(a:fname,".$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2374 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2375 let fname= a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2376 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2377 let t = getftime(fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2378 let sz = getfsize(fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2379 echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2380 " call Decho(fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2381 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2382 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2383 echo "sorry, \"qf\" not supported yet for remote files"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2384 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2385 " call Dret("s:NetrwFileInfo")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2386 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2387
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2388 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2389 " s:NetrwGetBuffer: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2390 " returns 0=cleared buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2391 " 1=re-used buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2392 fun! s:NetrwGetBuffer(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2393 " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2394 let dirname= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2395
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2396 " re-use buffer if possible {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2397 " call Decho("--re-use a buffer if possible--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2398 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2399 " find NetrwTreeList buffer if there is one
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2400 " call Decho("find NetrwTreeList buffer if there is one")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2401 if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2402 " call Decho(" re-use w:netrw_treebufnr=".w:netrw_treebufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2403 let eikeep= &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2404 set ei=all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2405 exe "b ".w:netrw_treebufnr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2406 let &ei= eikeep
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2407 " call Dret("s:NetrwGetBuffer : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2408 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2409 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2410 let bufnum= -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2411 " call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2412
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2413 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2414 " find buffer number of buffer named precisely the same as dirname {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2415 " call Decho("--find buffer numnber of buffer named precisely the same as dirname--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2416 " call Dredir("ls!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2417
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2418 " get dirname and associated buffer number
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2419 let bufnum = bufnr(escape(dirname,'\'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2420 " call Decho(" find buffer<".dirname.">'s number ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2421 " call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2422
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2423 if bufnum < 0 && dirname !~ '/$'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2424 " try appending a trailing /
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2425 " call Decho(" try appending a trailing / to dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2426 let bufnum= bufnr(escape(dirname.'/','\'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2427 if bufnum > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2428 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2429 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2430 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2431
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2432 if bufnum < 0 && dirname =~ '/$'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2433 " try removing a trailing /
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2434 " call Decho(" try removing a trailing / from dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2435 let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2436 if bufnum > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2437 let dirname= substitute(dirname,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2438 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2439 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2440
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2441 " call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2442 " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2443 if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2444 " handle approximate matches
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2445 " call Decho(" handling approx match: bufnum#".bufnum."<".bufname(bufnum)."> approx-dirname<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2446 let ibuf = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2447 let buflast = bufnr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2448 " call Decho(" findbuf2: buflast=".buflast)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2449 while ibuf <= buflast
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2450 let bname= substitute(bufname(ibuf),'\\','/','g')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2451 let bname= substitute(bname,'.\zs/$','','')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2452 " call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bufname(".ibuf.")<".bname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2453 if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2454 " call Decho(" findbuf3: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2455 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2456 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2457 if bname =~ '^'.dirname.'/\=$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2458 " call Decho(' findbuf3: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2459 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2460 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2461 if dirname =~ '^'.bname.'/$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2462 " call Decho(' findbuf3: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2463 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2464 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2465 let ibuf= ibuf + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2466 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2467 if ibuf > buflast
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2468 let bufnum= -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2469 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2470 let bufnum= ibuf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2471 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2472 " call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2473 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2474 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2475
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2476 " get enew buffer and name it -or- re-use buffer {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2477 " call Decho("--get enew buffer and name it OR re-use buffer-- (bufnum=".bufnum.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2478 mark '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2479 if bufnum < 0 || !bufexists(bufnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2480 call s:NetrwEnew(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2481 " call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2482 " name the buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2483 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2484 " Got enew buffer; transform into a NetrwTreeListing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2485 " call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2486 if !exists("s:netrw_treelistnum")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2487 let s:netrw_treelistnum= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2488 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2489 let s:netrw_treelistnum= s:netrw_treelistnum + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2490 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2491 let w:netrw_treebufnr= bufnr("%")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2492 " call Decho(" exe silent! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2493 exe 'silent! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2494 nnoremap <silent> <buffer> [ :silent call <SID>TreeListMove('[')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2495 nnoremap <silent> <buffer> ] :silent call <SID>TreeListMove(']')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2496 nnoremap <silent> <buffer> [[ :silent call <SID>TreeListMove('[')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2497 nnoremap <silent> <buffer> ]] :silent call <SID>TreeListMove(']')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2498 " call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2499 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2500 " let v:errmsg= "" " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2501 let escdirname= fnameescape(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2502 " call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2503 " call Decho(' exe silent! keepalt file '.escdirname)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2504 exe 'silent! keepalt file '.escdirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2505 " call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2506 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2507 " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2508
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2509 else " Re-use the buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2510 " call Decho("--re-use buffer#".bufnum.": --")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2511 let eikeep= &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2512 set ei=all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2513 if getline(2) =~ '^" Netrw Directory Listing'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2514 " call Decho(" re-use buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: keepalt b ".bufnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2515 exe "keepalt b ".bufnum
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2516 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2517 " call Decho(" reusing buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: b ".bufnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2518 exe "b ".bufnum
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2519 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2520 if bufname("%") == '.'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2521 " call Decho("exe silent! keepalt file ".fnameescape(getcwd()))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2522 exe "silent! keepalt file ".fnameescape(getcwd())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2523 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2524 let &ei= eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2525 if line("$") <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2526 call s:NetrwListSettings(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2527 " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2528 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2529 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2530 " call Decho("--re-use tree listing--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2531 " call Decho(" clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2532 silent %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2533 call s:NetrwListSettings(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2534 " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2535 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2536 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2537 " call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2538 return 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2539 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2540 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2541
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2542 " do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2543 " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2544 " slow 0 D D Deleting a buffer implies it will not be re-used (slow)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2545 " med 1 D H
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2546 " fast 2 H H
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2547 " call Decho("--do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2548 let fname= expand("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2549 call s:NetrwListSettings(a:islocal)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2550 " call Decho("exe keepalt file ".fnameescape(fname))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2551 exe "keepalt file ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2552
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2553 " delete all lines from buffer {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2554 " call Decho("--delete all lines from buffer--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2555 " call Decho(" clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2556 keepalt silent! %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2557
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2558 " call Dret("s:NetrwGetBuffer 0 : buf#".bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2559 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2560 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2561
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2562 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2563 " s:NetrwGetcwd: get the current directory. {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2564 " Change backslashes to forward slashes, if any.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2565 " If doesc is true, escape certain troublesome characters
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2566 fun! s:NetrwGetcwd(doesc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2567 " call Dfunc("NetrwGetcwd(doesc=".a:doesc.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2568 let curdir= substitute(getcwd(),'\\','/','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2569 if curdir !~ '[\/]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2570 let curdir= curdir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2571 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2572 if a:doesc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2573 let curdir= fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2574 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2575 " call Dret("NetrwGetcwd <".curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2576 return curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2577 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2578
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2579 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2580 " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2581 fun! s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2582 " call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2583 call s:UseBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2584
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2585 " insure that w:netrw_liststyle is set up
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2586 if !exists("w:netrw_liststyle")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2587 if exists("g:netrw_liststyle")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2588 let w:netrw_liststyle= g:netrw_liststyle
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2589 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2590 let w:netrw_liststyle= s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2591 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2592 " call Decho("w:netrw_liststyle=".w:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2593 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2594
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2595 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2596 " Active Banner support
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2597 " call Decho("active banner handling")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2598 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2599 let dirname= "./"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2600 let curline= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2601
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2602 if curline =~ '"\s*Sorted by\s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2603 norm s
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2604 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2605 echo 'Pressing "s" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2606
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2607 elseif curline =~ '"\s*Sort sequence:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2608 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2609 echo 'Press "S" to edit sorting sequence'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2610
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2611 elseif curline =~ '"\s*Quick Help:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2612 norm ?
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2613 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2614 echo 'Pressing "?" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2615
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2616 elseif curline =~ '"\s*\%(Hiding\|Showing\):'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2617 norm a
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2618 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2619 echo 'Pressing "a" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2620
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2621 elseif line("$") > w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2622 exe 'silent keepjumps '.w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2623 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2624
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2625 elseif w:netrw_liststyle == s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2626 " call Decho("thin column handling")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2627 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2628 let dirname= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2629
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2630 elseif w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2631 " call Decho("long column handling")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2632 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2633 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2634
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2635 elseif w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2636 " call Decho("treelist handling")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2637 let dirname= substitute(getline('.'),'^\(| \)*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2638
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2639 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2640 " call Decho("obtain word from wide listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2641 let dirname= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2642
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2643 if !exists("b:netrw_cpf")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2644 let b:netrw_cpf= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2645 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2646 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2647 " call Decho("computed cpf=".b:netrw_cpf)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2648 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2649
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2650 " call Decho("buf#".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2651 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2652 " call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2653 " call Decho("1: dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2654 if filestart == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2655 norm! 0ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2656 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2657 call cursor(line("."),filestart+1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2658 norm! ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2659 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2660 let rega= @a
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2661 let eofname= filestart + b:netrw_cpf + 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2662 if eofname <= col("$")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2663 call cursor(line("."),filestart+b:netrw_cpf+1)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2664 norm! "ay`a
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2665 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2666 norm! "ay$
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2667 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2668 let dirname = @a
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2669 let @a = rega
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2670 " call Decho("2: dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2671 let dirname= substitute(dirname,'\s\+$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2672 " call Decho("3: dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2673 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2674
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2675 " symlinks are indicated by a trailing "@". Remove it before further processing.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2676 let dirname= substitute(dirname,"@$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2677
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2678 " executables are indicated by a trailing "*". Remove it before further processing.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2679 let dirname= substitute(dirname,"\*$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2680
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2681 " call Dret("s:NetrwGetWord <".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2682 return dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2683 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2684
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2685 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2686 " s:NetrwListSettings: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2687 fun! s:NetrwListSettings(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2688 " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2689 let fname= bufname("%")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2690 " call Decho("setlocal bt=nofile nobl ma nonu nowrap noro")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2691 setlocal bt=nofile nobl ma nonu nowrap noro
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2692 " call Decho("exe keepalt file ".fnameescape(fname))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2693 exe "keepalt file ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2694 if g:netrw_use_noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2695 setlocal noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2696 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2697 " call Dredir("ls!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2698 " call Decho("exe setlocal ts=".g:netrw_maxfilenamelen)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2699 exe "setlocal ts=".g:netrw_maxfilenamelen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2700 setlocal isk+=.,~,-
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2701 if g:netrw_fastbrowse > a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2702 setlocal bh=hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2703 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2704 setlocal bh=delete
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2705 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2706 " call Dret("s:NetrwListSettings")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2707 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2708
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2709 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2710 " s:NetrwListStyle: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2711 " islocal=0: remote browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2712 " =1: local browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2713 fun! s:NetrwListStyle(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2714 " call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2715 let fname = s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2716 if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2717 let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2718 " call Decho("fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2719 " call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2720 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2721
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2722 if w:netrw_liststyle == s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2723 " use one column listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2724 " call Decho("use one column list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2725 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2726
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2727 elseif w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2728 " use long list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2729 " call Decho("use long list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2730 let g:netrw_list_cmd = g:netrw_list_cmd." -l"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2731
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2732 elseif w:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2733 " give wide list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2734 " call Decho("use wide list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2735 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2736
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2737 elseif w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2738 " call Decho("use tree list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2739 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2740
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2741 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2742 call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2743 let g:netrw_liststyle = s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2744 let w:netrw_liststyle = g:netrw_liststyle
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2745 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2746 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2747 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2748 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2749
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2750 " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2751 " call Decho("clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2752 %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2753
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2754 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2755 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2756 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2757 call netrw#NetrwRestorePosn(svpos)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2758 if w:netrw_liststyle != s:WIDELIST
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2759 if g:netrw_cursorline == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2760 setlocal cursorline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2761 let &cursorcolumn= s:netrw_usercuc
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2762 elseif g:netrw_cursorline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2763 setlocal cursorline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2764 " call Decho("setlocal cursorline")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2765 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2766 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2767 if g:netrw_cursorline == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2768 setlocal cursorline cursorcolumn
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2769 " call Decho("setlocal cursorline cursorcolumn")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2770 elseif g:netrw_cursorline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2771 let &cursorline= s:netrw_usercul
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2772 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2773 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2774
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2775 " keep cursor on the filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2776 silent keepjumps $
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2777 let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2778 " call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2779 if result <= 0 && exists("w:netrw_bannercnt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2780 exe "keepjumps ".w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2781 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2782
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2783 " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : ""))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2784 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2785
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2786 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2787 " s:NetrwBannerCtrl: toggles the display of the banner {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2788 fun! s:NetrwBannerCtrl(islocal)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2789 " call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2790
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2791 " toggle the banner (enable/suppress)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2792 let g:netrw_banner= !g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2793
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2794 " refresh the listing
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2795 let svpos= netrw#NetrwSavePosn()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2796 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2797
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2798 " keep cursor on the filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2799 let fname= s:NetrwGetWord()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2800 silent keepjumps $
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2801 let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2802 " call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2803 if result <= 0 && exists("w:netrw_bannercnt")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2804 exe "keepjumps ".w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2805 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2806 " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2807 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2808
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2809 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2810 " s:NetrwBookmarkMenu: Uses menu priorities {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2811 " .2.[cnt] for bookmarks, and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2812 " .3.[cnt] for history
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2813 " (see s:NetrwMenu())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2814 fun! s:NetrwBookmarkMenu()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2815 if !exists("s:netrw_menucnt")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2816 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2817 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2818 " call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2819
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2820 " the following test assures that gvim is running, has menus available, and has menus enabled.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2821 if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2822 if exists("g:NetrwTopLvlMenu")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2823 " call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2824 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2825 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2826 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2827 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2828 call s:NetrwBookHistRead()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2829 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2830
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2831 " show bookmarked places
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2832 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2833 let cnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2834 for bmd in g:netrw_bookmarklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2835 " call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2836 let bmd= escape(bmd,'. ')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2837
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2838 " show bookmarks for goto menu
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2839 exe 'silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.' :e '.bmd."\<cr>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2840
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2841 " show bookmarks for deletion menu
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2842 exe 'silent! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.' '.cnt."mB"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2843 let cnt= cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2844 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2845
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2846 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2847
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2848 " show directory browsing history
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2849 let cnt = g:netrw_dirhist_cnt
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2850 let first = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2851 let histcnt = 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2852 while ( first || cnt != g:netrw_dirhist_cnt )
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2853 let histcnt = histcnt + 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2854 let priority = g:netrw_dirhist_cnt + histcnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2855 if exists("g:netrw_dirhist_{cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2856 let histdir= escape(g:netrw_dirhist_{cnt},'./&? ')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2857 " call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2858 exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\<cr>"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2859 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2860 let first = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2861 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2862 if cnt < 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2863 let cnt= cnt + g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2864 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2865 endwhile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2866
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2867 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2868 " call Dret("NetrwBookmarkMenu")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2869 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2870
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2871 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2872 " s:NetrwBrowseChgDir: constructs a new directory based on the current {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2873 " directory and a new directory name. Also, if the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2874 " "new directory name" is actually a file,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2875 " NetrwBrowseChgDir() edits the file.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2876 fun! s:NetrwBrowseChgDir(islocal,newdir,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2877 " call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2878
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2879 if !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2880 " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2881 " and the current window is the NetrwMessage window.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2882 " call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2883 " call Decho("getcwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2884 " call Dredir("ls!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2885 " call Dret("s:NetrwBrowseChgDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2886 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2887 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2888
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2889 " check if the status bar was clicked on instead of a file/directory name
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2890 call feedkeys("\<LeftMouse>")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2891 let c= getchar()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2892 let mouse_lnum = v:mouse_lnum
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2893 let wlastline = line('w$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2894 let lastline = line('$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2895 " call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2896 if mouse_lnum == wlastline + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2897 " call Decho("appears to be a status bar leftmouse click")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2898 " appears to be a status bar leftmouse click
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2899 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2900 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2901
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2902 call s:NetrwOptionSave("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2903 call s:NetrwSafeOptions()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2904 let nbcd_curpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2905 let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2906 let dirname = substitute(b:netrw_curdir,'\\','/','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2907 let newdir = a:newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2908 let dolockout = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2909
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2910 " set up o/s-dependent directory recognition pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2911 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2912 let dirpat= '[\/:]$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2913 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2914 let dirpat= '[\/]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2915 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2916 " call Decho("dirname<".dirname."> dirpat<".dirpat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2917
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2918 if dirname !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2919 " apparently vim is "recognizing" that it is in a directory and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2920 " is removing the trailing "/". Bad idea, so I put it back.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2921 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2922 " call Decho("adjusting dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2923 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2924
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2925 if newdir !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2926 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2927 " edit a file:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2928 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2929 " call Decho('case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2930 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2931 let dirname= s:NetrwTreeDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2932 if dirname =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2933 let dirname= dirname.newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2934 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2935 let dirname= s:NetrwTreeDir()."/".newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2936 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2937 " call Decho("dirname<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2938 " call Decho("tree listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2939 elseif newdir =~ '^\(/\|\a:\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2940 let dirname= newdir
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2941 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2942 let dirname= s:ComposePath(dirname,newdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2943 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2944 " call Decho("handling a file: dirname<".dirname."> (a:0=".a:0.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2945 " this lets NetrwBrowseX avoid the edit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2946 if a:0 < 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2947 " call Decho("set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2948 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2949 if !exists("s:didsplit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2950 if g:netrw_browse_split == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2951 new
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2952 if !&ea
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2953 wincmd _
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2954 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2955 elseif g:netrw_browse_split == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2956 rightb vert new
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2957 if !&ea
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2958 wincmd |
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2959 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2960 elseif g:netrw_browse_split == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2961 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2962 elseif g:netrw_browse_split == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2963 if s:NetrwPrevWinOpen(2) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2964 " call Dret("s:NetrwBrowseChgDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2965 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2966 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2967 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2968 " handling a file, didn't split, so remove menu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2969 " call Decho("handling a file+didn't split, so remove menu")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2970 call s:NetrwMenu(0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2971 " optional change to window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2972 if g:netrw_chgwin >= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2973 exe "keepjumps ".g:netrw_chgwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2974 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2975 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2976 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2977 " the point where netrw actually edits the (local) file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2978 " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2979 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2980 " call Decho("edit local file: exe e! ".fnameescape(dirname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2981 exe "e! ".fnameescape(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2982 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2983 " call Decho("remote file: NetrwBrowse will edit it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2984 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2985 let dolockout= 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2986
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2987 " handle g:Netrw_funcref -- call external-to-netrw functions
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2988 " This code will handle g:Netrw_funcref as an individual function reference
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2989 " or as a list of function references. It will ignore anything that's not
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2990 " a function reference. See :help Funcref for information about function references.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2991 if exists("g:Netrw_funcref")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2992 if type(g:Netrw_funcref) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2993 call g:Netrw_funcref()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2994 elseif type(g:Netrw_funcref) == 3
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2995 for Fncref in g:Netrw_funcref
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2996 if type(FncRef) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2997 call FncRef()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2998 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2999 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3000 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3001 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3002 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3003
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3004 elseif newdir =~ '^/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3005 " ---------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3006 " just go to the new directory spec
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3007 " ---------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3008 " call Decho('case "just go to new directory spec": newdir<'.newdir.'>')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3009 let dirname= newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3010 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3011 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3012
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3013 elseif newdir == './'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3014 " --------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3015 " refresh the directory list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3016 " --------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3017 " call Decho('case "refresh directory listing": newdir == "./"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3018 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3019
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3020 elseif newdir == '../'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3021 " -------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3022 " go up one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3023 " -------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3024 " call Decho('case "go up one directory": newdir == "../"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3025
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3026 if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3027 " force a refresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3028 " call Decho("clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3029 setlocal noro ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3030 " call Decho("setlocal noro ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3031 keepjumps %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3032 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3033
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3034 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3035 " amiga
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3036 " call Decho('case "go up one directory": newdir == "../" and amiga')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3037 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3038 let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3039 let dirname= substitute(dirname,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3040 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3041 let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3042 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3043 " call Decho("amiga: dirname<".dirname."> (go up one dir)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3044
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3045 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3046 " unix or cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3047 " call Decho('case "go up one directory": newdir == "../" and unix or cygwin')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3048 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3049 let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3050 if dirname == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3051 let dirname= '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3052 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3053 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3054 let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3055 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3056 " call Decho("unix: dirname<".dirname."> (go up one dir)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3057 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3058 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3059
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3060 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3061 " call Decho('case liststyle is TREELIST and w:netrw_treedict exists')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3062 " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3063 setlocal noro ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3064 " call Decho("setlocal noro ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3065 if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3066 " call Decho("clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3067 keepjumps %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3068 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3069 let treedir = s:NetrwTreeDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3070 let s:treecurpos = nbcd_curpos
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3071 let haskey= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3072 " call Decho("w:netrw_treedict<".string(w:netrw_treedict).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3073
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3074 " search treedict for tree dir as-is
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3075 if has_key(w:netrw_treedict,treedir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3076 " call Decho('....searched for treedir<'.treedir.'> : found it!')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3077 let haskey= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3078 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3079 " call Decho('....searched for treedir<'.treedir.'> : not found')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3080 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3081
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3082 " search treedict for treedir with a / appended
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3083 if !haskey && treedir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3084 if has_key(w:netrw_treedict,treedir."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3085 let treedir= treedir."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3086 " call Decho('....searched.for treedir<'.treedir.'> found it!')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3087 let haskey = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3088 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3089 " call Decho('....searched for treedir<'.treedir.'/> : not found')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3090 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3091 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3092
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3093 " search treedict for treedir with any trailing / elided
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3094 if !haskey && treedir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3095 let treedir= substitute(treedir,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3096 if has_key(w:netrw_treedict,treedir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3097 " call Decho('....searched.for treedir<'.treedir.'> found it!')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3098 let haskey = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3099 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3100 " call Decho('....searched for treedir<'.treedir.'> : not found')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3101 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3102 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3103
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3104 if haskey
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3105 " close tree listing for selected subdirectory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3106 " call Decho("closing selected subdirectory<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3107 call remove(w:netrw_treedict,treedir)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3108 " call Decho("removed entry<".treedir."> from treedict")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3109 " call Decho("yielding treedict<".string(w:netrw_treedict).">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3110 let dirname = w:netrw_treetop
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3111 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3112 " go down one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3113 let dirname= substitute(treedir,'/*$','/','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3114 " call Decho("go down one dir: treedir<".treedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3115 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3116 call s:SetRexDir(a:islocal,dirname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3117 let s:treeforceredraw = 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3118
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3119 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3120 " go down one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3121 let dirname= s:ComposePath(dirname,newdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3122 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3123 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3124 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3125
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3126 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3127 if dolockout
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3128 " call Decho("doing modification lockout settings: ma nomod noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3129 setlocal ma nomod noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3130 " call Decho("setlocal ma nomod noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3131 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3132
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3133 " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3134 return dirname
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3135 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3136
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3137 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3138 " s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3139 " given filename; typically this means given their extension.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3140 " 0=local, 1=remote
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3141 fun! netrw#NetrwBrowseX(fname,remote)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3142 " call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3143
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3144 " special core dump handler
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3145 if a:fname =~ '/core\(\.\d\+\)\=$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3146 if exists("g:Netrw_corehandler")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3147 if type(g:Netrw_corehandler) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3148 " g:Netrw_corehandler is a function reference (see :help Funcref)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3149 " call Decho("g:Netrw_corehandler is a funcref")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3150 call g:Netrw_corehandler(a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3151 elseif type(g:netrw_corehandler) == 3)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3152 " g:Netrw_corehandler is a List of function references (see :help Funcref)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3153 " call Decho("g:Netrw_corehandler is a List")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3154 for Fncref in g:Netrw_corehandler
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3155 if type(FncRef) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3156 call FncRef(a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3157 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3158 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3159 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3160 " call Dret("NetrwBrowseX : coredump handler invoked")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3161 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3162 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3163 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3164
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3165 " set up the filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3166 " (lower case the extension, make a local copy of a remote file)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3167 let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3168 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3169 let exten= substitute(exten,'^.*$','\L&\E','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3170 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3171 " call Decho("exten<".exten.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3172
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3173 " seems kde systems often have gnome-open due to dependencies, even though
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3174 " gnome-open's subsidiary display tools are largely absent. Kde systems
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3175 " usually have "kdeinit" running, though... (tnx Mikolaj Machowski)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3176 if !exists("s:haskdeinit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3177 if has("unix")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3178 let s:haskdeinit= system("ps -e") =~ 'kdeinit'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3179 if v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3180 let s:haskdeinit = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3181 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3182 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3183 let s:haskdeinit= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3184 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3185 " call Decho("setting s:haskdeinit=".s:haskdeinit)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3186 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3187
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3188 if a:remote == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3189 " create a local copy
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3190 " call Decho("a:remote=".a:remote.": create a local copy of <".a:fname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3191 setlocal bh=delete
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3192 call netrw#NetRead(3,a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3193 " attempt to rename tempfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3194 let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3195 let newname= substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3196 " call Decho("basename<".basename.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3197 " call Decho("newname <".newname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3198 if rename(s:netrw_tmpfile,newname) == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3199 " renaming succeeded
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3200 let fname= newname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3201 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3202 " renaming failed
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3203 let fname= s:netrw_tmpfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3204 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3205 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3206 let fname= a:fname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3207 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3208 " call Decho("fname<".fname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3209 " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3210
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3211 " set up redirection
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3212 if &srr =~ "%s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3213 if (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3214 let redir= substitute(&srr,"%s","nul","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3215 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3216 let redir= substitute(&srr,"%s","/dev/null","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3217 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3218 elseif (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3219 let redir= &srr . "nul"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3220 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3221 let redir= &srr . "/dev/null"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3222 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3223 " call Decho("redir{".redir."} srr{".&srr."}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3224
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3225 " extract any viewing options. Assumes that they're set apart by quotes.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3226 if exists("g:netrw_browsex_viewer")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3227 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3228 if g:netrw_browsex_viewer =~ '\s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3229 let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3230 let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3231 let oviewer = ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3232 let cnt = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3233 while !executable(viewer) && viewer != oviewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3234 let viewer = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3235 let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3236 let cnt = cnt + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3237 let oviewer = viewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3238 " call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3239 endwhile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3240 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3241 let viewer = g:netrw_browsex_viewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3242 let viewopt = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3243 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3244 " call Decho("viewer<".viewer."> viewopt<".viewopt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3245 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3246
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3247 " execute the file handler
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3248 if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3249 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3250 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3251
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3252 elseif exists("g:netrw_browsex_viewer") && executable(viewer)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3253 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3254 " call Decho("exe silent !".viewer." ".viewopt.shellescape(fname,1).redir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3255 exe "silent !".viewer." ".viewopt.shellescape(fname,1).redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3256 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3257
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3258 elseif has("win32") || has("win64")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3259 if executable("start")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3260 " call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3261 exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3262 elseif executable("rundll32")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3263 " call Decho('exe silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3264 exe 'silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3265 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3266 call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3267 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3268 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3269 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3270
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3271 elseif has("unix") && executable("gnome-open") && !s:haskdeinit
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3272 " call Decho("exe silent !gnome-open ".shellescape(fname,1)." ".redir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3273 exe "silent !gnome-open ".shellescape(fname,1).redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3274 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3275
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3276 elseif has("unix") && executable("kfmclient") && s:haskdeinit
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3277 " call Decho("exe silent !kfmclient exec ".shellescape(fname,1)." ".redir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3278 exe "silent !kfmclient exec ".shellescape(fname,1)." ".redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3279 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3280
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3281 elseif has("macunix") && executable("open")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3282 " call Decho("exe silent !open ".shellescape(fname,1)." ".redir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3283 exe "silent !open ".shellescape(fname,1)." ".redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3284 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3285
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3286 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3287 " netrwFileHandlers#Invoke() always returns 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3288 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3289 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3290
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3291 " if unsuccessful, attempt netrwFileHandlers#Invoke()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3292 if ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3293 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3294 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3295
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3296 " restoring redraw! after external file handlers
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3297 redraw!
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3298
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3299 " cleanup: remove temporary file,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3300 " delete current buffer if success with handler,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3301 " return to prior buffer (directory listing)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3302 " Feb 12, 2008: had to de-activiate removal of
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3303 " temporary file because it wasn't getting seen.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3304 " if a:remote == 1 && fname != a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3305 " call Decho("deleting temporary file<".fname.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3306 " call s:NetrwDelete(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3307 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3308
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3309 if a:remote == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3310 setlocal bh=delete bt=nofile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3311 if g:netrw_use_noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3312 setlocal noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3313 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3314 exe "norm! \<c-o>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3315 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3316 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3317
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3318 " call Dret("NetrwBrowseX")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3319 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3320
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3321 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3322 " s:NetrwChgPerm: (implements "gp") change file permission {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3323 fun! s:NetrwChgPerm(islocal,curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3324 " call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3325 call inputsave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3326 let newperm= input("Enter new permission: ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3327 call inputrestore()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3328 let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',shellescape(expand("<cfile>")),'')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3329 let chgperm= substitute(chgperm,'\<PERM\>',shellescape(newperm),'')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3330 " call Decho("chgperm<".chgperm.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3331 call system(chgperm)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3332 if v:shell_error != 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3333 call netrw#ErrorMsg(1,"changing permission on file<".expand("<cfile>")."> seems to have failed",75)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3334 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3335 if a:islocal
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3336 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3337 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3338 " call Dret("s:NetrwChgPerm")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3339 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3340
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3341 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3342 " s:NetrwClearExplore: clear explore variables (if any) {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3343 fun! s:NetrwClearExplore()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3344 " call Dfunc("s:NetrwClearExplore()")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3345 2match none
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3346 if exists("s:explore_match") |unlet s:explore_match |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3347 if exists("s:explore_indx") |unlet s:explore_indx |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3348 if exists("s:netrw_explore_prvdir") |unlet s:netrw_explore_prvdir |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3349 if exists("s:dirstarstar") |unlet s:dirstarstar |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3350 if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3351 if exists("w:netrw_explore_indx") |unlet w:netrw_explore_indx |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3352 if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3353 if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3354 if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3355 " redraw!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3356 echo " "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3357 echo " "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3358 " call Dret("s:NetrwClearExplore")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3359 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3360
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3361 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3362 " netrw#Explore: launch the local browser in the directory of the current file {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3363 " indx: == -1: Nexplore
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3364 " == -2: Pexplore
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3365 " == +: this is overloaded:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3366 " * If Nexplore/Pexplore is in use, then this refers to the
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3367 " indx'th item in the w:netrw_explore_list[] of items which
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3368 " matched the */pattern **/pattern *//pattern **//pattern
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3369 " * If Hexplore or Vexplore, then this will override
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3370 " g:netrw_winsize to specify the qty of rows or columns the
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3371 " newly split window should have.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3372 " dosplit==0: the window will be split iff the current file has been modified
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3373 " dosplit==1: the window will be split before running the local browser
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3374 " style == 0: Explore style == 1: Explore!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3375 " == 2: Hexplore style == 3: Hexplore!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3376 " == 4: Vexplore style == 5: Vexplore!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3377 " == 6: Texplore
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3378 fun! netrw#Explore(indx,dosplit,style,...)
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3379 " call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." a:0=".a:0)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3380 if !exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3381 let b:netrw_curdir= getcwd()
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3382 " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3383 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3384 let curdir = b:netrw_curdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3385 let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3386 " call Decho("curdir<".curdir."> curfiledir<".curfiledir.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3387 " call FOTEST(1)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3388
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3389 " save registers
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3390 silent! let keepregstar = @*
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3391 silent! let keepregplus = @+
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3392 silent! let keepregslash= @/
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3393
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3394 " if dosplit or file has been modified
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3395 if a:dosplit || &modified || a:style == 6
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3396 " call Decho("case: dosplit=".a:dosplit." modified=".&modified." a:style=".a:style)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3397 call s:SaveWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3398 let winsize= g:netrw_winsize
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3399 if a:indx > 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3400 let winsize= a:indx
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3401 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3402
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3403 if a:style == 0 " Explore, Sexplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3404 " call Decho("style=0: Explore or Sexplore")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3405 exe winsize."wincmd s"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3406
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3407 elseif a:style == 1 "Explore!, Sexplore!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3408 " call Decho("style=1: Explore! or Sexplore!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3409 exe winsize."wincmd v"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3410
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3411 elseif a:style == 2 " Hexplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3412 " call Decho("style=2: Hexplore")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3413 exe "bel ".winsize."wincmd s"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3414
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3415 elseif a:style == 3 " Hexplore!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3416 " call Decho("style=3: Hexplore!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3417 exe "abo ".winsize."wincmd s"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3418
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3419 elseif a:style == 4 " Vexplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3420 " call Decho("style=4: Vexplore")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3421 exe "lefta ".winsize."wincmd v"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3422
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3423 elseif a:style == 5 " Vexplore!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3424 " call Decho("style=5: Vexplore!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3425 exe "rightb ".winsize."wincmd v"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3426
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3427 elseif a:style == 6 " Texplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3428 call s:SaveBufVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3429 " call Decho("style = 6: Texplore")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3430 tabnew
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3431 call s:RestoreBufVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3432 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3433 call s:RestoreWinVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3434 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3435 norm! 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3436 " call FOTEST(2)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3437
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3438 if a:0 > 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3439 " call Decho("case [a:0=".a:0."]>0: a:1<".a:1.">")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3440 if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin))
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3441 let dirname= substitute(a:1,'\~',expand("$HOME"),'')
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3442 " call Decho("using dirname<".dirname."> (case: ~ && unix||cygwin)")
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3443 elseif a:1 == '.'
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3444 let dirname= exists("b:netrw_curdir")? b:netrw_curdir : getcwd()
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3445 if dirname !~ '/$'
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3446 let dirname= dirname."/"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3447 endif
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3448 " call Decho("using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")")
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3449 elseif a:1 =~ '\$'
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3450 let dirname= expand(a:1)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3451 " call Decho("using user-specified dirname<".dirname."> with $env-var")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3452 else
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3453 let dirname= a:1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3454 " call Decho("using user-specified dirname<".dirname.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3455 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3456 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3457 " clear explore
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3458 call s:NetrwClearExplore()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3459 " call Dret("netrw#Explore : cleared list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3460 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3461 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3462 " call FOTEST(3)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3463
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3464 if dirname =~ '/\*\*/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3465 " handle .../**/.../filepat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3466 " call Decho("case Explore .../**/.../filepat")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3467 let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3468 if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16")))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3469 let b:netrw_curdir = prefixdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3470 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3471 let b:netrw_curdir= getcwd().'/'.prefixdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3472 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3473 let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3474 let starpat= 4;
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3475 " call Decho("pwd<".getcwd()."> dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3476 " call Decho("case Explore ../**/../filepat (starpat=".starpat.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3477
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3478 elseif dirname =~ '^\*//'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3479 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3480 " call Decho("case Explore *//pattern")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3481 let pattern= substitute(dirname,'^\*//\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3482 let starpat= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3483 " call Decho("Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3484 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3485
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3486 elseif dirname =~ '^\*\*//'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3487 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3488 " call Decho("case Explore **//pattern")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3489 let pattern= substitute(dirname,'^\*\*//','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3490 let starpat= 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3491 " call Decho("Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3492
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3493 elseif dirname =~ '^\*/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3494 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3495 let starpat= 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3496 " call Decho("case Explore */filepat (starpat=".starpat.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3497
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3498 elseif dirname=~ '^\*\*/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3499 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3500 let starpat= 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3501 " call Decho("case Explore **/filepat (starpat=".starpat.")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3502
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3503 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3504 let starpat= 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3505 " call Decho("default case: starpat=".starpat)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3506 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3507 " call FOTEST(4)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3508
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3509 if starpat == 0 && a:indx >= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3510 " [Explore Hexplore Vexplore Sexplore] [dirname]
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3511 " call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3512 if dirname == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3513 let dirname= curfiledir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3514 " call Decho("empty dirname, using current file's directory<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3515 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3516 if dirname =~ '^scp:' || dirname =~ '^ftp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3517 " call Decho("calling NetrwBrowse(0,dirname<".dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3518 call s:NetrwBrowse(0,dirname)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3519 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3520 if dirname == ""|let dirname= getcwd()|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3521 " call Decho("calling LocalBrowseCheck(dirname<".dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3522 call netrw#LocalBrowseCheck(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3523 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3524
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3525 " call Decho("curdir<".curdir.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3526 if has("win32") || has("win95") || has("win64") || has("win16")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3527 call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3528 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3529 call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3530 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3531
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3532 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3533 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3534 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3535 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3536 elseif a:indx <= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3537 " Nexplore, Pexplore, Explore: handle starpat
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3538 " call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3539 if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3540 " call Decho("set up <s-up> and <s-down> maps")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3541 let s:didstarstar= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3542 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3543 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3544 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3545
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3546 if has("path_extra")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3547 " call Decho("starpat=".starpat.": has +path_extra")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3548 if !exists("w:netrw_explore_indx")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3549 let w:netrw_explore_indx= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3550 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3551
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3552 let indx = a:indx
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3553 " call Decho("starpat=".starpat.": set indx= [a:indx=".indx."]")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3554
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3555 if indx == -1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3556 " Nexplore
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3557 " call Decho("case Nexplore with starpat=".starpat.": (indx=".indx.")")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3558 if !exists("w:netrw_explore_list") " sanity check
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3559 call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3560 silent! let @* = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3561 silent! let @+ = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3562 silent! let @/ = keepregslash
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3563 " call Dret("netrw#Explore")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3564 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3565 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3566 let indx= w:netrw_explore_indx
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3567 if indx < 0 | let indx= 0 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3568 if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3569 let curfile= w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3570 " call Decho("indx=".indx." curfile<".curfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3571 while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3572 let indx= indx + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3573 " call Decho("indx=".indx." (Nexplore while loop)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3574 endwhile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3575 if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3576 " call Decho("Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3577
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3578 elseif indx == -2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3579 " Pexplore
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3580 " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3581 if !exists("w:netrw_explore_list") " sanity check
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3582 call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3583 silent! let @* = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3584 silent! let @+ = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3585 silent! let @/ = keepregslash
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3586 " call Dret("netrw#Explore")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3587 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3588 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3589 let indx= w:netrw_explore_indx
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3590 if indx < 0 | let indx= 0 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3591 if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3592 let curfile= w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3593 " call Decho("indx=".indx." curfile<".curfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3594 while indx >= 0 && curfile == w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3595 let indx= indx - 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3596 " call Decho("indx=".indx." (Pexplore while loop)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3597 endwhile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3598 if indx < 0 | let indx= 0 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3599 " call Decho("Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3600
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3601 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3602 " Explore -- initialize
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3603 " build list of files to Explore with Nexplore/Pexplore
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3604 " call Decho("starpat=".starpat.": case Explore: initialize (indx=".indx.")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3605 call s:NetrwClearExplore()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3606 let w:netrw_explore_indx= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3607 if !exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3608 let b:netrw_curdir= getcwd()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3609 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3610 " call Decho("starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3611
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3612 " switch on starpat to build the w:netrw_explore_list of files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3613 if starpat == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3614 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3615 " call Decho("starpat=".starpat.": build *//pattern list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3616 " call Decho("pattern<".pattern.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3617 try
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3618 exe "noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3619 catch /^Vim\%((\a\+)\)\=:E480/
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3620 call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3621 " call Dret("netrw#Explore : unable to find pattern<".pattern.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3622 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3623 endtry
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3624 let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)'))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3625 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3626
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3627 elseif starpat == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3628 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3629 " call Decho("starpat=".starpat.": build **//pattern list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3630 try
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3631 exe "silent noautocmd vimgrep /".pattern."/gj "."**/*"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3632 catch /^Vim\%((\a\+)\)\=:E480/
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3633 call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3634 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3635 silent! let @* = keepregstar
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3636 silent! let @+ = keepregstar
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3637 silent! let @/ = keepregslash
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3638 " call Dret("netrw#Explore : no files matched pattern")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3639 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3640 endtry
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3641 let s:netrw_curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3642 let w:netrw_explore_list = getqflist()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3643 let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)'))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3644
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3645 elseif starpat == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3646 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3647 " call Decho("starpat=".starpat.": build */filepat list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3648 let filepat= substitute(dirname,'^\*/','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3649 let filepat= substitute(filepat,'^[%#<]','\\&','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3650 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3651 " call Decho("filepat<".filepat.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3652 let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3653 if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3654
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3655 elseif starpat == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3656 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3657 " call Decho("starpat=".starpat.": build **/filepat list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3658 let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n'))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3659 if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3660 endif " switch on starpat to build w:netrw_explore_list
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3661
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3662 let w:netrw_explore_listlen = len(w:netrw_explore_list)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3663 " call Decho("w:netrw_explore_list<".string(w:netrw_explore_list).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3664 " call Decho("w:netrw_explore_listlen=".w:netrw_explore_listlen)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3665
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3666 if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3667 call netrw#ErrorMsg(s:WARNING,"no files matched",42)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3668 silent! let @* = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3669 silent! let @+ = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3670 silent! let @/ = keepregslash
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3671 " call Dret("netrw#Explore : no files matched")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3672 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3673 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3674 endif " if indx ... endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3675
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3676 " NetrwStatusLine support - for exploring support
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3677 let w:netrw_explore_indx= indx
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3678 " call Decho("w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3679
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3680 " wrap the indx around, but issue a note
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3681 if indx >= w:netrw_explore_listlen || indx < 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3682 " call Decho("wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3683 let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3684 let w:netrw_explore_indx= indx
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3685 call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3686 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3687
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3688 exe "let dirfile= w:netrw_explore_list[".indx."]"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3689 " call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3690 let newdir= substitute(dirfile,'/[^/]*$','','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3691 " call Decho("newdir<".newdir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3692
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3693 " call Decho("calling LocalBrowseCheck(newdir<".newdir.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3694 call netrw#LocalBrowseCheck(newdir)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3695 if !exists("w:netrw_liststyle")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3696 let w:netrw_liststyle= g:netrw_liststyle
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3697 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3698 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3699 call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3700 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3701 call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3702 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3703 let w:netrw_explore_mtchcnt = indx + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3704 let w:netrw_explore_bufnr = bufnr("%")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3705 let w:netrw_explore_line = line(".")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3706 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3707 " call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3708
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3709 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3710 " call Decho("your vim does not have +path_extra")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3711 if !exists("g:netrw_quiet")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3712 call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3713 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3714 silent! let @* = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3715 silent! let @+ = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3716 silent! let @/ = keepregslash
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3717 " call Dret("netrw#Explore : missing +path_extra")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3718 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3719 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3720
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3721 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3722 " call Decho("default case: Explore newdir<".dirname.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3723 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3724 silent! unlet w:netrw_treedict
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3725 silent! unlet w:netrw_treetop
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3726 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3727 let newdir= dirname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3728 if !exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3729 call netrw#LocalBrowseCheck(getcwd())
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3730 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3731 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3732 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3733 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3734 " call FOTEST(5)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3735
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3736 " visual display of **/ **// */ Exploration files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3737 " call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3738 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3739 if exists("w:netrw_explore_indx") && exists("b:netrw_curdir")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3740 " call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3741 if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3742 " only update match list if current directory isn't the same as before
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3743 " call Decho("only update match list if current directory not the same as before")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3744 let s:explore_prvdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3745 let s:explore_match = ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3746 let dirlen = s:Strlen(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3747 if b:netrw_curdir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3748 let dirlen= dirlen + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3749 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3750 let prvfname= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3751 for fname in w:netrw_explore_list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3752 " call Decho("fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3753 if fname =~ '^'.b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3754 if s:explore_match == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3755 let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3756 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3757 let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3758 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3759 elseif fname !~ '^/' && fname != prvfname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3760 if s:explore_match == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3761 let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3762 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3763 let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3764 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3765 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3766 let prvfname= fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3767 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3768 " call Decho("explore_match<".s:explore_match.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3769 exe "2match netrwMarkFile /".s:explore_match."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3770 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3771 echo "<s-up>==Pexplore <s-down>==Nexplore"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3772 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3773 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3774 if exists("s:explore_match") | unlet s:explore_match | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3775 if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3776 echo " "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3777 " call Decho("cleared explore match list")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3778 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3779 " call FOTEST(6)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3780
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3781 silent! let @* = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3782 silent! let @+ = keepregstar
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3783 silent! let @/ = keepregslash
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3784 " call Dret("netrw#Explore : @/<".@/.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3785 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3786
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3787 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3788 " s:NetrwExploreListUniq: {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3789 fun! s:NetrwExploreListUniq(explist)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3790 " call Dfunc("s:NetrwExploreListUniq(explist)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3791
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3792 " this assumes that the list is already sorted
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3793 let newexplist= []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3794 for member in a:explist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3795 if !exists("uniqmember") || member != uniqmember
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3796 let uniqmember = member
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3797 let newexplist = newexplist + [ member ]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3798 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3799 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3800
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3801 " call Dret("s:NetrwExploreListUniq")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3802 return newexplist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3803 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3804
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3805 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3806 " s:NetrwHide: this function is invoked by the "a" map for browsing {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3807 " and switches the hiding mode. The actual hiding is done by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3808 " s:NetrwListHide().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3809 " g:netrw_hide= 0: show all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3810 " 1: show not-hidden files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3811 " 2: show hidden files only
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3812 fun! s:NetrwHide(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3813 " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3814 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3815
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3816 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3817 " call Decho(((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3818 " call Decho("g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3819
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3820 " hide the files in the markfile list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3821 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3822 " call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." isk=".&isk)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3823 if match(g:netrw_list_hide,'\<'.fname.'\>') != -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3824 " remove fname from hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3825 let g:netrw_list_hide= substitute(g:netrw_list_hide,'..\<'.escape(fname,g:netrw_fname_escape).'\>..','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3826 let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3827 let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3828 " call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3829 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3830 " append fname to hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3831 if exists("g:netrw_list_hide") && g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3832 let g:netrw_list_hide= g:netrw_list_hide.',\<'.escape(fname,g:netrw_fname_escape).'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3833 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3834 let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3835 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3836 " call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3837 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3838 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3839 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3840 let g:netrw_hide= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3841
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3842 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3843
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3844 " switch between show-all/show-not-hidden/show-hidden
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3845 let g:netrw_hide=(g:netrw_hide+1)%3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3846 exe "norm! 0"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3847 if g:netrw_hide && g:netrw_list_hide == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3848 call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3849 " call Dret("NetrwHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3850 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3851 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3852 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3853
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3854 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3855 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3856 " call Dret("NetrwHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3857 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3858
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3859 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3860 " s:NetrwHidden: invoked by "gh" {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3861 fun! s:NetrwHidden(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3862 " call Dfunc("s:NetrwHidden()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3863 " save current position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3864 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3865
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3866 if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3867 " remove pattern from hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3868 let g:netrw_list_hide= substitute(g:netrw_list_hide,'\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+','','')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3869 elseif s:Strlen(g:netrw_list_hide) >= 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3870 let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3871 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3872 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3873 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3874
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3875 " refresh screen and return to saved position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3876 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3877 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3878 " call Dret("s:NetrwHidden")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3879 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3880
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3881 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3882 " s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3883 fun! s:NetrwHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3884 if exists("g:netrw_home")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3885 let home= g:netrw_home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3886 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3887 " go to vim plugin home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3888 for home in split(&rtp,',') + ['']
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3889 if isdirectory(home) && filewritable(home) | break | endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3890 let basehome= substitute(home,'[/\\]\.vim$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3891 if isdirectory(basehome) && filewritable(basehome)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3892 let home= basehome."/.vim"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3893 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3894 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3895 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3896 if home == ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3897 " just pick the first directory
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3898 let home= substitute(&rtp,',.*$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3899 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3900 if (has("win32") || has("win95") || has("win64") || has("win16"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3901 let home= substitute(home,'/','\\','g')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3902 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3903 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3904 " insure that the home directory exists
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3905 if !isdirectory(home)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3906 if exists("g:netrw_mkdir")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3907 call system(g:netrw_mkdir." ".shellescape(home))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3908 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3909 call mkdir(home)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3910 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3911 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3912 let g:netrw_home= home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3913 return home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3914 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3915
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3916 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3917 " s:NetrwLeftmouse: handles the <leftmouse> when in a netrw browsing window {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3918 fun! s:NetrwLeftmouse(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3919 " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3920 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3921 if exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3922 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3923 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3924 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3925 if exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3926 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3927 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3928 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3929 " call Dret("s:NetrwLeftmouse")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3930 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3931
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3932 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3933 " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3934 " separated patterns given in g:netrw_list_hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3935 fun! s:NetrwListHide()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3936 " call Dfunc("NetrwListHide() hide=".g:netrw_hide." listhide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3937
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3938 " find a character not in the "hide" string to use as a separator for :g and :v commands
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3939 " How-it-works: take the hiding command, convert it into a range. Duplicate
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3940 " characters don't matter. Remove all such characters from the '/~...90'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3941 " string. Use the first character left as a separator character.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3942 let listhide= g:netrw_list_hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3943 let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3944 " call Decho("sep=".sep)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3945
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3946 while listhide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3947 if listhide =~ ','
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3948 let hide = substitute(listhide,',.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3949 let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3950 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3951 let hide = listhide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3952 let listhide = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3953 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3954
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3955 " Prune the list by hiding any files which match
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3956 if g:netrw_hide == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3957 " call Decho("hiding<".hide."> listhide<".listhide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3958 exe 'silent keepjumps '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3959 elseif g:netrw_hide == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3960 " call Decho("showing<".hide."> listhide<".listhide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3961 exe 'silent keepjumps '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3962 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3963 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3964 if g:netrw_hide == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3965 exe 'silent keepjumps '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3966 exe 'silent keepjumps '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3967 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3968
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3969 " call Dret("NetrwListHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3970 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3971
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3972 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3973 " NetrwHideEdit: allows user to edit the file/directory hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3974 fun! s:NetrwHideEdit(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3975 " call Dfunc("NetrwHideEdit(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3976
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3977 " save current cursor position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3978 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3979
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3980 " get new hiding list from user
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3981 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3982 let newhide= input("Edit Hiding List: ",g:netrw_list_hide)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3983 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3984 let g:netrw_list_hide= newhide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3985 " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3986
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3987 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3988 silent call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3989
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3990 " restore cursor position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3991 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3992
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3993 " call Dret("NetrwHideEdit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3994 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3995
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3996 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3997 " NetSortSequence: allows user to edit the sorting sequence
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3998 fun! s:NetSortSequence(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3999 " call Dfunc("NetSortSequence(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4000
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4001 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4002 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4003 let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4004 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4005
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4006 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4007 let g:netrw_sort_sequence= newsortseq
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4008 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4009 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4010
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4011 " call Dret("NetSortSequence")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4012 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4013
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4014 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4015 " s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4016 fun! s:NetrwMakeDir(usrhost)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4017 " call Dfunc("NetrwMakeDir(usrhost<".a:usrhost.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4018
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4019 " get name of new directory from user. A bare <CR> will skip.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4020 " if its currently a directory, also request will be skipped, but with
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4021 " a message.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4022 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4023 let newdirname= input("Please give directory name: ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4024 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4025 " call Decho("newdirname<".newdirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4026
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4027 if newdirname == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4028 " call Dret("NetrwMakeDir : user aborted with bare <cr>")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4029 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4030 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4031
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4032 if a:usrhost == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4033 " call Decho("local mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4034
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4035 " Local mkdir:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4036 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4037 let fullnewdir= b:netrw_curdir.'/'.newdirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4038 " call Decho("fullnewdir<".fullnewdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4039 if isdirectory(fullnewdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4040 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4041 call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4042 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4043 " call Dret("NetrwMakeDir : directory<".newdirname."> exists previously")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4044 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4045 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4046 if s:FileReadable(fullnewdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4047 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4048 call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4049 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4050 " call Dret("NetrwMakeDir : file<".newdirname."> exists previously")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4051 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4052 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4053
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4054 " requested new local directory is neither a pre-existing file or
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4055 " directory, so make it!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4056 if exists("*mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4057 call mkdir(fullnewdir,"p")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4058 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4059 let netrw_origdir= s:NetrwGetcwd(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4060 exe 'keepjumps lcd '.fnameescape(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4061 " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4062 " call Decho("exe silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4063 exe "silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4064 if !g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4065 exe 'keepjumps lcd '.fnameescape(netrw_origdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4066 " call Decho("netrw_keepdir=".g:netrw_keepdir.": keepjumps lcd ".fnameescape(netrw_origdir)." getcwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4067 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4068 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4069
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4070 if v:shell_error == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4071 " refresh listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4072 " call Decho("refresh listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4073 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4074 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4075 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4076 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4077 call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4078 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4079 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4080
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4081 elseif !exists("b:netrw_method") || b:netrw_method == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4082 " Remote mkdir:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4083 " call Decho("remote mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4084 let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4085 let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4086 " call Decho("exe silent! !".mkdircmd." ".shellescape(newdirname,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4087 exe "silent! !".mkdircmd." ".shellescape(newdirname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4088 if v:shell_error == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4089 " refresh listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4090 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4091 call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4092 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4093 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4094 call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4095 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4096 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4097
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4098 elseif b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4099 " COMBAK -- future work
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4100 call netrw#ErrorMsg(s:ERROR,"making directories via ftp not currently supported",68)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4101 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4102 " COMBAK -- future work
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4103 call netrw#ErrorMsg(s:ERROR,"making directories via ftp not currently supported",68)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4104 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4105
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4106 " call Dret("NetrwMakeDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4107 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4108
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4109 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4110 " s:NetrwMarkFile: (invoked by mf) This function is used to both {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4111 " mark and unmark files. If a markfile list exists,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4112 " then the rename and delete functions will use it instead
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4113 " of whatever may happen to be under the cursor at that
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4114 " moment. When the mouse and gui are available,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4115 " shift-leftmouse may also be used to mark files.
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4116 "
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4117 " Creates two lists
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4118 " s:netrwmarkfilelist -- holds complete paths to all marked files
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4119 " s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr())
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4120 "
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4121 " Creates a marked file match string
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4122 " s:netrwmarfilemtch_# -- used with 2match to display marked files
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4123 "
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4124 " Creates a buffer version of islocal
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4125 " b:netrw_islocal
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4126 "
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4127 fun! s:NetrwMarkFile(islocal,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4128 " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4129 let curbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4130 let curdir = b:netrw_curdir
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4131 let trailer = '[@=|\/\*]\=\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4132 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4133 " markfile list exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4134 " call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4135 " call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">")
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4136 let b:netrw_islocal= a:islocal
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4137
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4138 if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4139 " append filename to buffer's markfilelist
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4140 " call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4141 call add(s:netrwmarkfilelist_{curbufnr},a:fname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4142 let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(a:fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4143
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4144 else
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4145 " remove filename from buffer's markfilelist
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4146 " call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4147 call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4148 if s:netrwmarkfilelist_{curbufnr} == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4149 " local markfilelist is empty; remove it entirely
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4150 " call Decho("markfile list now empty")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4151 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4152 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4153 " rebuild match list to display markings correctly
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4154 " call Decho("rebuild s:netrwmarkfilemtch_".curbufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4155 let s:netrwmarkfilemtch_{curbufnr}= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4156 let first = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4157 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4158 if first
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4159 let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4160 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4161 let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4162 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4163 let first= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4164 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4165 " call Decho("ending s:netrwmarkfilelist_"curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4166 " call Decho("ending s:netrwmarkfilemtch_"curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4167 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4168 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4169
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4170 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4171 " initialize new markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4172
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4173 " call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4174 let s:netrwmarkfilelist_{curbufnr}= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4175 call add(s:netrwmarkfilelist_{curbufnr},a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4176 " call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4177
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4178 " build initial markfile matching pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4179 if a:fname =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4180 let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4181 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4182 let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4183 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4184 " call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4185 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4186
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4187 " handle global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4188 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4189 let dname= s:ComposePath(b:netrw_curdir,a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4190 if index(s:netrwmarkfilelist,dname) == -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4191 " append new filename to global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4192 call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4193 " call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4194 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4195 " remove new filename from global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4196 " call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4197 call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4198 " call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4199 if s:netrwmarkfilelist == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4200 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4201 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4202 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4203 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4204 " initialize new global-directory markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4205 let s:netrwmarkfilelist= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4206 call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4207 " call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4208 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4209
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4210 " set up 2match'ing to netrwmarkfilemtch list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4211 if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4212 " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4213 if exists("g:did_drchip_netrwlist_syntax")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4214 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4215 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4216 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4217 " call Decho("2match none")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4218 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4219 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4220 " call Dret("s:NetrwMarkFile : netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4221 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4222
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4223 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4224 " s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4225 " compress/decompress files using the programs
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4226 " in g:netrw_compress and g:netrw_uncompress,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4227 " using g:netrw_compress_suffix to know which to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4228 " do. By default:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4229 " g:netrw_compress = "gzip"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4230 " g:netrw_decompress = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4231 fun! s:NetrwMarkFileCompress(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4232 " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4233 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4234 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4235 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4236
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4237 if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4238 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4239 " for every filename in the marked list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4240 for sfx in sort(keys(g:netrw_decompress))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4241 if fname =~ '\'.sfx.'$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4242 " fname has a suffix indicating that its compressed; apply associated decompression routine
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4243 let exe= netrw#WinPath(g:netrw_decompress[sfx])
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4244 " call Decho("fname<".fname."> is compressed so decompress with <".exe.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4245 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4246 if g:netrw_keepdir
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4247 let fname= shellescape(s:ComposePath(curdir,fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4248 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4249 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4250 let fname= shellescape(b:netrw_curdir.fname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4251 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4252 if executable(exe)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4253 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4254 call system(exe." ".fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4255 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4256 call s:RemoteSystem(exe." ".fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4257 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4258 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4259 call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4260 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4261 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4262 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4263 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4264 if exists("exe")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4265 unlet exe
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4266 elseif a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4267 " fname not a compressed file, so compress it
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4268 call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname)))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4269 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4270 " fname not a compressed file, so compress it
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4271 call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4272 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4273 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4274 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4275 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4276 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4277 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4278 " call Dret("s:NetrwMarkFileCompress")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4279 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4280
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4281 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4282 " s:NetrwMarkFileCopy: (invoked by mc) copy marked files to target {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4283 " If no marked files, then set up directory as the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4284 " target. Currently does not support copying entire
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4285 " directories. Uses the local-buffer marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4286 " Returns 1=success (used by NetrwMarkFileMove())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4287 " 0=failure
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4288 fun! s:NetrwMarkFileCopy(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4289 " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---').">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4290
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4291 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4292 if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')})
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4293 call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4294 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4295 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4296 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4297 " call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')}))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4298 if !exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4299 call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4300 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4301 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4302 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4303 " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4304 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4305 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4306
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4307 if a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4308 " Copy marked files, local directory to local directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4309 " call Decho("copy from local to local")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4310 let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4311 " call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4312 call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4313
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4314 elseif a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4315 " Copy marked files, local directory to remote directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4316 " call Decho("copy from local to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4317 call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4318
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4319 elseif !a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4320 " call Decho("copy from remote to local")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4321 call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4322
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4323 elseif !a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4324 " call Decho("copy from remote to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4325 let curdir = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4326 let tmpdir = s:GetTempfile("")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4327 if tmpdir !~ '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4328 let tmpdir= curdir."/".tmpdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4329 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4330 if exists("*mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4331 call mkdir(tmpdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4332 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4333 exe "silent! !".g:netrw_local_mkdir.' '.shellescape(tmpdir,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4334 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4335 if isdirectory(tmpdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4336 exe "keepjumps lcd ".fnameescape(tmpdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4337 call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4338 let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4339 call s:NetrwUpload(localfiles,s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4340 if getcwd() == tmpdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4341 for fname in s:netrwmarkfilelist_{bufnr('%')}
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4342 call s:NetrwDelete(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4343 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4344 exe "keepjumps lcd ".fnameescape(curdir)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4345 exe "silent !".g:netrw_local_rmdir." ".shellescape(tmpdir,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4346 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4347 exe "keepjumps lcd ".fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4348 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4349 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4350 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4351
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4352 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4353 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4354 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4355 " call Decho("cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4356
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4357 " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4358 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4359
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4360 " refresh buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4361 if !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4362 call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4363 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4364 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4365 call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4366 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4367 if g:netrw_fastbrowse <= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4368 call s:LocalBrowseShellCmdRefresh()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4369 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4370
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4371 " call Dret("s:NetrwMarkFileCopy 1")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4372 return 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4373 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4374
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4375 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4376 " s:NetrwMarkFileDiff: (invoked by md) This function is used to {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4377 " invoke vim's diff mode on the marked files.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4378 " Either two or three files can be so handled.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4379 " Uses the global marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4380 fun! s:NetrwMarkFileDiff(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4381 " call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4382 let curbufnr= bufnr("%")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4383
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4384 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4385 let cnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4386 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4387 for fname in s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4388 let cnt= cnt + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4389 if cnt == 1
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4390 " call Decho("diffthis: fname<".fname.">")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4391 exe "e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4392 diffthis
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4393 elseif cnt == 2 || cnt == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4394 vsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4395 wincmd l
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4396 " call Decho("diffthis: ".fname)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4397 exe "e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4398 diffthis
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4399 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4400 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4401 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4402 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4403 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4404 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4405
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4406 " call Dret("s:NetrwMarkFileDiff")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4407 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4408
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4409 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4410 " s:NetrwMarkFileEdit: (invoked by me) put marked files on arg list and start editing them {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4411 " Uses global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4412 fun! s:NetrwMarkFileEdit(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4413 " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4414
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4415 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4416 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4417 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4418 call s:SetRexDir(a:islocal,curdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4419 let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4420 " unmark markedfile list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4421 " call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4422 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4423 " call Decho("exe silent args ".flist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4424 exe "silent args ".flist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4425 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4426
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4427 " call Dret("s:NetrwMarkFileEdit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4428 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4429
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4430 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4431 " s:NetrwMarkFileExe: (invoked by mx) execute arbitrary command on marked files, one at a time {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4432 " Uses the local marked-file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4433 fun! s:NetrwMarkFileExe(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4434 " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4435 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4436 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4437 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4438
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4439 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4440 " get the command
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4441 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4442 let cmd= input("Enter command: ","","file")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4443 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4444 " call Decho("cmd<".cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4445
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4446 " apply command to marked files. Substitute: filename -> %
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4447 " If no %, then append a space and the filename to the command
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4448 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4449 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4450 if g:netrw_keepdir
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4451 let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname)))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4452 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4453 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4454 let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4455 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4456 if cmd =~ '%'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4457 let xcmd= substitute(cmd,'%',fname,'g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4458 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4459 let xcmd= cmd.' '.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4460 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4461 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4462 " call Decho("local: xcmd<".xcmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4463 let ret= system(xcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4464 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4465 " call Decho("remote: xcmd<".xcmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4466 let ret= s:RemoteSystem(xcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4467 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4468 if v:shell_error < 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4469 call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4470 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4471 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4472 echo ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4473 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4474 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4475
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4476 " unmark marked file list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4477 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4478
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4479 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4480 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4481 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4482 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4483 call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4484 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4485
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4486 " call Dret("s:NetrwMarkFileExe")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4487 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4488
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4489 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4490 " s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4491 " as the marked file(s) (toggles suffix presence)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4492 " Uses the local marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4493 fun! s:NetrwMarkHideSfx(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4494 " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4495 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4496 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4497
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4498 " s:netrwmarkfilelist_{curbufnr}: the List of marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4499 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4500
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4501 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4502 " call Decho("s:NetrwMarkFileCopy: fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4503 " construct suffix pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4504 if fname =~ '\.'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4505 let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4506 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4507 let sfxpat= '^\%(\%(\.\)\@!.\)*$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4508 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4509 " determine if its in the hiding list or not
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4510 let inhidelist= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4511 if g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4512 let itemnum = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4513 let hidelist= split(g:netrw_list_hide,',')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4514 for hidepat in hidelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4515 if sfxpat == hidepat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4516 let inhidelist= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4517 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4518 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4519 let itemnum= itemnum + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4520 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4521 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4522 " call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4523 if inhidelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4524 " remove sfxpat from list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4525 call remove(hidelist,itemnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4526 let g:netrw_list_hide= join(hidelist,",")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4527 elseif g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4528 " append sfxpat to non-empty list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4529 let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4530 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4531 " set hiding list to sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4532 let g:netrw_list_hide= sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4533 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4534 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4535
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4536 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4537 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4538 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4539 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4540 call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4541 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4542
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4543 " call Dret("s:NetrwMarkHideSfx")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4544 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4545
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4546 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4547 " s:NetrwMarkFileGrep: (invoked by mg) This function applies vimgrep to marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4548 " Uses the global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4549 fun! s:NetrwMarkFileGrep(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4550 " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4551 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4552 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4553
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4554 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4555 " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4556 let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4557 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4558
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4559 " ask user for pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4560 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4561 let pat= input("Enter pattern: ","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4562 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4563 if pat !~ '^\s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4564 if pat !~ '^/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4565 let pat= '/'.pat.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4566 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4567 let pat= " ".pat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4568 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4569
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4570 " use vimgrep for both local and remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4571 " call Decho("exe vimgrep".pat." ".netrwmarkfilelist)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4572 try
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4573 exe "noautocmd vimgrep".pat." ".netrwmarkfilelist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4574 catch /^Vim\%((\a\+)\)\=:E480/
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4575 call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4576 " call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4577 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4578 endtry
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4579
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4580 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4581 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4582 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4583
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4584 " call Dret("s:NetrwMarkFileGrep")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4585 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4586
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4587 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4588 " s:NetrwMarkFileMove: (invoked by mm) execute arbitrary command on marked files, one at a time {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4589 " uses the global marked file list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4590 " s:netrwmfloc= 0: target directory is remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4591 " = 1: target directory is local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4592 fun! s:NetrwMarkFileMove(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4593 " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4594 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4595 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4596
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4597 " sanity check
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4598 if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')})
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4599 call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4600 " call Dret("s:NetrwMarkFileMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4601 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4602 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4603 " call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')}))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4604 if !exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4605 call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4606 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4607 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4608 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4609 " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4610
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4611 if a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4612 " move: local -> local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4613 " call Decho("move from local to local")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4614 " call Decho("(s:NetrwMarkFileMove) local to local move")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4615 if executable(g:netrw_localmovecmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4616 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4617 " call Decho("system(".g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt).")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4618 let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4619 if v:shell_error < 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4620 call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> failed, aborting",54)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4621 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4622 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4623 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4624 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4625 call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> is not executable!",57)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4626 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4627
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4628 elseif a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4629 " move: local -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4630 " call Decho("move from local to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4631 " call Decho("copy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4632 let mflist= s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4633 call s:NetrwMarkFileCopy(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4634 " call Decho("remove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4635 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4636 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4637 let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4638 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4639 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4640
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4641 elseif !a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4642 " move: remote -> local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4643 " call Decho("move from remote to local")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4644 " call Decho("copy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4645 let mflist= s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4646 call s:NetrwMarkFileCopy(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4647 " call Decho("remove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4648 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4649 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4650 let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4651 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4652 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4653
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4654 elseif !a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4655 " move: remote -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4656 " call Decho("move from remote to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4657 " call Decho("copy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4658 let mflist= s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4659 call s:NetrwMarkFileCopy(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4660 " call Decho("remove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4661 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4662 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4663 let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4664 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4665 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4666 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4667
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4668 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4669 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4670 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4671 " call Decho("cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4672
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4673 " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4674 call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4675
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4676 " refresh buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4677 if !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4678 call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4679 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4680 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4681 call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4682 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4683 if g:netrw_fastbrowse <= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4684 call s:LocalBrowseShellCmdRefresh()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4685 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4686
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4687 " call Dret("s:NetrwMarkFileMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4688 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4689
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4690 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4691 " s:NetrwMarkFilePrint: (invoked by mp) This function prints marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4692 " using the hardcopy command. Local marked-file list only.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4693 fun! s:NetrwMarkFilePrint(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4694 " call Dfunc("s:NetrwMarkFilePrint(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4695 let curbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4696 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4697 let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4698 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4699 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4700 for fname in netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4701 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4702 if g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4703 let fname= s:ComposePath(curdir,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4704 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4705 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4706 let fname= curdir.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4707 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4708 1split
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4709 " the autocmds will handle both local and remote files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4710 " call Decho("exe silent e ".escape(fname,' '))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4711 exe "silent e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4712 " call Decho("hardcopy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4713 hardcopy
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4714 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4715 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4716 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4717 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4718 " call Dret("s:NetrwMarkFilePrint")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4719 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4720
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4721 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4722 " s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4723 " files when given a regexp (for which a prompt is
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4724 " issued).
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4725 fun! s:NetrwMarkFileRegexp(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4726 " call Dfunc("s:NetrwMarkFileRegexp(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4727
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4728 " get the regular expression
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4729 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4730 let regexp= input("Enter regexp: ","","file")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4731 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4732
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4733 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4734 " get the matching list of files using local glob()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4735 " call Decho("handle local regexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4736 let dirname = escape(b:netrw_curdir,g:netrw_glob_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4737 let files = glob(s:ComposePath(dirname,regexp))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4738 " call Decho("files<".files.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4739 let filelist= split(files,"\n")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4740
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4741 " mark the list of files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4742 for fname in filelist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4743 " call Decho("fname<".fname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4744 call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','',''))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4745 endfor
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4746
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4747 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4748 " call Decho("handle remote regexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4749
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4750 " convert displayed listing into a filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4751 let eikeep = &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4752 let areg = @a
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4753 silent %y a
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4754 set ei=all ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4755 " call Decho("set ei=all ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4756 1split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4757 call s:NetrwEnew()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4758 call s:NetrwSafeOptions()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4759 silent norm! "ap
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4760 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4761 let bannercnt= search('^" =====','W')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4762 exe "silent 1,".bannercnt."d"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4763 set bt=nofile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4764 if g:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4765 silent %s/\s\{2,}\S.*$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4766 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4767 elseif g:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4768 silent %s/\s\{2,}/\r/ge
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4769 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4770 elseif g:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4771 silent %s/^| //e
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4772 silent! g/^ .*$/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4773 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4774 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4775 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4776 " convert regexp into the more usual glob-style format
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4777 let regexp= substitute(regexp,'\*','.*','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4778 " call Decho("regexp<".regexp.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4779 exe "silent! v/".escape(regexp,'/')."/d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4780 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4781 let filelist= getline(1,line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4782 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4783 for filename in filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4784 call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','',''))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4785 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4786 unlet filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4787 let @a = areg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4788 let &ei = eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4789 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4790
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4791 " call Dret("s:NetrwMarkFileRegexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4792 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4793
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4794 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4795 " s:NetrwMarkFileSource: (invoked by ms) This function sources marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4796 " Uses the local marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4797 fun! s:NetrwMarkFileSource(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4798 " call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4799 let curbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4800 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4801 let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4802 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4803 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4804 for fname in netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4805 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4806 if g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4807 let fname= s:ComposePath(curdir,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4808 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4809 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4810 let fname= curdir.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4811 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4812 " the autocmds will handle sourcing both local and remote files
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4813 " call Decho("exe so ".fnameescape(fname))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4814 exe "so ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4815 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4816 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4817 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4818 " call Dret("s:NetrwMarkFileSource")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4819 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4820
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4821 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4822 " s:NetrwMarkFileTag: (invoked by mT) This function applies g:netrw_ctags to marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4823 " Uses the global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4824 fun! s:NetrwMarkFileTag(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4825 " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4826 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4827 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4828 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4829
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4830 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4831 " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4832 let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4833 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4834
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4835 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4836 if executable(g:netrw_ctags)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4837 " call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4838 call system(g:netrw_ctags." ".netrwmarkfilelist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4839 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4840 call netrw#ErrorMsg(s:ERROR,"g:netrw_ctags<".g:netrw_ctags."> is not executable!",51)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4841 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4842 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4843 let cmd = s:RemoteSystem(g:netrw_ctags." ".netrwmarkfilelist)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4844 call netrw#NetrwObtain(a:islocal,"tags")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4845 let curdir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4846 1split
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4847 e tags
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4848 let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4849 " call Decho("curdir<".curdir."> path<".path.">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4850 exe '%s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4851 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4852 wq!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4853 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4854 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4855 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4856 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4857 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4858
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4859 " call Dret("s:NetrwMarkFileTag")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4860 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4861
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4862 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4863 " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4864 " Sets up two variables,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4865 " s:netrwmftgt : holds the target directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4866 " s:netrwmftgt_islocal : 0=target directory is remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4867 " 1=target directory is local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4868 fun! s:NetrwMarkFileTgt(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4869 " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4870 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4871 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4872 let hadtgt = exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4873 if !exists("w:netrw_bannercnt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4874 let w:netrw_bannercnt= b:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4875 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4876
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4877 " set up target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4878 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4879 " if cursor in banner region, use b:netrw_curdir for the target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4880 let s:netrwmftgt= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4881 " call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4882
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4883 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4884 " get word under cursor.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4885 " * If directory, use it for the target.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4886 " * If file, use b:netrw_curdir for the target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4887 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4888 let tgtdir = s:ComposePath(curdir,curword)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4889 if a:islocal && isdirectory(tgtdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4890 let s:netrwmftgt = tgtdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4891 " call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4892 elseif !a:islocal && tgtdir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4893 let s:netrwmftgt = tgtdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4894 " call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4895 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4896 let s:netrwmftgt = curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4897 " call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4898 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4899 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4900 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4901 " simplify the target (eg. /abc/def/../ghi -> /abc/ghi)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4902 let s:netrwmftgt= simplify(s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4903 " call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4904 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4905 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4906 let s:netrwmftgt= substitute(system("cygpath ".shellescape(s:netrwmftgt)),'\n$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4907 let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4908 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4909 let s:netrwmftgt_islocal= a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4910
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4911 if g:netrw_fastbrowse <= 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4912 call s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4913 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4914 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4915 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4916 if !hadtgt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4917 norm! j
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4918 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4919
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4920 " call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4921 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4922
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4923 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4924 " s:NetrwOpenFile: query user for a filename and open it {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4925 fun! s:NetrwOpenFile(islocal)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4926 " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4927 call inputsave()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4928 let fname= input("Enter filename: ")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4929 call inputrestore()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4930 if fname !~ '[/\\]'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4931 if exists("b:netrw_curdir")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4932 if exists("g:netrw_quiet")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4933 let netrw_quiet_keep = g:netrw_quiet
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4934 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4935 let g:netrw_quiet = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4936 if b:netrw_curdir =~ '/$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4937 exe "e ".fnameescape(b:netrw_curdir.fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4938 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4939 exe "e ".fnameescape(b:netrw_curdir."/".fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4940 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4941 if exists("netrw_quiet_keep")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4942 let g:netrw_quiet= netrw_quiet_keep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4943 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4944 unlet g:netrw_quiet
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4945 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4946 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4947 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4948 exe "e ".fnameescape(fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4949 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4950 " call Dret("s:NetrwOpenFile")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4951 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4952
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4953 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4954 " s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4955 fun! s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4956 " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4957
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4958 " remove all files in local marked-file list from global list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4959 if exists("s:netrwmarkfilelist_{a:curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4960 for mfile in s:netrwmarkfilelist_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4961 let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4962 let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4963 call remove(s:netrwmarkfilelist,idx) " remove from global list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4964 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4965 if s:netrwmarkfilelist == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4966 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4967 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4968
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4969 " getting rid of the local marked-file lists is easy
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4970 unlet s:netrwmarkfilelist_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4971 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4972 if exists("s:netrwmarkfilemtch_{a:curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4973 unlet s:netrwmarkfilemtch_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4974 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4975 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4976 " call Dret("s:NetrwUnmarkList")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4977 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4978
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4979 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4980 " s:NetrwUnmarkAll: remove the global marked file list and all local ones {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4981 fun! s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4982 " call Dfunc("s:NetrwUnmarkAll()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4983 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4984 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4985 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4986 silent call s:NetrwUnmarkAll2()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4987 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4988 " call Dret("s:NetrwUnmarkAll")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4989 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4990
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4991 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4992 " s:NetrwUnmarkAll2: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4993 fun! s:NetrwUnmarkAll2()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4994 " call Dfunc("s:NetrwUnmarkAll2()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4995 redir => netrwmarkfilelist_let
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4996 let
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4997 redir END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4998 let netrwmarkfilelist_list= split(netrwmarkfilelist_let,'\n') " convert let string into a let list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4999 call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5000 call map(netrwmarkfilelist_list,"substitute(v:val,'\\s.*$','','')") " remove what the entries are equal to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5001 for flist in netrwmarkfilelist_list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5002 let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5003 unlet s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5004 unlet s:netrwmarkfilemtch_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5005 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5006 " call Dret("s:NetrwUnmarkAll2")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5007 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5008
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5009 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5010 " s:NetrwUnMarkFile: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5011 fun! s:NetrwUnMarkFile(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5012 " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5013 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5014 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5015
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5016 " unmark marked file list (although I expect s:NetrwUpload()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5017 " to do it, I'm just making sure)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5018 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5019 " call Decho("unlet'ing: s:netrwmarkfile[list|mtch]_".bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5020 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5021 unlet s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5022 unlet s:netrwmarkfilemtch_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5023 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5024 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5025
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5026 " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5027 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5028 " call Dret("s:NetrwUnMarkFile")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5029 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5030
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5031 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5032 " s:NetrwMenu: generates the menu for gvim and netrw {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5033 fun! s:NetrwMenu(domenu)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5034
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5035 if !exists("g:NetrwMenuPriority")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5036 let g:NetrwMenuPriority= 80
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5037 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5038
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5039 if has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5040 " call Dfunc("NetrwMenu(domenu=".a:domenu.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5041
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5042 if !exists("s:netrw_menu_enabled") && a:domenu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5043 " call Decho("initialize menu")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5044 let s:netrw_menu_enabled= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5045 exe 'silent! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5046 exe 'silent! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5047 exe 'silent! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5048 exe 'silent! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5049 exe 'silent! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directory<tab>mb mb'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5050 exe 'silent! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)<tab>u u'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5051 exe 'silent! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)<tab>U U'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5052 exe 'silent! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.List<tab>qb qb'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5053 exe 'silent! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab><ctrl-h>'." \<c-h>'"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5054 exe 'silent! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ Sequence<tab>S S'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5055 exe 'silent! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files<tab>'."gh gh"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5056 exe 'silent! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l> \<c-l>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5057 exe 'silent! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5058 exe 'silent! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5059 exe 'silent! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window<tab><cr> '."\<cr>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5060 exe 'silent! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directory<tab>p p'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5061 exe 'silent! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ Window<tab>P P'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5062 exe 'silent! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Window<tab>o o'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5063 exe 'silent! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Window<tab>v v'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5064 exe 'silent! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5065 exe 'silent! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */ :Explore */'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5066 exe 'silent! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs)<tab>:Explore\ **/ :Explore **/'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5067 exe 'silent! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only)<tab>:Explore\ *// :Explore *//'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5068 exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs)<tab>:Explore\ **// :Explore **//'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5069 exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match<tab>:Nexplore :Nexplore<cr>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5070 exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match<tab>:Pexplore :Pexplore<cr>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5071 exe 'silent! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5072 exe 'silent! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ File<tab>mf mf'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5073 exe 'silent! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexp<tab>mr mr'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5074 exe 'silent! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Control<tab>a a'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5075 exe 'silent! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Target<tab>mc mc'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5076 exe 'silent! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.Delete<tab>D D'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5077 exe 'silent! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diff<tab>md md'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5078 exe 'silent! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Edit<tab>me me'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5079 exe 'silent! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmd<tab>mx mx'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5080 exe 'silent! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Target<tab>mm mm'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5081 exe 'silent! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.Obtain<tab>O O'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5082 exe 'silent! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Print<tab>mp mp'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5083 exe 'silent! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.Replace<tab>R R'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5084 exe 'silent! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Target<tab>mt mt'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5085 exe 'silent! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.Tag<tab>mT mT'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5086 exe 'silent! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompress<tab>mz mz'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5087 exe 'silent! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5088 exe 'silent! menu '.g:NetrwMenuPriority.'.16.1 '.g:NetrwTopLvlMenu.'Style.Listing\ Style\ (thin-long-wide-tree)<tab>i i'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5089 exe 'silent! menu '.g:NetrwMenuPriority.'.16.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show<tab>a a'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5090 exe 'silent! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order<tab>'."r r"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5091 exe 'silent! menu '.g:NetrwMenuPriority.'.16.4 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method\ (name-time-size)<tab>s s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5092 exe 'silent! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5093 exe 'silent! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5094 call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5095 let s:netrw_menucnt= 28
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5096
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5097 elseif !a:domenu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5098 let s:netrwcnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5099 let curwin = winnr()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5100 windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5101 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5102
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5103 if s:netrwcnt <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5104 " call Decho("clear menus")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5105 exe 'silent! unmenu '.g:NetrwTopLvlMenu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5106 " call Decho('exe silent! unmenu '.g:NetrwTopLvlMenu.'*')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5107 silent! unlet s:netrw_menu_enabled
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5108 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5109 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5110 " call Dret("NetrwMenu")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5111 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5112
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5113 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5114
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5115 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5116 " s:NetrwObtain: obtain file under cursor or from markfile list {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5117 " Used by the O maps (as <SID>NetrwObtain())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5118 fun! s:NetrwObtain(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5119 " call Dfunc("NetrwObtain(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5120
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5121 if exists("s:netrwmarkfilelist_{bufnr('%')}")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5122 let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5123 call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')})
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5124 call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5125 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5126 call netrw#NetrwObtain(a:islocal,expand("<cWORD>"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5127 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5128
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5129 " call Dret("NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5130 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5131
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5132 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5133 " netrw#NetrwObtain: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5134 " netrw#NetrwObtain(islocal,fname[,tgtdirectory])
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5135 " islocal=0 obtain from remote source
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5136 " =1 obtain from local source
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5137 " fname : a filename or a list of filenames
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5138 " tgtdir : optional place where files are to go (not present, uses getcwd())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5139 fun! netrw#NetrwObtain(islocal,fname,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5140 " call Dfunc("netrw#NetrwObtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5141 " NetrwStatusLine support - for obtaining support
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5142
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5143 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5144 let fnamelist= [ a:fname ]
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5145 elseif type(a:fname) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5146 let fnamelist= a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5147 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5148 call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5149 " call Dret("netrw#NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5150 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5151 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5152 " call Decho("fnamelist<".string(fnamelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5153 if a:0 > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5154 let tgtdir= a:1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5155 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5156 let tgtdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5157 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5158 " call Decho("tgtdir<".tgtdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5159
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5160 if exists("b:netrw_islocal") && b:netrw_islocal
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5161 " obtain a file from local b:netrw_curdir to (local) tgtdir
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5162 " call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5163 if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5164 let topath= s:ComposePath(tgtdir,"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5165 if (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5166 " transfer files one at time
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5167 " call Decho("transfer files one at a time")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5168 for fname in fnamelist
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5169 " call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5170 call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5171 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5172 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5173 " transfer files with one command
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5174 " call Decho("transfer files with one command")
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5175 let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5176 " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5177 call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5178 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5179 elseif !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5180 call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5181 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5182 call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5183 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5184
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5185 else
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5186 " obtain files from remote b:netrw_curdir to local tgtdir
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5187 " call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5188 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5189 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5190 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5191 call s:NetrwMethod(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5192
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5193 if b:netrw_method == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5194 " obtain file using scp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5195 " call Decho("obtain via scp (method#4)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5196 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5197 let useport= " ".g:netrw_scpport." ".g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5198 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5199 let useport= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5200 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5201 if b:netrw_fname =~ '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5202 let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5203 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5204 let path= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5205 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5206 let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)'))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5207 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5208 exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5209
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5210 elseif b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5211 " obtain file using ftp + .netrc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5212 " call Decho("obtain via ftp+.netrc (method #2)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5213 call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5214 let tmpbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5215 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5216 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5217 put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5218 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5219 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5220
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5221 if exists("b:netrw_fname") && b:netrw_fname != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5222 call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5223 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5224 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5225
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5226 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5227 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5228 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5229 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5230 for fname in fnamelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5231 call setline(line("$")+1,'get "'.fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5232 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5233 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5234 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5235 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5236 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5237 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5238 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5239 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5240 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5241 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5242 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5243 let debugkeep= &debug
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5244 setlocal debug=msg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5245 call netrw#ErrorMsg(s:ERROR,getline(1),4)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5246 let &debug= debugkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5247 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5248
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5249 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5250 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5251 " call Decho("obtain via ftp+mipf (method #3)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5252 call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5253 let tmpbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5254 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5255
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5256 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5257 put ='open '.g:netrw_machine.' '.g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5258 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5259 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5260 put ='open '.g:netrw_machine
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5261 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5262 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5263
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5264 if exists("g:netrw_ftp") && g:netrw_ftp == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5265 put =g:netrw_uid
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5266 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5267 put ='\"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5268 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5269 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5270 put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5271 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5272 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5273
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5274 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5275 put =g:netrw_ftpmode
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5276 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5277 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5278
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5279 if exists("b:netrw_fname") && b:netrw_fname != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5280 call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5281 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5282 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5283
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5284 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5285 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5286 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5287 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5288
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5289 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5290 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5291 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5292 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5293 for fname in fnamelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5294 call setline(line("$")+1,'get "'.fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5295 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5296 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5297
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5298 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5299 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5300 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5301 " -n win32: quit being obnoxious about password
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5302 norm! 1Gdd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5303 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5304 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5305 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5306 if getline(1) !~ "^$"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5307 " call Decho("error<".getline(1).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5308 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5309 call netrw#ErrorMsg(s:ERROR,getline(1),5)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5310 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5311 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5312 elseif !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5313 " call Dfunc("netrw#NetrwObtain : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5314 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5315 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5316
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5317 " restore status line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5318 if type(a:fname) == 1 && exists("s:netrw_users_stl")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5319 call s:SetupNetrwStatusLine(s:netrw_users_stl)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5320 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5321
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5322 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5323
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5324 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5325 if exists("tmpbufnr")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5326 if bufnr("%") != tmpbufnr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5327 exe tmpbufnr."bw!"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5328 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5329 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5330 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5331 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5332
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5333 " call Dret("netrw#NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5334 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5335
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5336 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5337 " s:NetrwPrevWinOpen: open file/directory in previous window. {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5338 " If there's only one window, then the window will first be split.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5339 " Returns:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5340 " choice = 0 : didn't have to choose
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5341 " choice = 1 : saved modified file in window first
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5342 " choice = 2 : didn't save modified file, opened window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5343 " choice = 3 : cancel open
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5344 fun! s:NetrwPrevWinOpen(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5345 " call Dfunc("NetrwPrevWinOpen(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5346
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5347 " grab a copy of the b:netrw_curdir to pass it along to newly split windows
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5348 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5349
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5350 " get last window number and the word currently under the cursor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5351 let lastwinnr = winnr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5352 let curword = s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5353 let choice = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5354 " call Decho("lastwinnr=".lastwinnr." curword<".curword.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5355
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5356 let didsplit = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5357 if lastwinnr == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5358 " if only one window, open a new one first
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5359 " call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5360 if g:netrw_preview
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5361 " call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5362 exe (g:netrw_alto? "top " : "bot ")."vert ".g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5363 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5364 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5365 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5366 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5367 let didsplit = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5368
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5369 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5370 call s:SaveBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5371 " call Decho("wincmd p")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5372 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5373 call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5374 " if the previous window's buffer has been changed (is modified),
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5375 " and it doesn't appear in any other extant window, then ask the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5376 " user if s/he wants to abandon modifications therein.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5377 let bnr = winbufnr(0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5378 let bnrcnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5379 if &mod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5380 " call Decho("detected: prev window's buffer has been modified: bnr=".bnr." winnr#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5381 let eikeep= &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5382 set ei=all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5383 windo if winbufnr(0) == bnr | let bnrcnt=bnrcnt+1 | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5384 exe bnr."wincmd p"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5385 let &ei= eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5386 " call Decho("bnr=".bnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5387 if bnrcnt == 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5388 let bufname = bufname(winbufnr(winnr()))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5389 let choice = confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5390 " call Decho("bufname<".bufname."> choice=".choice." winnr#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5391
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5392 if choice == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5393 " Yes -- write file & then browse
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5394 let v:errmsg= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5395 silent w
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5396 if v:errmsg != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5397 call netrw#ErrorMsg(s:ERROR,"unable to write <".bufname.">!",30)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5398 if didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5399 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5400 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5401 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5402 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5403 " call Dret("NetrwPrevWinOpen ".choice." : unable to write <".bufname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5404 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5405 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5406
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5407 elseif choice == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5408 " No -- don't worry about changed file, just browse anyway
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5409 setlocal nomod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5410 call netrw#ErrorMsg(s:WARNING,bufname." changes to ".bufname." abandoned",31)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5411 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5412
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5413 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5414 " Cancel -- don't do this
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5415 if didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5416 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5417 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5418 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5419 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5420 " call Dret("NetrwPrevWinOpen ".choice." : cancelled")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5421 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5422 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5423 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5424 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5425 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5426
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5427 " restore b:netrw_curdir (window split/enew may have lost it)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5428 let b:netrw_curdir= curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5429 if a:islocal < 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5430 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5431 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(a:islocal,curword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5432 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5433 call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,curword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5434 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5435 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5436 " call Dret("NetrwPrevWinOpen ".choice)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5437 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5438 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5439
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5440 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5441 " s:NetrwUpload: load fname to tgt (used by NetrwMarkFileCopy()) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5442 " Always assumed to be local -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5443 " call s:NetrwUpload(filename, target)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5444 " call s:NetrwUpload(filename, target, fromdirectory)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5445 fun! s:NetrwUpload(fname,tgt,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5446 " call Dfunc("s:NetrwUpload(fname<".((type(a:fname) == 1)? a:fname : string(a:fname))."> tgt<".a:tgt.">) a:0=".a:0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5447
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5448 if a:tgt =~ '^\a\+://'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5449 let tgtdir= substitute(a:tgt,'^\a\+://[^/]\+/\(.\{-}\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5450 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5451 let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5452 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5453 " call Decho("tgtdir<".tgtdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5454
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5455 if a:0 > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5456 let fromdir= a:1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5457 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5458 let fromdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5459 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5460 " call Decho("fromdir<".fromdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5461
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5462 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5463 " handle uploading a single file using NetWrite
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5464 " call Decho("handle uploading a single file via NetWrite")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5465 1split
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5466 " call Decho("exe e ".fnameescape(a:fname))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5467 exe "e ".fnameescape(a:fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5468 " call Decho("now locally editing<".expand("%").">, has ".line("$")." lines")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5469 if a:tgt =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5470 let wfname= substitute(a:fname,'^.*/','','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5471 " call Decho("exe w! ".fnameescape(wfname))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5472 exe "w! ".fnameescape(a:tgt.wfname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5473 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5474 " call Decho("writing local->remote: exe w ".fnameescape(a:tgt))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5475 exe "w ".fnameescape(a:tgt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5476 " call Decho("done writing local->remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5477 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5478 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5479
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5480 elseif type(a:fname) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5481 " handle uploading a list of files via scp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5482 " call Decho("handle uploading a list of files via scp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5483 let curdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5484 if a:tgt =~ '^scp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5485 exe "keepjumps silent lcd ".fnameescape(fromdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5486 let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')})
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5487 let args = join(map(filelist,"shellescape(v:val, 1)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5488 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5489 let useport= " ".g:netrw_scpport." ".g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5490 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5491 let useport= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5492 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5493 let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5494 let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5495 " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5496 exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5497 exe "keepjumps silent lcd ".fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5498
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5499 elseif a:tgt =~ '^ftp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5500 call s:NetrwMethod(a:tgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5501
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5502 if b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5503 " handle uploading a list of files via ftp+.netrc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5504 let netrw_fname = b:netrw_fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5505 silent keepjumps new
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5506 " call Decho("filter input window#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5507
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5508 put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5509 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5510
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5511 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5512 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5513 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5514 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5515
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5516 call setline(line("$")+1,'lcd "'.fromdir.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5517 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5518
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5519 call setline(line("$")+1,'cd "'.tgtdir.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5520 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5521
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5522 for fname in a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5523 call setline(line("$")+1,'put "'.fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5524 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5525 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5526
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5527 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5528 " call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5529 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5530 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5531 " call Decho("filter input window#".winnr())
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5532 " call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5533 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5534 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5535 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5536 silent g/Local directory now/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5537 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5538 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5539 call netrw#ErrorMsg(s:ERROR,getline(1),14)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5540 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5541 bw!|q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5542 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5543
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5544 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5545 " upload with ftp + machine, id, passwd, and fname (ie. no .netrc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5546 let netrw_fname= b:netrw_fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5547 call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5548 let tmpbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5549 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5550
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5551 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5552 put ='open '.g:netrw_machine.' '.g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5553 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5554 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5555 put ='open '.g:netrw_machine
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5556 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5557 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5558
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5559 if exists("g:netrw_ftp") && g:netrw_ftp == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5560 put =g:netrw_uid
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5561 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5562 call setline(line("$")+1,'"'.s:netrw_passwd.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5563 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5564 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5565 put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5566 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5567 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5568
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5569 call setline(line("$")+1,'lcd "'.fromdir.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5570 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5571
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5572 if exists("b:netrw_fname") && b:netrw_fname != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5573 call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5574 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5575 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5576
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5577 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5578 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5579 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5580 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5581
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5582 for fname in a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5583 call setline(line("$")+1,'put "'.fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5584 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5585 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5586
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5587 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5588 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5589 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5590 " -n win32: quit being obnoxious about password
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5591 norm! 1Gdd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5592 " call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5593 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5594 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5595 silent g/Local directory now/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5596 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5597 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5598 let debugkeep= &debug
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5599 setlocal debug=msg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5600 call netrw#ErrorMsg(s:ERROR,getline(1),15)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5601 let &debug = debugkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5602 let mod = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5603 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5604 bw!|q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5605 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5606 elseif !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5607 " call Dfunc("netrw#NetrwUpload : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5608 return
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5609 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5610 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5611 call netrw#ErrorMsg(s:ERROR,"can't obtain files with protocol from<".a:tgt.">",63)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5612 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5613 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5614
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5615 " call Dret("s:NetrwUpload")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5616 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5617
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5618 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5619 " s:NetrwPreview: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5620 fun! s:NetrwPreview(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5621 " call Dfunc("NetrwPreview(path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5622 call s:NetrwOptionSave("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5623 call s:NetrwSafeOptions()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5624 if has("quickfix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5625 if !isdirectory(a:path)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5626 exe (g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5627 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5628 call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5629 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5630 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5631 call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5632 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5633 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5634 " call Dret("NetrwPreview")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5635 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5636
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5637 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5638 " s:NetrwRefresh: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5639 fun! s:NetrwRefresh(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5640 " call Dfunc("NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5641 " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5642 " NetrwBrowseChgDir() may clear the display; hence a NetrwSavePosn() may not work if its placed here.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5643 " Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5644 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5645 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5646 " call Decho("clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5647 %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5648 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5649 call netrw#LocalBrowseCheck(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5650 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5651 call s:NetrwBrowse(a:islocal,a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5652 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5653 call netrw#NetrwRestorePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5654
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5655 " restore file marks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5656 if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5657 " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5658 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5659 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5660 " call Decho("2match none")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5661 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5662 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5663
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5664 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5665 " call Dret("NetrwRefresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5666 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5667
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5668 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5669 " s:NetrwRefreshDir: refreshes a directory by name {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5670 " Called by NetrwMarkFileCopy()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5671 " Interfaces to s:NetrwRefresh() and s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5672 fun! s:NetrwRefreshDir(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5673 " call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) fastbrowse=".g:netrw_fastbrowse)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5674 if g:netrw_fastbrowse == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5675 " slowest mode (keep buffers refreshed, local or remote)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5676 " call Decho("slowest mode: keep buffers refreshed, local or remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5677 let tgtwin= bufwinnr(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5678 " call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5679
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5680 if tgtwin > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5681 " tgtwin is being displayed, so refresh it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5682 let curwin= winnr()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5683 " call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5684 exe tgtwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5685 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5686 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5687
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5688 elseif bufnr(a:dirname) > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5689 let bn= bufnr(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5690 " call Decho("bd bufnr(".a:dirname.")=".bn)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5691 exe "silent bd ".bn
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5692 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5693
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5694 elseif g:netrw_fastbrowse <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5695 " call Decho("medium-speed mode: refresh local buffers only")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5696 call s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5697 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5698 " call Dret("s:NetrwRefreshDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5699 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5700
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5701 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5702 " s:NetrwSetSort: sets up the sort based on the g:netrw_sort_sequence {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5703 " What this function does is to compute a priority for the patterns
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5704 " in the g:netrw_sort_sequence. It applies a substitute to any
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5705 " "files" that satisfy each pattern, putting the priority / in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5706 " front. An "*" pattern handles the default priority.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5707 fun! s:NetrwSetSort()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5708 " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5709 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5710 let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5711 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5712 let seqlist = g:netrw_sort_sequence
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5713 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5714 " sanity check -- insure that * appears somewhere
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5715 if seqlist == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5716 let seqlist= '*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5717 elseif seqlist !~ '\*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5718 let seqlist= seqlist.',*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5719 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5720 let priority = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5721 while seqlist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5722 if seqlist =~ ','
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5723 let seq = substitute(seqlist,',.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5724 let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5725 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5726 let seq = seqlist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5727 let seqlist = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5728 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5729 if priority < 10
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5730 let spriority= "00".priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5731 elseif priority < 100
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5732 let spriority= "0".priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5733 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5734 let spriority= priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5735 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5736 " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5737
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5738 " sanity check
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5739 if w:netrw_bannercnt > line("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5740 " apparently no files were left after a Hiding pattern was used
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5741 " call Dret("SetSort : no files left after hiding")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5742 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5743 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5744 if seq == '*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5745 let starpriority= spriority
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5746 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5747 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5748 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5749 " sometimes multiple sorting patterns will match the same file or directory.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5750 " The following substitute is intended to remove the excess matches.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5751 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5752 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5753 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5754 let priority = priority + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5755 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5756 if exists("starpriority")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5757 exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5758 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5759 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5760
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5761 " Following line associated with priority -- items that satisfy a priority
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5762 " pattern get prefixed by ###/ which permits easy sorting by priority.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5763 " Sometimes files can satisfy multiple priority patterns -- only the latest
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5764 " priority pattern needs to be retained. So, at this point, these excess
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5765 " priority prefixes need to be removed, but not directories that happen to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5766 " be just digits themselves.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5767 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5768 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5769
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5770 " call Dret("SetSort")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5771 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5772
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5773 " =====================================================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5774 " s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5775 fun! s:NetrwSortStyle(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5776 " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5777 call s:NetrwSaveWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5778 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5779
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5780 let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5781 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5782 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5783 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5784
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5785 " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5786 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5787
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5788 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5789 " s:NetrwSplit: mode {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5790 " =0 : net and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5791 " =1 : net and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5792 " =2 : net and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5793 " =3 : local and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5794 " =4 : local and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5795 " =5 : local and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5796 fun! s:NetrwSplit(mode)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5797 " call Dfunc("s:NetrwSplit(mode=".a:mode.") alto=".g:netrw_alto." altv=".g:netrw_altv)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5798
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5799 call s:SaveWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5800
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5801 if a:mode == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5802 " remote and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5803 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5804 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5805 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5806 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5807 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5808 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5809
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5810 elseif a:mode == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5811 " remote and t
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5812 let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5813 " call Decho("tabnew")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5814 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5815 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5816 call s:RestoreWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5817 call s:NetrwBrowse(0,newdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5818 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5819
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5820 elseif a:mode == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5821 " remote and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5822 " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5823 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5824 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5825 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5826 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5827 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5828
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5829 elseif a:mode == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5830 " local and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5831 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5832 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5833 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5834 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5835 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5836 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5837
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5838 elseif a:mode == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5839 " local and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5840 let cursorword = s:NetrwGetWord()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5841 let netrw_curdir= s:NetrwTreeDir()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5842 " call Decho("tabnew")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5843 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5844 let b:netrw_curdir= netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5845 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5846 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5847 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5848 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5849
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5850 elseif a:mode == 5
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5851 " local and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5852 " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5853 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5854 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5855 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5856 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5857 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5858
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5859 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5860 call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5861 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5862
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5863 " call Dret("s:NetrwSplit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5864 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5865
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5866 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5867 " NetrwStatusLine: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5868 fun! NetrwStatusLine()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5869
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5870 " vvv NetrwStatusLine() debugging vvv
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5871 " let g:stlmsg=""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5872 " if !exists("w:netrw_explore_bufnr")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5873 " let g:stlmsg="!X<explore_bufnr>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5874 " elseif w:netrw_explore_bufnr != bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5875 " let g:stlmsg="explore_bufnr!=".bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5876 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5877 " if !exists("w:netrw_explore_line")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5878 " let g:stlmsg=" !X<explore_line>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5879 " elseif w:netrw_explore_line != line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5880 " let g:stlmsg=" explore_line!={line(.)<".line(".").">"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5881 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5882 " if !exists("w:netrw_explore_list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5883 " let g:stlmsg=" !X<explore_list>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5884 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5885 " ^^^ NetrwStatusLine() debugging ^^^
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5886
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5887 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")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5888 " restore user's status line
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5889 let &stl = s:netrw_users_stl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5890 let &laststatus = s:netrw_users_ls
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5891 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5892 if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5893 return ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5894 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5895 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5896 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5897 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5898
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5899 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5900 " s:NetrwTreeDir: determine tree directory given current cursor position {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5901 " (full path directory with trailing slash returned)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5902 fun! s:NetrwTreeDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5903 " call Dfunc("NetrwTreeDir() curline#".line(".")."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5904
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5905 let treedir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5906 " call Decho("set initial treedir<".treedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5907 let s:treecurpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5908
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5909 if w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5910 " call Decho("w:netrrw_liststyle is TREELIST:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5911 " call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5912
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5913 " extract tree directory if on a line specifying a subdirectory (ie. ends with "/")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5914 if getline('.') =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5915 let treedir= substitute(getline('.'),'^\%(| \)*\([^|].\{-}\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5916 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5917 let treedir= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5918 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5919 " call Decho("treedir<".treedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5920
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5921 " detect user attempting to close treeroot
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5922 if getline('.') !~ '|' && getline('.') != '..'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5923 " call Decho("user attempted to close treeroot")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5924 " now force a refresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5925 " call Decho("clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5926 keepjumps %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5927 " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5928 return b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5929 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5930
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5931 " elide all non-depth information
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5932 let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5933 " call Decho("depth<".depth."> 1st subst (non-depth info removed)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5934
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5935 " elide first depth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5936 let depth = substitute(depth,'^| ','','')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5937 " call Decho("depth<".depth."> 2nd subst (first depth removed)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5938
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5939 " construct treedir by searching backwards at correct depth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5940 " call Decho("constructing treedir<".treedir."> depth<".depth.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5941 while depth != "" && search('^'.depth.'[^|].\{-}/$','bW')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5942 let dirname= substitute(getline('.'),'^\(| \)*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5943 let treedir= dirname.treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5944 let depth = substitute(depth,'^| ','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5945 " call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5946 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5947 if w:netrw_treetop =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5948 let treedir= w:netrw_treetop.treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5949 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5950 let treedir= w:netrw_treetop.'/'.treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5951 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5952 " call Decho("bufnr(.)=".bufnr("%")." line($)=".line("$")." line(.)=".line("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5953 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5954 let treedir= substitute(treedir,'//$','/','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5955
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5956 " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5957 return treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5958 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5959
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5960 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5961 " s:NetrwTreeDisplay: recursive tree display {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5962 fun! s:NetrwTreeDisplay(dir,depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5963 " call Dfunc("NetrwTreeDisplay(dir<".a:dir."> depth<".a:depth.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5964
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5965 " insure that there are no folds
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5966 setlocal nofen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5967
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5968 " install ../ and shortdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5969 if a:depth == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5970 call setline(line("$")+1,'../')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5971 " call Decho("setline#".line("$")." ../ (depth is zero)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5972 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5973 if a:dir =~ '^\a\+://'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5974 if a:dir == w:netrw_treetop
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5975 let shortdir= a:dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5976 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5977 let shortdir= substitute(a:dir,'^.*/\([^/]\+\)/$','\1/','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5978 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5979 call setline(line("$")+1,a:depth.shortdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5980 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5981 let shortdir= substitute(a:dir,'^.*/','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5982 call setline(line("$")+1,a:depth.shortdir.'/')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5983 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5984 " call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5985
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5986 " append a / to dir if its missing one
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5987 let dir= a:dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5988 if dir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5989 let dir= dir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5990 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5991
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5992 " display subtrees (if any)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5993 let depth= "| ".a:depth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5994
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5995 " call Decho("display subtrees with depth<".depth."> and current leaves")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5996 for entry in w:netrw_treedict[a:dir]
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5997 let direntry= substitute(dir.entry,'/$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5998 " call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5999 if entry =~ '/$' && has_key(w:netrw_treedict,direntry)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6000 " call Decho("<".direntry."> is a key in treedict - display subtree for it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6001 call s:NetrwTreeDisplay(direntry,depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6002 elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6003 " call Decho("<".direntry."/> is a key in treedict - display subtree for it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6004 call s:NetrwTreeDisplay(direntry.'/',depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6005 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6006 " call Decho("<".entry."> is not a key in treedict (no subtree)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6007 call setline(line("$")+1,depth.entry)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6008 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6009 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6010 " call Dret("NetrwTreeDisplay")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6011 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6012
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6013 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6014 " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6015 fun! s:NetrwTreeListing(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6016 if w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6017 " call Dfunc("NetrwTreeListing() bufname<".expand("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6018 " call Decho("curdir<".a:dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6019 " call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exit")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6020
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6021 " update the treetop
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6022 " call Decho("update the treetop")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6023 if !exists("w:netrw_treetop")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6024 let w:netrw_treetop= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6025 " call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6026 elseif (w:netrw_treetop =~ ('^'.a:dirname) && s:Strlen(a:dirname) < s:Strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6027 let w:netrw_treetop= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6028 " call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6029 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6030
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6031 " insure that we have at least an empty treedict
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6032 if !exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6033 let w:netrw_treedict= {}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6034 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6035
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6036 " update the directory listing for the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6037 " call Decho("updating dictionary with ".a:dirname.":[..directory listing..]")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6038 " call Decho("bannercnt=".w:netrw_bannercnt." line($)=".line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6039 exe "silent! keepjumps ".w:netrw_bannercnt.',$g@^\.\.\=/$@d'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6040 let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6041 " call Decho("w:treedict[".a:dirname."]= ".w:netrw_treedict[a:dirname])
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6042 exe "silent! keepjumps ".w:netrw_bannercnt.",$d"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6043
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6044 " if past banner, record word
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6045 if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6046 let fname= expand("<cword>")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6047 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6048 let fname= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6049 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6050 " call Decho("fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6051
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6052 " display from treetop on down
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6053 call s:NetrwTreeDisplay(w:netrw_treetop,"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6054
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6055 " call Dret("NetrwTreeListing : bufname<".expand("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6056 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6057 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6058
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6059 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6060 " s:NetrwWideListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6061 fun! s:NetrwWideListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6062
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6063 if w:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6064 " call Dfunc("NetrwWideListing() w:netrw_liststyle=".w:netrw_liststyle.' fo='.&fo.' l:fo='.&l:fo)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6065 " look for longest filename (cpf=characters per filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6066 " cpf: characters per filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6067 " fpl: filenames per line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6068 " fpc: filenames per column
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6069 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6070 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6071 let b:netrw_cpf= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6072 if line("$") >= w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6073 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6074 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6075 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6076 " call Dret("NetrwWideListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6077 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6078 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6079 let b:netrw_cpf= b:netrw_cpf + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6080 " call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6081
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6082 " determine qty files per line (fpl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6083 let w:netrw_fpl= winwidth(0)/b:netrw_cpf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6084 if w:netrw_fpl <= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6085 let w:netrw_fpl= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6086 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6087 " call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6088
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6089 " make wide display
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6090 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6091 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6092 let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6093 let newcolstart = w:netrw_bannercnt + fpc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6094 let newcolend = newcolstart + fpc - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6095 " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6096 silent! let keepregstar = @*
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6097 while line("$") >= newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6098 if newcolend > line("$") | let newcolend= line("$") | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6099 let newcolqty= newcolend - newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6100 exe newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6101 if newcolqty == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6102 exe "silent keepjumps norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6103 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6104 exe "silent keepjumps norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6105 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6106 exe "silent keepjumps ".newcolstart.','.newcolend.'d'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6107 exe 'silent keepjumps '.w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6108 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6109 silent! let @*= keepregstar
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6110 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6111 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6112 setlocal noma nomod ro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6113 " call Dret("NetrwWideListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6114 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6115
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6116 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6117
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6118 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6119 " s:PerformListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6120 fun! s:PerformListing(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6121 " call Dfunc("s:PerformListing(islocal=".a:islocal.") buf(%)=".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6122
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6123 call s:NetrwSafeOptions()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6124 setlocal noro ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6125 " call Decho("setlocal noro ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6126
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6127 " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6128 " call Decho("(netrw) Processing your browsing request...")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6129 " endif " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6130
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6131 " call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6132 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6133 " force a refresh for tree listings
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6134 " call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6135 keepjumps %d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6136 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6137
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6138 " save current directory on directory history list
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6139 call s:NetrwBookHistHandler(3,b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6140
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6141 " Set up the banner {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6142 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6143 " call Decho("set up banner")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6144 keepjumps put ='\" ============================================================================'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6145 keepjumps put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6146 keepjumps put ='\" '.b:netrw_curdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6147 keepjumps 1d
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6148 let w:netrw_bannercnt= 3
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6149 exe "keepjumps ".w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6150 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6151 keepjumps 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6152 let w:netrw_bannercnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6153 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6154
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6155 let sortby= g:netrw_sort_by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6156 if g:netrw_sort_direction =~ "^r"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6157 let sortby= sortby." reversed"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6158 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6159
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6160 " Sorted by... {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6161 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6162 " call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6163 if g:netrw_sort_by =~ "^n"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6164 " call Decho("directories will be sorted by name")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6165 " sorted by name
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6166 keepjumps put ='\" Sorted by '.sortby
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6167 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6168 let w:netrw_bannercnt= w:netrw_bannercnt + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6169 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6170 " call Decho("directories will be sorted by size or time")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6171 " sorted by size or date
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6172 keepjumps put ='\" Sorted by '.sortby
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6173 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6174 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6175 exe "keepjumps ".w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6176 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6177
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6178 " show copy/move target, if any
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6179 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6180 if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6181 " call Decho("show copy/move target<".s:netrwmftgt.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6182 keepjumps put =''
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6183 if s:netrwmftgt_islocal
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6184 call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6185 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6186 call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6187 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6188 let w:netrw_bannercnt= w:netrw_bannercnt + 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6189 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6190 " call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6191 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6192 exe "keepjumps ".w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6193 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6194
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6195 " Hiding... -or- Showing... {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6196 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6197 " call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6198 if g:netrw_list_hide != "" && g:netrw_hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6199 if g:netrw_hide == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6200 keepjumps put ='\" Hiding: '.g:netrw_list_hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6201 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6202 keepjumps put ='\" Showing: '.g:netrw_list_hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6203 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6204 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6205 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6206 exe "keepjumps ".w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6207 keepjumps put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6208 keepjumps put ='\" ============================================================================'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6209 let w:netrw_bannercnt= w:netrw_bannercnt + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6210 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6211
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6212 " bannercnt should index the line just after the banner
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6213 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6214 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6215 exe "keepjumps ".w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6216 " call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6217 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6218
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6219 " set up syntax highlighting {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6220 " call Decho("set up syntax highlighting")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6221 if has("syntax")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6222 setlocal ft=netrw
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6223 if !exists("g:syntax_on") || !g:syntax_on
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6224 setlocal ft=
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6225 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6226 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6227
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6228 " get list of files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6229 " call Decho("Get list of files - islocal=".a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6230 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6231 call s:LocalListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6232 else " remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6233 call s:NetrwRemoteListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6234 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6235 " call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6236
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6237 " manipulate the directory listing (hide, sort) {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6238 if !g:netrw_banner || line("$") >= w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6239 " call Decho("manipulate directory listing (hide)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6240 " call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6241 if g:netrw_hide && g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6242 call s:NetrwListHide()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6243 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6244 if !g:netrw_banner || line("$") >= w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6245 " call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6246
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6247 if g:netrw_sort_by =~ "^n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6248 " sort by name
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6249 call s:NetrwSetSort()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6250
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6251 if !g:netrw_banner || w:netrw_bannercnt < line("$")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6252 " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6253 if g:netrw_sort_direction =~ 'n'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6254 " normal direction sorting
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6255 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6256 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6257 " reverse direction sorting
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6258 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6259 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6260 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6261 " remove priority pattern prefix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6262 " call Decho("remove priority pattern prefix")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6263 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6264 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6265
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6266 elseif a:islocal
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6267 if !g:netrw_banner || w:netrw_bannercnt < line("$")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6268 " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6269 if g:netrw_sort_direction =~ 'n'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6270 " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6271 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6272 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6273 " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort!')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6274 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6275 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6276 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6277 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6278 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6279 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6280
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6281 elseif g:netrw_sort_direction =~ 'r'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6282 " call Decho('reverse the sorted listing')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6283 if !g:netrw_banner || w:netrw_bannercnt < line('$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6284 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6285 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6286 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6287 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6288 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6289
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6290 " convert to wide/tree listing {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6291 " call Decho("modify display if wide/tree listing style")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6292 call s:NetrwWideListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6293 call s:NetrwTreeListing(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6294
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6295 if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6296 " place cursor on the top-left corner of the file listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6297 " call Decho("place cursor on top-left corner of file listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6298 exe 'silent keepjumps '.w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6299 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6300 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6301
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6302 " record previous current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6303 let w:netrw_prvdir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6304 " call Decho("record netrw_prvdir<".w:netrw_prvdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6305
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6306 " save certain window-oriented variables into buffer-oriented variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6307 call s:SetBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6308 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6309
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6310 " set display to netrw display settings
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6311 " call Decho("set display to netrw display settings (noma nomod etc)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6312 setlocal noma nomod nonu nobl nowrap ro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6313 if exists("s:treecurpos")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6314
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6315 call netrw#NetrwRestorePosn(s:treecurpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6316 unlet s:treecurpos
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6317 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6318
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6319 " call Dret("s:PerformListing : curpos<".string(getpos(".")).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6320 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6321
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6322 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6323 " s:SetupNetrwStatusLine: {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6324 fun! s:SetupNetrwStatusLine(statline)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6325 " call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6326
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6327 if !exists("s:netrw_setup_statline")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6328 let s:netrw_setup_statline= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6329 " call Decho("do first-time status line setup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6330
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6331 if !exists("s:netrw_users_stl")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6332 let s:netrw_users_stl= &stl
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6333 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6334 if !exists("s:netrw_users_ls")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6335 let s:netrw_users_ls= &laststatus
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6336 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6337
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6338 " set up User9 highlighting as needed
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6339 let keepa= @a
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6340 redir @a
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6341 try
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6342 hi User9
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6343 catch /^Vim\%((\a\+)\)\=:E411/
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6344 if &bg == "dark"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6345 hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6346 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6347 hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6348 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6349 endtry
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6350 redir END
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6351 let @a= keepa
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6352 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6353
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6354 " set up status line (may use User9 highlighting)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6355 " insure that windows have a statusline
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6356 " make sure statusline is displayed
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6357 let &stl=a:statline
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6358 setlocal laststatus=2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6359 " call Decho("stl=".&stl)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6360 redraw
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6361
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6362 " call Dret("SetupNetrwStatusLine : stl=".&stl)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6363 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6364
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6365 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6366 " Remote Directory Browsing Support: {{{1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6367 " ===========================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6368
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6369 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6370 " s:NetrwRemoteListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6371 fun! s:NetrwRemoteListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6372 " call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6373
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6374 call s:RemotePathAnalysis(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6375
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6376 " sanity check:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6377 if exists("b:netrw_method") && b:netrw_method =~ '[235]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6378 " call Decho("b:netrw_method=".b:netrw_method)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6379 if !executable("ftp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6380 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6381 call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6382 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6383 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6384 " call Dret("s:NetrwRemoteListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6385 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6386 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6387
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6388 elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6389 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6390 if g:netrw_list_cmd == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6391 call netrw#ErrorMsg(s:ERROR,g:netrw_ssh_cmd." is not executable on your system",47)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6392 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6393 call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6394 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6395 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6396
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6397 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6398 " call Dret("s:NetrwRemoteListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6399 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6400 endif " (remote handling sanity check)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6401
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6402 if exists("b:netrw_method")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6403 " call Decho("setting w:netrw_method<".b:netrw_method.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6404 let w:netrw_method= b:netrw_method
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6405 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6406
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6407 if s:method == "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6408 " use ftp to get remote file listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6409 " call Decho("use ftp to get remote file listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6410 let s:method = "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6411 let listcmd = g:netrw_ftp_list_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6412 if g:netrw_sort_by =~ '^t'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6413 let listcmd= g:netrw_ftp_timelist_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6414 elseif g:netrw_sort_by =~ '^s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6415 let listcmd= g:netrw_ftp_sizelist_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6416 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6417 " call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6418 call s:NetrwRemoteFtpCmd(s:path,listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6419 " exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6420
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6421 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6422 " shorten the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6423 " call Decho("generate short listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6424 exe "keepjumps ".w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6425
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6426 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6427 if g:netrw_ftp_browse_reject != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6428 exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6429 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6430 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6431 silent! keepjumps %s/\r$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6432 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6433
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6434 " if there's no ../ listed, then put ./ and ../ in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6435 let line1= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6436 exe "keepjumps ".w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6437 let line2= search('^\.\.\/\%(\s\|$\)','cnW')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6438 if line2 == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6439 " call Decho("netrw is putting ./ and ../ into listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6440 keepjumps put='../'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6441 keepjumps put='./'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6442 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6443 exe "keepjumps ".line1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6444 keepjumps norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6445
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6446 " call Decho("line1=".line1." line2=".line2." line(.)=".line("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6447 if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6448 " call Decho("M$ ftp cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6449 exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6450 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6451 else " normal ftp cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6452 " call Decho("normal ftp cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6453 exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6454 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6455 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6456 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6457 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6458 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6459 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6460 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6461
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6462 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6463 " use ssh to get remote file listing {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6464 " call Decho("use ssh to get remote file listing: s:path<".s:path.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6465 let listcmd= s:MakeSshCmd(g:netrw_list_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6466 " call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6467 if g:netrw_scp_cmd =~ '^pscp'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6468 " call Decho("1: exe silent r! ".shellescape(listcmd.s:path, 1))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6469 exe "silent r! ".listcmd.shellescape(s:path, 1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6470 " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6471 g/^Listing directory/d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6472 g/^d[-rwx][-rwx][-rwx]/s+$+/+e
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6473 silent g/^l[-rwx][-rwx][-rwx]/s+$+@+e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6474 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6475 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6476 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6477 if g:netrw_liststyle != s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6478 g/^[dlsp-][-rwx][-rwx][-rwx]/s/^.*\s\(\S\+\)$/\1/e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6479 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6480 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6481 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6482 if s:path == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6483 " call Decho("2: exe silent r! ".listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6484 exe "silent r! ".listcmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6485 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6486 " call Decho("3: exe silent r! ".listcmd.' '.shellescape(s:path,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6487 exe "silent r! ".listcmd.' '.shellescape(s:path,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6488 " call Decho("listcmd<".listcmd."> path<".s:path.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6489 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6490 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6491
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6492 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6493 if g:netrw_ftp_browse_reject != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6494 " call Decho("(cleanup) exe silent! g/".g:netrw_ssh_browse_reject."/keepjumps d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6495 exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6496 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6497 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6498 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6499
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6500 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6501 " do a long listing; these substitutions need to be done prior to sorting {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6502 " call Decho("fix long listing:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6503
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6504 if s:method == "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6505 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6506 exe "keepjumps ".w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6507 while getline('.') =~ g:netrw_ftp_browse_reject
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6508 keepjumps d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6509 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6510 " if there's no ../ listed, then put ./ and ../ in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6511 let line1= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6512 keepjumps 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6513 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6514 let line2= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6515 if line2 == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6516 exe 'keepjumps '.w:netrw_bannercnt."put='./'"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6517 if b:netrw_curdir != '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6518 exe 'keepjumps '.w:netrw_bannercnt."put='../'"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6519 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6520 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6521 exe "keepjumps ".line1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6522 keepjumps norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6523 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6524
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6525 if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6526 " call Decho("M$ ftp site listing cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6527 exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6528 elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6529 " call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6530 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6531 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6532 exe 'silent keepjumps '.w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6533 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6534 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6535 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6536 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6537 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6538
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6539 " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6540 " exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6541 " endif " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6542 " call Dret("s:NetrwRemoteListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6543 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6544
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6545 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6546 " s:NetrwRemoteRm: remove/delete a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6547 fun! s:NetrwRemoteRm(usrhost,path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6548 " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6549 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6550 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6551
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6552 let all= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6553 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6554 " remove all marked files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6555 " call Decho("remove all marked files with bufnr#".bufnr("%"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6556 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6557 let ok= s:NetrwRemoteRmFile(a:path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6558 if ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6559 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6560 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6561 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6562 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6563 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6564 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6565
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6566 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6567 " remove files specified by range
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6568 " call Decho("remove files specified by range")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6569
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6570 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6571 let ctr= a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6572
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6573 " remove multiple files and directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6574 while ctr <= a:lastline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6575 exe ctr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6576 let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6577 if ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6578 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6579 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6580 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6581 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6582 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6583 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6584 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6585
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6586 " refresh the (remote) directory listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6587 " call Decho("refresh remote directory listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6588 call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6589 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6590
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6591 " call Dret("s:NetrwRemoteRm")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6592 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6593
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6594 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6595 " s:NetrwRemoteRmFile: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6596 fun! s:NetrwRemoteRmFile(path,rmfile,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6597 " call Dfunc("s:NetrwRemoteRmFile(path<".a:path."> rmfile<".a:rmfile.">) all=".a:all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6598
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6599 let all= a:all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6600 let ok = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6601
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6602 if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6603 " attempt to remove file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6604 " call Decho("attempt to remove file (all=".all.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6605 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6606 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6607 " call Decho("case all=0:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6608 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6609 let ok= input("Confirm deletion of file<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6610 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6611 echohl NONE
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6612 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6613 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6614 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6615 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6616 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6617 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6618 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6619 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6620
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6621 if all || ok =~ 'y\%[es]' || ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6622 " call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6623 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6624 " call Decho("case ftp:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6625 let path= a:path
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6626 if path =~ '^\a\+://'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6627 let path= substitute(path,'^\a\+://[^/]\+/','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6628 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6629 silent! keepjumps .,$d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6630 call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6631 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6632 " call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6633 let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6634 " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6635 if !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6636 call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6637 let ok="q"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6638 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6639 let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6640 " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6641 " call Decho("remotedir<".remotedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6642 " call Decho("rmfile<".a:rmfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6643 if remotedir != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6644 let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(remotedir.a:rmfile))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6645 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6646 let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(a:rmfile))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6647 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6648 " call Decho("call system(".netrw_rm_cmd.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6649 let ret= system(netrw_rm_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6650 if ret != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6651 call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6652 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6653 " call Decho("returned=".ret." errcode=".v:shell_error)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6654 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6655 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6656 elseif ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6657 " call Decho("ok==".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6658 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6659 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6660
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6661 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6662 " attempt to remove directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6663 " call Decho("attempt to remove directory")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6664 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6665 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6666 let ok= input("Confirm deletion of directory<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6667 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6668 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6669 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6670 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6671 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6672 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6673 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6674 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6675 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6676
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6677 if all || ok =~ 'y\%[es]' || ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6678 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6679 call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6680 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6681 let rmfile = substitute(a:path.a:rmfile,'/$','','')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6682 let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6683 " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6684 let ret= system(netrw_rmdir_cmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6685 " call Decho("returned=".ret." errcode=".v:shell_error)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6686
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6687 if v:shell_error != 0
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6688 " call Decho("v:shell_error not 0")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6689 let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.shellescape(netrw#WinPath(substitute(rmfile,'[\/]$','','e')))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6690 " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6691 let ret= system(netrw_rmf_cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6692 " call Decho("returned=".ret." errcode=".v:shell_error)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6693
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6694 if v:shell_error != 0 && !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6695 call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6696 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6697 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6698 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6699
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6700 elseif ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6701 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6702 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6703 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6704
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6705 " call Dret("s:NetrwRemoteRmFile ".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6706 return ok
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6707 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6708
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6709 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6710 " s:NetrwRemoteFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6711 " This function assumes that a long listing will be received. Size, time,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6712 " and reverse sorts will be requested of the server but not otherwise
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6713 " enforced here.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6714 fun! s:NetrwRemoteFtpCmd(path,listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6715 " call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) netrw_method=".w:netrw_method)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6716 " call Decho("line($)=".line("$")." bannercnt=".w:netrw_bannercnt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6717
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6718 " because WinXX ftp uses unix style input
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6719 let ffkeep= &ff
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6720 setlocal ma ff=unix noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6721 " call Decho("setlocal ma ff=unix noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6722
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6723 " clear off any older non-banner lines
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6724 " note that w:netrw_bannercnt indexes the line after the banner
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6725 " call Decho('exe silent! keepjumps '.w:netrw_bannercnt.",$d (clear off old non-banner lines)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6726 exe "silent! keepjumps ".w:netrw_bannercnt.",$d"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6727
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6728 ".........................................
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6729 if w:netrw_method == 2 || w:netrw_method == 5
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6730 " ftp + <.netrc>: Method #2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6731 if a:path != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6732 put ='cd \"'.a:path.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6733 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6734 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6735 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6736 " call Decho("filter input: ".getline('.'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6737 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6738 call setline(line("$")+1,a:listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6739 " exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6740 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6741 " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6742 exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6743 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6744 " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6745 exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6746 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6747
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6748 ".........................................
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6749 elseif w:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6750 " ftp + machine,id,passwd,filename: Method #3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6751 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6752 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6753 put ='open '.g:netrw_machine.' '.g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6754 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6755 put ='open '.g:netrw_machine
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6756 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6757
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6758 if exists("g:netrw_ftp") && g:netrw_ftp == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6759 put =g:netrw_uid
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6760 put ='\"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6761 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6762 put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6763 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6764
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6765 if a:path != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6766 put ='cd \"'.a:path.'\"'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6767 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6768 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6769 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6770 " call Decho("filter input: ".getline('.'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6771 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6772 call setline(line("$")+1,a:listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6773
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6774 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6775 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6776 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6777 " -n win32: quit being obnoxious about password
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6778 " exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6779 " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6780 exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6781
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6782 ".........................................
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6783 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6784 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",23)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6785 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6786
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6787 " cleanup for Windows
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6788 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6789 silent! keepjumps %s/\r$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6790 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6791 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6792 if a:listcmd == "dir"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6793 " infer directory/link based on the file permission string
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6794 silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6795 silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6796 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6797 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6798 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6799 exe "silent! keepjumps ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6800 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6801 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6802 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6803
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6804 " ftp's listing doesn't seem to include ./ or ../
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6805 if !search('^\.\/$\|\s\.\/$','wn')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6806 exe 'keepjumps '.w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6807 put ='./'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6808 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6809 if !search('^\.\.\/$\|\s\.\.\/$','wn')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6810 exe 'keepjumps '.w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6811 put ='../'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6812 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6813
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6814 " restore settings
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6815 let &ff= ffkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6816 " call Dret("NetrwRemoteFtpCmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6817 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6818
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6819 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6820 " s:NetrwRemoteRename: rename a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6821 fun! s:NetrwRemoteRename(usrhost,path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6822 " call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6823
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6824 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6825 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6826 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6827 let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6828
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6829 " rename files given by the markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6830 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6831 for oldname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6832 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6833 if exists("subfrom")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6834 let newname= substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6835 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6836 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6837 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6838 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6839 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6840 if newname =~ '^s/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6841 let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6842 let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6843 let newname = substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6844 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6845 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6846 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6847
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6848 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6849 call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6850 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6851 let oldname= shellescape(a:path.oldname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6852 let newname= shellescape(a:path.newname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6853 " call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6854 let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6855 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6856
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6857 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6858 call s:NetrwUnMarkFile(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6859
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6860 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6861
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6862 " attempt to rename files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6863 while ctr <= a:lastline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6864 exe "keepjumps ".ctr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6865
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6866 let oldname= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6867 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6868
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6869 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6870 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6871 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6872
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6873 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6874 call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6875 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6876 let oldname= shellescape(a:path.oldname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6877 let newname= shellescape(a:path.newname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6878 " call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6879 let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6880 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6881
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6882 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6883 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6884 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6885
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6886 " refresh the directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6887 call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6888 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6889
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6890 " call Dret("NetrwRemoteRename")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6891 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6892
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6893 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6894 " Local Directory Browsing Support: {{{1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6895 " ==========================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6896
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6897 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6898 " netrw#LocalBrowseCheck: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6899 fun! netrw#LocalBrowseCheck(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6900 " unfortunate interaction -- split window debugging can't be
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6901 " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6902 " event triggers another call to LocalBrowseCheck() when attempts
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6903 " to write to the DBG buffer are made.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6904 " The &ft == "netrw" test was installed because the BufEnter event
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6905 " would hit when re-entering netrw windows, creating unexpected
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6906 " refreshes (and would do so in the middle of NetrwSaveOptions(), too)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6907 " call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : "")))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6908 if isdirectory(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6909 " call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6910 if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6911 silent! call s:NetrwBrowse(1,a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6912 elseif &ft == "netrw" && line("$") == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6913 silent! call s:NetrwBrowse(1,a:dirname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6914 elseif exists("s:treeforceredraw")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6915 unlet s:treeforceredraw
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6916 silent! call s:NetrwBrowse(1,a:dirname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6917 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6918 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6919 " not a directory, ignore it
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6920 endfun
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
6921
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
6922 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6923 " s:LocalListing: does the job of "ls" for local directories {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6924 fun! s:LocalListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6925 " call Dfunc("s:LocalListing()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6926 " call Decho("&ma=".&ma)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6927 " call Decho("&mod=".&mod)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6928 " call Decho("&ro=".&ro)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6929 " call Decho("bufname(%)<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6930
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6931 " if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6932 " if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6933
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6934 " get the list of files contained in the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6935 let dirname = escape(b:netrw_curdir,g:netrw_glob_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6936 let dirnamelen = s:Strlen(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6937 let filelist = glob(s:ComposePath(dirname,"*"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6938 " call Decho("glob(dirname<".dirname."/*>)=".filelist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6939 if filelist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6940 let filelist= filelist."\n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6941 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6942 let filelist= filelist.glob(s:ComposePath(dirname,".*"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6943 " call Decho("glob(dirname<".dirname."/.*>)=".filelist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6944
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6945 " Coding choice: either elide ./ if present
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6946 " or include ./ if not present
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6947 if filelist =~ '[\\/]\.[\\/]\=\(\n\|$\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6948 " elide /path/. from glob() entries if present
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6949 " call Decho("elide /path/. from glob entries if present")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6950 let filelist = substitute(filelist,'\n','\t','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6951 let filelist = substitute(filelist,'^[^\t]\+[/\\]\.\t','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6952 let filelist = substitute(filelist,'[^\t]\+[/\\]\.$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6953 let filelist = substitute(filelist,'\t\zs[^\t]\+[/\\]\.\t','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6954 let filelist = substitute(filelist,'\t','\n','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6955 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6956 " call Decho("filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6957 if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6958 " include ../ in the glob() entry if its missing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6959 " call Decho("forcibly tacking on ..")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6960 let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"../")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6961 " call Decho("filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6962 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6963 if b:netrw_curdir == '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6964 " remove .. from filelist when current directory is root directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6965 " call Decho("remove .. from filelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6966 let filelist= substitute(filelist,'/\.\.\n','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6967 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6968 " remove multiple contiguous newlines
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6969 let filelist= substitute(filelist,'\n\{2,}','\n','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6970 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6971 " change all \s to /s
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6972 " call Decho('change all \s to /s')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6973 let filelist= substitute(filelist,'\','/','g')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
6974 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6975 " escape all \s to \\
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6976 " call Decho('escape all \s to \\')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6977 let filelist= substitute(filelist,'\','\\','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6978 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6979
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6980 " call Decho("(before while) dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6981 " call Decho("(before while) dirnamelen<".dirnamelen.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6982 " call Decho("(before while) filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6983
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6984 while filelist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6985 if filelist =~ '\n'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6986 let filename = substitute(filelist,'\n.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6987 let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6988 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6989 let filename = filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6990 let filelist = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6991 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6992 " call Decho(" ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6993 " call Decho("(while) filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6994 " call Decho("(while) filename<".filename.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6995
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6996 if getftype(filename) == "link"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6997 " indicate a symbolic link
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6998 " call Decho("indicate <".filename."> is a symbolic link with trailing @")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6999 let pfile= filename."@"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7000
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7001 elseif getftype(filename) == "socket"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7002 " indicate a socket
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7003 " call Decho("indicate <".filename."> is a socket with trailing =")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7004 let pfile= filename."="
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7005
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7006 elseif getftype(filename) == "fifo"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7007 " indicate a fifo
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7008 " call Decho("indicate <".filename."> is a fifo with trailing |")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7009 let pfile= filename."|"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7010
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7011 elseif isdirectory(filename)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7012 " indicate a directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7013 " call Decho("indicate <".filename."> is a directory with trailing /")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7014 let pfile= filename."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7015
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7016 elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7017 if (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7018 if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7019 " indicate an executable
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7020 " call Decho("indicate <".filename."> is executable with trailing *")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7021 let pfile= filename."*"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7022 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7023 " normal file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7024 let pfile= filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7025 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7026 elseif executable(filename)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7027 " indicate an executable
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7028 " call Decho("indicate <".filename."> is executable with trailing *")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7029 let pfile= filename."*"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7030 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7031 " normal file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7032 let pfile= filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7033 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7034
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7035 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7036 " normal file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7037 let pfile= filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7038 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7039 " call Decho("pfile<".pfile."> (after *@/ appending)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7040
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7041 if pfile =~ '//$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7042 let pfile= substitute(pfile,'//$','/','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7043 " call Decho("change // to /: pfile<".pfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7044 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7045 let pfile= strpart(pfile,dirnamelen)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7046 let pfile= substitute(pfile,'^[/\\]','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7047 " call Decho("filename<".filename.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7048 " call Decho("pfile <".pfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7049
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7050 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7051 let sz = getfsize(filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7052 let fsz = strpart(" ",1,15-strlen(sz)).sz
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7053 let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7054 " call Decho("sz=".sz." fsz=".fsz)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7055 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7056
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7057 if g:netrw_sort_by =~ "^t"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7058 " sort by time (handles time up to 1 quintillion seconds, US)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7059 " call Decho("getftime(".filename.")=".getftime(filename))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7060 let t = getftime(filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7061 let ft = strpart("000000000000000000",1,18-strlen(t)).t
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7062 " call Decho("exe keepjumps put ='".ft.'/'.filename."'")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7063 let ftpfile= ft.'/'.pfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7064 keepjumps silent! put=ftpfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7065
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7066 elseif g:netrw_sort_by =~ "^s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7067 " sort by size (handles file sizes up to 1 quintillion bytes, US)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7068 " call Decho("getfsize(".filename.")=".getfsize(filename))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7069 let sz = getfsize(filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7070 let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7071 " call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7072 let fszpfile= fsz.'/'.pfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7073 keepjumps silent! put =fszpfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7074
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7075 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7076 " sort by name
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7077 " call Decho("exe keepjumps put ='".pfile."'")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7078 keepjumps silent! put=pfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7079 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7080 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7081
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7082 " cleanup any windows mess at end-of-line
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7083 silent! keepjumps g/^$/d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7084 silent! keepjumps %s/\r$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7085 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7086 exe "setlocal ts=".g:netrw_maxfilenamelen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7087 " call Decho("setlocal ts=".g:netrw_maxfilenamelen)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7088
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7089 " call Dret("s:LocalListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7090 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7091
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7092 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7093 " s:LocalBrowseShellCmdRefresh: this function is called after a user has {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7094 " performed any shell command. The idea is to cause all local-browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7095 " buffers to be refreshed after a user has executed some shell command,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7096 " on the chance that s/he removed/created a file/directory with it.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7097 fun! s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7098 " call Dfunc("LocalBrowseShellCmdRefresh() browselist=".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "empty")." ".tabpagenr("$")." tabs")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7099 " determine which buffers currently reside in a tab
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7100 if !exists("s:netrw_browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7101 " call Dret("LocalBrowseShellCmdRefresh : browselist is empty")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7102 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7103 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7104 if !exists("w:netrw_bannercnt")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7105 " call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw window")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7106 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7107 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7108 if exists("s:locbrowseshellcmd")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7109 if s:locbrowseshellcmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7110 let s:locbrowseshellcmd= 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7111 " call Dret("LocalBrowseShellCmdRefresh : NetrwBrowse itself caused the refresh")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7112 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7113 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7114 let s:locbrowseshellcmd= 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7115 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7116 let itab = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7117 let buftablist = []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7118 while itab <= tabpagenr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7119 let buftablist = buftablist + tabpagebuflist()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7120 let itab = itab + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7121 tabn
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7122 endwhile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7123 " call Decho("buftablist".string(buftablist))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7124 " call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7125 " GO through all buffers on netrw_browselist (ie. just local-netrw buffers):
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7126 " | refresh any netrw window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7127 " | wipe out any non-displaying netrw buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7128 let curwin = winnr()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7129 let ibl = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7130 for ibuf in s:netrw_browselist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7131 " call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7132 if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7133 " wipe out any non-displaying netrw buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7134 " call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7135 exe "silent! bd ".fnameescape(ibuf)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7136 call remove(s:netrw_browselist,ibl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7137 " call Decho("browselist=".string(s:netrw_browselist))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7138 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7139 elseif index(tabpagebuflist(),ibuf) != -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7140 " refresh any netrw buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7141 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7142 exe bufwinnr(ibuf)."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7143 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7144 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7145 let ibl= ibl + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7146 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7147 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7148
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7149 " call Dret("LocalBrowseShellCmdRefresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7150 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7151
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7152 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7153 " s:NetrwLocalRm: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7154 fun! s:NetrwLocalRm(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7155 " call Dfunc("s:NetrwLocalRm(path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7156 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7157
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7158 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7159 let ret = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7160 let all = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7161 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7162
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7163 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7164 " remove all marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7165 " call Decho("remove all marked files")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7166 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7167 let ok= s:NetrwLocalRmFile(a:path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7168 if ok =~ 'q\%[uit]' || ok == "no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7169 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7170 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7171 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7172 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7173 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7174 call s:NetrwUnMarkFile(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7175
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7176 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7177 " remove (multiple) files and directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7178 " call Decho("remove files in range [".a:firstline.",".a:lastline."]")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7179
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7180 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7181 while ctr <= a:lastline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7182 exe "keepjumps ".ctr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7183
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7184 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7185 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7186 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7187 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7188 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7189 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7190 if curword == "./" || curword == "../"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7191 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7192 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7193 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7194 let ok= s:NetrwLocalRmFile(a:path,curword,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7195 if ok =~ 'q\%[uit]' || ok == "no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7196 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7197 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7198 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7199 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7200 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7201 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7202 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7203
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7204 " refresh the directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7205 " call Decho("bufname<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7206 if bufname("%") != "NetrwMessage"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7207 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7208 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7209 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7210
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7211 " call Dret("s:NetrwLocalRm")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7212 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7213
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7214 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7215 " s:NetrwLocalRmFile: remove file fname given the path {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7216 " Give confirmation prompt unless all==1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7217 fun! s:NetrwLocalRmFile(path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7218 " call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7219
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7220 let all= a:all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7221 let ok = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7222 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7223 let rmfile= s:ComposePath(a:path,a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7224 " call Decho("rmfile<".rmfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7225
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7226 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7227 " attempt to remove file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7228 " call Decho("attempt to remove file<".rmfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7229 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7230 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7231 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7232 let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7233 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7234 echohl NONE
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7235 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7236 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7237 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7238 " call Decho("response: ok<".ok.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7239 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7240 " call Decho("response: ok<".ok."> (after sub)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7241 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7242 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7243 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7244 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7245
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7246 if all || ok =~ 'y\%[es]' || ok == ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7247 let ret= s:NetrwDelete(rmfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7248 " call Decho("errcode=".v:shell_error." ret=".ret)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7249 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7251 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7252 " attempt to remove directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7253 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7254 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7255 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7256 let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7257 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7258 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7259 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7260 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7261 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7262 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7263 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7264 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7265 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7266 let rmfile= substitute(rmfile,'[\/]$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7267
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7268 if all || ok =~ 'y\%[es]' || ok == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7269 " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7270 call system(netrw#WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7271 " call Decho("v:shell_error=".v:shell_error)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7272
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7273 if v:shell_error != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7274 " call Decho("2nd attempt to remove directory<".rmfile.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7275 let errcode= s:NetrwDelete(rmfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7276 " call Decho("errcode=".errcode)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7277
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7278 if errcode != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7279 if has("unix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7280 " call Decho("3rd attempt to remove directory<".rmfile.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7281 call system("rm ".shellescape(rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7282 if v:shell_error != 0 && !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7283 call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7284 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7285 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7286 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7287 call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7288 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7289 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7290 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7291 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7292 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7293 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7294
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7295 " call Dret("s:NetrwLocalRmFile ".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7296 return ok
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7297 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7298
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7299 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7300 " s:NetrwLocalRename: rename a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7301 fun! s:NetrwLocalRename(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7302 " call Dfunc("NetrwLocalRename(path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7303
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7304 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7305 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7306 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7307
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7308 " rename files given by the markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7309 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7310 for oldname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7311 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7312 if exists("subfrom")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7313 let newname= substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7314 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7315 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7316 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7317 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7318 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7319 if newname =~ '^s/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7320 let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7321 let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7322 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7323 let newname = substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7324 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7325 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7326 call rename(oldname,newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7327 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7328 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7329
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7330 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7331
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7332 " attempt to rename files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7333 while ctr <= a:lastline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7334 exe "keepjumps ".ctr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7335
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7336 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7337 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7338 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7339 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7340 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7341 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7342 if curword == "./" || curword == "../"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7343 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7344 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7345 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7346
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7347 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7348 let oldname= s:ComposePath(a:path,curword)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7349 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7350
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7351 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7352 let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7353 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7354
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7355 call rename(oldname,newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7356 " call Decho("renaming <".oldname."> to <".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7357
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7358 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7359 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7360 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7361
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7362 " refresh the directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7363 " call Decho("refresh the directory listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7364 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7365 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7366
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7367 " call Dret("NetrwLocalRename")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7368 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7369
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7370 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7371 " s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7372 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7373 " g:netrw_ Directory Is
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7374 " fastbrowse Local Remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7375 " slow 0 D D D=Deleting a buffer implies it will not be re-used (slow)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7376 " med 1 D H H=Hiding a buffer implies it may be re-used (fast)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7377 " fast 2 H H
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7378 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7379 " Deleting a buffer means that it will be re-loaded when examined, hence "slow".
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7380 " Hiding a buffer means that it will be re-used when examined, hence "fast".
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7381 " (re-using a buffer may not be as accurate)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7382 fun! s:LocalFastBrowser()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7383 " call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7384
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7385 " initialize browselist, a list of buffer numbers that the local browser has used
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7386 if !exists("s:netrw_browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7387 " call Decho("initialize s:netrw_browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7388 let s:netrw_browselist= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7389 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7390
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7391 " append current buffer to fastbrowse list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7392 if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1]
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7393 " call Decho("appendng current buffer to browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7394 call add(s:netrw_browselist,bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7395 " call Decho("browselist=".string(s:netrw_browselist))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7396 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7397
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7398 " enable autocmd events to handle refreshing/removing local browser buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7399 " If local browse buffer is currently showing: refresh it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7400 " If local browse buffer is currently hidden : wipe it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7401 if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7402 " call Decho("setting up local-browser shell command refresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7403 let s:netrw_browser_shellcmd= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7404 augroup AuNetrwShellCmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7405 au!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7406 if (has("win32") || has("win95") || has("win64") || has("win16"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7407 " call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7408 au ShellCmdPost * call s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7409 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7410 au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7411 " call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7412 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7413 augroup END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7414 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7415
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7416 " user must have changed fastbrowse to its fast setting, so remove
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7417 " the associated autocmd events
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7418 if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7419 " call Decho("remove AuNetrwShellCmd autcmd group")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7420 unlet s:netrw_browser_shellcmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7421 augroup AuNetrwShellCmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7422 au!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7423 augroup END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7424 augroup! AuNetrwShellCmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7425 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7426
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7427 " call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7428 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7429
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7430 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7431 " Support Functions: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7432
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7433 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7434 " netrw#ErrorMsg: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7435 " 0=note = s:NOTE
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7436 " 1=warning = s:WARNING
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7437 " 2=error = s:ERROR
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7438 " Dec 03, 2009 : max errnum currently is 76
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7439 fun! netrw#ErrorMsg(level,msg,errnum)
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7440 " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7441
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7442 if a:level == 1
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7443 let level= "**warning** (netrw) "
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7444 elseif a:level == 2
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7445 let level= "**error** (netrw) "
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7446 else
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7447 let level= "**note** (netrw) "
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7448 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7449 " call Decho("level=".level)
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7450
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7451 if g:netrw_use_errorwindow
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7452 " (default) netrw creates a one-line window to show error/warning
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7453 " messages (reliably displayed)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7454
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7455 " record current window number for NetrwRestorePosn()'s benefit
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7456 let s:winBeforeErr= winnr()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7457 " call Decho("s:winBeforeErr=".s:winBeforeErr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7458
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7459 " getting messages out reliably is just plain difficult!
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7460 " This attempt splits the current window, creating a one line window.
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7461 if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7462 " call Decho("write to NetrwMessage buffer")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7463 exe bufwinnr("NetrwMessage")."wincmd w"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7464 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7465 setlocal ma noro
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7466 call setline(line("$")+1,level.a:msg)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7467 $
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7468 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7469 " call Decho("create a NetrwMessage buffer window")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7470 bo 1split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7471 call s:NetrwEnew()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7472 call s:NetrwSafeOptions()
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7473 setlocal bt=nofile
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7474 file NetrwMessage
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7475 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7476 setlocal ma noro
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7477 call setline(line("$"),level.a:msg)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7478 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7479 " call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr())
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7480 if &fo !~ '[ta]'
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7481 syn clear
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7482 syn match netrwMesgNote "^\*\*note\*\*"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7483 syn match netrwMesgWarning "^\*\*warning\*\*"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7484 syn match netrwMesgError "^\*\*error\*\*"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7485 hi link netrwMesgWarning WarningMsg
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7486 hi link netrwMesgError Error
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7487 endif
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7488 setlocal noma ro bh=wipe
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7489
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7490 else
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7491 " (optional) netrw will show messages using echomsg. Even if the
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7492 " message doesn't appear, at least it'll be recallable via :messages
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7493 " redraw!
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7494 if a:level == s:WARNING
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7495 echohl WarningMsg
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7496 elseif a:level == s:ERROR
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7497 echohl Error
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7498 endif
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7499 echomsg level.a:msg
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7500 " call Decho("echomsg ***netrw*** ".a:msg)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7501 echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7502 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7503
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7504 " call Dret("netrw#ErrorMsg")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7505 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7506
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7507 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7508 " netrw#NetrwRestorePosn: restores the cursor and file position as saved by NetrwSavePosn() {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7509 fun! netrw#NetrwRestorePosn(...)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7510 " call Dfunc("netrw#NetrwRestorePosn() a:0=".a:0." winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7511 let eikeep= &ei
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7512 set ei=all
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7513 if expand("%") == "NetrwMessage"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7514 exe s:winBeforeErr."wincmd w"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7515 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7516
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7517 if a:0 > 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7518 exe a:1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7519 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7520
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7521 " restore window
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7522 if exists("w:netrw_winnr")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7523 " call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7524 exe "silent! ".w:netrw_winnr."wincmd w"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7525 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7526 if v:shell_error == 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7527 " as suggested by Bram M: redraw on no error
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7528 " allows protocol error messages to remain visible
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7529 " redraw!
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7530 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7531
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7532 " restore top-of-screen line
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7533 if exists("w:netrw_hline")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7534 " call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7535 exe "norm! ".w:netrw_hline."G0z\<CR>"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7536 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7537
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7538 " restore position
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7539 if exists("w:netrw_line") && exists("w:netrw_col")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7540 " call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7541 exe "norm! ".w:netrw_line."G0".w:netrw_col."\<bar>"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7542 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7543
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7544 let &ei= eikeep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7545 " call Dret("netrw#NetrwRestorePosn")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7546 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7547
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7548 " ---------------------------------------------------------------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7549 " netrw#NetrwSavePosn: saves position of cursor on screen {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7550 fun! netrw#NetrwSavePosn()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7551 " call Dfunc("netrw#NetrwSavePosn()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7552 " Save current line and column
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7553 let w:netrw_winnr= winnr()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7554 let w:netrw_line = line(".")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7555 let w:netrw_col = virtcol(".")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7556 " call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7557
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7558 " Save top-of-screen line
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7559 norm! H0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7560 let w:netrw_hline= line(".")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7561
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7562 " set up string holding position parameters
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7563 let ret = "let w:netrw_winnr=".w:netrw_winnr."|let w:netrw_line=".w:netrw_line."|let w:netrw_col=".w:netrw_col."|let w:netrw_hline=".w:netrw_hline
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7564
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7565 call netrw#NetrwRestorePosn()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7566 " call Dret("netrw#NetrwSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7567 return ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7568 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7569
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7570 " ------------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7571 " netrw#RFC2396: converts %xx into characters {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7572 fun! netrw#RFC2396(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7573 " call Dfunc("netrw#RFC2396(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7574 let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," \t")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7575 " call Dret("netrw#RFC2396 ".fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7576 return fname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7577 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7578
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7579 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7580 " s:ComposePath: Appends a new part to a path taking different systems into consideration {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7581 fun! s:ComposePath(base,subdir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7582 " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7583
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7584 if(has("amiga"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7585 " call Decho("amiga")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7586 let ec = a:base[s:Strlen(a:base)-1]
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7587 if ec != '/' && ec != ':'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7588 let ret = a:base . "/" . a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7589 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7590 let ret = a:base . a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7591 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7592
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7593 elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7594 " call Decho("windows")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7595 let ret= a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7596
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7597 elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7598 " call Decho("windows")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7599 if a:base =~ '[/\\]$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7600 let ret= a:base.a:subdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7601 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7602 let ret= a:base."/".a:subdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7603 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7604
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7605 elseif a:base =~ '^\a\+://'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7606 " call Decho("remote linux/macos")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7607 let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7608 let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7609 if a:subdir == '../'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7610 if curpath =~ '[^/]/[^/]\+/$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7611 let curpath= substitute(curpath,'[^/]\+/$','','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7612 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7613 let curpath=""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7614 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7615 let ret= urlbase.curpath
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7616 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7617 let ret= urlbase.curpath.a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7618 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7619 " call Decho("urlbase<".urlbase.">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7620 " call Decho("curpath<".curpath.">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7621 " call Decho("ret<".ret.">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7622
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7623 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7624 " call Decho("local linux/macos")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7625 let ret = substitute(a:base."/".a:subdir,"//","/","g")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7626 if a:base =~ '^//'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7627 " keeping initial '//' for the benefit of network share listing support
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7628 let ret= '/'.ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7629 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7630 let ret= simplify(ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7631 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7632
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7633 " call Dret("s:ComposePath ".ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7634 return ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7635 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7636
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7637 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7638 " s:FileReadable: o/s independent filereadable {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7639 fun! s:FileReadable(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7640 " call Dfunc("s:FileReadable(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7641
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7642 if g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7643 let ret= filereadable(substitute(a:fname,'/cygdrive/\(.\)','\1:/',''))
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7644 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7645 let ret= filereadable(a:fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7646 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7647
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7648 " call Dret("s:FileReadable ".ret)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7649 return ret
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7650 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7651
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7652 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7653 " s:GetTempfile: gets a tempname that'll work for various o/s's {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7654 " Places correct suffix on end of temporary filename,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7655 " using the suffix provided with fname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7656 fun! s:GetTempfile(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7657 " call Dfunc("s:GetTempfile(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7658
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7659 if !exists("b:netrw_tmpfile")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7660 " get a brand new temporary filename
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7661 let tmpfile= tempname()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7662 " call Decho("tmpfile<".tmpfile."> : from tempname()")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7663
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7664 let tmpfile= substitute(tmpfile,'\','/','ge')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7665 " call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7666
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7667 " sanity check -- does the temporary file's directory exist?
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7668 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7669 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7670 call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7671 " call Dret("s:GetTempfile getcwd<".getcwd().">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7672 return ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7673 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7674
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7675 " let netrw#NetSource() know about the tmpfile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7676 let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#NetrwBrowseX()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7677 " call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7678
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7679 " o/s dependencies
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7680 if g:netrw_cygwin != 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7681 let tmpfile = substitute(tmpfile,'^\(\a\):','/cygdrive/\1','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7682 elseif has("win32") || has("win95") || has("win64") || has("win16")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7683 if !exists("+shellslash") || !&ssl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7684 let tmpfile = substitute(tmpfile,'/','\','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7685 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7686 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7687 let tmpfile = tmpfile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7688 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7689 let b:netrw_tmpfile= tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7690 " call Decho("o/s dependent fixed tempname<".tmpfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7691 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7692 " re-use temporary filename
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7693 let tmpfile= b:netrw_tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7694 " call Decho("tmpfile<".tmpfile."> re-using")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7695 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7696
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7697 " use fname's suffix for the temporary file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7698 if a:fname != ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7699 if a:fname =~ '\.[^./]\+$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7700 " call Decho("using fname<".a:fname.">'s suffix")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7701 if a:fname =~ '.tar.gz' || a:fname =~ '.tar.bz2'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7702 let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7703 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7704 let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7705 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7706 " call Decho("suffix<".suffix.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7707 let tmpfile= substitute(tmpfile,'\.tmp$','','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7708 " call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7709 let tmpfile .= suffix
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7710 " call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7711 let s:netrw_tmpfile= tmpfile " supports netrw#NetSource()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7712 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7713 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7714
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7715 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7716 " call Dret("s:GetTempfile <".tmpfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7717 return tmpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7718 endfun
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7719
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7720 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7721 " s:MakeSshCmd: transforms input command using USEPORT HOSTNAME into {{{2
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7722 " a correct command for use with a system() call
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7723 fun! s:MakeSshCmd(sshcmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7724 " call Dfunc("s:MakeSshCmd(sshcmd<".a:sshcmd.">) user<".s:user."> machine<".s:machine.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7725 let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:user.s:machine,'')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7726 if exists("g:netrw_port") && g:netrw_port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7727 let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.g:netrw_port,'')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7728 elseif exists("s:port") && s:port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7729 let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.s:port,'')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7730 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7731 let sshcmd= substitute(sshcmd,"USEPORT ",'','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7732 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7733 " call Dret("s:MakeSshCmd <".sshcmd.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7734 return sshcmd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7735 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7736
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7737 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7738 " s:NetrwBMShow: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7739 fun! s:NetrwBMShow()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7740 " call Dfunc("s:NetrwBMShow()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7741 redir => bmshowraw
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7742 menu
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7743 redir END
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7744 let bmshowlist = split(bmshowraw,'\n')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7745 if bmshowlist != []
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7746 let bmshowfuncs= filter(bmshowlist,'v:val =~ "<SNR>\\d\\+_BMShow()"')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7747 if bmshowfuncs != []
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7748 let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7749 if bmshowfunc =~ '^call.*BMShow()'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7750 exe "silent! ".bmshowfunc
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7751 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7752 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7753 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7754 " call Dret("s:NetrwBMShow : bmshowfunc<".(exists("bmshowfunc")? bmshowfunc : 'n/a').">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7755 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7756
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7757 " ---------------------------------------------------------------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7758 " s:NetrwDelete: Deletes a file. {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7759 " Uses Steve Hall's idea to insure that Windows paths stay
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7760 " acceptable. No effect on Unix paths.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7761 " Examples of use: let result= s:NetrwDelete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7762 fun! s:NetrwDelete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7763 " call Dfunc("s:NetrwDelete(path<".a:path.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7764
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7765 let path = netrw#WinPath(a:path)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7766 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7767 if exists("+shellslash")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7768 let sskeep= &shellslash
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7769 setlocal noshellslash
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7770 let result = delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7771 let &shellslash = sskeep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7772 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7773 " call Decho("exe let result= ".a:cmd."('".path."')")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7774 let result= delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7775 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7776 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7777 " call Decho("let result= delete(".path.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7778 let result= delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7779 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7780 if result < 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7781 call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7782 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7783
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7784 " call Dret("s:NetrwDelete ".result)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7785 return result
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7786 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7787
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7788 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7789 " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7790 fun! s:NetrwEnew(...)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7791 " call Dfunc("s:NetrwEnew() a:0=".a:0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7792 " call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7793
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7794 " grab a function-local-variable copy of buffer variables
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7795 if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7796 if exists("b:netrw_browser_active") |let netrw_browser_active = b:netrw_browser_active |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7797 if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7798 if exists("b:netrw_curdir") |let netrw_curdir = b:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7799 if exists("b:netrw_explore_bufnr") |let netrw_explore_bufnr = b:netrw_explore_bufnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7800 if exists("b:netrw_explore_indx") |let netrw_explore_indx = b:netrw_explore_indx |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7801 if exists("b:netrw_explore_line") |let netrw_explore_line = b:netrw_explore_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7802 if exists("b:netrw_explore_list") |let netrw_explore_list = b:netrw_explore_list |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7803 if exists("b:netrw_explore_listlen")|let netrw_explore_listlen = b:netrw_explore_listlen|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7804 if exists("b:netrw_explore_mtchcnt")|let netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7805 if exists("b:netrw_fname") |let netrw_fname = b:netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7806 if exists("b:netrw_lastfile") |let netrw_lastfile = b:netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7807 if exists("b:netrw_liststyle") |let netrw_liststyle = b:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7808 if exists("b:netrw_method") |let netrw_method = b:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7809 if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7810 if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7811
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7812 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7813 " call Decho("generate a buffer with keepjumps keepalt enew!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7814 keepjumps keepalt enew!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7815 call s:NetrwOptionSave("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7816
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7817 " copy function-local-variables to buffer variable equivalents
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7818 if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7819 if exists("netrw_browser_active") |let b:netrw_browser_active = netrw_browser_active |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7820 if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7821 if exists("netrw_curdir") |let b:netrw_curdir = netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7822 if exists("netrw_explore_bufnr") |let b:netrw_explore_bufnr = netrw_explore_bufnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7823 if exists("netrw_explore_indx") |let b:netrw_explore_indx = netrw_explore_indx |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7824 if exists("netrw_explore_line") |let b:netrw_explore_line = netrw_explore_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7825 if exists("netrw_explore_list") |let b:netrw_explore_list = netrw_explore_list |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7826 if exists("netrw_explore_listlen")|let b:netrw_explore_listlen = netrw_explore_listlen|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7827 if exists("netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = netrw_explore_mtchcnt|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7828 if exists("netrw_fname") |let b:netrw_fname = netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7829 if exists("netrw_lastfile") |let b:netrw_lastfile = netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7830 if exists("netrw_liststyle") |let b:netrw_liststyle = netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7831 if exists("netrw_method") |let b:netrw_method = netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7832 if exists("netrw_option") |let b:netrw_option = netrw_option |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7833 if exists("netrw_prvdir") |let b:netrw_prvdir = netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7834
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7835 if a:0 > 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7836 let b:netrw_curdir= a:1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7837 if b:netrw_curdir =~ '/$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7838 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7839 file NetrwTreeListing
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7840 nno <silent> <buffer> [ :silent call <SID>TreeListMove('[')<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7841 nno <silent> <buffer> ] :silent call <SID>TreeListMove(']')<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7842 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7843 exe "silent! keepalt file ".fnameescape(b:netrw_curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7844 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7845 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7846 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7847
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7848 " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7849 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7850
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7851 " ------------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7852 " s:NetrwSaveWordPosn: used to keep cursor on same word after refresh, {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7853 " changed sorting, etc. Also see s:NetrwRestoreWordPosn().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7854 fun! s:NetrwSaveWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7855 " call Dfunc("NetrwSaveWordPosn()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7856 let s:netrw_saveword= '^'.fnameescape(getline('.')).'$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7857 " call Dret("NetrwSaveWordPosn : saveword<".s:netrw_saveword.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7858 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7859
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7860 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7861 " s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7862 " changed sorting, etc. Also see s:NetrwSaveWordPosn().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7863 fun! s:NetrwRestoreWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7864 " call Dfunc("NetrwRestoreWordPosn()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7865 silent! call search(s:netrw_saveword,'w')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7866 " call Dret("NetrwRestoreWordPosn")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7867 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7868
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7869 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7870 " s:RestoreBufVars: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7871 fun! s:RestoreBufVars()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7872 " call Dfunc("s:RestoreBufVars()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7873
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7874 if exists("s:netrw_curdir") |let b:netrw_curdir = s:netrw_curdir |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7875 if exists("s:netrw_lastfile") |let b:netrw_lastfile = s:netrw_lastfile |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7876 if exists("s:netrw_method") |let b:netrw_method = s:netrw_method |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7877 if exists("s:netrw_fname") |let b:netrw_fname = s:netrw_fname |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7878 if exists("s:netrw_machine") |let b:netrw_machine = s:netrw_machine |endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7879 if exists("s:netrw_browser_active")|let b:netrw_browser_active = s:netrw_browser_active|endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7880
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7881 " call Dret("s:RestoreBufVars")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7882 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7883
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7884 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7885 " s:RemotePathAnalysis: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7886 fun! s:RemotePathAnalysis(dirname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7887 " call Dfunc("s:RemotePathAnalysis()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7888
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7889 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7890 let s:method = substitute(a:dirname,dirpat,'\1','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7891 let s:user = substitute(a:dirname,dirpat,'\2','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7892 let s:machine = substitute(a:dirname,dirpat,'\3','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7893 let s:port = substitute(a:dirname,dirpat,'\4','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7894 let s:path = substitute(a:dirname,dirpat,'\5','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7895 let s:fname = substitute(a:dirname,'^.*/\ze.','','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7896
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7897 " call Decho("set up s:method <".s:method .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7898 " call Decho("set up s:user <".s:user .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7899 " call Decho("set up s:machine<".s:machine.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7900 " call Decho("set up s:port <".s:port.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7901 " call Decho("set up s:path <".s:path .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7902 " call Decho("set up s:fname <".s:fname .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7903
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7904 " call Dret("s:RemotePathAnalysis")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7905 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7906
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7907 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7908 " s:RemoteSystem: runs a command on a remote host using ssh {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7909 " Returns status
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7910 " Runs system() on
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7911 " [cd REMOTEDIRPATH;] a:cmd
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7912 " Note that it doesn't do shellescape(a:cmd)!
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7913 fun! s:RemoteSystem(cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7914 " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7915 if !executable(g:netrw_ssh_cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7916 call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7917 elseif !exists("b:netrw_curdir")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7918 call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7919 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7920 let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7921 let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7922 if remotedir != ""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7923 let cmd= cmd.' cd '.shellescape(remotedir).";"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7924 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7925 let cmd= cmd.' '
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7926 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7927 let cmd= cmd.a:cmd
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7928 " call Decho("call system(".cmd.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7929 let ret= system(cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7930 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7931 " call Dret("s:RemoteSystem ".ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7932 return ret
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7933 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7934
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7935 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7936 " s:RestoreWinVars: (used by Explore() and NetrwSplit()) {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7937 fun! s:RestoreWinVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7938 " call Dfunc("s:RestoreWinVars()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7939 if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7940 if exists("s:col") |let w:netrw_col = s:col |unlet s:col |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7941 if exists("s:curdir") |let w:netrw_curdir = s:curdir |unlet s:curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7942 if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7943 if exists("s:explore_indx") |let w:netrw_explore_indx = s:explore_indx |unlet s:explore_indx |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7944 if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7945 if exists("s:explore_listlen")|let w:netrw_explore_listlen = s:explore_listlen|unlet s:explore_listlen|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7946 if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7947 if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7948 if exists("s:fpl") |let w:netrw_fpl = s:fpl |unlet s:fpl |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7949 if exists("s:hline") |let w:netrw_hline = s:hline |unlet s:hline |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7950 if exists("s:line") |let w:netrw_line = s:line |unlet s:line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7951 if exists("s:liststyle") |let w:netrw_liststyle = s:liststyle |unlet s:liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7952 if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7953 if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7954 if exists("s:treedict") |let w:netrw_treedict = s:treedict |unlet s:treedict |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7955 if exists("s:treetop") |let w:netrw_treetop = s:treetop |unlet s:treetop |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7956 if exists("s:winnr") |let w:netrw_winnr = s:winnr |unlet s:winnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7957 " call Dret("s:RestoreWinVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7958 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7959
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7960 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7961 " s:Rexplore: implements returning from a buffer to a netrw directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7962 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7963 " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7964 " is true) and a command, :Rexplore, which call this function.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7965 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7966 " s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7967 fun! s:NetrwRexplore(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7968 " call Dfunc("s:NetrwRexplore(islocal=".a:islocal." dirname<".a:dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7969 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7970 call netrw#LocalBrowseCheck(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7971 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7972 call s:NetrwBrowse(0,a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7973 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7974 if exists("s:nbcd_curpos_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7975 call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')})
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7976 unlet s:nbcd_curpos_{bufnr('%')}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7977 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7978 if exists("s:explore_match")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7979 exe "2match netrwMarkFile /".s:explore_match."/"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7980 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7981 " call Dret("s:NetrwRexplore")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7982 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7983
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7984 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7985 " s:SaveBufVars: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7986 fun! s:SaveBufVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7987 " call Dfunc("s:SaveBufVars() buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7988
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7989 if exists("b:netrw_curdir") |let s:netrw_curdir = b:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7990 if exists("b:netrw_lastfile") |let s:netrw_lastfile = b:netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7991 if exists("b:netrw_method") |let s:netrw_method = b:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7992 if exists("b:netrw_fname") |let s:netrw_fname = b:netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7993 if exists("b:netrw_machine") |let s:netrw_machine = b:netrw_machine |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7994 if exists("b:netrw_browser_active")|let s:netrw_browser_active = b:netrw_browser_active|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7995
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7996 " call Dret("s:SaveBufVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7997 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7998
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7999 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8000 " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8001 fun! s:SaveWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8002 " call Dfunc("s:SaveWinVars() win#".winnr())
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8003 if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8004 if exists("w:netrw_col") |let s:col = w:netrw_col |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8005 if exists("w:netrw_curdir") |let s:curdir = w:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8006 if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8007 if exists("w:netrw_explore_indx") |let s:explore_indx = w:netrw_explore_indx |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8008 if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8009 if exists("w:netrw_explore_listlen")|let s:explore_listlen = w:netrw_explore_listlen|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8010 if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8011 if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8012 if exists("w:netrw_fpl") |let s:fpl = w:netrw_fpl |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8013 if exists("w:netrw_hline") |let s:hline = w:netrw_hline |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8014 if exists("w:netrw_line") |let s:line = w:netrw_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8015 if exists("w:netrw_liststyle") |let s:liststyle = w:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8016 if exists("w:netrw_method") |let s:method = w:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8017 if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8018 if exists("w:netrw_treedict") |let s:treedict = w:netrw_treedict |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8019 if exists("w:netrw_treetop") |let s:treetop = w:netrw_treetop |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8020 if exists("w:netrw_winnr") |let s:winnr = w:netrw_winnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8021 " call Dret("s:SaveWinVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8022 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8023
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8024 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8025 " s:SetBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8026 " To allow separate windows to have their own activities, such as
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8027 " Explore **/pattern, several variables have been made window-oriented.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8028 " However, when the user splits a browser window (ex: ctrl-w s), these
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
8029 " variables are not inherited by the new window. SetBufWinVars() and
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8030 " UseBufWinVars() get around that.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
8031 fun! s:SetBufWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8032 " call Dfunc("s:SetBufWinVars() win#".winnr())
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8033 if exists("w:netrw_liststyle") |let b:netrw_liststyle = w:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8034 if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8035 if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8036 if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8037 if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8038 if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen= w:netrw_explore_listlen|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8039 if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt= w:netrw_explore_mtchcnt|endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8040 if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8041 if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8042 if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8043 " call Dret("s:SetBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8044 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8045
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8046 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8047 " s:SetRexDir: set directory for :Rexplore {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8048 fun! s:SetRexDir(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8049 " call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8050 " set up Rex and leftmouse-double-click
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8051 if a:islocal
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8052 exe 'com! Rexplore call s:NetrwRexplore(1,"'.escape(a:dirname,'"\').'")'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8053 if g:netrw_retmap
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8054 if !hasmapto("<Plug>NetrwReturn") && maparg("<2-leftmouse>","n") == ""
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8055 nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8056 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8057 let dir = escape(a:dirname, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8058 exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(1,"'.dir.'")<cr>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8059 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8060 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8061 exe 'com! Rexplore call s:NetrwRexplore(0,"'.escape(a:dirname,'"\').'")'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8062 if g:netrw_retmap
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8063 if !hasmapto("<Plug>NetrwReturn") && maparg("<2-leftmouse>","n") == ""
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8064 nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8065 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8066 let dir = escape(a:dirname, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8067 exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(0,"'.dir.'")<cr>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8068 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8069 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8070 " call Dret("s:SetRexDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8071 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8072
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8073 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8074 " s:Strlen: this function returns the length of a string, even if its {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8075 " using two-byte etc characters.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8076 " Solution from Nicolai Weibull, vim docs (:help strlen()), Tony Mechelynck,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8077 " and a bit from me.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8078 " if g:netrw_xstrlen is zero (default), then the builtin strlen() function is used.
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8079 fun! s:Strlen(x)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8080 " call Dfunc("s:Strlen(x<".a:x.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8081 if g:netrw_xstrlen == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8082 " number of codepoints (Latin a + combining circumflex is two codepoints)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8083 " (comment from TM, solution from NW)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8084 let ret= strlen(substitute(a:x,'.','c','g'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8085
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8086 elseif g:netrw_xstrlen == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8087 " number of spacing codepoints (Latin a + combining circumflex is one spacing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8088 " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8089 " (comment from TM, solution from TM)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8090 let ret=strlen(substitute(a:x, '.\Z', 'x', 'g'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8091
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8092 elseif g:netrw_xstrlen == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8093 " virtual length (counting, for instance, tabs as anything between 1 and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8094 " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8095 " preceded by lam, one otherwise, etc.)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8096 " (comment from TM, solution from me)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8097 let modkeep= &mod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8098 exe "norm! o\<esc>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8099 call setline(line("."),a:x)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8100 let ret= virtcol("$") - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8101 d
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8102 let &mod= modkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8103
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8104 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8105 " at least give a decent default
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8106 let ret= strlen(a:x)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8107 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8108 " call Dret("s:Strlen ".ret)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8109 return ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8110 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8111
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8112 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8113 " s:TreeListMove: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8114 fun! s:TreeListMove(dir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8115 " call Dfunc("s:TreeListMove(dir<".a:dir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8116 let curline = getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8117 let prvline = (line(".") > 1)? getline(line(".")-1) : ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8118 let nxtline = (line(".") < line("$"))? getline(line(".")+1) : ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8119 let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8120 let indentm1 = substitute(curindent,'^| ','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8121 " call Decho("prvline <".prvline."> #".line(".")-1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8122 " call Decho("curline <".curline."> #".line("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8123 " call Decho("nxtline <".nxtline."> #".line(".")+1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8124 " call Decho("curindent<".curindent.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8125 " call Decho("indentm1 <".indentm1.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8126
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8127 if curline !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8128 " call Decho('regfile')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8129 if a:dir == '[' && prvline != ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8130 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8131 let nl = search('^'.indentm1.'[^|]','bWe') " search backwards from regular file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8132 " call Decho("regfile srch back: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8133 elseif a:dir == ']' && nxtline != ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8134 norm! $
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8135 let nl = search('^'.indentm1.'[^|]','We') " search forwards from regular file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8136 " call Decho("regfile srch fwd: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8137 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8138
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8139 elseif a:dir == '[' && prvline != ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8140 norm! 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8141 let curline= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8142 let nl = search('^'.curindent.'[^|]','bWe') " search backwards From directory, same indentation
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8143 " call Decho("dir srch back ind: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8144 if nl != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8145 if line(".") == curline-1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8146 let nl= search('^'.indentm1.'[^|]','bWe') " search backwards from directory, indentation - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8147 " call Decho("dir srch back ind-1: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8148 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8149 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8150
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8151 elseif a:dir == ']' && nxtline != ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8152 norm! $
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8153 let curline = line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8154 let nl = search('^'.curindent.'[^|]','We') " search forwards from directory, same indentation
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8155 " call Decho("dir srch fwd ind: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8156 if nl != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8157 if line(".") == curline+1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8158 let nl= search('^'.indentm1.'[^|]','We') " search forwards from directory, indentation - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8159 " call Decho("dir srch fwd ind-1: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8160 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8161 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8162
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8163 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8164
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8165 " call Dret("s:TreeListMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8166 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8167
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8168 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8169 " s:UpdateBuffersMenu: does emenu Buffers.Refresh (but due to locale, the menu item may not be called that) {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8170 " The Buffers.Refresh menu calls s:BMShow(); unfortunately, that means that that function
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8171 " can't be called except via emenu. But due to locale, that menu line may not be called
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8172 " Buffers.Refresh; hence, s:NetrwBMShow() utilizes a "cheat" to call that function anyway.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8173 fun! s:UpdateBuffersMenu()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8174 " call Dfunc("s:UpdateBuffersMenu()")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8175 if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8176 try
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8177 silent emenu Buffers.Refresh\ menu
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8178 catch /^Vim\%((\a\+)\)\=:E/
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8179 let v:errmsg= ""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8180 silent call s:NetrwBMShow()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8181 endtry
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8182 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8183 " call Dret("s:UpdateBuffersMenu")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8184 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8185
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8186 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8187 " s:UseBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck() {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8188 " Matching function to BufferWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8189 fun! s:UseBufWinVars()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8190 " call Dfunc("s:UseBufWinVars()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8191 if exists("b:netrw_liststyle") && !exists("w:netrw_liststyle") |let w:netrw_liststyle = b:netrw_liststyle |endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8192 if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8193 if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8194 if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8195 if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8196 if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8197 if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8198 if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8199 if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8200 if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8201 " call Dret("s:UseBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8202 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8203
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
8204 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8205 " netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8206 fun! netrw#WinPath(path)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8207 " call Dfunc("netrw#WinPath(path<".a:path.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8208 if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8209 " remove cygdrive prefix, if present
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8210 let path = substitute(a:path,'/cygdrive/\(.\)','\1:','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8211 " remove trailing slash (Win95)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8212 let path = substitute(path, '\(\\\|/\)$', '', 'g')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8213 " remove escaped spaces
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8214 let path = substitute(path, '\ ', ' ', 'g')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8215 " convert slashes to backslashes
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8216 let path = substitute(path, '/', '\', 'g')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8217 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8218 let path= a:path
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8219 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8220 " call Dret("netrw#WinPath <".path.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8221 return path
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8222 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8223
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8224 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
8225 " Settings Restoration: {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8226 let &cpo= s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8227 unlet s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8228
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8229 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8230 " Modelines: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8231 " vim:ts=8 fdm=marker